Search

Monday, October 1, 2012

Prerequisite of active dataguard setup

Step 1:  ON PRIMARY DATABASE (SURIYA)
Check the status  latest sequence generated in the primary database.
SQL> select status,instance_name,database_role from v$instance,v$database;
STATUS       INSTANCE_NAME    DATABASE_ROLE
------------ ---------------- ----------------
OPEN         suriya         PRIMARY

SQL> select max(sequence#) from v$archived_log;

MAX(SEQUENCE#)
--------------
 246

Step 2:  ON PHYSICAL STANDBY (SURIYADR)
Check the status of the  latest sequence applied on the physcial standby database.

SQL> select status,instance_name,database_role from v$instance,v$database;
STATUS       INSTANCE_NAME    DATABASE_ROLE
------------ ---------------- ----------------
MOUNTED      suriyadr           PHYSICAL STANDBY


SQL> select max(sequence#) from v$archived_log;

MAX(SEQUENCE#)
--------------
           246

Step 3: ON PRIMARY DATABASE (SURIYA)
Check if the Managed Recovery Process (MRP) is active on the physical standby database.

 SQL> select process,status,sequence# from v$managed_standby;

PROCESS   STATUS        SEQUENCE#
--------- ------------ ----------
ARCH      CONNECTED             0
ARCH      CLOSING             245
ARCH      CLOSING             244
ARCH      CONNECTED             0
LNS       WRITING             247

Step 4: ON PHYSICAL STANDBY (SURIYADR)
Cancel the MRP on the physical standby database and open the standby database so standby database  opened in the READ-ONLY Mode.

SQL> alter database recover managed standby database cancel;

Database altered.

SQL> alter database open;

Database altered.

SQL> select status,instance_name,database_role,open_mode from v$database,v$instance;

STATUS       INSTANCE_NAME    DATABASE_ROLE    OPEN_MODE
------------ ---------------- ---------------- --------------------
OPEN                   suriyadr                 PHYSICAL STANDBY      READ ONLY

Step 6: ON PHYSICAL STANDBY (SURIYADR)
Now start the Media Recovery Preocessor (MRP) on the physical standby database.

SQL> alter database recover managed standby database disconnect from session;

Database altered.

SQL> select process,status,sequence# from v$managed_standby;

PROCESS   STATUS        SEQUENCE#
--------- ------------ ----------
ARCH      CLOSING             244
ARCH      CONNECTED             0
ARCH      CONNECTED             0
ARCH      CLOSING             246
RFS       IDLE                  0
RFS       IDLE                  0
RFS       IDLE                247
MRP0      WAIT_FOR_LOG        247


Finally MRP is active and is waiting for the log sequence 247 on physical standby location and
also the physical standby database is opened in READ-ONLY mode. Now report from physical standby database can be fetched by the users.




Performing the switchover in 11gr2 datagurad steps

1) There are few steps we need to check before performing the switchover in dataguard environment 
a)If we are using the OEM Enable a blackout for primary database in enterprise manager.
b)check the crontab jobs for Primary database need to disabled.
c)Check for executing backups/exports and cancel.
d)Identify the log gap if gap present resolve the gap
e)From Primary and Standby database check the list of last log should be applied on both database

2)Verify that it is possible to perform a switchover operation On the primary database
On the primary database the switchover_status column of v$database check which is possible to perform a switchover operation

SQL> select switchover_status from v$database;
SWITCHOVER_STATUS
------------------
TO STANDBY
-In order to perform a switchover all sessions to the database need to be disconnected. This process has been automated with the “with session shutdown” clause that has been added to the alter database commit to switchover command.
SWITCHOVER_STATUS 
-------------------------------
 SESSIONS ACTIVE 
 -Then you should either disconnect all sessions manually (or) when performing step 3 you should append the “with session shutdown” clause.

For example:
 SQL> alter database commit to switchover to standby with session shutdown;
(Note: that the clause "with session shutdown" also works with the switchover to primary command 
Ex: alter database commit to switchover to primary with session shutdown;)

SWITCHOVER_STATUS 
-----------------------------
NOT ALLOWED         
-Either this is a standby database and the primary database has not been switched first, or this is a primary database and there are no standby databases. 

SWITCHOVER_STATUS 
-----------------------------
SESSIONS ACTIVE                 - 
-Indicates that there are active SQL sessions attached to the primary or                                               standby database that need to be disconnected before the switchover operation is permitted.

