收藏 分享(赏)

全数据库的完全恢复.doc

上传人:HR专家 文档编号:5924184 上传时间:2019-03-21 格式:DOC 页数:17 大小:48.50KB
下载 相关 举报
全数据库的完全恢复.doc_第1页
第1页 / 共17页
全数据库的完全恢复.doc_第2页
第2页 / 共17页
全数据库的完全恢复.doc_第3页
第3页 / 共17页
全数据库的完全恢复.doc_第4页
第4页 / 共17页
全数据库的完全恢复.doc_第5页
第5页 / 共17页
点击查看更多>>
资源描述

1、1 全数据库的完全恢复run allocate channel c11 type disk;allocate channel c12 type disk;allocate channel c21 type sbt_tape;allocate channel c22 type sbt_tape;restore controlfile;alter database mount;restore database; recover database; sql “alter database open“; release channel c11;release channel c12;release c

2、hannel c21;release channel c22;恢复步骤如下:$ svrmgrlsvrmgr connect internalsvrmgr startup nomount$ rmanprod recdbs.rcv rec.log 4 allocate channel c12 type disk;5 allocate channel c21 type sbt_tape;6 allocate channel c22 type sbt_tape;7 restore database;8 recover database;9 sql “alter database open“;10 re

3、lease channel c11;11 release channel c12;12 release channel c21;13 release channel c22;14 15 RMAN-03022: compiling command: allocateRMAN-03023: executing command: allocateRMAN-08030: allocated channel: c11RMAN-08500: channel c11: sid=13 devtype=DISKRMAN-03022: compiling command: allocateRMAN-03023:

4、executing command: allocateRMAN-08030: allocated channel: c12RMAN-08500: channel c12: sid=14 devtype=DISKRMAN-03022: compiling command: allocateRMAN-03023: executing command: allocateRMAN-08030: allocated channel: c21RMAN-08500: channel c21: sid=15 devtype=SBT_TAPERMAN-03022: compiling command: allo

5、cateRMAN-03023: executing command: allocateRMAN-08030: allocated channel: c22RMAN-08500: channel c22: sid=17 devtype=SBT_TAPERMAN-03022: compiling command: setRMAN-03022: compiling command: restoreRMAN-03025: performing implicit partial resync of recovery catalogRMAN-03023: executing command: partia

6、l resyncRMAN-08003: starting partial resync of recovery catalogRMAN-08005: partial resync completeRMAN-03022: compiling command: IRESTORERMAN-03023: executing command: IRESTORERMAN-08016: channel c21: starting datafile backupset restoreRMAN-08502: set_count=28 set_stamp=402253457RMAN-08016: channel

7、c22: starting datafile backupset restoreRMAN-08502: set_count=29 set_stamp=402253577RMAN-08019: channel c21: restoring datafile 1RMAN-08509: destination for restore of datafile 1: /dev/vx/rdsk/datadg/system01RMAN-08019: channel c22: restoring datafile 3RMAN-08509: destination for restore of datafile

8、 3: /dev/vx/rdsk/datadg/tempaRMAN-08019: channel c21: restoring datafile 2RMAN-08509: destination for restore of datafile 2: /dev/vx/rdsk/datadg/rbsaRMAN-08019: channel c22: restoring datafile 16RMAN-08509: destination for restore of datafile 16: /dev/vx/rdsk/datadg/t3s200n1RMAN-08023: channel c21:

9、restored backup piece 1RMAN-08511: piece handle=dbf_28_402253457_1 params=NULLRMAN-08024: channel c21: restore completeRMAN-08016: channel c21: starting datafile backupset restoreRMAN-08502: set_count=31 set_stamp=402253614RMAN-08019: channel c21: restoring datafile 4RMAN-08509: destination for rest

10、ore of datafile 4: /dev/vx/rdsk/datadg/toolsRMAN-08019: channel c21: restoring datafile 7RMAN-08509: destination for restore of datafile 7: /dev/vx/rdsk/datadg/tempbRMAN-08023: channel c22: restored backup piece 1RMAN-08511: piece handle=dbf_29_402253577_1 params=NULLRMAN-08024: channel c22: restore

