Note: 1 The experiment environment is the same platform, in the same byte order, in the same version. The directory structure of the source and target machines is the same. 2. You only need to install the oracle database software on the target machine. 3. Use backup for the first time to restore the test environment, copy the backup from the source machine to the target machine, and register it in the control file. Goodbye to restore the test.
One copy parameter file backup, control file backup, data file backup, and archive backup to the new host
1. Connect rman to the source database[Oracle @ oracle dbs] $ rman target/Recovery Manager: Release 10.2.0.1.0-Production on Tue Dec 11 19:02:05 2012 Copyright (c) 1982,200 5, Oracle. all rights reserved. connected to target database: CRM (DBID = 3601019238) RMAN>
2. List parameter file backup, control file backup, data file backup, and archive backup name respectively.
The parameter file backup is as follows:
RMAN> list backup of spfile;BS Key Type LV Size Device Type Elapsed Time Completion Time
-------------------------------------------------------------
13 Full 7.11 m disk 00:00:04 09-DEC-12
BP Key: 13 Status: AVAILABLE Compressed: NO Tag: TAG20121209T040058
Piece Name:/oracle/app/db1/dbs/0dnsd96i_1_1
SPFILE encoded ded: Modification time: 09-DEC-12
The backup of the control file is as follows:RMAN> list backup of controlfile; BS Key Type LV Size Device Type Elapsed Time Completion Time
-------------------------------------------------------------
13 Full 7.11 m disk 00:00:04 09-DEC-12
BP Key: 13 Status: AVAILABLE Compressed: NO Tag: TAG20121209T040058
Piece Name:/oracle/app/db1/dbs/0dnsd96i_1_1
Control File Included: Ckp SCN: 2779528241 Ckp time: 09-DEC-12
Data file backup is as follows:RMAN> list backup of database; BS Key Type LV Size Device Type Elapsed Time Completion Time
-------------------------------------------------------------
12 Full 599.38 m disk 00:03:33 09-DEC-12
BP Key: 12 Status: AVAILABLE Compressed: NO Tag: TAG20121209T040058
Piece Name:/oracle/app/db1/dbs/0cnsd8vq_1_1
List of Datafiles in backup set 12
File LV Type Ckp SCN Ckp Time Name
---------------------------------
1 Full 2779528081 09-DEC-12/oracle/test/system1.dbf
2 Full 2779528081 09-DEC-12/oracle/test/zxb. dbf
3 Full 2779528081 09-DEC-12/oracle/test/sysaux01.dbf
4 Full 2779528081 09-DEC-12/oracle/test/users01.dbf
5 Full 2779528081 09-DEC-12/oracle/test/zxa. dbf
6 Full 2779528081 09-DEC-12/oracle/test/test1.dbf
7 Full 2779528081 09-DEC-12/oracle/test/zxc. dbf
8 Full 2779528081 09-DEC-12/oracle/test/undotbs1.dbf
9 Full 2779528081 09-DEC-12/oracle/test/zxbig. dbf
The archive backups are listed as follows:RMAN> list backup of archivelog all; note: the archived backup should include the current online log file.
3 copy these backups to the new host
2. Restore parameter files and Control Files
1. Configure ORACLE_SID on the new hostExport ORACLE_SID = CRM
2. Initiate the rman connection on the new host[Oracle @ oracle dbs] $ rman target/Recovery Manager: Release 10.2.0.1.0-Production on Mon Dec 10 05:49:11 2012 Copyright (c) 1982,200 5, Oracle. all rights reserved. connected to target database (not started)
3. Set dbid and start the instance to nomount.RMAN> set dbid 3601019238 executing command: set dbid rman> startup nomount startup failed: ORA-01078: failure in processing system parametersLRM-00109: cocould not open parameter file '/oracle/app/db1/dbs/initCRM. ora 'starting Oracle instance without parameter file for retrival of spfileOracle instance started Total System Global Area 159383552 bytes Fixed Size 2019224 bytesVariable Size 67108968 bytesDatabase Buffers 83886080 bytesRedo Buffers 6369280 bytes
Note: a dummy instance is started by default even if there is no parameter file in rman to restore the parameter file.
4. Restore the spfile FileRMAN> restore spfile to '/oracle/app/db1/dbs/spfileCRM. ora 'from'/oracle/app/db1/dbs/0dnsd96i_1_1 '; Starting restore at 10-DEC-12using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: sid = 34 devtype = DISK channel ORA_DISK_1: autobackup found:/oracle/app/db1/dbs/0dnsd96i_1_1channel ORA_DISK_1: SPFILE restore from autobackup completeFinished restore at 10-DEC-12
5 startup force nomountRMAN> startup force nomount; Oracle instance started Total System Global Area 322961408 bytes Fixed Size 2020480 bytesVariable Size 96471936 bytesDatabase Buffers 218103808 bytesRedo Buffers 6365184 bytes
6. Restore Control FilesRMAN> restore controlfile to '/oracle/CRM2/CRM/control01.ctl' from '/oracle/app/db1/dbs/0dnsd96i_1_1'; Starting restore at 10-DEC-12allocated channel: ORA_DISK_1channel ORA_DISK_1: sid = 210 devtype = DISK channel ORA_DISK_1: restoring control filechannel ORA_DISK_1: restore complete, elapsed time: 00: 00: 04 Finished restore at 10-DEC-12
Cp/oracle/CRM2/CRM/control01.ctl/oracle/CRM2/CRM/control02.ctl
7. Start the database to the load statusRMAN> alter database mount; database mountedreleased channel: ORA_DISK_1
3. Register data file backup and archive backup in the new control fileRMAN> catalog start with '/backup /'; searching for all files that match the pattern/backup/List of Files Unknown to the Database ================== ================== File Name: /backup/0ensd96n_1_1File Name:/backup/0bnsd8vn_1_1File Name:/backup/0cnsd8vq_1_1 Do you really want to catalog the above files (enter YES or NO )? Yescataloging files... cataloging done List of Cataloged Files ======================== File Name:/backup/0ensd96n_1_1File Name: /backup/0bnsd8vn_1_1File Name:/backup/0cnsd8vq_1_1
4. Restore the entire database
1 RMAN> restore database;Starting restore at 10-DEC-12allocated channel: ORA_DISK_1channel ORA_DISK_1: sid = 209 devtype = DISK channel ORA_DISK_1: starting datafile backupset restorechannel ORA_DISK_1: specifying datafile (s) to restore from backup setrestoring datafile 00001 to/oracle/test/system1.dbfrestoring datafile 00002 to/oracle/test/zxb. dbfrestoring datafile 00003 to/oracle/test/sysaux01.dbfrestoring datafile 00004 to/oracle/test/users01.dbfrestoring datafile 00005 to/oracle/test/zxa. dbfrestoring datafile 00006 to/oracle/test/test1.dbfrestoring datafile 00007 to/oracle/test/zxc. dbfrestoring datafile 00008 to/oracle/test/undotbs1.dbfrestoring datafile 00009 to/oracle/test/zxbig. dbfchannel ORA_DISK_1: reading from backup piece/oracle/app/db1/dbs/0cnsd8vq_1_1channel ORA_DISK_1: restored backup piece 1 piece handle =/oracle/app/db1/dbs/0cnsd8vq_1_1 tag = duplicate ORA_DISK_1: restore complete, elapsed time: 00: 02: 56 Finished restore at 10-DEC-12
2 RMAN> recover database;Starting recover at 10-DEC-12using channel ORA_DISK_1 starting media recovery archive log thread 1 sequence 16 is already on disk as file/oracle/CRM2/CRM/redo04b. logarchive log thread 1 sequence 17 is already on disk as file/oracle/CRM2/CRM/redo05.logarchive log filename =/oracle/CRM2/CRM/redo04b. log thread = 1 sequence = 16 archive log filename =/oracle/CRM2/CRM/redo05.log thread = 1 sequence = 17 media recovery complete, elapsed time: 00: 00: 05 Finished recover at 10-DEC-12
3 alter database open resetlogs open databaseSQL> alter database open resetlogs; Database altered.
Conclusion: At this point, the database has been restored. You only need to back up, archive, or archive the data on the source machine and copy the data to the target machine, register the backup (catalog start with '/backup/') in the control file and then perform restoration.
This article is from the "myblog" blog, please be sure to keep this source http://jiujian.blog.51cto.com/444665/1085478