After rman incrementally restores the dg gap, the master database adds a new data file, rmangap
1) On the standby database, close (MRP)
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
2) On the standby database, obtain the minimum scn value of the slave DATABASE and use it as the Incremental backup point of the master DATABASE:
Col MIN (CHECKPOINT_CHANGE #) for 999999999999999999
Col CURRENT_SCN for 99999999999999999
SELECT CURRENT_SCN from v $ DATABASE;
Select min (checkpoint_change #) from v $ datafile_header;
CHECKPOINT_CHANGE #
---------------------
3162298
Col current_scn for 999999999999999
SELECT CURRENT_SCN from v $ DATABASE;
Select min (fhscn) from x $ kcvfh;
Select min (f. fhscn) from x $ kcvfh f, v $ datafile d
Where f. hxfil = d. file # and d. enabled! = 'Read only ';
Minimum scn
3) the newly added data file after determining the dg gap in the master database (scn is based on the minimum scn of the slave database ):
SQL> SELECT FILE #, NAME FROM V $ DATAFILE WHERE CREATION_CHANGE #> <SCN_NUMBER_FROM_STEP 2>;
4) use rman to create a backup of the corresponding data file, and Incremental backup of the entire database based on scn, standb control file:
RMAN> backup datafile #,#,#,# format '/tmp/ForStandby _ % U' tag 'forstandby ';
RMAN> backup incremental from SCN 3162298 database format'/tmp/ForStandby _ % U' tag 'forstandby ';
RMAN> backup current controlfile for standby format'/tmp/ForStandbyCTRL. bck ';
5) copy the backup result to the slave Database
Scp/tmp/ForStandby _ * standby:/tmp
6) restore the newly generated standby control file and register the copied backup file:
RMAN> shutdown;
RMAN> startup nomount;
RMAN> restore standby controlfile from '/tmp/ForStandbyCTRL. bck ';
RMAN> alter database mount;
----- Register copies of copies
RMAN> catalog start with '/tmp/forstandby ';
Using target database control file instead of recovery catalog
Searching for all files that match the pattern/tmp/ForStandby
List of Files Unknown to the Database
============================================
File Name:/tmp/ForStandby_2llixora4_1_1
File Name:/tmp/ForStandby_2mlixora8_1_1
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/ForStandby_2llixora4_1_1
File Name:/tmp/ForStandby_2mlixora8_1_1
7) restore missing datafiles:
There may be a problem here. When the newly added data file in the master database does not have data, ramn backup generates a backup set that is only over 100 kb.
When catalog start with, oracle cannot identify it.
But it does not matter. We can directly manually register:
Catalog backuppiece '/tmp/01dmsbj4_00001.bcp ';
Run
{
Set newname for datafile 9 to '+ diskgroup ';
Set newname for datafile 8 to '+ diskgroup ';
Set newname for datafile 11 to '+ diskgroup ';
# Set newname for datafile 12 to '/oradata/datafile/lixora. dbf ';
Restore datafile 9, 8, 11 ,....;
}
8) Update the path of the data file in the stndby control file of the slave database.
Use the catalog command to update the data file path (the data file names of the standby and Primary databases are different from the data files in different paths)
RMAN> catalog start with '+ DATA/lixora/datafile /';
Or
RMAN> catalog start with '/oradata/lixora/datafile /';
List of Files Unknown to the Database
============================================
File Name: + data/lixora/DATAFILE/SYSTEM.309.685535773
File Name: + data/lixora/DATAFILE/SYSAUX.301.685535773
File Name: + data/lixora/DATAFILE/UNDOTBS1.302.685535775
File Name: + data/lixora/DATAFILE/SYSTEM.297.688213333
File Name: + data/lixora/DATAFILE/SYSAUX.267.688213333
File Name: + data/lixora/DATAFILE/UNDOTBS1.268.688213335
Do you really want to catalog the above files (enter YES or NO )? YES
Cataloging files...
Cataloging done
List of Cataloged Files
======================================
File Name: + data/lixora/DATAFILE/SYSTEM.297.688213333
File Name: + data/lixora/DATAFILE/SYSAUX.267.688213333
File Name: + data/lixora/DATAFILE/UNDOTBS1.268.688213335
--- This step is equivalent to alert database datafile rename. This step updates the data file information in the standby control file:
RMAN> switch database to copy;
Datafile 1 switched to datafile copy "+ DATA/lixora/datafile/system.297.688213333"
Datafile 2 switched to datafile copy "+ DATA/lixora/datafile/undotbs1.268.688213335"
Datafile 3 switched to datafile copy "+ DATA/lixora/datafile/sysaux.267.688213333"
9) Use Incremental backup to restore the slave database. noredo indicates that redo or archive is not applied:
RMAN> recover database noredo;
Starting recover at 03-JUN-09
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: sid = 28 devtype = DISK
Channel ORA_DISK_1: starting incremental datafile backupset restore
Channel ORA_DISK_1: specifying datafile (s) to restore from backup set
Destination for restore of datafile 00001: + DATA/lixora/datafile/system.297.688213333
Destination for restore of datafile 00002: + DATA/lixora/datafile/undotbs1.268.688213335
Destination for restore of datafile 00003: + DATA/lixora/datafile/sysaux.267.688213333
Channel ORA_DISK_1: reading from backup piece/tmp/ForStandby_2llixora4_1_1
Channel ORA_DISK_1: restored backup piece 1
Piece handle =/tmp/ForStandby_2llixora4_1_1 tag = FORSTANDBY
Channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
Finished recover at 03-JUN-09
10) [Optional] configure flash back
If the STANDBY database needs to be configured for FLASHBACK use the below step to enable.
SQL> ALTER DATABASE FLASHBACK OFF;
SQL> ALTER DATABASE FLASHBACK ON;
11) Clean Up All standby redologs.
SQL> ALTER DATABASE CLEAR LOGFILE GROUP 1;
SQL> ALTER DATABASE CLEAR LOGFILE GROUP 2;
SQL> ALTER DATABASE CLEAR LOGFILE GROUP 3;
....
12) On the STANDBY database, start MRP
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;
This note assumes all files are at the same recovery scn or very close.
If nologging operations have been made or files are at differnt or widely varying scns see
Online documentation:
10.2: http://download.oracle.com/docs/cd/B19306_01/server.102/b14239/scenarios.htm#CIHIAADC
11.1: http://download.oracle.com/docs/cd/B28359_01/server.111/b28294/rman.htm#SBYDB00759
11.2: http://download.oracle.com/docs/cd/E11882_01/server.112/e17022/rman.htm#CIHIAADC