11、 completeRMAN-08016: channel c22: starting datafile backupset restoreRMAN-08502: set_count=32 set_stamp=402253679RMAN-08019: channel c22: restoring datafile 5RMAN-08509: destination for restore of datafile 5: /dev/vx/rdsk/datadg/usersRMAN-08019: channel c22: restoring datafile 13RMAN-08509: destinat

12、ion for restore of datafile 13: /dev/vx/rdsk/datadg/t3s1n1RMAN-08023: channel c21: restored backup piece 1RMAN-08511: piece handle=dbf_31_402253614_1 params=NULLRMAN-08024: channel c21: restore completeRMAN-08016: channel c21: starting datafile backupset restoreRMAN-08502: set_count=30 set_stamp=402

13、253614RMAN-08019: channel c21: restoring datafile 6RMAN-08509: destination for restore of datafile 6: /dev/vx/rdsk/datadg/rbsbRMAN-08019: channel c21: restoring datafile 17RMAN-08509: destination for restore of datafile 17: /dev/vx/rdsk/datadg/t2s200n8RMAN-08023: channel c21: restored backup piece 1

14、RMAN-08511: piece handle=dbf_30_402253614_1 params=NULLRMAN-08024: channel c21: restore completeRMAN-08016: channel c21: starting datafile backupset restoreRMAN-08502: set_count=26 set_stamp=402253457RMAN-08019: channel c21: restoring datafile 8RMAN-08509: destination for restore of datafile 8: /dev

15、/vx/rdsk/datadg/system02RMAN-08019: channel c21: restoring datafile 10RMAN-08509: destination for restore of datafile 10: /dev/vx/rdsk/datadg/t3s500n2RMAN-08023: channel c22: restored backup piece 1RMAN-08511: piece handle=dbf_32_402253679_1 params=NULLRMAN-08024: channel c22: restore completeRMAN-0

16、8016: channel c22: starting datafile backupset restoreRMAN-08502: set_count=25 set_stamp=402253457RMAN-08023: channel c21: restored backup piece 1RMAN-08511: piece handle=dbf_26_402253457_1 params=NULLRMAN-08024: channel c21: restore completeRMAN-08016: channel c21: starting datafile backupset resto

17、reRMAN-08502: set_count=27 set_stamp=402253457RMAN-08019: channel c22: restoring datafile 9RMAN-08509: destination for restore of datafile 9: /dev/vx/rdsk/datadg/t2s500n2RMAN-08019: channel c21: restoring datafile 11RMAN-08509: destination for restore of datafile 11: /dev/vx/rdsk/datadg/t2s500n10RMA

18、N-08019: channel c22: restoring datafile 12RMAN-08509: destination for restore of datafile 12: /dev/vx/rdsk/datadg/t3s500n1RMAN-08019: channel c21: restoring datafile 14RMAN-08509: destination for restore of datafile 14: /dev/vx/rdsk/datadg/t2s200n10RMAN-08023: channel c22: restored backup piece 1RM

19、AN-08511: piece handle=dbf_25_402253457_1 params=NULLRMAN-08024: channel c22: restore completeRMAN-08016: channel c22: starting datafile backupset restoreRMAN-08502: set_count=33 set_stamp=402253726RMAN-08019: channel c22: restoring datafile 15RMAN-08509: destination for restore of datafile 15: /dev

20、/vx/rdsk/datadg/t2s1n1RMAN-08023: channel c21: restored backup piece 1RMAN-08511: piece handle=dbf_27_402253457_1 params=NULLRMAN-08024: channel c21: restore completeRMAN-08023: channel c22: restored backup piece 1RMAN-08511: piece handle=dbf_33_402253726_1 params=NULLRMAN-08024: channel c22: restor

