您好,欢迎访问三七文档
当前位置:首页 > IT计算机/网络 > 数据库 > oracle11g-rman备份与恢复详细实例
登录sqlplussys/oracleassysdba查询归档模式archvieloglist修改归档模式shutdownimmediatestartupmountalterdatabasearchivelogalterdatabaseopenarchiveloglist;或者selectlog_modefromv$database;登陆raman恢复管理器rmantarget/orcldbid=1313107278备份run{sql'altersystemarchivelogcurrent';--强制归档backupdatabaseformat'd:\backup\dbfull_%d_%s_%U.bak';--备份全库backupcurrentcontrolfileformat'd:\backup\ctl_%d_%U.bak';--备份控制文件backuparchivelogallformat'd:\backup\arc_%U.bak';--备份归档日志}恢复1sqlplussys/oracleassysdba2shutdownimmediate;3删除所有的数据文件4rmantarget/5startupnomountsetdbid=13773175126exit--7rmantarget/8restorecontrolfilefrom'd:\rman\CTL_ORCL_20141031_746';9alterdatabasemount;///sql'alterdatabasemount';10如果安装路径不一样则跳过10去实行20、21步再执行11步后面的restoredatabase;11exit12复制归档日志到D:\oracle\product\10.2.0\db_1\flash_recovery_area\ORCL\ARCHIVELOG13sqlplus/assysdba--sconnect/assysdba14recoverdatabaseusingbackupcontrolfileuntilcancel;15使用resetlogs方式打开数据库:SQLalterdatabaseopenresetlogs;如果出现'没有过旧的备份中还原'之类错误跳回14步操作后,用在线日志恢复,指定文件'E:\rman\REDO03.LOG'16、如果导航台登录不行添加临时表空间altertablespacetempaddtempfile'D:\oracle\product\10.2.0\oradata\orcl\TEMP02.DBF'size40m;selectdest_name,destination,statusfromv$archive_dest;select'setnewnamefordatafile'||chr(39)||to_char(name)||chr(39)||'to'||Chr(39)||'D:\app\Administrator\oradata\orcl\'||substr(name,instr(Name,'\',-1)+1)||chr(39)||';'fromv$datafile;select'alterdatabaserenamefile'||chr(39)||name||chr(39)||'to'||Chr(39)||'D:\app\Administrator\oradata\orcl\'||substr(name,instr(Name,'\',-1)+1)||chr(39)||';'aafromv$tempfileUnionAllselect'alterdatabaserenamefile'||chr(39)||MEMBER||chr(39)||'to'||Chr(39)||'D:\app\Administrator\oradata\orcl\'||substr(MEMBER,instr(MEMBER,'\',-1)+1)||chr(39)||';'aafromv$Logfile20、run{setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF'to'D:\app\Administrator\oradata\orcl\SYSTEM01.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\SYSAUX01.DBF'to'D:\app\Administrator\oradata\orcl\SYSAUX01.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF'to'D:\app\Administrator\oradata\orcl\UNDOTBS01.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\USERS01.DBF'to'D:\app\Administrator\oradata\orcl\USERS01.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\EXAMPLE01.DBF'to'D:\app\Administrator\oradata\orcl\EXAMPLE01.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\ZLTOOLSTBS.DBF'to'D:\app\Administrator\oradata\orcl\ZLTOOLSTBS.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\ZL9BASEITEM.DBF'to'D:\app\Administrator\oradata\orcl\ZL9BASEITEM.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\ZL9PATIENT.DBF'to'D:\app\Administrator\oradata\orcl\ZL9PATIENT.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\ZL9EXPENSE.DBF'to'D:\app\Administrator\oradata\orcl\ZL9EXPENSE.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\ZL9MEDLST.DBF'to'D:\app\Administrator\oradata\orcl\ZL9MEDLST.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\ZL9DUEREC.DBF'to'D:\app\Administrator\oradata\orcl\ZL9DUEREC.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\ZL9CISREC.DBF'to'D:\app\Administrator\oradata\orcl\ZL9CISREC.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\ZL9EPRLOB.DBF'to'D:\app\Administrator\oradata\orcl\ZL9EPRLOB.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\ZL9EPRDAT.DBF'to'D:\app\Administrator\oradata\orcl\ZL9EPRDAT.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\ZL9HISTORY.DBF'to'D:\app\Administrator\oradata\orcl\ZL9HISTORY.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\ZL9INDEXHIS.DBF'to'D:\app\Administrator\oradata\orcl\ZL9INDEXHIS.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\ZL9INDEXCIS.DBF'to'D:\app\Administrator\oradata\orcl\ZL9INDEXCIS.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\ZL9INDEXHISTORY.DBF'to'D:\app\Administrator\oradata\orcl\ZL9INDEXHISTORY.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\ZL9MEDBASE.DBF'to'D:\app\Administrator\oradata\orcl\ZL9MEDBASE.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\ZL9MEDREC.DBF'to'D:\app\Administrator\oradata\orcl\ZL9MEDREC.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\ZL9MEDDAY.DBF'to'D:\app\Administrator\oradata\orcl\ZL9MEDDAY.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\ZL9INDEXMDR.DBF'to'D:\app\Administrator\oradata\orcl\ZL9INDEXMDR.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\ZLBAKZLHIS.DBF'to'D:\app\Administrator\oradata\orcl\ZLBAKZLHIS.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\ZL9PEISDATA.DBF'to'D:\app\Administrator\oradata\orcl\ZL9PEISDATA.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\ZL9DEVBASE.DBF'to'D:\app\Administrator\oradata\orcl\ZL9DEVBASE.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\ZL9DEVREC.DBF'to'D:\app\Administrator\oradata\orcl\ZL9DEVREC.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\ZL9DEVUSE.DBF'to'D:\app\Administrator\oradata\orcl\ZL9DEVUSE.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\ZL9INDEXDEV.DBF'to'D:\app\Administrator\oradata\orcl\ZL9INDEXDEV.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORCL\ZL9MTLBASE.DBF'to'D:\app\Administrator\oradata\orcl\ZL9MTLBASE.DBF';setnewnamefordatafile'E:\ORACLE\ORADATA\ORC
本文标题:oracle11g-rman备份与恢复详细实例
链接地址:https://www.777doc.com/doc-4031092 .html