How to perform for Rolling Forward a Physical Standby Database using RMAN Incremental Backup
1) Stop the managed recovery process (MRP) on the STANDBY database
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
2) On the STANDBY DATABASE, find the SCN which will be used for the incremental backup at the primary database. You need to use the ‘lowest SCN’ from the the 3 queries below
SQL> SELECT CURRENT_SCN FROM V$DATABASE;CURRENT_SCN--------------1165354SQL> select min(fhscn) from x$kcvfh;MIN(FHSCN)----------------1165321SQL> select min(f.fhscn) from x$kcvfh f, v$datafile dwhere f.hxfil =d.file#and d.enabled != 'READ ONLY' ;MIN(F.FHSCN)----------------1165301
3) Take an incremental backup off the PRIMARY database
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 1165301 DATABASE FORMAT '/tmp/ForStandby_%U' tag 'FORSTANDBY';
4) Transfer all backup sets to STANDBY server from primary database
All backups created by step #3 must be transferred from the primary to the standby server. If the backup is written to NFS device, this step can be skipped.
$ scp /tmp/ForStandby_* standby:/tmp
5) Catalog the backups in STANDBY.
In order for the standby database to know about the backups, catalog the backup pieces on the STANDBY database.
RMAN> CATALOG START WITH '/tmp/ForStandby';using target database control file instead of recovery catalogsearching for all files that match the pattern /tmp/ForStandbyList of Files Unknown to the Database=====================================File Name: /tmp/ForStandby_2lkglss4_1_1File Name: /tmp/ForStandby_2mkglst8_1_1Do you really want to catalog the above files (enter YES or NO)? YEScataloging files...cataloging doneList of Cataloged Files=======================File Name: /tmp/ForStandby_2lkglss4_1_1File Name: /tmp/ForStandby_2mkglst8_1_1
6) Recover the STANDBY database with the cataloged incremental backup:
RMAN> RECOVER DATABASE NOREDO;starting recover at 05-AUG-20allocated channel: ORA_DISK_1channel ORA_DISK_1: sid=28 devtype=DISKchannel ORA_DISK_1: starting incremental datafile backupset restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setdestination for restore of datafile 00001: +DATA/STBY/datafile/system.297.688213333destination for restore of datafile 00002: +DATA/STBY/datafile/undotbs1.268.688213335destination for restore of datafile 00003: +DATA/STBY/datafile/sysaux.267.688213333channel ORA_DISK_1: reading from backup piece /tmp/ForStandby_2lkglss4_1_1channel ORA_DISK_1: restored backup piece 1piece handle=/tmp/ForStandby_2lkglss4_1_1 tag=FORSTANDBYchannel ORA_DISK_1: restore complete, elapsed time: 00:00:02Finished recover at 05-AUG-20
7) In RMAN, connect to the PRIMARY database and create a standby control file backup:
RMAN> BACKUP CURRENT CONTROLFILE FOR STANDBY FORMAT '/tmp/ForStandbyCTRL.bck';
8) Copy the standby control file backup to the STANDBY system.
$ scp /tmp/ForStandbyCTRL.bck standby:/tmp
9) Capture datafile information in STANDBY database.
The standby controlfile will need to be refreshed from the backup taken at step #7. Since the datafile names are likely different than primary, save the names of your standby datafile names for reference after restoring the controlfile from the primary backup. Run below query in the standby database and save the results for further use.
spool standby_datafile_names.txtset pagesize 1000;set lines 200col name format a60select file#, name from v$datafile order by file# ;spool off
10) From RMAN, connect to STANDBY database and restore the standby control file:
RMAN> SHUTDOWN IMMEDIATE ;RMAN> STARTUP NOMOUNT;RMAN> RESTORE STANDBY CONTROLFILE FROM '/tmp/ForStandbyCTRL.bck';Starting restore at 03-JUN-09using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: sid=36 devtype=DISKchannel ORA_DISK_1: restoring control filechannel ORA_DISK_1: restore complete, elapsed time: 00:00:07output filename=+DATA/STBY/controlfile/current.257.688583989Finished restore at 03-JUN-09
11) Shut down the STANDBY database and startup mount:
SQL> SHUTDOWN;SQL> STARTUP MOUNT;
12) Since the controlfile is restored from PRIMARY, the datafile locations in STANDBY controlfile will be same as PRIMARY database, so catalog datafiles in STANDBY will do the necessary rename operations. Perform the below step in STANDBY for each diskgroup where the datafile directory structure between primary and standby are different.
These are not required if same path is there on primary and standby for the datafile.
RMAN> CATALOG START WITH '+DATA/mystd/datafile/';List of Files Unknown to the Database=====================================File Name: +data/mystd/DATAFILE/SYSTEM.309.685535773File Name: +data/mystd/DATAFILE/SYSAUX.301.685535773File Name: +data/mystd/DATAFILE/UNDOTBS1.302.685535775File Name: +data/mystd/DATAFILE/SYSTEM.297.688213333File Name: +data/mystd/DATAFILE/SYSAUX.267.688213333File Name: +data/mystd/DATAFILE/UNDOTBS1.268.688213335Do you really want to catalog the above files (enter YES or NO)? YEScataloging files...cataloging doneList of Cataloged Files=======================File Name: +data/mystd/DATAFILE/SYSTEM.297.688213333File Name: +data/mystd/DATAFILE/SYSAUX.267.688213333File Name: +data/mystd/DATAFILE/UNDOTBS1.268.688213335
13) Switch the datafiles to its correct names at the standby site :
RMAN> SWITCH DATABASE TO COPY;datafile 1 switched to datafile copy "+DATA/mystd/datafile/system.297.688213333"datafile 2 switched to datafile copy "+DATA/mystd/datafile/undotbs1.268.688213335"datafile 3 switched to datafile copy "+DATA/mystd/datafile/sysaux.267.688213333"
14) On standby database, clear all standby redo log groups:
SQL> ALTER DATABASE CLEAR LOGFILE GROUP [group number];
15) Now you can start the MRP Process to apply new logs.
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
Post a Comment
Post a Comment