Use RMAN to migrate the database to a different machine

Source: Internet
Author: User

There are many methods to migrate the database, and RMAN is commonly used for migration. Using RMAN to migrate a database belongs to the physical backup and recovery scope of the database. The database information is a complete image throughout the process. Therefore, using the restored database for testing will make it less different from the real production environment. This document describes how to use RMAN to restore an Oracle 10 Gb database.

 

1. Main Steps
1. Back up the database
2. Back up FTP data to the target server
3. Create a project directory for the target database
4. Create a pfile or spfile for the target database (use RMAN to restore or copy the original pfile to the target server)
5. Restore the control file
6. Restore data files
7. Open Database

In fact, these steps are quite understandable. The whole essence is the understanding of the database architecture and the entire database startup process.
For more information about the architecture and startup process, see
Oracle instances and Oracle databases (Oracle Architecture)
Oracle database instance startup and Shutdown Process

This is described below
A. Create a directory for the running environment of the instance, such as the dump location, datafile location, and archive location.
If the path is restored to a different path, you need to use the set newname for datafile method to update it to the control file later in RMAN.
B. The instance needs pfile to be started. Therefore, you need to restore pfile or spfile, and then switch the database to nomount status.
C. The next step is to switch the database to the Mount state through the control file, so you need to restore the control file and then mount
D. After mounting, you can restore the database (Restore ).
E. After the restoration is completed, the database is recovered (the restore and recover operations must be performed based on the backup information or recovery directory of the control file)
F. Finally, Open Database

Ii. Migration demonstration

