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 source database and target database demonstrated here use the same version as Oracle 10g R2 (10.2.0.3), and the operating system is SUSE 10 + Sp3

The backup process is omitted. For the backup script, see RMAN backup shell script in Linux.

2. ftp all backup files to the server to be restored

Package the entire backup set ftp to the target server or scp to the target server

The following are the files extracted from ftp to the target server.

  1. Oracle @ 2go-devDB01uv:/u02/database/SY5221_RMAN/20121013> ls-hltr
  2. Total 9.4 GB
  3. -Rw-r -- 1 oracle oinstall 3.0 K 2012-10-16 48 initSY5221.ora
  4. -Rw-r -- 1 oracle oinstall 2.7G 2012-10-16 10:02 SY5221_lev0_201210130630_4unnkjvi_1_1
  5. -Rw-r -- 1 oracle oinstall 3.1G 2012-10-16 10:04 SY5221_lev0_201210130630_4vnnkjvi_1_1
  6. -Rw-r -- 1 oracle oinstall 938 M 2012-10-16 10:07 SY5221_lev0_201210130630_arc_51nnkk2h_1_1
  7. -Rw-r -- 1 oracle oinstall 935 M 2012-10-16 10:08 SY5221_lev0_201210130630_arc_52nnkk2h_1_1
  8. -Rw-r -- 1 oracle oinstall 930 M 2012-10-16 10:10 10 SY5221_lev0_201210130630_arc_53nnkk31_1_1
  9. -Rw-r -- 1 oracle oinstall 15 M 2012-10-16 10:10 SY5221_lev0_cntl_bak_c-1468911009-20121013-00
  10. -Rw-r -- 1 oracle oinstall 15 M 2012-10-16 10:10 SY5221_lev0_cntl_bak_c-1468911009-20121013-01
  11. -Rw-r -- 1 oracle oinstall 910 M 2012-10-16 10: 11 SY5221_lev0_201210130630_arc_54nnkk32_1_1

3. create the required directory (using oracle Users)

  1. Oracle @ 2go-devDB01uv: ~> More mkdir_sy5221.sh
  2. Mkdir-p/u02/database/SY5221/flash_recovery_area
  3. Mkdir-p/u02/database/SY5221
  4. Mkdir-p/u02/database/SY5221/archive
  5. Mkdir-p/u02/database/SY5221/backup
  6. Mkdir-p/u02/database/SY5221/bdump
  7. Mkdir-p/u02/database/SY5221/cdump
  8. Mkdir-p/u02/database/SY5221/udump
  9. Mkdir-p/u02/database/SY5221/controlf
  10. Mkdir-p/u02/database/SY5221/oradata
  11. Mkdir-p/u02/database/SY5221/redolog
  12. Mkdir-p/u02/database/SY5221/undo
  13. Mkdir-p/u02/database/SY5221/temp
  14. Mkdir-p/u02/database/SY5221/ref_data
  15. Mkdir-p/u02/database/SY5221/BNR
  16. Mkdir-p/u02/database/SY5221/BNR/full
  17. Mkdir-p/u02/database/SY5221/BNR/dump
  18. Mkdir-p/u02/database/SY5221/dbcreatelogs
  19. ORACLE_SID = SY5221; export ORACLE_SID
  20. Oracle @ 2go-devDB01uv: ~> Chmod u + x mkdir_sy5221.sh
  21. Oracle @ 2go-devDB01uv: ~> ./Mkdir_sy5221.sh

4. Create a password file

  1. Oracle @ 2go-devDB01uv: ~> Cd $ ORACLE_HOME/dbs
  2. Oracle @ 2go-devDB01uv :~ /OraHome10g/dbs> orapwd file = orapwSY5221 password = oracle force = y entries = 10
  • 1
  • 2
  • Next Page

Related Article

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.