Google Plus LinkedIn

How to create a physical standby database with RMAN DUPLICATE command

 

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.sgp.st.com. Standby database is called rac2 and is running on server2.sgp.st.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.sgp.st.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_logfiles, 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.sgp.st.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_logfiles, 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.sgp.st.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]

About 

    Find more about me on:
  • googleplus
  • linkedin

2 comments to How to create a physical standby database with RMAN DUPLICATE command

Leave a Reply

  

  

  


*

You can use these HTML tags

<a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>