日志在写满以后会自动进行切换的,当然没有写满时也可以进行手工方式强制切换 alter system switch logfile;
创新互联公司专注于两当网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供两当营销型网站建设,两当网站制作、两当网页设计、两当网站官网定制、成都微信小程序服务,打造两当网络公司原创品牌,更为您提供两当网站排名全网营销落地服务。
这个我就实在不知道了,9I上好你没有这个参数吧。找人问了问,人家也没说。
本文对Oracle11g中的自动数据库维护任务管理做一个总体介绍,文章保持简洁出于两个原因: 1、大部分人都还没有接触过这些设置。尽管这么说,如果你是在夜间处理维护任务的,如果在晚上打开一个维护窗口并不是一个好主意,你可能想要改变这一切。2、基本的管理任务都是自我控
dataguard的热备就是就是逻辑DG(有一点延迟,但是基本上数据量不大的话,还是可以的),现在用的不多,现在应用多的一般都是物理DG。因为物理DG比逻辑dg更加稳定,而且不会出现太大的资源调用,影响系统。
自动切换这里,要说明,dg的切换是有一套流程的,都可以自动有脚本完成,但是最后一步一定是手动的,所以不能完成全自动切换,最多就是半自动。
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~尽量别用不标准的SQL。但是分页之类的语句没办法避免,只能够加参数动态在mybtais配置文件中切换。
2~mybtais用的时候别偷懒用接口自动生成dao的方式,dao还是老老实实在代码实现多个数据源切换。