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.
- Oracle @ 2go-devDB01uv:/u02/database/SY5221_RMAN/20121013> ls-hltr
- Total 9.4 GB
- -Rw-r -- 1 oracle oinstall 3.0 K 2012-10-16 48 initSY5221.ora
- -Rw-r -- 1 oracle oinstall 2.7G 2012-10-16 10:02 SY5221_lev0_201210130630_4unnkjvi_1_1
- -Rw-r -- 1 oracle oinstall 3.1G 2012-10-16 10:04 SY5221_lev0_201210130630_4vnnkjvi_1_1
- -Rw-r -- 1 oracle oinstall 938 M 2012-10-16 10:07 SY5221_lev0_201210130630_arc_51nnkk2h_1_1
- -Rw-r -- 1 oracle oinstall 935 M 2012-10-16 10:08 SY5221_lev0_201210130630_arc_52nnkk2h_1_1
- -Rw-r -- 1 oracle oinstall 930 M 2012-10-16 10:10 10 SY5221_lev0_201210130630_arc_53nnkk31_1_1
- -Rw-r -- 1 oracle oinstall 15 M 2012-10-16 10:10 SY5221_lev0_cntl_bak_c-1468911009-20121013-00
- -Rw-r -- 1 oracle oinstall 15 M 2012-10-16 10:10 SY5221_lev0_cntl_bak_c-1468911009-20121013-01
- -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)
- 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
- Mkdir-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.sh
4. Create a password file
- Oracle @ 2go-devDB01uv: ~> Cd $ ORACLE_HOME/dbs
- Oracle @ 2go-devDB01uv :~ /OraHome10g/dbs> orapwd file = orapwSY5221 password = oracle force = y entries = 10