1、首先打开任务管理器、或者右击桌面下方的任务栏选择q启动任务管理器。在任务管理器上点击上方的服务、再点击右下方的服务、将oracle服务调成手动模式。
创新互联长期为上千家客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为资阳企业提供专业的成都网站设计、成都网站制作、外贸网站建设,资阳网站改版等技术服务。拥有10多年丰富建站经验和众多成功案例,为您定制开发。
2、其次可以看见红色箭头所指向的两个服务、分别是oracle服务和oracle监听器、将oracle服务调成手动模式选中监听器、右击选择属性将oracle服务调成手动模式。
3、最后击下拉框、选择手动、保存将oracle服务调成手动模式完成后、开机速度就会明显加快了将oracle服务调成手动模式同上将oracle服务设置为手动即可。
oracle dg 三大模式切换
1、最大性能模式MAXIMUM PERFORMANCE --默认模式,最大性能模式特点。
192.168.1.181
SQL select database_role,protection_mode,protection_level from v$database;
DATABASE_ROLE PROTECTION_MODE PROTECTION_LEVEL
---------------- -------------------- --------------------
PRIMARY MAXIMUM PERFORMANCE MAXIMUM PERFORMANCE
SQL col dest_name for a25
SQL select dest_name,status from v$archive_dest_status;
DEST_NAME STATUS
------------------------- ---------
LOG_ARCHIVE_DEST_1 VALID
LOG_ARCHIVE_DEST_2 VALID
SQL show parameter log_archive
NAME TYPE VALUE
------------------------------------ ----------- ---------------------------
log_archive_config string dg_config=(orcl,db01)
log_archive_dest_1 string location=/home/oracle/arch_orc
l valid_for=(all_logfiles,all_
roles) db_unique_name=orcl
log_archive_dest_2 string service=db_db01 LGWR ASYNC val
id_for=(online_logfiles,primar
y_roles) db_unique_name=db01
SQL archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/oracle/arch_orcl
Oldest online log sequence 31
Next log sequence to archive 33
Current log sequence 33
192.168.1.183
SQL select database_role,protection_mode,protection_level from v$database;
DATABASE_ROLE PROTECTION_MODE PROTECTION_LEVEL
---------------- -------------------- --------------------
PHYSICAL STANDBY MAXIMUM PERFORMANCE MAXIMUM PERFORMANCE
SQL col dest_name for a25
SQL select dest_name,status from v$archive_dest_status;
DEST_NAME STATUS
------------------------- ---------
LOG_ARCHIVE_DEST_1 VALID
LOG_ARCHIVE_DEST_2 VALID
SQL show parameter log_archive
NAME TYPE VALUE
------------------------------------ ----------- ---------------------------
log_archive_config string dg_config=(db01,orcl)
log_archive_dest_1 string location=/home/oracle/arch_db0
1 valid_for=(all_logfiles,all_
roles) db_unique_name=db01
log_archive_dest_2 string service=db_orcl LGWR ASYNC val
id_for=(online_logfiles,primar
y_roles) db_unique_name=orcl
SQL archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/oracle/arch_orcl
Oldest online log sequence 31
Next log sequence to archive 33
Current log sequence 33
192.168.1.181
SQL alter system switch logfile;
SQL archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/oracle/arch_orcl
Oldest online log sequence 32
Next log sequence to archive 34
Current log sequence 34
192.168.1.183
SQL archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/oracle/arch_db01
Oldest online log sequence 32
Next log sequence to archive 0
Current log sequence 34
2 、最大性能模式--切换到--最大高可用 (默认是最大性能模式---MAXIMUM PERFORMANCE)。
192.168.1.181
SQL select DATABASE_ROLE,PROTECTION_MODE,PROTECTION_LEVEL from v$database;
DATABASE_ROLE PROTECTION_MODE PROTECTION_LEVEL
---------------- -------------------- --------------------
PRIMARY MAXIMUM PERFORMANCE MAXIMUM PERFORMANCE
SQL show parameter log_archive_dest_2
NAME TYPE VALUE
------------------------------------ ----------- ---------------------------
log_archive_dest_2 string service=db_db01 LGWR ASYNC val
id_for=(online_logfiles,primar
y_roles) db_unique_name=db01
192.168.1.181
SQL shutdown immediate
192.168.1.183
SQL alter database recover managed standby database cancel;
SQL shutdown immediate
192.168.1.181
SQL startup mount;
SQL alter database set standby database to maximize availability;
SQL alter system set log_archive_dest_2='service=db_db01 LGWR SYNC valid_for=(online_logfiles,primary_roles) db_unique_name=db01' scope=spfile;
192.168.1.183
SQL startup nomount
SQL alter database mount standby database;
SQL alter system set log_archive_dest_2='service=db_orcl LGWR SYNC valid_for=(online_logfiles,primary_roles) db_unique_name=orcl' scope=spfile;
SQL shutdown immediate
SQL startup nomount
SQL alter database mount standby database;
192.168.1.181
SQL startup
SQL col dest_name for a25
SQL select dest_name,status from v$archive_dest_status;
DEST_NAME STATUS
------------------------- ---------
LOG_ARCHIVE_DEST_1 VALID
LOG_ARCHIVE_DEST_2 VALID
SQL show parameter log_archive_dest_2
NAME TYPE VALUE
------------------------------------ ----------- ---------------------------
log_archive_dest_2 string service=db_db01 LGWR SYNC vali
d_for=(online_logfiles,primary
_roles) db_unique_name=db01
SQL select database_role,protection_level,protection_mode from v$database;
DATABASE_ROLE PROTECTION_LEVEL PROTECTION_MODE
---------------- -------------------- --------------------
PRIMARY MAXIMUM AVAILABILITY MAXIMUM AVAILABILITY
SQL archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/oracle/arch_orcl
Oldest online log sequence 34
Next log sequence to archive 36
Current log sequence 36
192.168.1.183
SQL col dest_name for a25
SQL select dest_name,status from v$archive_dest_status;
DEST_NAME STATUS
------------------------- ---------
LOG_ARCHIVE_DEST_1 VALID
LOG_ARCHIVE_DEST_2 VALID
SQL show parameter log_archive_dest_2
NAME TYPE VALUE
------------------------------------ ----------- ---------------------------
log_archive_dest_2 string service=db_orcl LGWR SYNC vali
d_for=(online_logfiles,primary
_roles) db_unique_name=orcl
SQL select database_role,protection_level,protection_mode from v$database;
DATABASE_ROLE PROTECTION_LEVEL PROTECTION_MODE
---------------- -------------------- --------------------
PHYSICAL STANDBY MAXIMUM AVAILABILITY MAXIMUM AVAILABILITY
SQL archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/oracle/arch_db01
Oldest online log sequence 35
Next log sequence to archive 0
Current log sequence 36
192.168.1.181
SQL alter system switch logfile;
SQL archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/oracle/arch_orcl
Oldest online log sequence 35
Next log sequence to archive 37
Current log sequence 37
192.168.1.183
SQL archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/oracle/arch_db01
Oldest online log sequence 36
Next log sequence to archive 0
Current log sequence 37
3、最大高可用--切换到--最保护能模式,DG最大保护模式Maximum protection。
192.168.1.181
SQL shutdown immediate
192.168.1.183
SQL shutdown immediate
192.168.1.181
SQL alter database set standby database to maximize protection;
SQL shutdown immediate
192.168.1.183
SQL startup nomount
SQL alter database mount standby database;
192.168.1.181
SQL startup
SQL col dest_name for a25
SQL select dest_name,status from v$archive_dest_status;
DEST_NAME STATUS
------------------------- ---------
LOG_ARCHIVE_DEST_1 VALID
LOG_ARCHIVE_DEST_2 VALID
SQL show parameter log_archive_dest_2
NAME TYPE VALUE
------------------------------------ ----------- ---------------------------
log_archive_dest_2 string service=db_db01 LGWR SYNC vali
d_for=(online_logfiles,primary
_roles) db_unique_name=db01
SQL select database_role,protection_level,protection_mode from v$database;
DATABASE_ROLE PROTECTION_LEVEL PROTECTION_MODE
---------------- -------------------- --------------------
PRIMARY MAXIMUM PROTECTION MAXIMUM PROTECTION
SQL archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/oracle/arch_orcl
Oldest online log sequence 37
Next log sequence to archive 39
Current log sequence 39
192.168.1.183
SQL col dest_name for a25
SQL select dest_name,status from v$archive_dest_status;
DEST_NAME STATUS
------------------------- ---------
LOG_ARCHIVE_DEST_1 VALID
LOG_ARCHIVE_DEST_2 VALID
SQL show parameter log_archive_dest_2
NAME TYPE VALUE
------------------------------------ ----------- ---------------------------
log_archive_dest_2 string service=db_db01 LGWR SYNC vali
d_for=(online_logfiles,primary
_roles) db_unique_name=db01
SQL select database_role,protection_level,protection_mode from v$database;
DATABASE_ROLE PROTECTION_LEVEL PROTECTION_MODE
---------------- -------------------- --------------------
PRIMARY MAXIMUM PROTECTION MAXIMUM PROTECTION
SQL archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/oracle/arch_db01
Oldest online log sequence 37
Next log sequence to archive 0
Current log sequence 39
192.168.1.181
SQL alter system switch logfile;
SQL archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/oracle/arch_orcl
Oldest online log sequence 38
Next log sequence to archive 40
Current log sequence 40
192.168.1.183
SQL archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/oracle/arch_db01
Oldest online log sequence 37
Next log sequence to archive 0
Current log sequence 40
1、首先第一种转换方式是:将字符串类型的转换成数字类型的,这中方法转换直接用to_number()进行转换,具体的语法为to_number(str)就可以了。
2、第二种:将数字类型转换成字符串类型的。
这种转换方式用to_char(),其实转换的方式有点类似上面的to_number()模式,至于后面的999代表的和上面的意思一样。
3、第三种:将日期类型转换成字符串类型
这种方法其实也用的是to_char(),就是将日期格式的转换成自己想要的格式类型的,这种方法比较个性化一点。
4、下面这种将日期类型转换成常见的字符串类型,这种转换方式用的频率比较多一点,也是一种比较全的字符串格式。
5、最后一种:将字符串类型转换成日期类型,这种转换方式用to_date()进行转换。用法也比较简单,转换的日期格式也是自己自定义的。
6、完成效果图。
直接登录相应的用户就可以了。
步骤:直接在命令行输入sqlconn
username/password;即可完成切换.
解释:每个用户都只能默认一个数据库,不可能出现多个数据库。所以直接切换到需要的用户下即可完成操作。