You are on page 1of 23

Creating Physical Standby Database With RMAN Duplicate From Active

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.

Primary Site Preparation :

1. Enable Database Force Logging

2. Create SRL (Standby Redo Logs)

3. Modify Init.ora parameters

4. Enable Archiving

5. Create a init.ora file for Standby Database ( Optional )

6. Configure listener.ora and tnsnames.ora

7. Copy init.ora and password files to Standby Server

Standby Site Preparation :

1. Create a remote login password file ( if it is not copied from primary site )

2. Create a directory structure

3. Modify the init.ora parameter file (Optional)

4. Configure listener.ora and tnsnames.ora

5. Verify connectivity

Creating Physical Standby Database :

1. Create Physical Standby Using RMAN Duplication From Active Database (New in 11g)

2. Keep it in recovery
Verifications

Primary Site Preparation :

1. Enable Database Force Logging:

SQL> select FORCE_LOGGING from v$database;

SQL> ALTER DATABASE FORCE LOGGING;

2. Create SRL ( Standby Redo Logs):

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.

SQL> select name,user from v$database;

NAME USER

--------- ------------------------------

ORCL SYS

SQL> col group# for 9999

SQL> col member for a50

SQL> set linesize 120

SQL> select name,user from v$database;

NAME USER

--------- ------------------------------

ORCL SYS

SQL> select GROUP#,THREAD#,MEMBERS,BYTES FROM V$LOG;

GROUP# THREAD# MEMBERS BYTES

------ ---------- ---------- ----------

1 1 1 52428800

2 1 1 52428800

3 1 1 52428800

SQL> select group#,member from v$logfile;

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

SQL> SELECT GROUP#, BYTES FROM V$STANDBY_LOG;

no rows selected

SQL> ALTER DATABASE ADD STANDBY LOGFILE ('/home/oracle/app/oracle/oradata/orcl/s_redo01.log') SIZE


52428800;

Database altered.

SQL> ALTER DATABASE ADD STANDBY LOGFILE ('/home/oracle/app/oracle/oradata/orcl/s_redo02.log') SIZE


52428800;

Database altered.

SQL> SELECT GROUP#, BYTES FROM V$STANDBY_LOG;

GROUP# BYTES

------ ----------

4 52428800

5 52428800

SQL> ALTER DATABASE ADD STANDBY LOGFILE ('/home/oracle/app/oracle/oradata/orcl/s_redo03.log') SIZE


52428800;

Database altered.

SQL> ALTER DATABASE ADD STANDBY LOGFILE ('/home/oracle/app/oracle/oradata/orcl/s_redo04.log') SIZE


52428800;

Database altered.

SQL> SELECT GROUP#, BYTES FROM V$STANDBY_LOG;

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_2='SERVICE=sbyorcl ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)


DB_UNIQUE_NAME=sbyorcl'

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.

SQL> shut immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> STARTUP MOUNT;

ORACLE instance started.


Total System Global Area 456146944 bytes

Fixed Size 1344840 bytes

Variable Size 381684408 bytes

Database Buffers 67108864 bytes

Redo Buffers 6008832 bytes

Database mounted.

SQL> ALTER DATABASE ARCHIVELOG;

Database altered.

SQL> ALTER DATABASE OPEN;

Database altered.

SQL> archive log list

Database log mode Archive Mode

Automatic archival Enabled

Archive destination /home/oracle/app/oracle/flash_recovery_area/orcl/

Oldest online log sequence 360

Next log sequence to archive 362

Current log sequence 362

SQL>

5. Create a init.ora file for Standby Database: ( Optional)

We can specify the required init.ora parameter when using RMAN duplication command and need not create a
separate init.ora parmeter file.

SQL> CREATE PFILE='/tmp/askm/initsbyorcl.ora' FROM SPFILE;

6. Configure listener.ora and tnsnames.ora:


[oracle@dgaskmpri01 admin]$ cat listener.ora

LISTENER_PRI =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1525))

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = dgaskmpri01.localdomain)(PORT = 1525))

