联系:手机/微信(+86 17813235971) QQ(107644445)
作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]
RDBMS tnsnames.ora配置
在主备库的数据库的tns中均增加如下配置
q9dbdg = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = q9db01-dg-vip)(PORT = 1522)) (ADDRESS = (PROTOCOL = TCP)(HOST = q9db02-dg-vip)(PORT = 1522)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = q9db) ) ) q9adgdg = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = q9adg01-dg-vip)(PORT = 1522)) (ADDRESS = (PROTOCOL = TCP)(HOST = q9adg02-dg-vip)(PORT = 1522)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = q9db) ) )
主库修改参数配置
alter system set DB_UNIQUE_NAME=q9db scope=spfile; alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(q9db,q9db_adg)' scope=both; alter system set LOG_ARCHIVE_DEST_1='LOCATION=+arch/q9db/ARCHIVELOG VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=q9db' scope=both; alter system set LOG_ARCHIVE_DEST_2='SERVICE=q9adg1dg LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=q9db_adg'; alter system set standby_file_management='AUTO' sid='*' scope=both; alter system set fal_client='q9dbdg'; alter system set fal_server='q9adgdg'; alter system set db_file_name_convert='+DATA','+DATA' SCOPE=SPFILE; ALTER SYSTEM SET log_file_name_convert='+DATA','+DATA' SCOPE=SPFILE;
备库修改参数配置
alter system set DB_UNIQUE_NAME=q9db_adg scope=spfile; alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(q9db,q9db_adg)' scope=both; alter system set LOG_ARCHIVE_DEST_1='LOCATION=+arch/q9db/ARCHIVELOG VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=q9db_adg'; alter system set LOG_ARCHIVE_DEST_2='SERVICE=q9db1dg LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=q9db'; alter system set standby_file_management='AUTO' sid='*' scope=both; alter system set fal_client='q9adgdg'; alter system set fal_server='q9dbdg'; alter system set service_names='q9db'; alter system set db_file_name_convert='+DATA','+DATA' SCOPE=SPFILE; ALTER SYSTEM SET log_file_name_convert='+DATA','+DATA' SCOPE=SPFILE;
主库增加standby redo log
alter database add standby logfile THREAD 1 group 51 '+DATA' size 512m; ………… alter database add standby logfile THREAD 1 group 61 '+DATA' size 512m; alter database add standby logfile THREAD 2 group 71 '+DATA' size 512m; ………… alter database add standby logfile THREAD 2 group 81 '+DATA' size 512m;
主库修改强制日志
SQL> ALTER DATABASE FROCE LOGGING;
RMAN备份主库
rman target / run{ configure device type disk parallelism 16; backup database filesperset = 10 format '/q9bak/df_%U'; backup current controlfile format '/q9bak/ctl_%U'; }
创建standby controlfile
ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/q9bak/stb_ctl';
还原standby controlfile
ASMCMD> cp /q9bak/stb_ctl control01.ctl copying /q9bak/stb_ctl -> +data/Q9DB/control01.ctl ASMCMD> cp /q9bak/stb_ctl control02.ctl copying /q9bak/stb_ctl -> +arch/q9db/control02.ctl
还原备库
SQL>startup mount; rman target / nocatalog <<EOF run{ configure default device type to disk; configure device type disk parallelism 16; restore database; } <<EOF
修改备库文件名
RMAN>catalog start with '+DATA/Q9DB/DATAFILE/'; RMAN> switch database to copy;
清理redo
--清理redo(所有的group#) SQL> select group# from v$log; SQL> alter database clear logfile group 1; …… --清理standby redo(所有的group#) SQL> select group# from v$standby_log; SQL> alter database clear logfile group 51; ……
开启备库实时应用模式
SQL> alter database recover managed standby database using current logfile disconnect from session;
备库注册DB服务(oracle用户)
srvctl add database -d q9db_adg -o $ORACLE_HOME srvctl add instance -d q9db_adg -i q9db1 -n q9adg01 srvctl add instance -d q9db_adg -i q9db2 -n q9adg02 srvctl modify database -d q9db_adg -a DATA,ARCH
只在一个节点开启,另外你归档放到共享目录,当一个节点的mrp出现问题的时候,你可以在另外一个节点启动mrp
飞哥,请教一个问题;
在RAC-RAC的ADG环境下,DG端的RAC有两个节点,如果设置的是主库把日志发送到备库的scan-ip这种情况下,备库这两个节点都需要开始mrp进程吗?如果只需要在一个节点开启mrp,那么没有开启的那个节点就无法接收并应用日志了吧?