配套视频:《Oracle11g DataGuard 管理》
1) On the standby database, stop the managed recovery process (MRP)
```
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
```
SQL> SELECT CURRENT_SCN FROM V$DATABASE;
SQL> select min(checkpoint_change#) from v$datafile_header;
CHECKPOINT_CHANGE#
---------------------
1083631
In ideal situation the above 2 queries will return the almost same SCN. However if there is huge difference its better to take backup using the SCN from second query (lesser SCN), as one of the datafile may be behind.
```
3) In sqlplus, connect to the primary database and identify datafiles added:
```
SQL> set line 200
SQL> col NAME format a60;
SQL> SELECT FILE#, NAME FROM V$DATAFILE WHERE CREATION_CHANGE# > <checkpoint_change# from 2>;
```
4) Using rman, create backup of an incremental backup using the SCN derived in the previous step:
```
RMAN> backup incremental from SCN 1083631 database format '/tmp/ForStandby_%U' tag 'FORSTANDBY';
RMAN> backup current controlfile for standby format '/tmp/ForStandbyCTRL.bck';
```
5) Transfer all backup sets created on the primary system to the standby system.
```
scp /tmp/ForStandby* standby:/tmp
```
6) Restore new controlfile and catalog the backup transfered in step #5
```
RMAN> shutdown;
RMAN> startup nomount;
RMAN> restore standby controlfile from '/tmp/ForStandbyCTRL.bck';
RMAN> alter database mount;
RMAN> CATALOG START WITH '/tmp/ForStandby';
```
7) Recover the standby database with the cataloged incremental backup:
```
RMAN> RECOVER DATABASE NOREDO;
```
8) On the standby database, start the MRP
```
--启动数据库
alter database open
--开启实时应用
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
--查看日志应用情况<主、备库上执行对比>
SQL> select unique thread#,max(sequence#) over(partition by thread#) last from v$archived_log;
SQL> select * from v$archive_gap;
```