Oracle 10g non archiving mode of RMAN database migration

Time:2020-9-23

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 mode 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 ORCL

Steps of RMAN recovery ideas:

  • Initialize the database and install the same environment;
  • Restore the parameter file;
  • Restore the control file;
  • Start the database to the mount state, and use the control file to recover the data;
  • restore database;
  • alter database open ressetlogs;
  • Verification results

Specific recovery steps:

  1. Log in to the RMAN console on the source database, 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;


2. Start another command window, log in to sqlplus, query dbid and record the value, then close the command window.

sqlplus / as sysdba
select dbid from v$database;

  1. 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; 
}


4. Backup the parameter file and control file of the source database, and record the backup path.

backup spfile;
backup current controlfile;


5. Install the same version of Oracle database in the target system, and set DB_ Home and DB_ Sid settings are the same as in the source library.

6. After installation, copy the backup files of the whole database, parameter file and control file to the same system path in the target database
7. In the target database, D: \_ 1. Create a new blank file with the name of FAKESPFILEORCL.ORA And copy the contents below into the file

db_name=ORCL
java_pool_size=4194304
large_pool_size=4194304
shared_pool_size=96468992
  1. If there is no shutdown in the target database, it will be shut down first, and the database will be started by nomount with the newly created parameter file
startup pfile='D:\oracle\product.2.0\db_1\database\FAKESPFILEORCL.ORA' nomount;


9. In RMAN, execute the command set dbid = 1526707455 (source database dbid);

set dbid=1526707455;

  1. Restore the parameter file in the target library
restore spfile from 'D:\oracle\product.2.0\flash_recovery_area\ORCL\BACKUPSET19_01_30\O1_MF_NNSNF_TAG20190130T171134_G52TL81Y_.BKP';


11. Close the database and start nomount with the restored parameter file

shutdown immediate;
startup nomount;


12. Restore the control file in the target database

restore controlfile from 'D:\oracle\product.2.0\flash_recovery_area\ORCL\BACKUPSET19_01_30\O1_MF_NCNNF_TAG20190130T171148_G52TLNS2_.BKP';


13. Close the database and start with mount

shutdown immediate;
startup mount;
  1. (optional operation) modify the data file path recorded in the control file (this step is necessary if there is a database file on disk f in the source system and disk f does not exist in the target system), and start the recovery
    (or use windows virtual drive letter)
    ! please make sure there is a path folder where the data files are stored in the target system!
report schema;

run{
	set newname for datafile 8 to 'D:\ORACLEDATA1\INFO_LOB';
	restore database;             
	switch datafile all;          
}

  • At this point, the database recovery is complete
  1. If you do not need to modify the path, you can restore the database directly
    ! please make sure there is a path folder where the data files are stored in the target system!
  2. Clear redo log and open database
alter database open resetlogs;
  1. Verify database (verify that the data in the source database is in the target database)
  2. end

ps:

  1. Other reference address:
    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
  2. The migration of win system to Linux is similar to the above steps, but the specific path of the control file needs to be modified after the parameter file is restored
  3. Monitor the progress of implementation
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;