oracle数据库rman备份计划及恢复
作者:网络转载 发布时间:[ 2015/12/15 11:36:51 ] 推荐标签:数据库
h.把拷贝到新机器的备份文件注册到(刚恢复的)控制文件中(redolog不能被注册,所以后有报错,没有关系):
RMAN>catalogstartwith"/u01/ora_bak";
Startingimplicitcrosscheckbackupat14-DEC-15
allocatedchannel:ORA_DISK_1
channelORA_DISK_1:SID=1146devicetype=DISK
Crosschecked1objects
Finishedimplicitcrosscheckbackupat14-DEC-15
Startingimplicitcrosscheckcopyat14-DEC-15
usingchannelORA_DISK_1
Finishedimplicitcrosscheckcopyat14-DEC-15
searchingforallfilesintherecoveryarea
catalogingfiles...
catalogingdone
ListofCatalogedFiles
=======================
FileName:/u01/app/oracle/fast_recovery_area/ATEST/backupset/2015_12_09/o1_mf_nnndf_TAG20151209T161546_c6hrslnq_.bkp
FileName:/u01/app/oracle/fast_recovery_area/ATEST/autobackup/2015_12_09/o1_mf_s_898014415_c6hsghgm_.bkp
FileName:/u01/app/oracle/fast_recovery_area/ATEST/autobackup/2015_12_09/o1_mf_s_898013812_c6hrvo18_.bkp
searchingforallfilesthatmatchthepattern/u01/ora_bak
ListofFilesUnknowntotheDatabase
=====================================
FileName:/u01/ora_bak/O1_MF_S_895896351_C4KSF2YN_.BKP
FileName:/u01/ora_bak/ora_bak/arch/1_11_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_23_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_19_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_33_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_8_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_9_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_17_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_21_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_20_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_12_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_6_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_14_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_26_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_24_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_30_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_16_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_22_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_7_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_27_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_31_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_25_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_29_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_28_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_13_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_18_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_10_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_15_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_32_896812716.dbf
FileName:/u01/ora_bak/ora_bak/controlfile/o1_mf_c5fr9b6n_.ctl
FileName:/u01/ora_bak/ora_bak/onlinelog_f/o1_mf_2_c5fr9h1f_.log
FileName:/u01/ora_bak/ora_bak/onlinelog_f/o1_mf_3_c5fr9kfo_.log
FileName:/u01/ora_bak/ora_bak/onlinelog_f/o1_mf_1_c5fr9ds4_.log
FileName:/u01/ora_bak/ora_bak/onlinelog/o1_mf_3_c5fr9k9d_.log
FileName:/u01/ora_bak/ora_bak/onlinelog/o1_mf_2_c5fr9gy5_.log
FileName:/u01/ora_bak/ora_bak/onlinelog/o1_mf_1_c5fr9dmk_.log
FileName:/u01/ora_bak/ora_bak/backupset/2015_12_07/o1_mf_nnndf_TAG20151207T173421_c6bnnxsl_.bkp
FileName:/u01/ora_bak/ora_bak/autobackup/2015_12_07/o1_mf_s_897845728_c6bnq1rq_.bkp
FileName:/u01/ora_bak/O1_MF_S_895896118_C4KS5S1R_.BKP
Doyoureallywanttocatalogtheabovefiles(enterYESorNO)?yes
catalogingfiles...
catalogingdone
ListofCatalogedFiles
=======================
FileName:/u01/ora_bak/ora_bak/arch/1_11_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_23_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_19_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_33_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_8_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_9_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_17_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_21_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_20_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_12_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_6_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_14_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_26_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_24_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_30_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_16_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_22_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_7_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_27_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_31_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_25_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_29_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_28_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_13_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_18_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_10_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_15_896812716.dbf
FileName:/u01/ora_bak/ora_bak/arch/1_32_896812716.dbf
FileName:/u01/ora_bak/ora_bak/backupset/2015_12_07/o1_mf_nnndf_TAG20151207T173421_c6bnnxsl_.bkp
FileName:/u01/ora_bak/ora_bak/autobackup/2015_12_07/o1_mf_s_897845728_c6bnq1rq_.bkp
ListofFilesWhichWhereNotCataloged
=======================================
FileName:/u01/ora_bak/O1_MF_S_895896351_C4KSF2YN_.BKP
RMAN-07518:Reason:ForeigndatabasefileDBID:966107096DatabaseName:RFDB
FileName:/u01/ora_bak/ora_bak/controlfile/o1_mf_c5fr9b6n_.ctl
RMAN-07519:Reason:Errorwhilecataloging.Seealert.log.
FileName:/u01/ora_bak/ora_bak/onlinelog_f/o1_mf_2_c5fr9h1f_.log
RMAN-07529:Reason:catalogisnotsupportedforthisfiletype
FileName:/u01/ora_bak/ora_bak/onlinelog_f/o1_mf_3_c5fr9kfo_.log
RMAN-07529:Reason:catalogisnotsupportedforthisfiletype
FileName:/u01/ora_bak/ora_bak/onlinelog_f/o1_mf_1_c5fr9ds4_.log
RMAN-07529:Reason:catalogisnotsupportedforthisfiletype
FileName:/u01/ora_bak/ora_bak/onlinelog/o1_mf_3_c5fr9k9d_.log
RMAN-07529:Reason:catalogisnotsupportedforthisfiletype
FileName:/u01/ora_bak/ora_bak/onlinelog/o1_mf_2_c5fr9gy5_.log
RMAN-07529:Reason:catalogisnotsupportedforthisfiletype
FileName:/u01/ora_bak/ora_bak/onlinelog/o1_mf_1_c5fr9dmk_.log
RMAN-07529:Reason:catalogisnotsupportedforthisfiletype
FileName:/u01/ora_bak/O1_MF_S_895896118_C4KS5S1R_.BKP
RMAN-07518:Reason:ForeigndatabasefileDBID:966107096DatabaseName:RFDB
i.开始restore数据文件:
RMAN>restoredatabase;
Startingrestoreat14-DEC-15
usingchannelORA_DISK_1
channelORA_DISK_1:startingdatafilebackupsetrestore
channelORA_DISK_1:specifyingdatafile(s)torestorefrombackupset
channelORA_DISK_1:restoringdatafile00001to/u01/app/oracle/oradata/ATEST/datafile/o1_mf_system_c5fr6s3v_.dbf
channelORA_DISK_1:restoringdatafile00002to/u01/app/oracle/oradata/ATEST/datafile/o1_mf_sysaux_c5fr6s6d_.dbf
channelORA_DISK_1:restoringdatafile00003to/u01/app/oracle/oradata/ATEST/datafile/o1_mf_undotbs1_c5fr6s7n_.dbf
channelORA_DISK_1:restoringdatafile00004to/u01/app/oracle/oradata/ATEST/datafile/o1_mf_users_c5fr6s88_.dbf
channelORA_DISK_1:readingfrombackuppiece/u01/app/oracle/fast_recovery_area/ATEST/backupset/2015_12_09/o1_mf_nnndf_TAG20151209T161546_c6hrslnq_.bkp
channelORA_DISK_1:piecehandle=/u01/app/oracle/fast_recovery_area/ATEST/backupset/2015_12_09/o1_mf_nnndf_TAG20151209T161546_c6hrslnq_.bkptag=TAG20151209T161546
channelORA_DISK_1:restoredbackuppiece1
channelORA_DISK_1:restorecomplete,elapsedtime:00:00:45
Finishedrestoreat14-DEC-15
j.开始recover数据(在此之前,需要先拷贝redolog到控制文件默认的路径下):
redolog默认路径:
SQL>selectmemberfromv$logfile;
MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/ATEST/onlinelog/o1_mf_3_c5fr9k9d_.log
/u01/app/oracle/fast_recovery_area/ATEST/onlinelog/o1_mf_3_c5fr9kfo_.log
/u01/app/oracle/oradata/ATEST/onlinelog/o1_mf_2_c5fr9gy5_.log
/u01/app/oracle/fast_recovery_area/ATEST/onlinelog/o1_mf_2_c5fr9h1f_.log
/u01/app/oracle/oradata/ATEST/onlinelog/o1_mf_1_c5fr9dmk_.log
/u01/app/oracle/fast_recovery_area/ATEST/onlinelog/o1_mf_1_c5fr9ds4_.log
6rowsselected.
开始recover数据库:
RMAN>recoverdatabase;
Startingrecoverat14-DEC-15
usingtargetdatabasecontrolfileinsteadofrecoverycatalog
allocatedchannel:ORA_DISK_1
channelORA_DISK_1:SID=1137devicetype=DISK
startingmediarecovery
archivedlogforthread1withsequence15isalreadyondiskasfile/u01/ora_bak/ora_bak/arch/1_15_896812716.dbf
archivedlogforthread1withsequence16isalreadyondiskasfile/u01/ora_bak/ora_bak/arch/1_16_896812716.dbf
archivedlogforthread1withsequence17isalreadyondiskasfile/u01/ora_bak/ora_bak/arch/1_17_896812716.dbf
archivedlogforthread1withsequence18isalreadyondiskasfile/u01/ora_bak/ora_bak/arch/1_18_896812716.dbf
archivedlogforthread1withsequence19isalreadyondiskasfile/u01/ora_bak/ora_bak/arch/1_19_896812716.dbf
archivedlogforthread1withsequence20isalreadyondiskasfile/u01/ora_bak/ora_bak/arch/1_20_896812716.dbf
archivedlogforthread1withsequence21isalreadyondiskasfile/u01/ora_bak/ora_bak/arch/1_21_896812716.dbf
archivedlogforthread1withsequence22isalreadyondiskasfile/u01/ora_bak/ora_bak/arch/1_22_896812716.dbf
archivedlogforthread1withsequence23isalreadyondiskasfile/u01/ora_bak/ora_bak/arch/1_23_896812716.dbf
archivedlogforthread1withsequence24isalreadyondiskasfile/u01/ora_bak/ora_bak/arch/1_24_896812716.dbf
archivedlogforthread1withsequence25isalreadyondiskasfile/u01/ora_bak/ora_bak/arch/1_25_896812716.dbf
archivedlogforthread1withsequence26isalreadyondiskasfile/u01/ora_bak/ora_bak/arch/1_26_896812716.dbf
archivedlogforthread1withsequence27isalreadyondiskasfile/u01/ora_bak/ora_bak/arch/1_27_896812716.dbf
archivedlogforthread1withsequence28isalreadyondiskasfile/u01/ora_bak/ora_bak/arch/1_28_896812716.dbf
archivedlogforthread1withsequence29isalreadyondiskasfile/u01/ora_bak/ora_bak/arch/1_29_896812716.dbf
archivedlogforthread1withsequence30isalreadyondiskasfile/u01/ora_bak/ora_bak/arch/1_30_896812716.dbf
archivedlogforthread1withsequence31isalreadyondiskasfile/u01/ora_bak/ora_bak/arch/1_31_896812716.dbf
archivedlogforthread1withsequence32isalreadyondiskasfile/u01/app/oracle/oradata/ATEST/onlinelog/o1_mf_2_c5fr9gy5_.log
archivedlogforthread1withsequence33isalreadyondiskasfile/u01/app/oracle/oradata/ATEST/onlinelog/o1_mf_3_c5fr9k9d_.log
archivedlogforthread1withsequence34isalreadyondiskasfile/u01/app/oracle/oradata/ATEST/onlinelog/o1_mf_1_c5fr9dmk_.log
archivedlogfilename=/u01/ora_bak/ora_bak/arch/1_15_896812716.dbfthread=1sequence=15
archivedlogfilename=/u01/ora_bak/ora_bak/arch/1_16_896812716.dbfthread=1sequence=16
archivedlogfilename=/u01/ora_bak/ora_bak/arch/1_17_896812716.dbfthread=1sequence=17
archivedlogfilename=/u01/ora_bak/ora_bak/arch/1_18_896812716.dbfthread=1sequence=18
archivedlogfilename=/u01/ora_bak/ora_bak/arch/1_19_896812716.dbfthread=1sequence=19
archivedlogfilename=/u01/ora_bak/ora_bak/arch/1_20_896812716.dbfthread=1sequence=20
archivedlogfilename=/u01/ora_bak/ora_bak/arch/1_21_896812716.dbfthread=1sequence=21
archivedlogfilename=/u01/ora_bak/ora_bak/arch/1_22_896812716.dbfthread=1sequence=22
archivedlogfilename=/u01/ora_bak/ora_bak/arch/1_23_896812716.dbfthread=1sequence=23
archivedlogfilename=/u01/ora_bak/ora_bak/arch/1_24_896812716.dbfthread=1sequence=24
archivedlogfilename=/u01/ora_bak/ora_bak/arch/1_25_896812716.dbfthread=1sequence=25
archivedlogfilename=/u01/ora_bak/ora_bak/arch/1_26_896812716.dbfthread=1sequence=26
archivedlogfilename=/u01/ora_bak/ora_bak/arch/1_27_896812716.dbfthread=1sequence=27
archivedlogfilename=/u01/ora_bak/ora_bak/arch/1_28_896812716.dbfthread=1sequence=28
archivedlogfilename=/u01/ora_bak/ora_bak/arch/1_29_896812716.dbfthread=1sequence=29
archivedlogfilename=/u01/ora_bak/ora_bak/arch/1_30_896812716.dbfthread=1sequence=30
archivedlogfilename=/u01/ora_bak/ora_bak/arch/1_31_896812716.dbfthread=1sequence=31
archivedlogfilename=/u01/app/oracle/oradata/ATEST/onlinelog/o1_mf_2_c5fr9gy5_.logthread=1sequence=32
archivedlogfilename=/u01/app/oracle/oradata/ATEST/onlinelog/o1_mf_3_c5fr9k9d_.logthread=1sequence=33
archivedlogfilename=/u01/app/oracle/oradata/ATEST/onlinelog/o1_mf_1_c5fr9dmk_.logthread=1sequence=34
mediarecoverycomplete,elapsedtime:00:00:04
Finishedrecoverat14-DEC-15
k.以resetlogs打开数据库(在此之前,先删除原来的redolog,因为数据库会重新创建一组redolog):
删除原来的redo:
rm-rf/u01/app/oracle/oradata/ATEST/onlinelog/*
以resetlogs打开数据库:
RMAN>alterdatabaseopenresetlogs;
usingtargetdatabasecontrolfileinsteadofrecoverycatalog
databaseopened
至此,数据库恢复全部完成!
本文内容不用于商业目的,如涉及知识产权问题,请权利人联系SPASVO小编(021-61079698-8054),我们将立即处理,马上删除。
相关推荐
更新发布
功能测试和接口测试的区别
2023/3/23 14:23:39如何写好测试用例文档
2023/3/22 16:17:39常用的选择回归测试的方式有哪些?
2022/6/14 16:14:27测试流程中需要重点把关几个过程?
2021/10/18 15:37:44性能测试的七种方法
2021/9/17 15:19:29全链路压测优化思路
2021/9/14 15:42:25性能测试流程浅谈
2021/5/28 17:25:47常见的APP性能测试指标
2021/5/8 17:01:11热门文章
常见的移动App Bug??崩溃的测试用例设计如何用Jmeter做压力测试QC使用说明APP压力测试入门教程移动app测试中的主要问题jenkins+testng+ant+webdriver持续集成测试使用JMeter进行HTTP负载测试Selenium 2.0 WebDriver 使用指南