21、e completeRMAN-03023: executing command: partial resyncRMAN-08003: starting partial resync of recovery catalogRMAN-08005: partial resync completeRMAN-03022: compiling command: recoverRMAN-03022: compiling command: recover(1)RMAN-03022: compiling command: recover(2)RMAN-03022: compiling command: reco

22、ver(3)RMAN-03023: executing command: recover(3)RMAN-08054: starting media recoveryRMAN-08515: archivelog filename=/archlog/arch2_1.log thread=2 sequence=1RMAN-08515: archivelog filename=/archlog/arch1_1.log thread=1 sequence=1RMAN-08515: archivelog filename=/archlog/arch2_2.log thread=2 sequence=2RM

23、AN-08515: archivelog filename=/archlog/arch2_3.log thread=2 sequence=3RMAN-08515: archivelog filename=/archlog/arch2_4.log thread=2 sequence=4RMAN-08515: archivelog filename=/archlog/arch1_2.log thread=1 sequence=2RMAN-08515: archivelog filename=/archlog/arch2_5.log thread=2 sequence=5RMAN-08515: ar

24、chivelog filename=/archlog/arch2_6.log thread=2 sequence=6RMAN-08515: archivelog filename=/archlog/arch1_3.log thread=1 sequence=3RMAN-08515: archivelog filename=/archlog/arch2_7.log thread=2 sequence=7RMAN-08515: archivelog filename=/archlog/arch2_8.log thread=2 sequence=8RMAN-08515: archivelog fil

25、ename=/archlog/arch2_9.log thread=2 sequence=9RMAN-08055: media recovery completeRMAN-03022: compiling command: recover(4)RMAN-03022: compiling command: sqlRMAN-06162: sql statement: alter database openRMAN-03023: executing command: sqlRMAN-03026: error recovery releasing channel resourcesRMAN-08031

26、: released channel: c12RMAN-08031: released channel: c11RMAN-08031: released channel: c21RMAN-08031: released channel: c22Recovery Manager complete.以下将不注明恢复日志。2 表空间的恢复run allocate channel c11 type disk;allocate channel c12 type disk;allocate channel c21 type sbt_tape;allocate channel c22 type sbt_ta

27、pe;sql “alter tablespace test_tbs1 offline immediate“; # 使表空间离线restore tablespace test_tbs1; # 物理恢复表空间recover tablespace test_tbs1; # 逻辑恢复表空间(应用日志)sql “alter tablespace test_tbs1 online“; # 使表空间在线release channel c11;release channel c12;release channel c21;release channel c22;表空间恢复分为离线和在线两种,数据库在线时,如果

28、某表空间发生损坏,可以进行在线的表空间恢复,该任务不会影响数据库其他表空间的正常运行。当系统表空间损坏,导致数据库不能正常运行,因此需离线恢复系统表空间。测试步骤如下:在线恢复某应用表空间a) 破坏某表空间数据文件$ cd /dev/vx/rdsk/datadg$ dd if=data01 of=data02 bs=10kb) 对该数据文件进行操作svrmgr alter system check datafiles;svrmgr select file#,status,error from v$datafile_header如果发现错误,则该数据库文件已经被损坏。c) 恢复该表空间svrmg

29、r alter tablespace test_tbs1 offline;$ rmanprod rectbs.rcv rec2.log allocate channel c12 type disk;allocate channel c21 type sbt_tape;allocate channel c22 type sbt_tape;restore tablespace system;recover tablespace system;sql “alter database open“;release channel c11;release channel c12;release chann

30、el c21;release channel c22;在对系统表空间进行恢复时,由于数据库系统运行已经不正常,因此必须使OPS某线程(本例中为 test-host2上线程 2)在 mount状态,然后执行以上恢复脚本。步骤如下:$ svrmgr startup mount;$ rmanprod rectbs.rcv rec2.log恢复日志与在线恢复表空间基本相同。4 全库物理恢复,逻辑恢复至某时刻runallocate channel c11 type disk;allocate channel c12 type disk;allocate channel c21 type sbt_tape