SID_LIST_LISTENER_PRI =

(SID_LIST =

(SID_DESC =

(ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_2)

(SID_NAME = orcl)

[oracle@dgaskmpri01 admin]$ cat tnsnames.ora

orcl =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = dgaskmpri01.localdomain)(PORT = 1525))

(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]$

7. Copy init.ora and password files to Standby Server:

Create a temporary directory(/tmp/askm) on standby server and copy initsbyorcl.ora and password
file(orapwsbyorcl) from primary server to standby server.

Standby Site Preparation :

1. Create a remote login password file ( if it is not copied from primary site )

Copy the password file /tmp/askm/orapwsbyorcl to $ORACLE_HOME/dbs

2. Create a directory structure

If you are using a different directory structure on the standby server, they you need to create all the directories
on the standby site.

Copy initsbyorcl.ora to $ORACLE_HOME/dbs location.

[oracle@dgaskmsby01]$ mkdir /home/oracle/app/oracle/oradata/sbyorcl/

[oracle@dgaskmsby01]$ mkdir /home/oracle/app/oracle/flash_recovery_area/sbyorcl/

[oracle@dgaskmsby01]$ cd $ORACLE_HOME/dbs

[oracle@dgaskmsby01 sbyorcl]$ cp /tmp/askm/initsbyorcl.ora $ORACLE_HOME/dbs

3. Modify the init.ora parameter file (Optional) :

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_2='SERVICE=orcl ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)


DB_UNIQUE_NAME=orcl'

LOG_ARCHIVE_DEST_STATE_1=ENABLE

LOG_ARCHIVE_DEST_STATE_2=ENABLE

REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE

STANDBY_FILE_MANAGEMENT=AUTO

FAL_SERVER=orcl

4. Configure listener.ora and tnsnames.ora:

[oracle@dgaskmsby01 admin]$ cat listener.ora

LISTENER_SBY =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1525))

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = dgaskmsby01.localdomain)(PORT = 1525))

SID_LIST_LISTENER_SBY =

(SID_LIST =

(SID_DESC =
(ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_2)

(SID_NAME = sbyorcl)

[oracle@dgaskmsby01 admin]$ cat tnsnames.ora

orcl =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = dgaskmpri01.localdomain)(PORT = 1525))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SID=orcl)

sbyorcl =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = dgaskmsby01.localdomain)(PORT = 1525))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SID=sbyorcl)

[oracle@dgaskmsby01 admin]$

5. Verify connectivity

On Primary Server:

[oracle@dgaskmpri01]$ lsnrctl stop LISTENER_PRI

[oracle@dgaskmpri01]$ lsnrctl start LISTENER_PRI

[oracle@dgaskmpri01]$ tnsping orcl


[oracle@dgaskmpri01]$ tnsping sbyorcl

[oracle@dgaskmpri01]$ sqlplus sys/xxxxx@orcl

[oracle@dgaskmpri01]$ sqlplus sys/xxxxx@sbyorcl

On Standby Server:

[oracle@dgaskmsby01]$ lsnrctl stop LISTENER_SBY

[oracle@dgaskmsby01]$ lsnrctl start LISTENER_SBY

[oracle@dgaskmsby01]$ tnsping orcl

[oracle@dgaskmsby01]$ tnsping sbyorcl

[oracle@dgaskmsby01]$ sqlplus sys/xxxxx@orcl

[oracle@dgaskmsby01]$ sqlplus sys/xxxxx@sbyorcl

Creating Physical Standby Database :

1. Create Physical Standby Using RMAN Duplication From Active Database (New in 11g) :

[oracle@dgaskmsby01 sbyorcl]$ sqlplus '/as sysdba'

SQL*Plus: Release 11.2.0.2.0 Production on Mon Nov 21 08:53:10 2011

Copyright (c) 1982, 2010, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup nomount

ORACLE instance started.

Total System Global Area 456146944 bytes

Fixed Size 1344840 bytes

