oracle数据库rman备份计划及恢复
作者:网络转载 发布时间:[ 2015/12/15 11:36:51 ] 推荐标签:数据库
1.rman完全恢复的前提条件:历史的datafile,controlfile和spfile备份,加上完整的archivelog和完好的redolog。
2.rman备份脚本:
a.RMAN0级备份命令:
run{
allocatechannelc1typedisk;
allocatechannelc2typedisk;
allocatechannelc3typedisk;
backupincrementallevel0tag'level0'format"E:
ecovery_area
fdb
fdbAUTOBACKUP
man_dirRFDB_level_0_%u_%s_%p"ascompressedbackupset
database;
sql"altersystemarchivelogcurrent";
backupfilesperset3format"E:
ecovery_area
fdb
fdbAUTOBACKUP
man_dirarch_%u_%s_%p_%c"
archivelogalldeleteinput;#备份归档可选,可以单独定期备份
releasechannelc1;
releasechannelc2;
releasechannelc3;
}
b.RMAN1级备份命令:
run{
allocatechannelc1typedisk;
allocatechannelc2typedisk;
allocatechannelc3typedisk;
backupincrementallevel1tag'level1'format'E:
ecovery_area
fdb
fdbAUTOBACKUP
man_dirRFDB_level_1_%u_%s_%p'ascompressedbackupset
database;
sql'altersystemarchivelogcurrent';
backupfilesperset3format'E:
ecovery_area
fdb
fdbAUTOBACKUP
man_dirarch_%u_%s_%p'
archivelogalldeleteinput;#备份归档可选,可以单独定期备份
releasechannelc1;
releasechannelc2;
releasechannelc3;
}
c.rman删除备份命令(在保留近备份的情况下,删除其他备份):
DELETENOPROMPTOBSOLETERECOVERYWINDOWOF1DAYS;
d.操作系统层面运行rman备份或删除命令:
rmantargetsys/rf4rfvbgt56yhn@rfdbnocatalogCMDFILE'D:app
man
man_filelevel_0.txt'log=E:
ecovery_area
fdb
fdbAUTOBACKUP
man_dirlog
man_level_0.log
3.rman恢复
a.拷贝datafile,controlfile和spfile的rman备份,以及完整的archivelog和完好的redolog文件到新的数据库。
b.切换至oracle用户,进入rman(先设置sid):
exportORACLE_SID=rfdb
rlwraprmantarget/
c.启动一个伪实例:
RMAN>startupnomount
connectedtotargetdatabase(notstarted)
startupfailed:ORA-01078:failureinprocessingsystemparameters
LRM-00109:couldnotopenparameterfile'/u01/app/oracle/product/11.2.0/db1/dbs/initrfdb.ora'
startingOracleinstancewithoutparameterfileforretrievalofspfile
Oracleinstancestarted
TotalSystemGlobalArea1068937216bytes
FixedSize2260088bytes
VariableSize281019272bytes
DatabaseBuffers780140544bytes
RedoBuffers5517312bytes
d.在伪实例下恢复spfile文件(必须要指定rman的备份片):
RMAN>restorespfilefrom"/u01/ora_bak/ora_bak/autobackup/2015_12_07/o1_mf_s_897845728_c6bnq1rq_.bkp";
Startingrestoreat14-DEC-15
usingchannelORA_DISK_1
channelORA_DISK_1:restoringspfilefromAUTOBACKUP/u01/ora_bak/ora_bak/autobackup/2015_12_07/o1_mf_s_897845728_c6bnq1rq_.bkp
channelORA_DISK_1:SPFILErestorefromAUTOBACKUPcomplete
Finishedrestoreat14-DEC-15
e.关闭伪实例,用spfile文件启动至nomount状态:
RMAN>shutdownabort
Oracleinstanceshutdown
RMAN>startupnomount
connectedtotargetdatabase(notstarted)
Oracleinstancestarted
TotalSystemGlobalArea1068937216bytes
FixedSize2260088bytes
VariableSize910164872bytes
DatabaseBuffers150994944bytes
RedoBuffers5517312bytes
f.恢复控制文件(必须要指定rman的备份片,备份片应该和spfile的恢复片是同一个):
RMAN>restorecontrolfilefrom"/u01/ora_bak/ora_bak/autobackup/2015_12_07/o1_mf_s_897845728_c6bnq1rq_.bkp";
Startingrestoreat14-DEC-15
allocatedchannel:ORA_DISK_1
channelORA_DISK_1:SID=1146devicetype=DISK
channelORA_DISK_1:restoringcontrolfile
channelORA_DISK_1:restorecomplete,elapsedtime:00:00:01
outputfilename=/u01/app/oracle/oradata/ATEST/controlfile/o1_mf_c5fr9b0h_.ctl
outputfilename=/u01/app/oracle/fast_recovery_area/ATEST/controlfile/o1_mf_c5fr9b6n_.ctl
Finishedrestoreat14-DEC-15
g.启动数据库至mount状态:
RMAN>alterdatabasemount;
databasemounted
releasedchannel:ORA_DISK_1
相关推荐
更新发布
功能测试和接口测试的区别
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