SWITCHOVER_STATUS 
-----------------------------
SWITCHOVER PENDING - 
-This is a standby database and the primary database switchover request has been received but not processed. 

SWITCHOVER_STATUS 
-----------------------------
SWITCHOVER LATENT - 
-The switchover was in pending mode, but did not complete and went back to the primary database.

SWITCHOVER_STATUS 
-----------------------------
TO PRIMARY                  
 - This is a standby database, with no active sessions, that is allowed to switch over to a primary database.

SWITCHOVER_STATUS 
-----------------------------
TO STANDBY 
- This is a primary database, with no active sessions, that is allowed to switch over to a standby database.

SWITCHOVER_STATUS 
-----------------------------
RECOVERY NEEDED 
- This is a standby database that has not received the switchover request.

During normal operations it is acceptable to see the following values for

SWITCHOVER_STATUS 
-----------------------------
 SESSIONS ACTIVE (or) TO STANDBY. ( on the primary database)
 During normal operations  it is acceptable to see these values

SWITCHOVER_STATUS 
-----------------------------
NOT ALLOWED (or) SESSIONS ACTIVE.  (on the standby database)
-During normal operations  it is acceptable to see these values 

3. Convert the primary database to the new standby:
SQL> alter database commit to switchover to physical standby ;
Database altered.

4. Shutdown the former primary and mount as a standby database:
SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.

SQL> startup nomount
ORACLE instance started.
Total System Global Area  818401280 bytes
Fixed Size                  2217792 bytes
Variable Size             528484544 bytes
Database Buffers          285212672 bytes
Redo Buffers                2486272 bytes

SQL> alter database mount standby database;
Database altered.

5. Defer the remote archive destination on the old primary:
SQL> alter system set log_archive_dest_state_3=defer;

6. Verify that the physical standby can be converted to the new primary:
SQL> select switchover_status from v$database;
SWITCHOVER_STATUS
------------------
SWITCHOVER PENDING
(Note that if the status returns SESSIONS ACTIVE then you should append the with session shutdown clause to the command in step 7.

7. Convert the physical standby to the new primary:
SQL> alter database commit to switchover to primary;
Database altered.

8. Shutdown and startup the new primary:
SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.

SQL> startup
ORACLE instance started.
Total System Global Area  818401280 bytes
Fixed Size                  2217792 bytes
Variable Size             482347200 bytes
Database Buffers          331350016 bytes
Redo Buffers                2486272 bytes
Database mounted.
Database opened.

9. Enable remote archiving on the new primary to the new standby:
SQL> alter system set log_archive_dest_state_2=enable;

10. Start managed recover on the new standby database:
SQL> recover managed standby database disconnect;
Media recovery complete.

11) There are few steps we need to check after performing the switchover in dataguard environment 
a)If we are using the OEM check the status of  primary database in enterprise manager.
b)check the crontab jobs for Primary database need to enabled
c)Check for executing backups/exports and start as per schedule
d)Identify the log gap if gap present resolve the gap
e)From Primary and Standby database check the list of last log should be applied on both database


Oracle 11gr2 dataguard setup with flashback enabled with zero down time using RMAN ACTIVE Database Duplication method

Dataguard setup can be achieve with zero time only possible if  Primary DB already archive log enabled. Otherwise down time required.

Primary DB : suriya
Standby DB: suriyadr

Prerequistes:
1. Primary DB must be in archive log mode.(
2. In this setup Flashback feature enabled in Primary DB

1) Enableing database to archive log mode:

SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /u01/app/oracle/product/11.2.0/db_1/dbs/arch
Oldest online log sequence 1
Current log sequence 2

SQL> show parameter spfile;

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /u01/app/oracle/product/11.2.0
/db_1/dbs/spfileprime.ora

SQL> create pfile='/u01/app/oracle/product/11.2.0/db_1/dbs/initsuriya.ora' from spfile;

File created.

SQL> !mkdir -p /u01/app/oracle/oradata/suriya/archive
Created

SQL> alter system set log_archive_dest_1='LOCATION=/u01/app/oracle/oradata/suriya/archive' scope=spfile;

System altered.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> 
 
SQL> startup mount;
ORACLE instance started.

Total System Global Area 818401280 bytes
Fixed Size 2217792 bytes
Variable Size 482347200 bytes
Database Buffers 331350016 bytes
Redo Buffers 2486272 bytes
Database mounted.

SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.

SQL> alter system switch logfile;

