Table of contents
Preamble
This article is a follow up of previous post called Data Guard hands on with a physical standby database creation. In this post we will use a RMAN backup to create the physical standby and the RMAN DUPLICATE command. The expensive FROM ACTIVE DATABASE option that copy database files from primary node to remote standby node will so not be used.
In this post primary instance is called rac1 and is running on server1.domain.com. Standby database is called rac2 and is running on server2.domain.com.
Primary instance configuration
Ensure force logging is activated:
SQL> ALTER DATABASE force logging; DATABASE altered. SQL> SELECT force_logging FROM v$database; FOR --- YES |
Ensure you have standby redo log files:
SQL> col member FOR a50 SQL> SET lines 200 SQL> SELECT * FROM v$logfile ORDER BY GROUP#; GROUP# STATUS TYPE MEMBER IS_ ---------- ------- ------- -------------------------------------------------- --- 1 ONLINE +DATA/rac1/onlinelog/group_1.284.752251015 YES 2 ONLINE +DATA/rac1/onlinelog/group_2.263.752251021 NO 3 ONLINE +DATA/rac1/onlinelog/group_3.268.752251035 YES 4 STANDBY +DATA/rac1/onlinelog/group_4.366.752251043 YES 5 STANDBY +DATA/rac1/onlinelog/group_5.365.752251047 NO 6 STANDBY +DATA/rac1/onlinelog/group_6.363.752251051 NO 7 STANDBY +DATA/rac1/onlinelog/group_7.361.752251057 NO 7 ROWS selected. |
Ensure SQL*Net configuration has been done like in previous post.
Typical primary instance initialization parameters file. Second block are pure Data Guard parameters:
*.audit_file_dest='/ora_rac/dump' *.audit_trail='none' *.compatible='11.2.0.0.0' *.control_files='+DATA/rac1/controlfile/current.269.752250853','+DATA/rac1/controlfile/current.256.752250857' *.db_block_size=8192 *.db_create_file_dest='+DATA' *.db_name='rac1' *.db_unique_name=rac1 *.db_domain='world' *.db_recovery_file_dest='+DATA' *.db_recovery_file_dest_size=5242880000 *.diagnostic_dest='/ora_rac/dump' *.local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=server1.domain.com)(PORT=1541))))' *.log_archive_dest_1='location=USE_DB_RECOVERY_FILE_DEST','valid_for=(ALL_LOGFILES, ALL_ROLES)' *.log_archive_dest_state_1='enable' *.memory_target=200M *.open_cursors=300 *.processes=150 *.remote_login_passwordfile='exclusive' *.undo_tablespace='undotbs1' |
*.dg_broker_start=FALSE *.log_archive_config='dg_config=(rac1,rac2)' *.log_archive_dest_2='service=rac2 valid_for=(online_logfile, primary_role) db_unique_name=rac2' *.log_archive_dest_state_2='enable' *.standby_file_management='auto' *.fal_server=rac2 *.fal_client=rac1 |
Typical standby database initialization parameter. Second block are pure Data Guard parameters. Please note omission of CONTROL_FILES parameter that will be set by RMAN DUPLICATE command:
*.audit_file_dest='/ora_rac/dump' *.audit_trail='none' *.compatible='11.2.0.0.0' *.db_block_size=8192 *.db_create_file_dest='+DATA' *.db_name='rac1' *.db_unique_name=rac2 *.db_domain='world' *.db_recovery_file_dest='+DATA' *.db_recovery_file_dest_size=5242880000 *.diagnostic_dest='/ora_rac/dump' *.local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=server2.domain.com)(PORT=1541))))' *.log_archive_dest_1='location=USE_DB_RECOVERY_FILE_DEST','valid_for=(ALL_LOGFILES, ALL_ROLES)' *.log_archive_dest_state_1='enable' *.memory_target=200M *.open_cursors=300 *.processes=150 *.remote_login_passwordfile='exclusive' *.undo_tablespace='undotbs1' |
*.dg_broker_start=FALSE *.log_archive_config='dg_config=(rac1,rac2)' *.log_archive_dest_2='service=rac1 valid_for=(online_logfile, primary_role) db_unique_name=rac1' *.log_archive_dest_state_2='enable' *.standby_file_management='auto' *.fal_server=rac1 *.fal_client=rac2 |
RMAN DUPLICATE command
On source database issue a backup with a command like below (or use an existing one):
run { allocate channel disk1 type disk; allocate channel disk2 type disk; backup as compressed backupset database format '/var/tmp/standby_%U.bck' tag 'standby'; backup as compressed backupset current controlfile for standby format '/var/tmp/standby_%U.bck' tag 'standby'; release channel disk1; release channel disk2; } |
Remote copy all backupset to server2.domain.com (/var/tmp directory). Or better use a shared NFS mount point.
Startup in NOMOUNT state the standby database.
Start RMAN on standby node with following command:
rman target sys/password@rac1 auxiliary / |
and execute following script:
run { allocate channel disk1 device type disk; allocate auxiliary channel disk2 device type disk; duplicate target database for standby nofilenamecheck; release channel disk1; release channel disk2; } |
Remark:
The norecover keyword is not needed at this stage, if you decide to use it you must have backup archived log files of primary database i.e. adding:
backup as compressed backupset format '/var/tmp/standby_%U.bck' archivelog all tag 'standby'; |
Once RMAN DUPLICATE command is completed start redo log apply by:
ALTER DATABASE recover managed standby DATABASE USING CURRENT logfile disconnect; |
With additional SQL*Net configuration we have see in Data Guard Broker configuration with failover and switchover testing you can create a Data Guard Broker (DGB) configuration with (dg_broker_start must be set to true on both instances):
create configuration 'DGConfig1' as primary database is 'rac1' connect identifier is rac1; add database 'rac2' as connect identifier is rac2; enable configuration show configuration |
References
- Step By Step Guide On Creating Physical Standby Using RMAN Duplicate In ASM Filesystem For ASM Primary [ID 837102.1]
- Creating a physical standby from ASM primary [ID 787793.1]
- Creating Physical Standby using RMAN Duplicate Without Shutting down The Primary [ID 789370.1]
- Step-By-Step Guide To Create Physical Standby On Normal File System For ASM Primary using RMAN [ID 838828.1]
- Step By Step Guide To Create Physical Standby Database Using RMAN [ID 469493.1]
- Rman Duplicate For Standby Failing with Rman-06024 [ID 881674.1]
Dmitry says:
Hi
Can I use other than /var/tmp directory for copying all backupset to server2.domain.com ?
For example /var/tmp2 and then issue in rman CATALOG START WITH ‘/var/tmp2 ‘?
Yannick Jaquier says:
Hi,
Good question, in this post target database is primary one so cataloging backupset will apply to it…
Please refer to DUPLICATE documentation (which I also did):
http://docs.oracle.com/cd/E11882_01/backup.112/e10643/rcmsynta020.htm#i81724
And in particular table 2.6…
You will read that without target connection you may use BACKUP LOCATION option but this is slightly different from this post…
For reference:
http://docs.oracle.com/cd/E11882_01/backup.112/e10642/rcmdupdb.htm#BRADV010
So to answer more precisely to your question, yes it is possible not to use same directory but not with CATALOG command…