I. Rman Backup Source Library
Note the point:
It is best to keep the Rman backup log
$rman target/log=Backup.logrman>Run {Allocate channel T1 type disk;allocate channel T2 type disk;allocate channel T3 type disk;allocate channel T4 Typ E disk;backup Format'<give Location of backup/%u>'Filesperset8(database); SQL'alter system archive log current'; backup Format'<give Location of backup/%u>'Fiesperset8(Archivelog all); Backup format'<give Location of backup/%u>'Current controlfile;}
Two. Transfer the backup file to the machine for recovery
Note the point:
Before 10, the backup must be placed in the same path and directory; After 10g, you can register with the catalog command.
In addition to backing up files, transfer the parameter files to the past (you can rebuild yourself, of course)
2.1 Creating or modifying a parameter file
For the file path directory used in the parameter file, create a good
2.2 Creating a password file
c:\> orapwd File=pwdmdb.ora password=ys0608ys entries=2
2.3 Creating Oracle Services (Windows platform requires execution)
C:\> Oradim-new -startmode auto-pfile 'C:\init.ora';
Three. Restore the control file
set oracle_sid=mdb> Sqlplus// as sysdba$ startup nomount pfile=C : \init.ora$ exit> Rman target/ rmanfrom'C:\data\NCCNTRL_20150921_8AQHLUR6_1 _1' #这一步需要使用到参数文件中对控制文件的配置信息RMAN> ALTER DATABASE mount;
Four. Catalog Backup information
If the location of the backup file differs from the source Library, catalog registration is required
' storage directory for backup files ' noprompt; #会将所有的备份片注册进来 RMAN'<backup tag from backup log>' ; #如果有多份备份, mark the old backup as expired RMAN> Delete expired backup; #删除过期的备份
Five. Restore the database
Rman>Report schema; #列出schema信息, if the source and destination libraries have different file locations or filenames, you need to use set NewName to reset the Rman>run{Allocate channel T1 type disk; Allocate channel T2 type disk; SetNewName forDataFile1To'C:\ORACLE\ORADATA\SYSTEM01. DBF'; SetNewName forDataFile2To'C:\ORACLE\ORADATA\SYSAUX01. DB'; SetNewName forDataFile3To'C:\ORACLE\ORADATA\UNDOTBS01. DBF'; SetNewName forDataFile4To'C:\ORACLE\ORADATA\USERS01. DBF'; SetUntil sequence -; Restore database; Switchdatafile All; Recover database; }
Sequence can be found from the Rman backup log, or view V$backup_redolog
Six. Renaming the Redo file
Set $ Col member format A60 Select a.thread#,a.group#,b.type,b.member,a.bytes/1048576 from v$log a,v$logfile b where a.group#=b.group# ORDER by a.group#; SQL'<old file location and name>"<new location and name>';
Check it out.
Select a.thread#,a.group#,b.type,b.member,a.bytes/1048576fromwhere a.group#= b.group# ORDER by a.group#;
Seven. Renaming the temp file
' D:\APP\ADMINISTRATOR\ORADATA\mdb\TEMP01. DBF'C:\ORACLE\ORADATA\TEMP01. DBF'
Eight. Open the database
sql> ALTER DATABASE open resetlogs; SQL from pfile;sql> shutdown immediatesql> Startup
Recovering a database using Rman backup for a different machine