System altered.

SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/app/oracle/oradata/prime/archive
Oldest online log sequence 1
Next log sequence to archive 3
Current log sequence 3
SQL>

SQL> !ls -lrt /u01/app/oracle/oradata/suriya/archive
total 26388
-rw-r----- 1 oracle dba 26984960 Sep 29 02:36 1_2_795233705.dbf

2) From here consider database already archive log enabled so we can setup the dataguard with zero down-time

SQL> select force_logging from v$database;

FOR
---
YES

SQL> col member for a56
SQL> select l.group#, member, bytes, l.status from v$log l, v$logfile lf where lf.group#=l.group# order by group#;

GROUP# MEMBER BYTES
---------- -------------------------------------------------------- ----------
STATUS
----------------
1 /u01/app/oracle/oradata/prime/redo01.log 52428800
INACTIVE

2 /u01/app/oracle/oradata/prime/redo02.log 52428800
INACTIVE

3 /u01/app/oracle/oradata/prime/redo03.log 52428800
CURRENT


SQL> alter database add standby logfile '/u01/app/oracle/oradata/suriya/stby_redo01.log' size 50M;
Database altered.

SQL> alter database add standby logfile '/u01/app/oracle/oradata/suriya/stby_redo02.log' size 50M;
Database altered.

SQL> alter database add standby logfile '/u01/app/oracle/oradata/suriya/stby_redo03.log' size 50M;
Database altered.

SQL> alter database add standby logfile '/u01/app/oracle/oradata/suriya/stby_redo04.log' size 50M;
Database altered.

SQL> SELECT GROUP#, BYTES FROM V$STANDBY_LOG;
GROUP# BYTES
---------- ----------
4 52428800
5 52428800
6 52428800
7 52428800

SQL> select value from v$parameter where name = 'db_unique_name';
VALUE
--------------------------------------------------------------------------------
prime

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

GROUP# MEMBER TYPE IS_
---------- -------------------------------------------------------- ------- ---
STATUS
-------
3 /u01/app/oracle/oradata/suriya/redo03.log ONLINE NO


2 /u01/app/oracle/oradata/suriya/redo02.log ONLINE NO


1 /u01/app/oracle/oradata/suriya/redo01.log ONLINE NO


GROUP# MEMBER TYPE IS_
---------- -------------------------------------------------------- ------- ---
STATUS
-------
4 /u01/app/oracle/oradata/suriya/stby_redo01.log STANDBY NO


5 /u01/app/oracle/oradata/suriya/stby_redo02.log STANDBY NO


6 /u01/app/oracle/oradata/suriya/stby_redo03.log STANDBY NO


GROUP# MEMBER TYPE IS_
---------- -------------------------------------------------------- ------- ---
STATUS
-------
7 /u01/app/oracle/oradata/suriya/stby_redo04.log STANDBY NO

7 rows selected.

sql>alter system set log_archive_config='DG_CONFIG=(SURIYA, SURIYADR)';

SQL> alter system set LOG_ARCHIVE_DEST_1='LOCATION=/u01/app/oracle/flash_recovery_area/SURIYA/onlinelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=SURIYA';
System altered.

SQL> alter system set LOG_ARCHIVE_DEST_2='SERVICE=SURIYADR LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=SURIYADR';
System altered.

SQL> alter system set LOG_ARCHIVE_DEST_STATE_1=ENABLE;
System altered.

SQL> alter system set LOG_ARCHIVE_DEST_STATE_2=ENABLE;
System altered.

SQL> alter system set FAL_SERVER=SURIYADR;
System altered.

SQL> alter system set FAL_CLIENT=SURIYA;
System altered.

SQL> alter system set standby_file_management=auto;
System altered.

SQL> alter system set remote_loging_passwordfile=exclusive;
System altered.

SQL> alter system set DB_FILE_NAME_CONVERT='/u01/app/oracle/oradata/suriyadr','/u01/app/oracle/oradata/suriya' scope=spfile;

System altered.

SQL> alter system set LOG_FILE_NAME_CONVERT='/u01/app/oracle/flash_recovery_area/SURIYADR/onlinelog/','/u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/' scope=spfile;

System altered.

Setup SqlNet connectivity between primary database and standby database ON BOTH NODE
Primary side ( Listener configuration)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =192.168.1.81 )(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = suriya )
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = suriya)
)
)

primary side (tnsnames.ora)

SURIYADR =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.83)(PORT = 1525))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = suriyadr)
)
)