Variable Size 322964152 bytes

Database Buffers 125829120 bytes


Redo Buffers 6008832 bytes

SQL>

[oracle@dgaskmpri01 tmp]$ rman target sys/oracle@orcl auxiliary sys/oracle@sbyorcl

Recovery Manager: Release 11.2.0.2.0 - Production on Mon Nov 21 08:55:07 2011

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

connected to target database: ORCL (DBID=1229390655)

connected to auxiliary database: ORCL (not mounted)

RMAN> run {

2> allocate channel prmy1 type disk;

3> allocate channel prmy2 type disk;

4> duplicate target database for standby from active database;

5> }

using target database control file instead of recovery catalog

allocated channel: prmy1

channel prmy1: SID=117 device type=DISK

allocated channel: prmy2

channel prmy2: SID=82 device type=DISK

Starting Duplicate Db at 21-NOV-11

released channel: prmy1

released channel: prmy2

RMAN-00571: =========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===========

RMAN-00571: =========================================================
RMAN-03002: failure of Duplicate Db command at 11/21/2011 08:58:23

RMAN-05501: aborting duplication of target database

RMAN-05503: at least one auxiliary channel must be allocated to execute this command

RMAN> run {

2> allocate channel prmy1 type disk;

3> allocate auxiliary channel stby type disk;

4> duplicate target database for standby from active database;

5> }

allocated channel: prmy1

channel prmy1: SID=117 device type=DISK

allocated channel: stby

channel stby: SID=21 device type=DISK

Starting Duplicate Db at 21-NOV-11

contents of Memory Script:

backup as copy reuse

targetfile '/home/oracle/app/oracle/product/11.2.0/dbhome_2/dbs/orapworcl' auxiliary format

'/home/oracle/app/oracle/product/11.2.0/dbhome_2/dbs/orapwsbyorcl' ;

executing Memory Script

Starting backup at 21-NOV-11

Finished backup at 21-NOV-11

contents of Memory Script:

{
backup as copy current controlfile for standby auxiliary format
'/home/oracle/app/oracle/oradata/sbyorcl/s_control01.ctl';

restore clone controlfile to '/home/oracle/app/oracle/flash_recovery_area/sbyorcl/s_control02.ctl' from

'/home/oracle/app/oracle/oradata/sbyorcl/s_control01.ctl';

executing Memory Script

Starting backup at 21-NOV-11

channel prmy1: starting datafile copy

copying standby control file

output file name=/home/oracle/app/oracle/product/11.2.0/dbhome_2/dbs/snapcf_orcl.f


tag=TAG20111121T090020 RECID=3 STAMP=767782824

channel prmy1: datafile copy complete, elapsed time: 00:00:07

Finished backup at 21-NOV-11

Starting restore at 21-NOV-11

channel stby: copied control file copy

Finished restore at 21-NOV-11

contents of Memory Script:

sql clone 'alter database mount standby database';

executing Memory Script

sql statement: alter database mount standby database

contents of Memory Script:

set newname for tempfile 1 to

"/home/oracle/app/oracle/oradata/sbyorcl/temp01.dbf";
switch clone tempfile all;

set newname for datafile 1 to

"/home/oracle/app/oracle/oradata/sbyorcl/system01.dbf";

set newname for datafile 2 to

"/home/oracle/app/oracle/oradata/sbyorcl/sysaux01.dbf";

set newname for datafile 3 to

"/home/oracle/app/oracle/oradata/sbyorcl/undotbs01.dbf";

set newname for datafile 4 to

"/home/oracle/app/oracle/oradata/sbyorcl/users01.dbf";

set newname for datafile 5 to

"/home/oracle/app/oracle/oradata/sbyorcl/example01.dbf";

set newname for datafile 6 to

"/home/oracle/app/oracle/oradata/sbyorcl/APEX_1246426611663638.dbf";

set newname for datafile 7 to

"/home/oracle/app/oracle/oradata/sbyorcl/APEX_1265209995679366.dbf";

backup as copy reuse

datafile 1 auxiliary format

"/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" ;

sql 'alter system archive log current';


}

executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /home/oracle/app/oracle/oradata/sbyorcl/temp01.dbf in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting backup at 21-NOV-11

channel prmy1: starting datafile copy

input datafile file number=00002 name=/home/oracle/app/oracle/oradata/orcl/sysaux01.dbf

output file name=/home/oracle/app/oracle/oradata/sbyorcl/sysaux01.dbf tag=TAG20111121T090043

channel prmy1: datafile copy complete, elapsed time: 00:06:00

channel prmy1: starting datafile copy

input datafile file number=00001 name=/home/oracle/app/oracle/oradata/orcl/system01.dbf

output file name=/home/oracle/app/oracle/oradata/sbyorcl/system01.dbf tag=TAG20111121T090043

channel prmy1: datafile copy complete, elapsed time: 00:07:12

channel prmy1: starting datafile copy


input datafile file number=00004 name=/home/oracle/app/oracle/oradata/orcl/users01.dbf

output file name=/home/oracle/app/oracle/oradata/sbyorcl/users01.dbf tag=TAG20111121T090043

channel prmy1: datafile copy complete, elapsed time: 00:02:03

channel prmy1: starting datafile copy

input datafile file number=00003 name=/home/oracle/app/oracle/oradata/orcl/undotbs01.dbf

output file name=/home/oracle/app/oracle/oradata/sbyorcl/undotbs01.dbf tag=TAG20111121T090043

channel prmy1: datafile copy complete, elapsed time: 00:01:23

channel prmy1: starting datafile copy

input datafile file number=00005 name=/home/oracle/app/oracle/oradata/orcl/example01.dbf

output file name=/home/oracle/app/oracle/oradata/sbyorcl/example01.dbf tag=TAG20111121T090043

channel prmy1: datafile copy complete, elapsed time: 00:00:54

channel prmy1: starting datafile copy

input datafile file number=00007 name=/home/oracle/app/oracle/oradata/orcl/APEX_1265209995679366.dbf

output file name=/home/oracle/app/oracle/oradata/sbyorcl/APEX_1265209995679366.dbf


tag=TAG20111121T090043

channel prmy1: datafile copy complete, elapsed time: 00:00:17

channel prmy1: starting datafile copy

input datafile file number=00006 name=/home/oracle/app/oracle/oradata/orcl/APEX_1246426611663638.dbf

output file name=/home/oracle/app/oracle/oradata/sbyorcl/APEX_1246426611663638.dbf


tag=TAG20111121T090043

channel prmy1: datafile copy complete, elapsed time: 00:00:08

Finished backup at 21-NOV-11

sql statement: alter system archive log current

contents of Memory Script:

switch clone datafile all;

executing Memory Script

datafile 1 switched to datafile copy


input datafile copy RECID=3 STAMP=767783912 file
name=/home/oracle/app/oracle/oradata/sbyorcl/system01.dbf

datafile 2 switched to datafile copy

input datafile copy RECID=4 STAMP=767783912 file


name=/home/oracle/app/oracle/oradata/sbyorcl/sysaux01.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=5 STAMP=767783913 file


name=/home/oracle/app/oracle/oradata/sbyorcl/undotbs01.dbf

datafile 4 switched to datafile copy

input datafile copy RECID=6 STAMP=767783913 file


name=/home/oracle/app/oracle/oradata/sbyorcl/users01.dbf

datafile 5 switched to datafile copy

input datafile copy RECID=7 STAMP=767783913 file


name=/home/oracle/app/oracle/oradata/sbyorcl/example01.dbf

datafile 6 switched to datafile copy

input datafile copy RECID=8 STAMP=767783913 file


name=/home/oracle/app/oracle/oradata/sbyorcl/APEX_1246426611663638.dbf

datafile 7 switched to datafile copy

input datafile copy RECID=9 STAMP=767783913 file


