Rolling forward a standby database using Incremental Backup
1) On the standby database
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
2) On the STANDBY DATABASE, find the 'lowest SCN' which will be used for the incremental backup at the primary database:
SQL> SELECT to_char(CURRENT_SCN) FROM V$DATABASE;
CURRENT_SCN
--------------
3164433
SQL> select min(f.fhscn) from x$kcvfh f, v$datafile d where f.hxfil =d.file# and d.enabled != 'READ ONLY' ;
MIN(F.FHSCN)
----------------
3162298
3) In RMAN, connect to the PRIMARY database and create an incremental backup from the SCN derived in the previous step:
RMAN> BACKUP INCREMENTAL FROM SCN 3162298 DATABASE FORMAT '/tmp/ForStandby_%U' tag 'FORSTANDBY';
4) Transfer all backup sets created on the primary system to the standby system.
scp /tmp/ForStandby_* standby:/tmp
5) On the STANDBY catalog the backuppieces:
RMAN> CATALOG START WITH '/tmp/ForStandby';
RMAN> RECOVER DATABASE NOREDO;
6) In RMAN, connect to the PRIMARY database and create a standby control file backup:
RMAN> BACKUP CURRENT CONTROLFILE FOR STANDBY FORMAT '/tmp/ctlForStandby.bck';
7) Copy the standby control file backup to the STANDBY system.
scp /tmp/ctlForStandby.bck standby:/tmp
8) From RMAN, connect to STANDBY database and restore the standby control file:
RMAN> SHUTDOWN IMMEDIATE ;
RMAN> STARTUP NOMOUNT;
RMAN> RESTORE STANDBY CONTROLFILE FROM '/tmp/ctlForStandby.bck';
9) Shut down the STANDBY database and startup mount:
RMAN> SHUTDOWN;
RMAN> STARTUP MOUNT;
RMAN> CATALOG START WITH '+DATA/mystd/datafile/';
RMAN> SWITCH DATABASE TO COPY;
10) On standby database
alter database open;
11) On the STANDBY database, start the recovery process
SQL> alter database recover managed standby database disconnect from session;
1) On the standby database
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
2) On the STANDBY DATABASE, find the 'lowest SCN' which will be used for the incremental backup at the primary database:
SQL> SELECT to_char(CURRENT_SCN) FROM V$DATABASE;
CURRENT_SCN
--------------
3164433
SQL> select min(f.fhscn) from x$kcvfh f, v$datafile d where f.hxfil =d.file# and d.enabled != 'READ ONLY' ;
MIN(F.FHSCN)
----------------
3162298
3) In RMAN, connect to the PRIMARY database and create an incremental backup from the SCN derived in the previous step:
RMAN> BACKUP INCREMENTAL FROM SCN 3162298 DATABASE FORMAT '/tmp/ForStandby_%U' tag 'FORSTANDBY';
4) Transfer all backup sets created on the primary system to the standby system.
scp /tmp/ForStandby_* standby:/tmp
5) On the STANDBY catalog the backuppieces:
RMAN> CATALOG START WITH '/tmp/ForStandby';
RMAN> RECOVER DATABASE NOREDO;
6) In RMAN, connect to the PRIMARY database and create a standby control file backup:
RMAN> BACKUP CURRENT CONTROLFILE FOR STANDBY FORMAT '/tmp/ctlForStandby.bck';
7) Copy the standby control file backup to the STANDBY system.
scp /tmp/ctlForStandby.bck standby:/tmp
8) From RMAN, connect to STANDBY database and restore the standby control file:
RMAN> SHUTDOWN IMMEDIATE ;
RMAN> STARTUP NOMOUNT;
RMAN> RESTORE STANDBY CONTROLFILE FROM '/tmp/ctlForStandby.bck';
9) Shut down the STANDBY database and startup mount:
RMAN> SHUTDOWN;
RMAN> STARTUP MOUNT;
RMAN> CATALOG START WITH '+DATA/mystd/datafile/';
RMAN> SWITCH DATABASE TO COPY;
10) On standby database
alter database open;
11) On the STANDBY database, start the recovery process
SQL> alter database recover managed standby database disconnect from session;
select max(sequence#) from V$ARCHIVED_LOG group by thread# union all
ReplyDeleteselect max(sequence#) from V$ARCHIVED_LOG where applied='YES' group by thread#;