Standby side Listener Configuration

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =192.168.1.83)(PORT = 1525))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = suriyadr )
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = suriyadr)
)
)

standby database tns configuration

SURIYA =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.81)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = suriya)
)
)

#this standby database tns entry configuration is required on standby location because
#we are performing the active database duplication from standby side database.

SURIYADR=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.83)(PORT = 1525))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = suriyadr)
)
)

creating password file
orapwd file=orapwsuriya password=oracle entries=5 force=y

[oracle@rak1 dbs]$ scp orapwsuriya oracle@192.168.1.83:/u01/app/oracle/product/11.2.0/db_1/dbs/orapwsuriyadr
orapwsuriya                                                                                                                           100% 2048 2.0KB/s 00:00

Pfile created for standby database and parameter changes are also achieved for flashback database

Copy the init parameter nessarey change
*.audit_file_dest='/u01/app/oracle/admin/suriyadr/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/suriyadr/control01.ctl','/u01/app/oracle/flash_recovery_area/suriyadr/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_file_name_convert='/u01/app/oracle/oradata/suriya','/u01/app/oracle/oradata/suriyadr'
*.db_name='suriya'
db_unique_name=suriyadr
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4070572032
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=suriyaXDB)'
*.fal_client='SURIYADR'
*.fal_server='SURIYA'
*.log_archive_config='DG_CONFIG=(SURIYA, SURIYADR)'
*.log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=SURIYADR'
*.log_archive_dest_2='SERVICE=SURIYA LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=SURIYA'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='ENABLE'
*.log_file_name_convert='/u01/app/oracle/flash_recovery_area/SURIYADR/onlinelog/','/u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/'
*.memory_target=822083584
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.standby_file_management='AUTO'
*.undo_tablespace='UNDOTBS1'


[oracle@rak1 tmp]$ scp initsuriyadr.ora oracle@192.168.1.83:/u01/app/oracle/product/11.2.0/db_1/dbs/

3)Creating nessary directory structure in standby database location

[oracle@rak3 admin]$ mkdir -p /u01/app/oracle/admin/suriyadr/adump
[oracle@rak3 admin]$ mkdir -p /u01/app/oracle/oradata/suriyadr
[oracle@rak3 admin]$ mkdir -p /u01/app/oracle/flash_recovery_area/suriyadr
[oracle@rak3 admin]$ mkdir -p /u01/app/oracle/flash_recovery_area/SURIYADR/onlinelog

In standby database location primary directory required because (during the media recovery from the standby database, it creates the redo logs generation as same directory structure of redolog file location as primary database. So i am creating the following the directory structure in standby location.

mkdir -p /u01/app/oracle/oradata/suriya/

also creating the following directory structure in primary database location

mkdir -p /u01/app/oracle/oradata/suriyadr/


4)Check the connectivity from standby database location net configuration are archived properly and start
the RMAN active database duplication

SQL> conn sys/oracle@suriya as sysdba;
Connected.
SQL> conn sys/oracle@suriyadr as sysdba

5)On standby DB Locatoin

[oracle@rak3 admin]$ . oraenv
ORACLE_SID = [oracle] ? suriyadr
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 is /u01/app/oracle
[oracle@rak3 admin]$ rman target sys/oracle@suriya auxiliary sys/oracle@suriyadr

This output is created by RMAN
Recovery Manager: Release 11.2.0.1.0 - Production on Sat Sep 29 09:50:39 2012

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

connected to target database: SURIYA (DBID=3309137318)

[oracle@rak3 admin]$ rman target sys/oracle@suriya auxiliary sys/oracle@suriyadr

Recovery Manager: Release 11.2.0.1.0 - Production on Sat Sep 29 09:56:19 2012

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

connected to target database: SURIYA (DBID=3309137318)
connected to auxiliary database: SURIYA (not mounted)

Duplicate for standby

Below is the RMAN run command to perform the database duplication from and active database along with brief explanations for the options used in the duplicate.

FOR STANDBY – the duplicate is for use as a standby so a DBID change will not be forced.
FROM ACTIVE DATABASE – instructs RMAN to use the active target database instead of disk based backups.
DORECOVER – do recovery bringing the standby database up to the current point in time.
SPFILE – values for parameters specific to the auxiliary instance can be set here.
NOFILENAMECHECK – this option is added because the duplicate database files uses the same name as the source database.

RMAN> duplicate target database for standby from active database dorecover;

