Oralce 11203 64位 ,rhel6.3操作系统
Db_unique_name 主备: tantest (RAC环境),asm存储
备库: dgbro,单实例,文件系统
保护模式: maximumperformance mode
Redo log传输模式两端是SYNC
Standby库是物理的standby库
http://docs.oracle.com/cd/E11882_01/server.112/e25608/create_ps.htm#SBYDB00210
primarydatabase
SQL> ALTERDATABASE FORCE LOGGING;
确保主备在归档模式
DB_NAME=tantest
DB_UNIQUE_NAME=tantest
REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
LOG_ARCHIVE_FORMAT=%t_%s_%r.dbf
Alter systemset LOG_ARCHIVE_CONFIG='DG_CONFIG=(tantest,dgbro)' scope=both;
Alter systemset LOG_ARCHIVE_DEST_1= 'LOCATION=+FRI/TANTEST/ARCH1 VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=tantest' scope=bothSID='tantest1';
Alter systemset LOG_ARCHIVE_DEST_1= 'LOCATION=+FRI/TANTEST/ARCH2 VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=tantest' scope=bothSID='tantest2';
Alter systemset LOG_ARCHIVE_DEST_2= 'SERVICE=dgbro LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=dgbro' scope=both;
Alter systemset LOG_ARCHIVE_DEST_STATE_1=ENABLE scope=both;
Alter systemset LOG_ARCHIVE_DEST_STATE_2=ENABLE scope=both;
Alter systemset LOG_ARCHIVE_MAX_PROCESSES=30 scope=both;
RAC任意实例
Rman target /
RMAN>backup format '/u01/bak/full_%U' database;
RAC在任意实际执行:
SQL>startup mount;
SQL> alterdatabase create standby controlfile as '/ u01/bak /dgbro.ctl';
SQL> alterdatabase open;
SQL>create pfile='/u01/bak/initdgbro.ora' from spfile;
拷贝RAC中任意实例的密码文件至standby库并改名
增加:
db_unique_name=dgbro
log_archive_config='DG_CONFIG=(tantest,dgbro)'
db_file_name_convert='tantest','dgbro'
log_file_name_convert='+FRI/TANTEST/ARCH1','/u01/arch2','+FRI/TANTEST/ARCH2','/u01/arch2'
log_archive_format=%t_%s_%r.dbf
log_archive_dest_1='location=/u01/arch1/valid_for=(all_logfiles,all_roles) db_unique_name=dgbro'
log_archive_dest_2='service=tantestlgwr async valid_for=(online_logfiles,primary_role) db_unique_name=tantest'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
STANDBY_FILE_MANAGEMENT=AUTO
FAL_SERVER=tantest
FAL_CLIENT=dgbro
RMAN>restore database;
主库查询:SELECTMEMBERS,GROUP#, BYTES,STATUS FROM V$LOG;
alterdatabase add standby logfile group 5
'/u01/dgbro/oradata/DGBRO/datafile/stdredo01.log'size 50m;
alterdatabase add standby logfile group 6
'/u01/dgbro/oradata/DGBRO/datafile/stdredo02.log'size 50m;
alter database add standby logfile group 7
'/u01/dgbro/oradata/DGBRO/datafile/stdredo03.log'size 50m;
alter database add standby logfile group 8
'/u01/dgbro/oradata/DGBRO/datafile/stdredo04.log'size 50m;
alter database add standby logfile group 9
'/u01/dgbro/oradata/DGBRO/datafile/stdredo05.log'size 50m;
SQL> ALTER DATABASE ADD STANDBY LOGFILE THREAD 1SIZE 50M;
SQL> ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 SIZE50M;
SQL> ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 SIZE50M;
SQL> ALTER DATABASE ADD STANDBY LOGFILE THREAD 2SIZE 50M;
SQL> ALTER DATABASE ADD STANDBY LOGFILE THREAD 2SIZE 50M;
SQL> ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 SIZE50M;
SQL> alterdatabase recover managed standby database disconnect from session;