Oracle Database Migration

Keywords: Database rman Oracle SQL


target
1. Complete database migration
2. Reorganization of database file structure
3. Verify data file integrity
Detailed Data Migration Scheme
1. Overview of the migration environment
2. source database
Ip:192.168.52.103
Oracle_sid=test
Database version Oracle 10g release 2

  1. target database
    IP:192.168.52.254
    ORACLE_SID=test
    Database version Oracle 10g release 2
    Source Library Preparation
    1. Create a consistent backup of the source database (mainly including data files, control files, archive files)
    Rman target / nocatalog
    Configuring rman-related parameters
    rman> configure control lfile autobackup; //Open rman automatic backup control file
    Detecting rman backup set validity
    RMAN> crosscheck backup;
    RMAN> delete expired backup;
    RMAN> delete obsolete;
    RMAN> backup full format '/export/home/oracle/bk/full_%d_%t' plus archivelog;
    2, Scp –r /export/home/oracle/bk/full_* 192.168.52.254: /export/home/oracle/full_bk
    3. Copy parameter and control files of rman automatic backup to target database
    Scp –r /export/home/oracle/bk/b_s 192.168.52.254: /export/home/oracle/full_bk/b_s

Target Library Preparation
1,ort ORACLE_SID=test
2,rman target / nocatalog
3,RMAN> startup nomount
How can a target database be started to a nomount state without a parameter file?
Only rman can do this. The system defaults to a sid, which the sqlplus tool cannot do.
If this fails, we can create a pfile parameter file of our own, as long as sid is indicated, the other parameters are default.
4,

    RMAN> restore spfile to '$ORACLE_HOME/dbs' from '/export/home/oracle/full_bk/b_s';
5,  RMAN> restore controlfile to '/oradata/test' from '/export/home/oracle/full_bk/ full_test_20150707';
6,  SQl> create pfile from spfile;
7,  Vi $ORACLE_HOME/dbs/inittest.ora 
audit_file_dest
backupground_dump_dest
control_files
core_dump_dest
user_dump_dest
db_recovery_file_dest
8,  SQL> shutdown abort;
9,  SQL> startup mount pfile=' $ORACLE_HOME/dbs/inittest.ora'; 
10, SQL> create spfile from pfile;
11, RMAN> run{
  set newname for datafile 1  to  '/u02/database/SY5223/oradata/sysSY5223.dbf';                                  
  set newname for datafile 2  to  '/u02/database/SY5223/undo/undotbsSY5223.dbf';                                 
  set newname for datafile 3  to  '/u02/database/SY5223/oradata/sysauxSY5223.dbf';                               
  set newname for datafile 4  to  '/u02/database/SY5223/undo/undotbsSY52232.dbf';                                
  set newname for datafile 5  to  '/u02/database/SY5223/oradata/SY5223_system_tbl.dbf';                          
  set newname for datafile 6  to  '/u02/database/SY5223/oradata/SY5223_account_tbl.dbf';                         
  set newname for datafile 7  to  '/u02/database/SY5223/oradata/SY5223_stock_tbl.dbf';                           
  set newname for datafile 8  to  '/u02/database/SY5223/oradata/SY5223_stock_l_tbl.dbf';
  restore database;
  switch datafile all;
  recover database;}


12, RMAN> catalog start with '/export/home/oracle/full_bk';

13,

    RMAN> run{
  set newname for datafile 1  to  '/u02/database/SY5223/oradata/sysSY5223.dbf';                                  
  set newname for datafile 2  to  '/u02/database/SY5223/undo/undotbsSY5223.dbf';                                 
  set newname for datafile 3  to  '/u02/database/SY5223/oradata/sysauxSY5223.dbf';                               
  set newname for datafile 4  to  '/u02/database/SY5223/undo/undotbsSY52232.dbf';                                
  set newname for datafile 5  to  '/u02/database/SY5223/oradata/SY5223_system_tbl.dbf';                          
  set newname for datafile 6  to  '/u02/database/SY5223/oradata/SY5223_account_tbl.dbf';                         
  set newname for datafile 7  to  '/u02/database/SY5223/oradata/SY5223_stock_tbl.dbf';                           
  set newname for datafile 8  to  '/u02/database/SY5223/oradata/SY5223_stock_l_tbl.dbf';
  restore database;
  switch datafile all;
  recover database;}


The log that should be redone online has not been archived, resulting in errors in consistency checking while recovering.This error reminds you that you need a redo log with thread 1 and equence number 52 If you want to continue the recovery, but this file is not found in the archive backup set, so we can set the restored sequence# for incomplete recovery, set until sequence 51, of course we can also reset the redolog scn# without consistency check to force the database to start.R database open resetlogs;
12,alter database open resetlogs;
The database migration is complete.
Note: The above database offline migration supports cross-network migration.Since some of the data in the database is online redolog during backup, it is necessary to refresh the memory and the database in online redolog into archivelog or datafile during backup to ensure consistent backup.If it is not a consistent backup, use until or resetlogs to open the database at the time of recovery.
duplicate Database Migration

Set oracle_sid=orcl 
rman target=sys/robert auxname=sys/Robert@orcl2 duplicate target database to
neworcl from active database nofilenamecheck spfile 
set control_files 'c:\oracle\oradata\neworcl\control01.ctl','c:\oracle\oradata\neworcl\control02.ctl' 
set db_file_name_convert 'c:\oracle\oradata\orcl','c:\oracle\oradata\neworcl' 
set log_file_name_convert 'c:\oracle\oradata\orcl','c:\oracle\oradata\neworcl';

recover tablespace users until time '10/06/2008:22:42:00' auxiliary destination 'c:\oracle\auxiliary';

Posted by angershallreign on Mon, 27 May 2019 17:02:04 -0700