Starting Duplicate Db at 29-SEP-12
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=27 device type=DISK

contents of Memory Script:
{
backup as copy reuse
targetfile '/u01/app/oracle/product/11.2.0/db_1/dbs/orapwsuriya' auxiliary format
'/u01/app/oracle/product/11.2.0/db_1/dbs/orapwsuriyadr' ;
}
executing Memory Script

Starting backup at 29-SEP-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=51 device type=DISK
Finished backup at 29-SEP-12

contents of Memory Script:
{
backup as copy current controlfile for standby auxiliary format '/u01/app/oracle/oradata/suriyadr/control01.ctl';
restore clone controlfile to '/u01/app/oracle/flash_recovery_area/suriyadr/control02.ctl' from
'/u01/app/oracle/oradata/suriyadr/control01.ctl';
}
executing Memory Script

Starting backup at 29-SEP-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying standby control file
output file name=/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_suriya.f tag=TAG20120929T095829 RECID=1 STAMP=795261527
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
Finished backup at 29-SEP-12

Starting restore at 29-SEP-12
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: copied control file copy
Finished restore at 29-SEP-12

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
"/u01/app/oracle/oradata/suriyadr/temp01.dbf";
switch clone tempfile all;
set newname for datafile 1 to
"/u01/app/oracle/oradata/suriyadr/system01.dbf";
set newname for datafile 2 to
"/u01/app/oracle/oradata/suriyadr/sysaux01.dbf";
set newname for datafile 3 to
"/u01/app/oracle/oradata/suriyadr/undotbs01.dbf";
set newname for datafile 4 to
"/u01/app/oracle/oradata/suriyadr/users01.dbf";
backup as copy reuse
datafile 1 auxiliary format
"/u01/app/oracle/oradata/suriyadr/system01.dbf" datafile
2 auxiliary format
"/u01/app/oracle/oradata/suriyadr/sysaux01.dbf" datafile
3 auxiliary format
"/u01/app/oracle/oradata/suriyadr/undotbs01.dbf" datafile
4 auxiliary format
"/u01/app/oracle/oradata/suriyadr/users01.dbf" ;
sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/oracle/oradata/suriyadr/temp01.dbf in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting backup at 29-SEP-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/u01/app/oracle/oradata/suriya/system01.dbf
output file name=/u01/app/oracle/oradata/suriyadr/system01.dbf tag=TAG20120929T095915
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:16
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/u01/app/oracle/oradata/suriya/sysaux01.dbf

.
.
.

RMAN>

NOTE : We get warnings at the end of the rman  active rupilicatoin method. these can be ignored as these are due to the initialization parameter STANDBY_FILE_MANAGEMENT is set to AUTO.

 
6)On the standby start the managed recovery process.

SQL> alter database recover managed standby database disconnect from session;

Database altered.

7)So RMAN duplicate is completed along with the dataguard environment. Now need to validate that that logs are shipping and applying. On the standby database issue the following command.

SQL> select sequence#, first_time, next_time, applied
  2  from v$archived_log
  3  order by sequence#;

(Note: applied column must "yes" for all archive logs)

8)On the primary database location switch the redo logs a few times and use archive log list to view information on the oldest, current and next log sequence.

SQL> alter system switch logfile;
System altered.

SQL> alter system switch logfile;
System altered.

SQL> alter system switch logfile;
System altered.

SQL> archive log list

SQL> select sequence#, first_time, next_time, applied
  2  from v$archived_log
  3  order by sequence#;

(Note: applied column must "yes" for all archive logs and match the sequence# from the primary location output taken from point:2)


Sunday, September 30, 2012

Steps to recover the primary database's datafile using a copy of a standby database's datafile



Steps to recover the Dataguard primary database's datafile using a copy of a standby database's datafile.

This procedure will work for all file systems including raw or ASM.


Through this example we will be using user12 (datafile).

1) On standby database, copy datafile from ASM to a file system:

SQL> select NAME,FILE#,TS# from v$datafile;

RMAN> backup as copy datafile 12 format '/tmp/user12.dbf';

2) Move the datafile copy from standby to primary database host using scp.

3)On primary database Place the datafile to recover offline.


SQL> alter database datafile 12 offline;

4) catalog this datafile copy:

RMAN> catalog datafilecopy '/tmp/user5.dbf';

5) Confirm that datafile exists:

RMAN> list copy of datafile 12;

