Environmental information:
Source Library Target Library operating system WIN7 WIN SVR 2012 R2 IP x.x.x.216 x.x.x.112 Database Version 10.2.0.4.0 - 64bi 10.2.0.4.0 - 64bi Storage Single instance Single instance ORACLE_HOME D:\oracle\product\10.2.0\db_1 D:\oracle\product\10.2.0\db_1 ORACLE_SID ORCL ORCLRMAN Recovery Idea Steps:
- Initialize the database and install the same environment;
- Restore parameter file;
- Restore control files;
- Start the database to MOUNT state and use the control file for data recovery;
- restore database;
- alter database open ressetlogs;
-
Verification results
Specific recovery steps:
- Log in to the RMAN console on the source library and switch log groups, trigger checkpoints, close the database, and restart the database to mount mode.
rman target / sql'alter system switch logfile'; sql'alter system checkpoint'; shutdown immediate; startup mount;
- Start another command window, log in to sqlplus, query the DBID, and record the value before closing the command window.
sqlplus / as sysdba select dbid from v$database;
- Make a full backup of the source library and record the backup path.
run{ allocate channel d1 type disk; allocate channel d2 type disk; backup as compressed backupset database; release channel d1; release channel d2; report obsolete; crosscheck backup; delete noprompt expired backup; delete noprompt obsolete; }
- Make a backup of the parameter files, control files and record the backup path to the source library.
backup spfile; backup current controlfile;
- Install the same version of the ORACLE database on the target system and set the DB_HOME and DB_SID settings as in the source library.
- After installation, copy the full library backup file, parameter file backup, control file backup to the same system path in the target library
- Create a new blank file in the target library, D:\oracle\product\10.2.0\db_1\database, named FAKESPFILEORCL.ORA, and copy the following into the file
db_name=ORCL java_pool_size=4194304 large_pool_size=4194304 shared_pool_size=96468992
- If there is no shutdown in the target library, shutdown first and nomount the database with the newly created parameter file
startup pfile='D:\oracle\product\10.2.0\db_1\database\FAKESPFILEORCL.ORA' nomount;
- Under RMAN, execute the command SET DBID=1526707455 (source library DBID);
set dbid=1526707455;
- Parameter file recovery in target library
restore spfile from 'D:\oracle\product\10.2.0\flash_recovery_area\ORCL\BACKUPSET\2019_01_30\O1_MF_NNSNF_TAG20190130T171134_G52TL81Y_.BKP';
- Close the database and start nomount with the restored parameter file
shutdown immediate; startup nomount;
- Control file recovery in target library
restore controlfile from 'D:\oracle\product\10.2.0\flash_recovery_area\ORCL\BACKUPSET\2019_01_30\O1_MF_NCNNF_TAG20190130T171148_G52TLNS2_.BKP';
- Close the database and start with mount
shutdown immediate; startup mount;
- (Optional) Modify the data file path recorded in the control file (this is necessary if there is a database file on the source system and no F disk on the target system) and initiate recovery
(Or use a windows virtual drive letter)
Make sure there is a path folder for the data files in the target system!
report schema;
run{ set newname for datafile 8 to 'D:\ORACLEDATA1\INFO_LOB'; restore database; switch datafile all; }
- Database recovery is now complete
- Restore the database directly if you don't need to modify the path; you can
Make sure there is a path folder for the data files in the target system! - Clear the redo log to open the database
alter database open resetlogs;
- Verify the database (verify that the data in the source database is in the target database)
- End
- Other reference addresses:
http://blog.51cto.com/jiujian/1165766
http://blog.51cto.com/pimg2005/1920337
https://blog.csdn.net/hzcyhujw/article/details/79421613
https://docs.oracle.com/cd/B19306_01/backup.102/b14192/recov004.htm#sthref588 - win system migration linux is similar to the above steps, but the specific path of the control file needs to be modified after restoring the parameter file
- Monitor progress of execution
select sid,SERIAL# ,CONTEXT,SOFAR,TOTALWORK,round(SOFAR/TOTALWORK*100,2) "_%" from v$session_longops where OPNAME like 'RMAN%' and SOFAR<>TOTALWORK and TOTALWORK<>0;