DG级联安装:
数据库版本 11.2.0.1
r2 primary 10.3.4.110
r5 standby1 10.3.4.111
r6 standby2 10.3.4.112
###########################################################主库r2参数文件设置#########################################
现在r2与r5是一套DG
主库r2的参数文件如下:
*.DB_UNIQUE_NAME='r2'
*.FAL_CLIENT='r2'
*.FAL_SERVER='r5'
*.LOG_ARCHIVE_CONFIG='DG_CONFIG=(r2,r5)'
*.LOG_ARCHIVE_DEST_1='LOCATION=/u01/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=r2'
*.LOG_ARCHIVE_DEST_2='SERVICE=r5 LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=r5'
*.LOG_ARCHIVE_DEST_STATE_1='ENABLE'
*.LOG_ARCHIVE_DEST_STATE_2='DEFER'
*.STANDBY_FILE_MANAGEMENT='AUTO'
*.DB_FILE_NAME_CONVERT='r2','r5'
*.LOG_FILE_NAME_CONVERT='r2','r5'
对主库的参数文件作修改如下:
ALTER SYSTEM SET LOG_ARCHIVE_DEST_3='SERVICE=dg2 LGWR ASYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=dg2' scope=both;
ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(r2,r5,r6)' scope=both;
ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DEFER' scope=both;
#是为了后面的从主库r2的备库塔建备库r6
ALTER SYSTEM SET DB_FILE_NAME_CONVERT='r2','r6' ;
ALTER SYSTEM SET LOG_FILE_NAME_CONVERT='r2','r6' ;
修改之后主库r2的参数文件如下:
*.DB_UNIQUE_NAME='r2'
*.FAL_CLIENT='r2'
*.FAL_SERVER='r5'
*.LOG_ARCHIVE_CONFIG='DG_CONFIG=(r2,r5,r6)'
*.LOG_ARCHIVE_DEST_1='LOCATION=/u01/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=r2'
*.LOG_ARCHIVE_DEST_2='SERVICE=r5 LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=r5'
*.LOG_ARCHIVE_DEST_2='SERVICE=r6 LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=r6'
*.LOG_ARCHIVE_DEST_STATE_1='ENABLE'
*.LOG_ARCHIVE_DEST_STATE_2='ENABLE'
*.LOG_ARCHIVE_DEST_STATE_2='DEFER'
*.STANDBY_FILE_MANAGEMENT='AUTO'
*.DB_FILE_NAME_CONVERT='r2','r6'
*.LOG_FILE_NAME_CONVERT='r2','r6'
########################################### 塔建备库r6 ###############################################################
在主库上复制备分到备库r6上,源数据库必须是主库
复制主库r2的参数文件至r6,并启动备库r6至mount状态
主库r2上运行:
rman target sys/admin@r2 auxiliary sys/admin@r6
duplicate target database for standby nofilenamecheck from active database;
alter system set log_archive_dest_state_3=enable scope=both;
在备库r6
alter database open read only;
alter database recover managed standby database using current logfile disconnect from session;
ALTER SYSTEM SET log_archive_dest_1='LOCATION=/u01/ora_archive VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=r6' scope=both;
ALTER SYSTEM SET log_archive_dest_2='SERVICE=r5 LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=r5'
alter system set fal_server='r5';
alter system set fal_client='r6';
在主库r2上
alter system set log_archive_dest_state_3=defer scope=both;
########################################### 备库r5 参数的修改 #########################################################
*.fal_client='r5'
*.fal_server='r2'
*.log_archive_dest_1='LOCATION=/u01/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=r5'
*.log_archive_dest_2='SERVICE=r2 LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=r2'
*.log_archive_dest_3='SERVICE=r6 LGWR SYNC AFFIRM VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE) DB_UNIQUE_NAME=r6'
ALTER SYSTEM SET LOG_ARCHIVE_DEST_3='SERVICE=r6 LGWR ASYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=r6' scope=both;
ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(r2,r5,r6)' scope=both;
开启时报:
SQL> startup nomount pfile='/home/oracle/initr2.ora'
ORA-01678: parameter db_file_name_convert must be pairs of pattern and replacement strings
Cascaded Redo Transport Destinations
A cascaded redo transport destination (also known as a terminal destination) receives primary database redo indirectly from a standby database rather than directly from a primary database.
A physical standby database that cascades primary database redo to one or more terminal destinations at the same time it is applying changes to its local database files is known as a cascading standby database.
With cascading, the overhead associated with performing redo transport is offloaded from a primary database to a cascading standby database.
A cascading standby database can cascade primary database redo to up to 30 terminal destinations.
官方文档安装如下:
Example 7–1 Some of the Initialization Parameters Used When Cascading Redo
Primary Database
DB_UNIQUE_NAME=boston
FAL_SERVER=boston2
LOG_ARCHIVE_CONFIG='DG_CONFIG=(boston,boston2,denver)'
LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=boston'
LOG_ARCHIVE_DEST_2='SERVICE=boston2 SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=boston2'
Cascading Physical Standby Database
DB_UNIQUE_NAME=boston2
FAL_SERVER=boston
LOG_ARCHIVE_CONFIG= 'DG_CONFIG=(boston,boston2,denver)'
LOG_ARCHIVE_DEST_1='LOCATION= USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=boston2'
LOG_ARCHIVE_DEST_2= 'SERVICE=denver VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE) DB_UNIQUE_NAME=denver'
Cascaded Physical Standby Database
DB_UNIQUE_NAME=denver
FAL_SERVER=boston2
LOG_ARCHIVE_CONFIG='DG_CONFIG=(boston,boston2,denver)'
LOG_ARCHIVE_DEST_1='LOCATION= USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=denver'
注意事项:
1。备库r6需要重启f5才能同步数据,而且只能通过归档日志同步到r6
r2 到 r5 是 归档日志与现线日志同步
r5 到 r6 只能通过归档日志同步了,所以必须在r2切换日志,r6才会接受到日志并同步数据
alter database recover managed standby database using current logfile disconnect from session;
2。 官方文档说最好是11.2.0.2或以上的版本,经测试11.2.0.1也是可以的
如有错误麻烦提出来,谢谢!