6) Restore the datafile:

RMAN> restore datafile 12;

7) Recover the datafile:

RMAN> recover datafile 12;

8) Place the datafile online:

SQL> alter database datafile 12 online;



Steps to recover the standby database's datafile using a copy of a primary database's datafile.

1) Backup the primary database's datafile.

RMAN> backup as copy datafile 12 format '/tmp/user5.dbf';

2) transfer the file to the standby site using an operating system utility such as scp.

3) catalog the datafile copy on the standby site.

RMAN> catalog datafilecopy '/tmp/user5.dbf';

4) stop redo apply on the physical standby database.

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

5) on the standby site restore the datafile copy.

RMAN> restore datafile 12;

6) restart redo apply on the physical standby database.

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;

Resolving Gaps in DataGuard Physical Standby Using RMAN Incremental Backup

Note: To perform this test purpose only. disabled the log_archive_dest_state_2='defer' in  primary database location using command
alter system set log_archive_dest_state_2='DEFER';

until the test is implemented. then enable the parameter in primary database location using command 
sql>alter system set log_archive_dest_state_2='ENABLE';
 
In Primary Database

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     223
Next log sequence to archive   225
Current log sequence           225

SQL> select current_scn from v$database;

    CURRENT_SCN
---------------
        1062658

In Standby Database (physical standby)
SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog
Oldest online log sequence     81
Next log sequence to archive   0
Current log sequence           224

SQL> select current_scn from v$database;
    CURRENT_SCN
---------------
        1061314


Alert log file file of Standby Database

Sun Sep 30 03:16:40 2012
Archived Log entry 238 added for thread 1 sequence 224 ID 0xc53dd54c dest 1:
Sun Sep 30 03:16:42 2012
Media Recovery Log /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_224_795237478.dbf
Media Recovery Waiting for thread 1 sequence 225

Alert log file file of primary Database

Using STANDBY_ARCHIVE_DEST parameter default value as USE_DB_RECOVERY_FILE_DEST
ALTER SYSTEM SET log_archive_dest_state_2='DEFER' SCOPE=MEMORY;
Sun Sep 30 03:16:40 2012
Thread 1 advanced to log sequence 225 (LGWR switch)
  Current log# 3 seq# 225 mem# 0: /u01/app/oracle/oradata/suriya/redo03.log
Sun Sep 30 03:16:40 2012


Command to check sequence are received and applied on primary and standby database

SELECT ARCH.THREAD# "Thread", ARCH.SEQUENCE# "Last Sequence Received", APPL.SEQUENCE# "Last Sequence Applied", (ARCH.SEQUENCE# - APPL.SEQUENCE#) "Difference" FROM (SELECT THREAD# ,SEQUENCE# FROM V$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$ARCHIVED_LOG GROUP BY THREAD#))ARCH, (SELECT THREAD# ,SEQUENCE# FROM V$LOG_HISTORY WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$LOG_HISTORY GROUP BY THREAD#)) APPL WHERE ARCH.THREAD# = APPL.THREAD# ORDER BY 1;

Output

         Thread Last Sequence Received Last Sequence Applied      Difference
--------------- ---------------------- --------------------- ---------------
              1                    224                   224               0
         
In Standby Database

SQL> alter database recover managed standby database cancel;

Database altered.

Perform Rman Incremental backup from Primary database
[oracle@rak3 trace]$ . oraenv
ORACLE_SID = [oracle] ? suriyadr
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 is /u01/app/oracle
[oracle@rak3 trace]$ rman target=/

Recovery Manager: Release 11.2.0.1.0 - Production on Sun Sep 30 03:45:52 2012

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

connected to target database: SURIYA (DBID=3309137318)

RMAN> run {
allocate channel c1 type disk format '/tmp/suriyabak/%U.rmb';
backup incremental from scn 1061314 database;

}

using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=50 device type=DISK

Starting backup at 30-SEP-12

backup will be obsolete on date 07-OCT-12
archived logs will not be kept or backed up
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/suriyadr/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/suriyadr/sysaux01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/suriyadr/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/suriyadr/users01.dbf
channel c1: starting piece 1 at 30-SEP-12
channel c1: finished piece 1 at 30-SEP-12
piece handle=/tmp/suriyabak/03nmfd5c_1_1.rmb tag=TAG20120930T034652 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:36

