应用归档日志方式进行数据同步
sql> alter system set log_archive_dest_2='SERVICE=standby arch noaffirm valid_for=(online_logfiles,primary_role) db_unique_name=standby' scope=spfile;
应用在线日志方式进行数据同步
SYNC:
sql> alter system set log_archive_dest_2='SERVICE=standby lgwr sync affirm valid_for=(online_logfiles,primary_role) db_unique_name=standby' scope=spfile;
ASYNC:
sql> alter system set log_archive_dest_2='SERVICE=standby lgwr async noaffirm valid_for=(online_logfiles,primary_role) db_unique_name=standby';
DG切换模式
最大性能模式--切换到-->最大高可用 (MAXIMUM PERFORMANCE——>MAXIMUM AVAILABILITY)
1.192.168.163.6:
sql> shutdown immediate
2.192.168.163.18
sql> alter database recover managed standby database cancel;
3.192.168.163.6
sql>
sql>
sql> startup mount
sql> alter database set standby database to maximize availability;
sql> alter system set log_archive_dest_2='SERVICE=PROD_STD LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=PROD_STD' scope=spfile;
System altered.
4.192.168.163.18
sql> startup nomount;
sql> alter database mount standby database;
sql> alter system set log_archive_dest_2='SERVICE=PROD_STD LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=PROD_STD' scope=spfile;
sql> shutdown immediate
sql> startup nomount
sql> alter database mount standby database;
sql> select open_mode,protection_mode,database_role,switchover_status from v$database;
OPEN_MODE PROTECTION_MODE DATABASE_ROLE SWITCHOVER_STATUS
-------------------- -------------------- ---------------- --------------------
MOUNTED MAXIMUM AVAILABILITY PHYSICAL STANDBY NOT ALLOWED
5.192.168.163.6
sql> shutdown immediate
sql> startup
sql> show parameter log_archive_dest_2
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_2 string SERVICE=PROD_STD LGWR SYNC VAL
ID_FOR=(ONLINE_LOGFILES,PRIMAR
Y_ROLE) DB_UNIQUE_NAME=PROD_ST
D
6.192.168.163.18
sql> alter database open;
sql> alter database recover managed standby database using current logfile disconnect from session;
最大高可用--切换到-->最保护能模式 (MAXIMUM AVAILABILITY——>MAXIMUM PROTECTION)
(因为最大可用模式和最大保护模式对应的参数都是LGWR和SYNC,所以不需要再改参数了)
1.192.168.163.6
sql> shutdown immediate
sql> startup mount
sql> alter database set standby database to maximize protection;
sql> show parameter log_archive_dest_2
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_2 string SERVICE=PROD_STD LGWR SYNC VAL
ID_FOR=(ONLINE_LOGFILES,PRIMAR
Y_ROLE) DB_UNIQUE_NAME=PROD_ST
D
sql> alter database open;
2.192.168.163.18
sql> select open_mode,switchover_status from v$database;
OPEN_MODE PROTECTION_MODE DATABASE_ROLE SWITCHOVER_STATUS
-------------------- -------------------- ---------------- --------------------
READ ONLY WITH APPLY MAXIMUM PROTECTION PHYSICAL STANDBY NOT ALLOWED
最大保护模式转最大性能模式 (MAXIMUM PROTECTION——>MAXIMUM PERFORMANCE)
(最大性能参数问LGWR、SYNC或者ASYNC或者ARCH、SYNC,因为上面已经改为LGWR、SYNC,可以不需要再设置了,直接转换)
本文进行了转换将LGWR SYNC转换为LGWR ASYNC,最大性能模式
1.192.168.163.6
sql> shutdown immediate
2.192.168.163.18
sql> alter database recover managed standby database cancel;
sql> shutdown immediate
3.192.168.163.6
sql> alter system set log_archive_dest_2='SERVICE=PROD_STD LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=PROD_STD' scope=spfile;
4.192.168.163.18
sql> startup nomount
sql> alter database mount standby database;
sql> alter system set log_archive_dest_2='SERVICE=PROD_STD LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=PROD_STD' scope=spfile;
5.192.168.163.6
sql> shutdown immediate
sql> startup
sql> select open_mode,switchover_status from v$database;
OPEN_MODE PROTECTION_MODE DATABASE_ROLE SWITCHOVER_STATUS
-------------------- -------------------- ---------------- --------------------
READ WRITE MAXIMUM PERFORMANCE PRIMARY SESSIONS ACTIVE
6.192.168.163.18
sql> shutdown immediate
sql> startup
sql> select open_mode,switchover_status from v$database;
OPEN_MODE PROTECTION_MODE DATABASE_ROLE SWITCHOVER_STATUS
-------------------- -------------------- ---------------- --------------------
READ ONLY MAXIMUM PERFORMANCE PHYSICAL STANDBY NOT ALLOWED
主备切换日志验证同步
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。