RMAN通过db_unique_name把备份集同db关联在一起,
RMAN uses the DB_UNIQUE_NAME initializationparameter to distinguish one database site from another database site. Thus, itis critical that the uniqueness of DB_UNIQUE_NAME be maintained in a Data Guardconfiguration,执行操作时需要使用FOR DB_UNIQUE_NAME与某个db进行关联
dataguard中若一个standby运行了unregister命令,则其备份集仍可以被其他db使用
When a standby database is completelyremoved from a Data Guard environment, the database information in the recoverycatalog can also be removed after you connect to another database in the sameData Guard environment. The backups that were associated with the database thatwas unregistered are still usable by other databases. You can associate thesebackups with any other existing database by using the CHANGE BACKUP RESETDB_UNIQUE_NAME command.
When the UNREGISTER DB_UNIQUE_NAME commandis used with the INCLUDING BACKUPS option, the metadata for all the backupfiles associated with the database being removed is also removed from therecovery catalog.
主库配置archived log的保留策略,有两种方式可以用来节约主库存储空间
1 日志一旦传输到备库即删除CONFIGUREARCHIVELOG DELETION POLICY TO SHIPPED TO ALL STANDBY
2 日志一旦已经应用到备库即删除CONFIGUREARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY
恢复案例
利用备库的文件恢复主库
1 rman登录备库
CONNECT TARGET sys@standby
2 以auxiliary身份连接主库
CONNECT AUXILIARY sys@primary
3 备份数据文件到主库
BACKUP AS COPY DATAFILE 2 AUXILIARY FORMAT '/disk9/df2copy.dbf';
4 rman登录主库,进行识别恢复
CONNECT TARGET sys@primary
CONNECT CATALOG rman@catdb
CATALOG DATAFILECOPY '/disk9/df2copy.dbf';
RUN {
SET NEWNAME FOR DATAFILE 2 TO '/disk9/df2copy.dbf';
SWITCH DATAFILE 2;
}
利用增量备份roll forward物理备库
适用两种情况:
1 备库存在很大的lag,或者需要恢复的archivelog已被删除
2 备库的数据文件存在nologgingchanges
步骤
1 停止备库应用,查看v$database.current_scn;若是因为nologgingchanges, 则查询
SQL> SELECT FILE#, FIRST_NONLOGGED_SCNFROM V$DATAFILE WHERE FIRST_NONLOGGED_SCN > 0;
FILE# FIRST_NONLOGGED_SCN
---------- -------------------
4 225979
5 230184
2 rman登录主库,执行主库的增量备份;若是nologging changes,则只备份相应数据文件
RMAN> BACKUP INCREMENTAL FROM SCN 225979DATAFILE 4 FORMAT '/tmp/ForStandby_%U' TAG 'FORSTANDBY';
RMAN> BACKUP INCREMENTAL FROM SCN 230184DATAFILE 5 FORMAT '/tmp/ForStandby_%U' TAG 'FORSTANDBY';
3 将备份集scp到备库并catalog加载,然后执行reportschema确认备份集已注册至备库
4 备库执行recoverredo
RMAN> STARTUP FORCE NOMOUNT;
RMAN> RESTORE STANDBY CONTROLFILE FROMTAG 'FORSTANDBY';
RMAN> ALTER DATABASE MOUNT;
RMAN> RECOVER DATABASE NOREDO;
然后验证
SELECT FILE#, FIRST_NONLOGGED_SCN FROM V$DATAFILEWHERE FIRST_NONLOGGED_SCN > 0;
验证无误后开启备库redo apply
对于因为nologging导致的corrupted block,可以参照
http://t.askmaclean.com/thread-475-1-1.html
联系客服