dataguard通过rman实现增量备份和恢复
【摘要】 适用版本:Oracle Database - Enterprise Edition - Version 10.2.0.1 to 12.1.0.2 [Release 10.2 to 12.1]#检查备库SCNSQL> SELECT CURRENT_SCN FROM V$DATABASE;CURRENT_SCN--------------3164433SQL> select min(checkp...
适用版本:
Oracle Database - Enterprise Edition - Version 10.2.0.1 to 12.1.0.2 [Release 10.2 to 12.1]
#检查备库SCN
SQL> SELECT CURRENT_SCN FROM V$DATABASE;
CURRENT_SCN
--------------
3164433
SQL> select min(checkpoint_change#) from v$datafile_header
where file# not in (select file# from v$datafile where enabled = 'READ ONLY');
MIN(F.FHSCN)
----------------
3162298
#主数据库执行增量备份:
RMAN> BACKUP INCREMENTAL FROM SCN 3162298 DATABASE FORMAT '/tmp/ForStandby_%U' tag 'FORSTANDBY';
#拷贝到备机,并注册到控制文件:
$ scp /tmp/ForStandby_* standby:/tmp
#注册
RMAN> CATALOG START WITH '/tmp/ForStandby';
#备机执行增量恢复
RMAN> RECOVER DATABASE NOREDO;
#备份主库控制文件(for standby)
RMAN> BACKUP CURRENT CONTROLFILE FOR STANDBY FORMAT '/tmp/ForStandbyCTRL.bck';
#拷贝到备机,恢复新控制文件:
$ scp /tmp/ForStandbyCTRL.bck standby:/tmp
RMAN> SHUTDOWN IMMEDIATE ;
RMAN> STARTUP NOMOUNT;
RMAN> RESTORE STANDBY CONTROLFILE FROM '/tmp/ForStandbyCTRL.bck';
RMAN> ALTER DATABASE MOUNT;
#如果主备文件位置不同,备机需要重新注册:
RMAN> CATALOG START WITH '+DATA/STBY/datafile/';
RMAN> SWITCH DATABASE TO COPY;
#切换单个文件位置:"RMAN-06571: datafile .. does not have recoverable copy"
For example:
RMAN> switch datafile 5 to copy;
#清理日志信息,并启动日志应用:
#On STANDBY database, clear all standby redo log groups:
SQL> select GROUP# from v$logfile where TYPE='STANDBY' group by GROUP#;
SQL> ALTER DATABASE CLEAR LOGFILE GROUP 1;
SQL> ALTER DATABASE CLEAR LOGFILE GROUP 2;
SQL> ALTER DATABASE CLEAR LOGFILE GROUP
#On the STANDBY database, start the MRP
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)