使用RMAN增量备份处理Dataguard因归档丢失造成的(2)

Starting backup at 29-MAR-18
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=9 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including standby control file in backup set
channel ORA_DISK_1: starting piece 1 at 29-MAR-18
channel ORA_DISK_1: finished piece 1 at 29-MAR-18
piece handle=/tmp/ForStandbyCTRL.bck tag=TAG20180329T114413 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 29-MAR-18

[oracle@prim tmp]$ scp ForStandbyCTRL.bck 192.168.211.162:/tmp
oracle@192.168.211.162's password:
ForStandbyCTRL.bck 100% 9856KB 9.6MB/s 00:00

8.备库还原控制文件:

RMAN> shutdown immediate;

database dismounted

Oracle instance shut down

RMAN> startup nomount;

connected to target database (not started)
Oracle instance started

Total System Global Area 1002127360 bytes

Fixed Size 2259440 bytes
Variable Size 285214224 bytes
Database Buffers 708837376 bytes
Redo Buffers 5816320 bytes

RMAN> RESTORE STANDBY CONTROLFILE FROM '/tmp/ForStandbyCTRL.bck';

Starting restore at 29-MAR-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=10 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/oradata/rzorcl/control01.ctl
output file name=/u01/app/oracle/oradata/rzorcl/control02.ctl
Finished restore at 29-MAR-18

9.重启备库到mount

RMAN> SHUTDOWN;
RMAN> STARTUP MOUNT;

10.如果数据库是用OMF方式管理数据文件的,则需要在备库的控制文件中重新注册下数据文件,示例如下:

(如果数据文件存放在文件系统,没有使用OMF,则跳过此步骤)

RMAN> CATALOG START WITH '+DATA/rzorcl/datafile/';

List of Files Unknown to the Database
=====================================
File Name: +data/rzorcl/DATAFILE/SYSTEM.309.685535773
File Name: +data/rzorcl/DATAFILE/SYSAUX.301.685535773
File Name: +data/rzorcl/DATAFILE/UNDOTBS1.302.685535775
File Name: +data/rzorcl/DATAFILE/SYSTEM.297.688213333
File Name: +data/rzorcl/DATAFILE/SYSAUX.267.688213333
File Name: +data/rzorcl/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/rzorcl/DATAFILE/SYSTEM.297.688213333
File Name: +data/rzorcl/DATAFILE/SYSAUX.267.688213333
File Name: +data/rzorcl/DATAFILE/UNDOTBS1.268.688213335

确保主库在这个SCN之后没有添加新的数据文件,如果有则需要单独进行备份和还原,参考文档文档 ID 836986.1

SQL> select file#,name from v$datafile where creation_change# > 3505254;

no rows selected

RMAN> SWITCH DATABASE TO COPY;

datafile 1 switched to datafile copy "+DATA/rzorcl/datafile/system.297.688213333"
datafile 2 switched to datafile copy "+DATA/rzorcl/datafile/undotbs1.268.688213335"
datafile 3 switched to datafile copy "+DATA/rzorcl/datafile/sysaux.267.688213333"

11. 若备库开启了闪回,需要重新开启闪回

SQL> ALTER DATABASE FLASHBACK OFF;
SQL> ALTER DATABASE FLASHBACK ON;

12. 备库clear standby log group

SQL> ALTER DATABASE CLEAR LOGFILE GROUP 4;
SQL> ALTER DATABASE CLEAR LOGFILE GROUP 5;
SQL> ALTER DATABASE CLEAR LOGFILE GROUP 6;
SQL> ALTER DATABASE CLEAR LOGFILE GROUP 7;

13. 备库开启日志应用,至此整个过程结束

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/a700adfd312262e7f7f5bee73bf7b63b.html