backup will be obsolete on date 07-OCT-12
archived logs will not be kept or backed up
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
including current control file in backup set
channel c1: starting piece 1 at 30-SEP-12
channel c1: finished piece 1 at 30-SEP-12
piece handle=/tmp/suriyabak/04nmfd6h_1_1.rmb tag=TAG20120930T034652 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 30-SEP-12
released channel: c1

RMAN> exit


Recovery Manager complete.
[oracle@rak3 trace]$ cd /tmp/suriyabak/
[oracle@rak3 suriyabak]$ ls
03nmfd5c_1_1.rmb  04nmfd6h_1_1.rmb
[oracle@rak3 suriyabak]$


[oracle@rak3 tmp]$ ls
suriyabak      

[oracle@rak3 tmp]$ tar -cvf suriyabak.tar.gz suriyabak
suriyabak/
suriyabak/04nmfd6h_1_1.rmb
suriyabak/03nmfd5c_1_1.rmb
[oracle@rak3 tmp]$ ls suri*
suriyabak.tar.gz

suriyabak:
03nmfd5c_1_1.rmb  04nmfd6h_1_1.rmb
[oracle@rak3 tmp]$ scp suriyabak.tar.gz oracle@192.168.1.81:/tmp/
suriyabak.tar.gz                                                                                                                                                                                          100%   14MB  13.7MB/s   00:00   
[oracle@rak3 tmp]$

In Physical Standby Locatoin

[oracle@rak1 tmp]$ tar -cvf suriyabak.tar.gz
tar: Cowardly refusing to create an empty archive
Try `tar --help' or `tar --usage' for more information.
[oracle@rak1 tmp]$ tar -xvf suriyabak.tar.gz
suriyabak/
suriyabak/04nmfd6h_1_1.rmb
suriyabak/03nmfd5c_1_1.rmb
[oracle@rak1 tmp]$ ls
suriyabak        

[oracle@rak1 tmp]$
[oracle@rak1 tmp]$ cd suriyabak
[oracle@rak1 suriyabak]$ ls
03nmfd5c_1_1.rmb  04nmfd6h_1_1.rmb
[oracle@rak1 suriyabak]$

In Primary Database location

SQL> show parameter control

NAME                                 TYPE VALUE
------------------------------------ ---- ------------------------------
control_file_record_keep_time        inte 7
                                     gerset
control_files                        stri /u01/app/oracle/oradata/suriya
                                     ng   dr/control01.ctl, /u01/app/ora
                                          cle/flash_recovery_area/suriya
                                          dr/control02.ctl
control_management_pack_access       stri DIAGNOSTIC+TUNING
                                     ng

SQL> alter database create standby controlfile as '/tmp/suriya_standby.ctl';

Database altered.

[oracle@rak3 tmp]$ ls sur*
suriyabak.tar.gz  suriya_standby.ctl

suriyabak:
03nmfd5c_1_1.rmb  04nmfd6h_1_1.rmb
[oracle@rak3 tmp]$ scp suriya_standby.ctl oracle@192.168.1.81:/tmp/
suriya_standby.ctl                                          


In Standby Database location

SQL> startup nomount
ORACLE instance started.

Total System Global Area       818401280 bytes
Fixed Size                       2217792 bytes
Variable Size                  507513024 bytes
Database Buffers               306184192 bytes
Redo Buffers                     2486272 bytes

SQL> show parameter control_files

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_files                        string      /u01/app/oracle/oradata/suriya
                                                 /control01.ctl, /u01/app/oracl
                                                 e/flash_recovery_area/suriya/c
                                                 ontrol02.ctl

[oracle@rak1 suriyabak]$ mv /u01/app/oracle/oradata/suriya/control01.ctl control01.ctl.bak
[oracle@rak1 suriyabak]$ cp /tmp/suriya_standby.ctl control01.ctl
[oracle@rak1 suriyabak]$ ls cont* /u01/app/oracle/oradata/suriya/
control01.ctl  control01.ctl.bak
[oracle@rak1 suriya]$ cp /tmp/suriya_standby.ctl /u01/app/oracle/flash_recovery_area/suriya/control02.ctl
[oracle@rak1 suriya]$

[oracle@rak1 suriya]$ ls con* /u01/app/oracle/flash_recovery_area/suriya/
/u01/app/oracle/flash_recovery_area/suriya/:
control02.ctl


SQL> alter database mount standby database;

Database altered.


RMAN> catalog start with '/tmp/suriyabak';
Starting implicit crosscheck backup at 30-SEP-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=31 device type=DISK
Crosschecked 2 objects
Finished implicit crosscheck backup at 30-SEP-12

