ITPub博客

首页 > Linux操作系统 > Linux操作系统 > dataguard中rman恢复的应用

dataguard中rman恢复的应用

原创 Linux操作系统 作者:myownstars 时间:2012-03-12 16:21:49 0 删除 编辑

RMAN通过db_unique_name把备份集同db关联在一起,

RMAN uses the DB_UNIQUE_NAME initialization parameter to distinguish one database site from another database site. Thus, it is critical that the uniqueness of DB_UNIQUE_NAME be maintained in a Data Guard configuration,执行操作时需要使用FOR DB_UNIQUE_NAME与某个db进行关联

 

dataguard中若一个standby运行了unregister命令,则其备份集仍可以被其他db使用

When a standby database is completely removed from a Data Guard environment, the database information in the recovery catalog can also be removed after you connect to another database in the same Data Guard environment. The backups that were associated with the database that was unregistered are still usable by other databases. You can associate these backups with any other existing database by using the CHANGE BACKUP RESET DB_UNIQUE_NAME command.

When the UNREGISTER DB_UNIQUE_NAME command is used with the INCLUDING BACKUPS option, the metadata for all the backup files associated with the database being removed is also removed from the recovery catalog.

 

 

主库配置archived log的保留策略,有两种方式可以用来节约主库存储空间

1 日志一旦传输到备库即删除CONFIGURE ARCHIVELOG DELETION POLICY TO SHIPPED TO ALL STANDBY

2 日志一旦已经应用到备库即删除CONFIGURE ARCHIVELOG 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       备库的数据文件存在nologging changes

 

步骤

1  停止备库应用,查看v$database.current_scn;若是因为nologging changes, 则查询

SQL> SELECT FILE#, FIRST_NONLOGGED_SCN FROM V$DATAFILE WHERE FIRST_NONLOGGED_SCN > 0;

FILE#      FIRST_NONLOGGED_SCN

---------- -------------------

4              225979

5                    230184

 

2  rman登录主库,执行主库的增量备份;若是nologging changes,则只备份相应数据文件

RMAN> BACKUP INCREMENTAL FROM SCN 225979 DATAFILE 4 FORMAT '/tmp/ForStandby_%U' TAG 'FORSTANDBY';

RMAN> BACKUP INCREMENTAL FROM SCN 230184 DATAFILE 5 FORMAT '/tmp/ForStandby_%U' TAG 'FORSTANDBY';

 

3 将备份集scp到备库并catalog加载,然后执行report schema确认备份集已注册至备库

4  备库执行recover redo

RMAN> STARTUP FORCE NOMOUNT;

RMAN> RESTORE STANDBY CONTROLFILE FROM TAG 'FORSTANDBY';

RMAN> ALTER DATABASE MOUNT;

RMAN> RECOVER DATABASE NOREDO;

 

然后验证

SELECT FILE#, FIRST_NONLOGGED_SCN FROM V$DATAFILE WHERE FIRST_NONLOGGED_SCN > 0;

验证无误后开启备库redo apply

 

对于因为nologging导致的corrupted block,可以参照

http://t.askmaclean.com/thread-475-1-1.html

 

 

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15480802/viewspace-718366/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-03-18

  • 博文量
    375
  • 访问量
    3095559