name=/home/oracle/app/oracle/oradata/sbyorcl/APEX_1265209995679366.dbf

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

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

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
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

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

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

ORA-01275: Operation RENAME is not allowed if standby file management is automatic.

RMAN-05535: WARNING: All redo log files were not defined properly.

Finished Duplicate Db at 21-NOV-11

released channel: prmy1

released channel: stby

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:

[oracle@dgaskmsby01 sbyorcl]$ sqlplus '/as sysdba'

SQL*Plus: Release 11.2.0.2.0 Production on Mon Nov 21 09:19:27 2011


Copyright (c) 1982, 2010, Oracle. All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production

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.

SQL> select database_role,switchover_status from v$database;

DATABASE_ROLE SWITCHOVER_STATUS

---------------- --------------------

PHYSICAL STANDBY NOT ALLOWED

SQL> SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;

SEQUENCE# APPLIED

---------- ---------

517 YES

518 YES

519 IN-MEMORY

SQL> archive log list;

Database log mode Archive Mode

Automatic archival Enabled

Archive destination /home/oracle/app/oracle/flash_recovery_area/sbyorcl/

Oldest online log sequence 515


Next log sequence to archive 0

Current log sequence 520

SQL>

Verifications :

On Standby:

SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;

SQL> select database_role,switchover_status from v$database;

DATABASE_ROLE SWITCHOVER_STATUS

---------------- --------------------

PHYSICAL STANDBY NOT ALLOWED

SQL> SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;

SEQUENCE# APPLIED

---------- ---------

517 YES

518 YES

519 IN-MEMORY

SQL> archive log list;

Database log mode Archive Mode

Automatic archival Enabled

Archive destination /home/oracle/app/oracle/flash_recovery_area/sbyorcl/

Oldest online log sequence 515

Next log sequence to archive 0

Current log sequence 520

SQL>

On Primary :

Do some redo log switches


SQL> ALTER SYSTEM SWITCH LOGFILE;

[oracle@dgaskmpri01 tmp]$ sqlplus '/as sysdba'

SQL*Plus: Release 11.2.0.2.0 Production on Mon Nov 21 09:21:23 2011

Copyright (c) 1982, 2010, Oracle. All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> archive log list

Database log mode Archive Mode

Automatic archival Enabled

Archive destination /home/oracle/app/oracle/flash_recovery_area/orcl/

Oldest online log sequence 518

Next log sequence to archive 520

Current log sequence 520

SQL> alter system switch logfile;

System altered.

SQL> archive log list

Database log mode Archive Mode

Automatic archival Enabled

Archive destination /home/oracle/app/oracle/flash_recovery_area/orcl/

Oldest online log sequence 519

Next log sequence to archive 521

Current log sequence 521

SQL> select database_role,switchover_status from v$database;

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.

SQL> SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;

SQL> SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;

SQL> SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;

SEQUENCE# APPLIED

---------- ---------

517 YES

518 YES

519 YES

520 IN-MEMORY

SQL> archive log list;

Database log mode Archive Mode

Automatic archival Enabled

Archive destination /home/oracle/app/oracle/flash_recovery_area/sbyorcl/

Oldest online log sequence 519

Next log sequence to archive 0

Current log sequence 521

SQL>

Other Useful Information:

To verify all the init.ora parameter in a single command:

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|

STANDBY_FILE_MANAGEMENT" <specify init.ora parameter file>

To Cancel the Standby Recovery Mode:

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;


Useful commands To Troubleshoot:

select message from v$dataguard_status where dest_id = 2;

select archived_thread#, archived_seq#, applied_thread#, applied_seq# from v$archive_dest_status;

select registrar, creator, thread#, sequence#, first_change#, next_change# from v$archived_log;

select thread#, sequence#, first_change#, next_change# from v$log_history;

To Verify Recover Process On Standby:

select thread#, sequence# from v$log where status='CURRENT'; = > On Primary

select thread#, sequence#, status from v$managed_standby where process='MRP0'; = > On Standby

You might also like