Starting implicit crosscheck copy at 30-SEP-12
using channel ORA_DISK_1
Finished implicit crosscheck copy at 30-SEP-12

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_81_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_136_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_156_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_127_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_114_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_174_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_87_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_214_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_36_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_62_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_117_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_123_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_12_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_78_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_194_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_90_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_107_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_105_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_118_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_53_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_219_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_129_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_207_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_103_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_122_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_128_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_222_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_6_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_180_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_161_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_47_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_57_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_100_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_206_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_41_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_119_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_115_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_49_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_94_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_204_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_9_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_51_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_121_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_209_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_18_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_79_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_164_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_32_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_143_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_170_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_212_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_137_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_65_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_146_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_72_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_109_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_85_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_152_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_19_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_42_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_221_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_73_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_38_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_93_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_188_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_28_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_216_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_187_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_151_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_24_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_202_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_132_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_158_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_80_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_217_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_139_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_177_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_58_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_110_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_144_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_61_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_199_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_25_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_37_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_20_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_150_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_134_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_89_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_75_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_160_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_50_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_141_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_76_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_200_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_66_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_195_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_8_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_31_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_211_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_33_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_52_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_113_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_184_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_14_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_68_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_203_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_101_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_153_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_189_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_131_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_125_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_130_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_23_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_183_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_99_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_71_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_135_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_198_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_186_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_168_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_82_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_178_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_69_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_11_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_124_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_48_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_116_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_64_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_157_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_86_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_45_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_210_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_201_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_91_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_166_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_16_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_147_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_176_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_22_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_102_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_77_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_165_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_171_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_92_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_74_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_39_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_63_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_193_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_70_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_220_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_55_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_172_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_54_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_7_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_192_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_46_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_185_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_196_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_126_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_26_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_175_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_154_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_104_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_98_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_111_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_97_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_133_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_140_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_149_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_60_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_15_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_88_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_21_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_148_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_30_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_59_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_40_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_35_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_67_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_112_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_224_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_197_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_191_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_182_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_223_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_142_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_179_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_181_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_10_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_120_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_218_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_213_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_138_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_215_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_83_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_163_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_44_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_56_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_167_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_145_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_162_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_29_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_34_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_159_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_13_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_27_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_95_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_173_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_84_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_169_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_96_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_190_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_43_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_17_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_106_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_208_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_155_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_205_795237478.dbf
File Name: /u01/app/oracle/flash_recovery_area/SURIYA/onlinelog/1_108_795237478.dbf

searching for all files that match the pattern /tmp/suriyabak

List of Files Unknown to the Database
=====================================
File Name: /tmp/suriyabak.tar.gz
File Name: /tmp/suriyabak/control01.ctl.bak
File Name: /tmp/suriyabak/control02.ctl.bak
File Name: /tmp/suriyabak/show
File Name: /tmp/suriyabak/control01.ctl

Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /tmp/suriyabak/control01.ctl.bak
File Name: /tmp/suriyabak/control02.ctl.bak
File Name: /tmp/suriyabak/control01.ctl


RMAN> recover database;

Starting recover at 30-SEP-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: /u01/app/oracle/oradata/suriya/system01.dbf
destination for restore of datafile 00002: /u01/app/oracle/oradata/suriya/sysaux01.dbf
destination for restore of datafile 00003: /u01/app/oracle/oradata/suriya/undotbs01.dbf
destination for restore of datafile 00004: /u01/app/oracle/oradata/suriya/users01.dbf
channel ORA_DISK_1: reading from backup piece /tmp/suriyabak/03nmfd5c_1_1.rmb
channel ORA_DISK_1: piece handle=/tmp/suriyabak/03nmfd5c_1_1.rmb tag=TAG20120930T034652
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03

starting media recovery

unable to find archived log
archived log thread=1 sequence=225
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 09/30/2012 04:22:16
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 225 and starting SCN of 1063718

(note: This always happens becoz we have come to know the last of the archived logs. The requested archived log with sequence# 1063718 which is not generated yet.)

In Standby Database

SQL> alter database recover managed standby database disconnect from session;

Database altered.


SQL>  select current_scn from v$database;
    CURRENT_SCN
---------------
        1064789

 
Primary Database (wait for some time scn number change frequently)
 

SQL>  select current_scn from v$database;
    CURRENT_SCN
---------------
        1064789