Professional Documents
Culture Documents
Database
In this article, I will explain the step by step procedure to create a physical standby database using RMAN
duplicate command without shutting down the primary database and using primary active database files. There
is no need to take any database backups. This is new feature available in 11g database.
4. Enable Archiving
1. Create a remote login password file ( if it is not copied from primary site )
5. Verify connectivity
1. Create Physical Standby Using RMAN Duplication From Active Database (New in 11g)
2. Keep it in recovery
Verifications
You need to create SRL with the same size or greater size as of the online redo logs and also the number of SRLs
should be one greater than the online redologs.
NAME USER
--------- ------------------------------
ORCL SYS
NAME USER
--------- ------------------------------
ORCL SYS
1 1 1 52428800
2 1 1 52428800
3 1 1 52428800
GROUP# MEMBER
------ --------------------------------------------------
3 /home/oracle/app/oracle/oradata/orcl/redo03.log
2 /home/oracle/app/oracle/oradata/orcl/redo02.log
1 /home/oracle/app/oracle/oradata/orcl/redo01.log
no rows selected
Database altered.
Database altered.
GROUP# BYTES
------ ----------
4 52428800
5 52428800
Database altered.
Database altered.
GROUP# BYTES
------ ----------
4 52428800
5 52428800
6 52428800
7 52428800
SQL>
3. Modify the init.ora parameters:
Modify the init.ora parameters on the primary database side to reflect the following values. If you are using
spfile, you can add these parameter online without shutting down the primary database.
DB_NAME=orcl
DB_UNIQUE_NAME=orcl
LOG_ARCHIVE_CONFIG='DG_CONFIG=(orcl,sbyorcl)'
LOG_ARCHIVE_DEST_1='LOCATION=/home/oracle/app/oracle/flash_recovery_area/orcl/
VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orcl'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
LOG_ARCHIVE_FORMAT=%t_%s_%r.arc
LOG_ARCHIVE_MAX_PROCESSES=30
FAL_SERVER=sbyorcl
DB_FILE_NAME_CONVERT='sbyorcl','orcl'
LOG_FILE_NAME_CONVERT='/home/oracle/app/oracle/flash_recovery_area/sbyorcl/','/home/oracle/app/oracl
e/flash_recovery_area/orcl/'
STANDBY_FILE_MANAGEMENT=AUTO
4. Enable Archiving :
Make sure that your database is running in archive log mode. Because in a physical standby setup all the
redologs generated on the primary database will be transferred to standby site and applied to the standby
database.
Database closed.
Database dismounted.
Database mounted.
Database altered.
Database altered.
SQL>
We can specify the required init.ora parameter when using RMAN duplication command and need not create a
separate init.ora parmeter file.
LISTENER_PRI =
(DESCRIPTION_LIST =
(DESCRIPTION =
(DESCRIPTION =
SID_LIST_LISTENER_PRI =
(SID_LIST =
(SID_DESC =
(ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_2)
(SID_NAME = orcl)
orcl =
(DESCRIPTION =
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID=orcl)
sbyorcl =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dgaskmsby01.localdomain)(PORT = 1525))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID=sbyorcl)
[oracle@dgaskmpri01 admin]$
Create a temporary directory(/tmp/askm) on standby server and copy initsbyorcl.ora and password
file(orapwsbyorcl) from primary server to standby server.
1. Create a remote login password file ( if it is not copied from primary site )
If you are using a different directory structure on the standby server, they you need to create all the directories
on the standby site.
[oracle@dgaskmsby01]$ cd $ORACLE_HOME/dbs
Modify the initsbyorcl.ora file to reflect the following initialization parameters. This step is optional if you are
specifying the required init.ora parameter in the RMAN duplication command.
DB_NAME=orcl
DB_UNIQUE_NAME=sbyorcl
LOG_ARCHIVE_CONFIG='DG_CONFIG=(orcl,sbyorcl)'
CONTROL_FILES='/home/oracle/app/oracle/oradata/sbyorcl/s_control01.ctl',
'/home/oracle/app/oracle/flash_recovery_area/sbyorcl/s_control02.ctl'
DB_FILE_NAME_CONVERT='orcl','sbyorcl'
LOG_FILE_NAME_CONVERT='/home/oracle/app/oracle/flash_recovery_area/orcl/','/home/oracle/app/oracle/fl
ash_recovery_area/sbyorcl/'
LOG_ARCHIVE_FORMAT=%t_%s_%r.arc
LOG_ARCHIVE_DEST_1='LOCATION=/home/oracle/app/oracle/flash_recovery_area/sbyorcl/
VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=sbyorcl'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
STANDBY_FILE_MANAGEMENT=AUTO
FAL_SERVER=orcl
LISTENER_SBY =
(DESCRIPTION_LIST =
(DESCRIPTION =
(DESCRIPTION =
SID_LIST_LISTENER_SBY =
(SID_LIST =
(SID_DESC =
(ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_2)
(SID_NAME = sbyorcl)
orcl =
(DESCRIPTION =
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID=orcl)
sbyorcl =
(DESCRIPTION =
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID=sbyorcl)
[oracle@dgaskmsby01 admin]$
5. Verify connectivity
On Primary Server:
On Standby Server:
1. Create Physical Standby Using RMAN Duplication From Active Database (New in 11g) :
SQL>
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
RMAN> run {
5> }
RMAN-00571: =========================================================
RMAN-00571: =========================================================
RMAN-03002: failure of Duplicate Db command at 11/21/2011 08:58:23
RMAN-05503: at least one auxiliary channel must be allocated to execute this command
RMAN> run {
5> }
'/home/oracle/app/oracle/product/11.2.0/dbhome_2/dbs/orapwsbyorcl' ;
{
backup as copy current controlfile for standby auxiliary format
'/home/oracle/app/oracle/oradata/sbyorcl/s_control01.ctl';
'/home/oracle/app/oracle/oradata/sbyorcl/s_control01.ctl';
"/home/oracle/app/oracle/oradata/sbyorcl/temp01.dbf";
switch clone tempfile all;
"/home/oracle/app/oracle/oradata/sbyorcl/system01.dbf";
"/home/oracle/app/oracle/oradata/sbyorcl/sysaux01.dbf";
"/home/oracle/app/oracle/oradata/sbyorcl/undotbs01.dbf";
"/home/oracle/app/oracle/oradata/sbyorcl/users01.dbf";
"/home/oracle/app/oracle/oradata/sbyorcl/example01.dbf";
"/home/oracle/app/oracle/oradata/sbyorcl/APEX_1246426611663638.dbf";
"/home/oracle/app/oracle/oradata/sbyorcl/APEX_1265209995679366.dbf";
"/home/oracle/app/oracle/oradata/sbyorcl/system01.dbf" datafile
2 auxiliary format
"/home/oracle/app/oracle/oradata/sbyorcl/sysaux01.dbf" datafile
3 auxiliary format
"/home/oracle/app/oracle/oradata/sbyorcl/undotbs01.dbf" datafile
4 auxiliary format
"/home/oracle/app/oracle/oradata/sbyorcl/users01.dbf" datafile
5 auxiliary format
"/home/oracle/app/oracle/oradata/sbyorcl/example01.dbf" datafile
6 auxiliary format
"/home/oracle/app/oracle/oradata/sbyorcl/APEX_1246426611663638.dbf" datafile
7 auxiliary format
"/home/oracle/app/oracle/oradata/sbyorcl/APEX_1265209995679366.dbf" ;
ORACLE error from auxiliary database: ORA-01511: error in renaming log/data files
RMAN-05535: WARNING: All redo log files were not defined properly.
ORACLE error from auxiliary database: ORA-01511: error in renaming log/data files
RMAN-05535: WARNING: All redo log files were not defined properly.
ORACLE error from auxiliary database: ORA-01511: error in renaming log/data files
RMAN-05535: WARNING: All redo log files were not defined properly.
ORACLE error from auxiliary database: ORA-01511: error in renaming log/data files
ORA-01275: Operation RENAME is not allowed if standby file management is automatic.
RMAN-05535: WARNING: All redo log files were not defined properly.
ORACLE error from auxiliary database: ORA-01511: error in renaming log/data files
RMAN-05535: WARNING: All redo log files were not defined properly.
ORACLE error from auxiliary database: ORA-01511: error in renaming log/data files
RMAN-05535: WARNING: All redo log files were not defined properly.
ORACLE error from auxiliary database: ORA-01511: error in renaming log/data files
RMAN-05535: WARNING: All redo log files were not defined properly.
RMAN>
NOTE : These warnings can be ignored as these are due to the initialization parameter
STANDBY_FILE_MANAGEMENT is set to AUTO.
2. Keep it in recovery:
Connected to:
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM
SESSION;
Database altered.
DATABASE_ROLE SWITCHOVER_STATUS
---------------- --------------------
SEQUENCE# APPLIED
---------- ---------
517 YES
518 YES
519 IN-MEMORY
SQL>
Verifications :
On Standby:
DATABASE_ROLE SWITCHOVER_STATUS
---------------- --------------------
SEQUENCE# APPLIED
---------- ---------
517 YES
518 YES
519 IN-MEMORY
SQL>
On Primary :
Connected to:
With the Partitioning, OLAP, Data Mining and Real Application Testing options
System altered.
DATABASE_ROLE SWITCHOVER_STATUS
---------------- --------------------
PRIMARY TO STANDBY
SQL>
On Standby:
Verify that the recent archived log file is shifted to standby side and applied with the following commands.
SEQUENCE# APPLIED
---------- ---------
517 YES
518 YES
519 YES
520 IN-MEMORY
SQL>
egrep -i
"DB_NAME|DB_UNIQUE_NAME|LOG_ARCHIVE_CONFIG|CONTROL_FILES|LOG_ARCHIVE_DEST_1|LOG_ARCHIV
E_DEST_2|
LOG_ARCHIVE_DEST_STATE_1|LOG_ARCHIVE_DEST_STATE_2|REMOTE_LOGIN_PASSWORDFILE|LOG_ARCHIVE
_FORMAT|
LOG_ARCHIVE_MAX_PROCESSES|FAL_SERVER|DB_FILE_NAME_CONVERT|LOG_FILE_NAME_CONVERT|
select thread#, sequence#, status from v$managed_standby where process='MRP0'; = > On Standby