1. Back up the original database the same version of the source database and target database demonstrated here is Oracle 10g R2 (10.2.0.3), and the operating system supports a slight backup process of SuSE 10 + SP3, for backup scripts, see: linux RMAN backup shell script unzip package the entire backup set FTP to the target server or SCP to the target server is FTP to the target server after decompression file Oracle @ 2go-devdb01uv: /u02/database/sy5221_rman/20121013> ls-hltr total 9.4G-RW-r -- 1 Oracle oinstall 3.0 K 2012-10-16 48 initsy5221.ora-RW-r -- 1 ora CLE oinstall 2.7g 2012-10-16 warning-RW-r -- 1 Oracle oinstall 3.1g 2012-10-16 warning-RW-r -- 1 Oracle oinstall 938 M 2012-10-16 warning-RW- r -- 1 Oracle oinstall 935 m 2012-10-16 sy5221_lev0_201210130630_arc_52nnkk2h_1_1-RW-r -- 1 Oracle oinstall 930 m 2012-10-16 s Y5221_lev0_201210130630_arc_53nnkk31_1_1-RW-r -- 1 Oracle oinstall 15 m 2012-10-16 SY5221_lev0_cntl_bak_c-1468911009-20121013-00-RW-r -- 1 Oracle oinstall 15 m 2012-10-16 SY5221_lev0_cntl_bak_c-1468911009-20121013-01-RW-r -- 1 oinstall 910 m sy5221_lev0_201210130630_arc_54nnkk32_1_13. create the required directory (use ORACLE Users) oracle @ 2go-devdb01uv: ~> More mkdir_sy5221.sh mkdir-P/u02/database/sy5221/flash_recovery_area mkdir-P/u02/database/sy5221 mkdir-P/u02/database/sy5221/archive mkdir-P/u02/Database /sy5221/backup mkdir-P/u02/database/sy5221/bdump mkdir-P/u02/database/sy5221/cdump mkdir-P/u02/database/sy5221/udump mkdir-P /u02/database/sy5221/controlf mkdir-P/u02/database/sy5221/oradata mkdir-P/u02/database/sy5221/redolog m Kdir-P/u02/database/sy5221/undo mkdir-P/u02/database/sy5221/temp mkdir-P/u02/database/sy5221/ref_data mkdir-P/u02/Database /sy5221/BNR mkdir-P/u02/database/sy5221/BNR/full mkdir-P/u02/database/sy5221/BNR/dump mkdir-P/u02/database/sy5221/ dbcreatelogs oracle_sid = sy5221; export oracle_sid Oracle @ 2go-devdb01uv: ~> Chmod U + x mkdir_sy5221.sh Oracle @ 2go-devdb01uv: ~> ./Mkdir_sy5221.sh4. Create the password file Oracle @ 2go-devdb01uv: ~> CD $ ORACLE_HOME/DBS Oracle @ 2go-devdb01uv :~ /Orahome10g/DBS> orapwd file = orapwsy5221 Password = Oracle force = y entries = 10 # Author: Robinson # blog: Login Oracle @ 2go-devdb01uv: ~> CP/u02/database/sy5221_rman/20121013/initsy5221.ora $ ORACLE_HOME/DBS Oracle @ 2go-devdb01uv: ~> Export oracle_sid = sy5221 Oracle @ 2go-devdb01uv: ~> Sqlplus/As sysdba SQL> startup nomount; 4. Restore the control file and switch to the Mount state # Open another session Oracle @ 2go-devdb01uv: ~> Export oracle_sid = sy5221 Oracle @ 2go-devdb01uv: ~> $ ORACLE_HOME/bin/RMAN target/RMAN> restore controlfile from '/u02/database/sy5221_rman/20121013/SY5221_lev0_cntl.bak_c-1468911009-20121013-01'; RMAN> alter database Mount; 5. Specify the directory where the backup file is located. RMAN> catalog start with '/u02/database/sy5221_rman/100 '; # This command is used to scan the backup slices or archive log files in the entire directory. 6. Restore the database RMAN> Restore database. 7. Restore the database RMAN> recover database; unable to find archive log thread = 1 sequence = 143388 RMAN-00571: ========================================================== ============================== RMAN-00569: ================ error message stack follows ============================ RMAN-00571: ========================================================== ============================== RMAN-03002: failure of recover command at 10/16/2012 11:32:54 RMAN-06054: Media recovery requesting unknown log: thread 1 seq 143388 lowscn 608805162 # because the online log file is not copied, the prompt requires seqence 143388, SCN 608805162 # resume SQL> Conn/As sysdba connected from the sqlplus prompt. idle> recover database until cancel; ORA-00283: Recovery session canceled due to errors ORA-01610: recovery using the backup controlfile option must be done SQL> recover database using backup controlfile until cancel; ORA-00279: change 608805162 generated at 10/13/2012 06:31:44 needed for thread 1 ORA-00289: Suggestion:/u02/database/sy5221/archive/arch_668881377_1_143388.arc ORA-00280: Change 608805162 for thread 1 is in sequence #143388 specify log: {<RET> = suggested | filename | auto | cancel} cancel # Enter Cancel to restore media recovery cancelled.8. Open Database # If open fails, open again after shutdown, if you still cannot use the hidden parameter _ allow_resetlogs_uption to open the database SQL> alter database open resetlogs; database altered.9. Close the database consistently and restart the database SQL> shutdown immediate; SQL> startup

Iii. More references

For more information about the basics and concepts of Oracle network configuration, see:
Configure the Oracle client to connect to the database
Configure dynamic service registration for non-default ports
Configure sqlnet. ora to restrict IP Access to Oracle
Configure and manage Oracle listener logs
Set the Oracle listener password (listener)
Oracle RAC Listener Configuration
Non-Default port listening configuration in Oracle RAC (listener. ora tnsnames. ora)

Load Balance)

Configure RAC load balancing and Failover

For more information about user-managed backup and recovery, see

Oracle cold backup

Oracle Hot Backup

Concept of Oracle backup recovery

Oracle instance recovery

Oracle recovery based on user management

System tablespace management and Backup Recovery

Sysaux tablespace management and recovery

Oracle backup control file recovery (unsing backup controlfile)

 

For information on RMAN backup recovery and management, see

RMAN overview and architecture

RMAN configuration, Monitoring and Management

Detailed description of RMAN backup

RMAN restoration and recovery

Create and use RMAN catalog

Create RMAN storage script based on catalog

Catalog-based RMAN backup and recovery

RMAN backup path confusion

 

For the Oracle architecture, see

Oracle tablespace and data files

Oracle Password File

Oracle parameter file

Oracle online redo log file)

Oracle Control File)

Oracle archiving logs

Oracle rollback and undo)

Oracle database instance startup and Shutdown Process

Automated Management of Oracle 10g SGA

Oracle instances and Oracle databases (Oracle Architecture)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.