搭建oracle 级联DG
现有架构:physical standby 一主二备,在此基础上,在主库下新建备库standby3、级联备库cascade
数据库版本 11.2.0.4 db_name=prod db为主库,dg1为备库,dg2为级联备库;
DB_UNIQUE_NAME DATABASE_ROLE
db primary 10.100.12.10
dg1 standby1 10.100.12.11
dg2 standby2 10.100.12.12
三个库的LOG_FILE_NAME_CONVERT,DB_FILE_NAME_CONVERT路径一致
############################ 主库db参数文件设置 #########################################
主库db的参数文件如下:
db_name=prod
instance_name=db
db_unique_name=db
*.FAL_CLIENT='db'
*.FAL_SERVER='dg1'
*.LOG_ARCHIVE_CONFIG='DG_CONFIG=(db,dg1,dg2)';
*.LOG_ARCHIVE_DEST_1='LOCATION=/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=db'
*.LOG_ARCHIVE_DEST_2='SERVICE=dg1 SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=dg1'
*.LOG_ARCHIVE_DEST_STATE_1='ENABLE'
*.LOG_ARCHIVE_DEST_STATE_2='ENABLE'
*.STANDBY_FILE_MANAGEMENT='AUTO'
*.DB_FILE_NAME_CONVERT='db','dg1'
*.LOG_FILE_NAME_CONVERT='db','dg1'
############################### 备库dg1 ####################################################
备库dg1的参数文件如下
db_name=prod
instance_name=dg1
db_unique_name=dg1
*.FAL_CLIENT='dg1'
*.FAL_SERVER='db'
*.LOG_ARCHIVE_CONFIG='DG_CONFIG=(db,dg1,dg2)';
*.LOG_ARCHIVE_DEST_1='LOCATION=/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=dg1'
*.LOG_ARCHIVE_DEST_2='SERVICE=dg2 SYNC VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE) DB_UNIQUE_NAME=dg2'
*.LOG_ARCHIVE_DEST_STATE_1='ENABLE'
*.LOG_ARCHIVE_DEST_STATE_2='ENABLE'
*.STANDBY_FILE_MANAGEMENT='AUTO'
*.DB_FILE_NAME_CONVERT='db','dg1'
*.LOG_FILE_NAME_CONVERT='db','dg1'
################################ 备库dg2 参数 ################################################
在主库上做备份,传至备库dg2,源数据库为主库
复制主库db的参数文件至dg2,并做修改,restore standby controlfile并启动备库dg2至mount状态
主库dg2上运行:
rman target sys/xxxxxx@db auxiliary sys/xxxxxx@dg2
duplicate target database for standby nofilenamecheck from active database;
备库dg2的参数文件如下
db_name=prod
instance_name=dg2
db_unique_name=dg2
*.FAL_CLIENT='dg2'
*.FAL_SERVER='dg1'
*.LOG_ARCHIVE_CONFIG='DG_CONFIG=(db,dg1,dg2)';
*.LOG_ARCHIVE_DEST_1='LOCATION=/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=dg1'
*.LOG_ARCHIVE_DEST_STATE_1='ENABLE'
*.DB_FILE_NAME_CONVERT='dg1','dg2'
*.LOG_FILE_NAME_CONVERT='dg1','dg2'
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.
db到dg1是归档日志与在线日志同步,dg1到dg2只能通过归档日志同步,所以必须在dg切换日志,dg2才会接受到日志并同步数据