31、;allocate channel c22 type sbt_tape;restore database; # 执行数据库全库的物理恢复set until time Jul 05 2000 11:00:00;recover database; # 执行数据库全库的逻辑恢复,恢复到该时刻的状态sql “alter database open“;release channel c11;release channel c12;release channel c21;release channel c22;按时间点恢复的情况使用于:数据库发生逻辑错误,例如在 7月 6日发生了逻辑错误,即表中有了错误的

32、内容而非数据库系统故障,需要恢复到 7月 5日 11:00 的状态。5 物理恢复至某时间点,然后逻辑恢复到该时刻:runallocate channel c11 type disk;allocate channel c12 type disk;allocate channel c21 type sbt_tape;allocate channel c22 type sbt_tape;set until time Jul 05 2000 11:00:00;restore database; # 执行数据库全库的物理恢复,恢复到2000/07/05 11:00recover database; #

33、执行数据库全库的逻辑恢复,恢复到2000/07/05 11:00sql “alter database open“; # 打开数据库release channel c11;release channel c12;release channel c21;release channel c22;按时间点恢复的情况使用于: 使用当前时间的备份版本不可用,必须使用前一次的备份版本进行恢复,例如在 7月 6日备份的磁带发现故障,即磁带中有了错误块,并且数据库系统发生故障,需马上恢复到正常运行状态,本例中即实现了恢复至 7月 5日 11:00 的状态。6 按 LOGSEQ的恢复到某日志,然后逻辑恢复到当前

34、时刻runallocate channel c11 type disk;allocate channel c12 type disk;allocate channel c21 type sbt_tape;allocate channel c22 type sbt_tape;set until logseq 10 thread 2;restore database;set until time SYSDATE;recover database;sql “alter database open“;release channel c11;release channel c12;release cha

35、nnel c21;release channel c22;使用如上脚本可用于将数据库恢复到应用某一个日志,恢复到某一日志与恢复到某时间点的结果基本相同,应用场合也基本相同。7 数据文件恢复到另外一个数据文件的恢复runallocate channel c11 type disk;allocate channel c12 type disk;allocate channel c21 type sbt_tape;allocate channel c22 type sbt_tape;sql “alter tablespace test_tbs1 offline immediate”;set newn

36、ame for datafile 11 to /dev/vx/rdsk/datadg/t0s500n10;restore datafile 11;switch datafile all;recover datafile 11;sql “alter tablespace test_tbs1 online“;release channel c11;release channel c12;release channel c21;release channel c22;本恢复方式使用于:某数据文件发生损坏,或该数据文件所在分区或硬盘发生损坏,而且不能继续使用原数据文件名字进行恢复。恢复之前应先将欲使用

37、的文件先在操作系统中建立好,并赋予 oracle/dba的用户/组属主。执行恢复后,使用如下命令查看当前数据库运行情况,如所有数据文件状态都为“online”,即表明已经利用新文件替代原有的数据文件使用。svrmgr select file#,status,error from v$datafile_header;8.控制文件的备份/恢复run allocate channel c11 type disk;allocate channel c12 type disk;allocate channel c21 type sbt_tape;allocate channel c22 type sbt

38、_tape;set until time May 30 2000 9:00:00;restore controlfile to /dev/vx/rdsk/datadg/ctrl01;replicate controlfile from /dev/vx/rdsk/datadg/ctrl01;sql “alter database mount“;restore database;recover database;sql “alter database open“;release channel c11;release channel c12;release channel c21;release channel c22;另:由于使用以上的备份对控制文件进行恢复的速度非常慢,Oracle 工程师建议使用如下方式进行备份:SVRMGR ALTER SYSTEM BACKUP CONTROLFILE TO TRACE;然后将 trace到操作系统中的文件备份到 NetWorker服务器中;使用该种方法备份控制文件的恢复可按如下步骤进行:$ cd $ORACLE_BASE/admin/udumpSVRMGR connect internalSVRMGR crtctrl执行$ORACLE_BASE/admin/udump/crtctrl.sql 脚本重新创建控制文件。

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 企业管理 > 经营企划

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报