- 续上一篇文章:
- http://yunlongzheng.blog.51cto.com/788996/717235
- 4、执行数据恢复作业
- RMAN> catalog start with '/bak/from14/for18dg/';
- searching for all files that match the pattern /bak/from14/for18dg/
- List of Files Unknown to the Database
- =====================================
- File Name: /bak/from14/for18dg/standby_MYPORT_20111114_p8mrlq22_1_1.bak
- File Name: /bak/from14/for18dg/standby_MYPORT_20111114_pcmrlqi5_1_1.bak
- File Name: /bak/from14/for18dg/standby_MYPORT_20111114_pdmrlqj9_1_1.bak
- File Name: /bak/from14/for18dg/standby_MYPORT_20111114_p9mrlq22_1_1.bak
- File Name: /bak/from14/for18dg/standby_MYPORT_20111114_p7mrlq22_1_1.bak
- File Name: /bak/from14/for18dg/standby_MYPORT_20111114_pbmrlqee_1_1.bak
- File Name: /bak/from14/for18dg/standby_MYPORT_20111114_pamrlq22_1_1.bak
- Do you really want to catalog the above files (enter YES or NO)? yes
- cataloging files...
- cataloging done
- List of Cataloged Files
- =======================
- File Name: /bak/from14/for18dg/standby_MYPORT_20111114_p8mrlq22_1_1.bak
- File Name: /bak/from14/for18dg/standby_MYPORT_20111114_pcmrlqi5_1_1.bak
- File Name: /bak/from14/for18dg/standby_MYPORT_20111114_pdmrlqj9_1_1.bak
- File Name: /bak/from14/for18dg/standby_MYPORT_20111114_p9mrlq22_1_1.bak
- File Name: /bak/from14/for18dg/standby_MYPORT_20111114_p7mrlq22_1_1.bak
- File Name: /bak/from14/for18dg/standby_MYPORT_20111114_pbmrlqee_1_1.bak
- File Name: /bak/from14/for18dg/standby_MYPORT_20111114_pamrlq22_1_1.bak
- RMAN>
- run {
- allocate channel dsk0 type disk;
- allocate channel dsk1 type disk;
- allocate channel dsk2 type disk;
- restore standby controlfile to '/u01/datafile/ctlrestore/control01.ctl';
- }
- RMAN> run {
- allocate channel dsk0 type disk;
- allocate channel dsk1 type disk;
- allocate channel dsk2 type disk;
- restore standby controlfile to '/u01/datafile/ctlfrom14/control01.ctl';
- recover database noredo;
- }2> 3> 4> 5> 6> 7>
- allocated channel: dsk0
- channel dsk0: sid=1082 devtype=DISK
- allocated channel: dsk1
- channel dsk1: sid=1081 devtype=DISK
- allocated channel: dsk2
- channel dsk2: sid=1080 devtype=DISK
- Starting restore at 2011-11-15 08:27:57
- control file is already restored to file /u01/datafile/ctlfrom14/control01.ctl
- restore not done; all files readonly, offline, or already restored
- Finished restore at 2011-11-15 08:27:57
- Starting recover at 2011-11-15 08:27:57
- channel dsk0: starting incremental datafile backupset restore
- channel dsk0: specifying datafile(s) to restore from backup set
- destination for restore of datafile 00014: /oradata/datafile/in_bbc_index.869.729797303.dbf
- destination for restore of datafile 00024: /oradata/datafile/users.604.752426949.dbf
- destination for restore of datafile 00025: /oradata/datafile/in_hangzhou_data.740.758652903
- channel dsk0: reading from backup piece /bak/from14/for18dg/standby_MYPORT_20111114_p8mrlq22_1_1.bak
- channel dsk1: starting incremental datafile backupset restore
- channel dsk1: specifying datafile(s) to restore from backup set
- destination for restore of datafile 00008: /oradata/datafile/inman_data.617.718999513.dbf
- destination for restore of datafile 00015: /oradata/datafile/in_man_index.885.729797313.dbf
- destination for restore of datafile 00017: /oradata/datafile/in_xian_index.724.729797333.dbf
- destination for restore of datafile 00018: /oradata/datafile/in_bbc_data.291.730331961.dbf
- destination for restore of datafile 00026: /oradata/datafile/in_bbc_data.752.758838665
- channel dsk1: reading from backup piece /bak/from14/for18dg/standby_MYPORT_20111114_pcmrlqi5_1_1.bak
- channel dsk2: starting incremental datafile backupset restore
- channel dsk2: specifying datafile(s) to restore from backup set
- destination for restore of datafile 00009: /oradata/datafile/auditbbc.882.710070905.dbf
- destination for restore of datafile 00016: /oradata/datafile/in_hangzhou_index.821.729797323.dbf
- destination for restore of datafile 00019: /oradata/datafile/eport_data.522.736786031.dbf
- destination for restore of datafile 00021: /oradata/datafile/in_xian_index.663.747696899.dbf
- destination for restore of datafile 00023: /oradata/datafile/tbs_catalog.791.752426905.dbf
- channel dsk2: reading from backup piece /bak/from14/for18dg/standby_MYPORT_20111114_p9mrlq22_1_1.bak
- channel dsk2: restored backup piece 1
- piece handle=/bak/from14/for18dg/standby_MYPORT_20111114_p9mrlq22_1_1.bak tag=FOR STANDBY
- channel dsk2: restore complete, elapsed time: 00:03:05
- channel dsk2: starting incremental datafile backupset restore
- channel dsk2: specifying datafile(s) to restore from backup set
- destination for restore of datafile 00001: /oradata/datafile/system.256.697238117.dbf
- destination for restore of datafile 00002: /oradata/datafile/undotbs1.258.697238119.dbf
- destination for restore of datafile 00004: /oradata/datafile/users.259.697238119.dbf
- channel dsk2: reading from backup piece /bak/from14/for18dg/standby_MYPORT_20111114_p7mrlq22_1_1.bak
- channel dsk0: restored backup piece 1
- piece handle=/bak/from14/for18dg/standby_MYPORT_20111114_p8mrlq22_1_1.bak tag=FOR STANDBY
- channel dsk0: restore complete, elapsed time: 00:04:41
- channel dsk1: restored backup piece 1
- piece handle=/bak/from14/for18dg/standby_MYPORT_20111114_pcmrlqi5_1_1.bak tag=FOR STANDBY
- channel dsk1: restore complete, elapsed time: 00:04:41
- channel dsk0: starting incremental datafile backupset restore
- channel dsk0: specifying datafile(s) to restore from backup set
- destination for restore of datafile 00003: /oradata/datafile/sysaux.257.697238119.dbf
- destination for restore of datafile 00007: /oradata/datafile/hangzhou.451.709317119.dbf
- destination for restore of datafile 00010: /oradata/datafile/tbs_catalog.891.710434097.dbf
- destination for restore of datafile 00011: /oradata/datafile/xian.880.711538313.dbf
- destination for restore of datafile 00020: /oradata/datafile/eport_index.779.736786171.dbf
- channel dsk0: reading from backup piece /bak/from14/for18dg/standby_MYPORT_20111114_pbmrlqee_1_1.bak
- channel dsk1: starting incremental datafile backupset restore
- channel dsk1: specifying datafile(s) to restore from backup set
- destination for restore of datafile 00005: /oradata/datafile/undotbs2.267.697238205.dbf
- destination for restore of datafile 00006: /oradata/datafile/ts_test.348.704715437.dbf
- destination for restore of datafile 00012: /oradata/datafile/inman_index.723.718999521.dbf
- destination for restore of datafile 00013: /oradata/datafile/bbcled_data.588.727381165.dbf
- destination for restore of datafile 00022: /oradata/datafile/in_hangzhou_data.362.747696959.dbf
- channel dsk1: reading from backup piece /bak/from14/for18dg/standby_MYPORT_20111114_pamrlq22_1_1.bak
- channel dsk1: restored backup piece 1
- piece handle=/bak/from14/for18dg/standby_MYPORT_20111114_pamrlq22_1_1.bak tag=FOR STANDBY
- channel dsk1: restore complete, elapsed time: 00:01:25
- channel dsk0: restored backup piece 1
- piece handle=/bak/from14/for18dg/standby_MYPORT_20111114_pbmrlqee_1_1.bak tag=FOR STANDBY
- channel dsk0: restore complete, elapsed time: 00:02:00
- channel dsk2: restored backup piece 1
- piece handle=/bak/from14/for18dg/standby_MYPORT_20111114_p7mrlq22_1_1.bak tag=FOR STANDBY
- channel dsk2: restore complete, elapsed time: 00:06:10
- Finished recover at 2011-11-15 08:37:13
- released channel: dsk0
- released channel: dsk1
- released channel: dsk2
- RMAN>
- 5、关闭standby数据库
- 将restore standby controlfile to '/u01/datafile/ctlrestore/control01.ctl'恢复出来的控制文件覆盖现有的控制文件
- 6、启动物理备库检查(之后可以开启recover进程)
- SQL> startup mount
- SQL> select to_char(current_scn) from v$database;
- SQL> startup mount;
- ORACLE instance started.
- Total System Global Area 4596957184 bytes
- Fixed Size 2090048 bytes
- Variable Size 838863808 bytes
- Database Buffers 3741319168 bytes
- Redo Buffers 14684160 bytes
- Database mounted.
- SQL> SELECT * FROM V$ARCHIVE_GAP;
- no rows selected
- 7、开启recover进程时日志提示ORA-38500: USING CURRENT LOGFILE option not available without stand问题。
- 原因是需要为备库增加standby redolog,具体如下:
- SQL> alter database recover managed standby database disconnect from session using current logfile;
- alter database recover managed standby database disconnect from session using current logfile
- *
- ERROR at line 1:
- ORA-38500: USING CURRENT LOGFILE option not available without stand
- SQL> select member from v$logfile;
- MEMBER
- --------------------------------------------------------------------------------
- /u01/datafile/group_2.264.697238179
- /u01/datafile/group_2.265.697238179
- /u01/datafile/group_1.262.697238177
- /u01/datafile/group_1.263.697238177
- /u01/datafile/group_3.268.697238217
- /u01/datafile/group_3.269.697238219
- /u01/datafile/group_4.270.697238219
- /u01/datafile/group_4.271.697238221
- 8 rows selected.
- -----------------------------------
- SQL> alter database add standby logfile group 5 '/u01/datafile/standbyredo1_1.LOG' size 100m;
- alter database add standby logfile group 6 '/u01/datafile/standbyredo1_2.LOG' size 100m;
- alter database add standby logfile group 7 '/u01/datafile/standbyredo1_3.LOG' size 100m;
- alter database add standby logfile group 8 '/u01/datafile/standbyredo1_4.LOG' size 100m;
- alter database add standby logfile group 9 '/u01/datafile/standbyredo1_5.LOG' size 100m;
- SQL>
- Database altered.
- SQL>
- Database altered.
- SQL>
- Database altered.
- SQL>
- Database altered.
- SQL>
- Database altered.
- 8、接着又出现数据文件无法识别的问题(因为主库的数据文件命名和从库命名有区别导致)
- Tue Nov 15 12:53:33 2011
- Errors in file /u01/app/oracle/admin/MYPORT/bdump/MYPORT_dbw0_3952.trc:
- ORA-01157: cannot identify/lock data file 20 - see DBWR trace file
- ORA-01110: data file 20: '/oradata/datafile/eport_index.779.736786171'
- ORA-27037: unable to obtain file status
- Linux-x86_64 Error: 2: No such file or directory
- Additional information: 3
- 用RENAME方法解决命名不一致问题
- alter database rename file '/oradata/datafile/system.256.697238117' to '/oradata/datafile/system.256.697238117.dbf';
- alter database rename file '/oradata/datafile/undotbs1.258.697238119' to '/oradata/datafile/undotbs1.258.697238119.dbf';
- alter database rename file '/oradata/datafile/sysaux.257.697238119' to '/oradata/datafile/sysaux.257.697238119.dbf';
- alter database rename file '/oradata/datafile/users.259.697238119' to '/oradata/datafile/users.259.697238119.dbf';
- alter database rename file '/oradata/datafile/undotbs2.267.697238205' to '/oradata/datafile/undotbs2.267.697238205.dbf';
- alter database rename file '/oradata/datafile/ts_test.348.704715437' to '/oradata/datafile/ts_test.348.704715437.dbf';
- alter database rename file '/oradata/datafile/hangzhou.451.709317119' to '/oradata/datafile/hangzhou.451.709317119.dbf';
- alter database rename file '/oradata/datafile/inman_data.617.718999513' to '/oradata/datafile/inman_data.617.718999513.dbf';
- alter database rename file '/oradata/datafile/auditbbc.882.710070905' to '/oradata/datafile/auditbbc.882.710070905.dbf';
- alter database rename file '/oradata/datafile/tbs_catalog.891.710434097' to '/oradata/datafile/tbs_catalog.891.710434097.dbf';
- alter database rename file '/oradata/datafile/xian.880.711538313' to '/oradata/datafile/xian.880.711538313.dbf';
- alter database rename file '/oradata/datafile/inman_index.723.718999521' to '/oradata/datafile/inman_index.723.718999521.dbf';
- alter database rename file '/oradata/datafile/bbcled_data.588.727381165' to '/oradata/datafile/bbcled_data.588.727381165.dbf';
- alter database rename file '/oradata/datafile/in_bbc_index.869.729797303' to '/oradata/datafile/in_bbc_index.869.729797303.dbf';
- alter database rename file '/oradata/datafile/in_man_index.885.729797313' to '/oradata/datafile/in_man_index.885.729797313.dbf';
- alter database rename file '/oradata/datafile/in_hangzhou_index.821.729797323' to '/oradata/datafile/in_hangzhou_index.821.729797323.dbf';
- alter database rename file '/oradata/datafile/in_xian_index.724.729797333' to '/oradata/datafile/in_xian_index.724.729797333.dbf';
- alter database rename file '/oradata/datafile/in_bbc_data.291.730331961' to '/oradata/datafile/in_bbc_data.291.730331961.dbf'
- alter database rename file '/oradata/datafile/eport_data.522.736786031' to '/oradata/datafile/eport_data.522.736786031.dbf';
- alter database rename file '/oradata/datafile/eport_index.779.736786171' to '/oradata/datafile/eport_index.779.736786171.dbf';
- alter database rename file '/oradata/datafile/in_xian_index.663.747696899' to '/oradata/datafile/in_xian_index.663.747696899.dbf';
- alter database rename file '/oradata/datafile/in_hangzhou_data.362.747696959' to '/oradata/datafile/in_hangzhou_data.362.747696959.dbf';
- alter database rename file '/oradata/datafile/tbs_catalog.791.752426905' to '/oradata/datafile/tbs_catalog.791.752426905.dbf';
- alter database rename file '/oradata/datafile/users.604.752426949' to '/oradata/datafile/users.604.752426949.dbf';
- 9、重启数据库服务到管理模式
- SQL>shutdown immediate;
- SQL>startup nomount;
- SQL>alter database mount standby database;
- SQL>alter database recover managed standby database disconnect from session;
- 10、再次尝试开启recover进程
- SQL> alter database recover managed standby database disconnect from session using current logfile;
- 然后观察alertlog一段时间,发现已经在正常恢复了
- Tue Nov 15 22:02:44 2011
- Completed: alter database recover managed standby database disconnect from session using current logfile
- Tue Nov 15 22:02:47 2011
- Using STANDBY_ARCHIVE_DEST parameter default value as /u01/archive
- Redo Shipping Client Connected as PUBLIC
- -- Connected User is Valid
- RFS[1]: Assigned to RFS process 15741
- RFS[1]: Identified database type as 'physical standby'
- Tue Nov 15 22:02:47 2011
- RFS LogMiner: Client disabled from further notification
- RFS[1]: Archived Log: '/u01/archive/2_11039_697238176.dbf'
- Tue Nov 15 22:03:15 2011
- Media Recovery Log /u01/archive/2_11039_697238176.dbf
- Media Recovery Log /u01/archive/2_11040_697238176.dbf
- 11、如果备份用不到了,则现在可以删除
- RMAN> DELETE BACKUP TAG ‘FOR STANDBY’;
- 12、完毕
本文转自zylhsy 51CTO博客,原文链接:http://blog.51cto.com/yunlongzheng/717249,如需转载请自行联系原作者