The Rman backup set in archive mode is restored on different machines (the paths of the original and target databases are inconsistent)

Source: Internet
Author: User
Environment: OS: RedHatLinuxAs5DB: Oracle10.2.0.4 sometimes we need to use the backup set of the production database to restore data on another new machine.

Environment: OS: Red Hat Linux As 5DB: Oracle 10.2.0.4 sometimes we need to use the backup set of the production database to restore data on another new machine.

Environment:
OS: Red Hat Linux As 5
DB: Oracle 10.2.0.4

Sometimes, due to the need of the test environment, we need to use the backup set of the production database to recover from another new machine (provided that the Oracle software is installed on the new machine, and the version is the same as that of the original database ), the recovery process is as follows.

1. Perform full backup on the original database (operate on the original database)
Run {
Allocate channel c1 device type disk;
Allocate channel c2 device type disk;
Backup format '/u02/rman_backup/full_backup _ % T _ % s' database;
SQL 'alter system archive log current ';
Backup format '/u02/rman_backup/full_backup/arc_backup _ % T _ % s' archivelog all;
Release channel c1;
Release channel c2;
}
2. view the DBID of the original database (operate on the original database)
Because DBID needs to be set during the recovery process, you need to find the DBID of the original database
SQL> select dbid from v $ database;
DBID
----------
1820932955

----- The following operations are not described in detail. All operations are performed on the target database -----
3. Use ftp to copy the backup set in the original database to the directory of the target database/u02/ftp/(the specific operation is omitted)

4. Create the following directory on the new machine:
Mkdir/u02/mydb
Mkdir-p/u02/mydb/oracl/{adump, bdump, cdump, dpdump, udump, pfile}
Mkdir-p/u02/mydb/oradata/oracl
Mkdir-p/u02/mydb/flash_recovery_area

5. Create a password file
Orapwd file =/u01/app/oracle/product/10.2.0/db_1/dbs/orapworacl. ora password = oracle

6. Restore the parameter file
[Oracle @ hxlbak ~] $ Rman target/

Recovery Manager: Release 10.2.0.1.0-Production on Fri Jun 29 06:51:54 2012

Copyright (c) 1982,200 5, Oracle. All rights reserved.

Connected to target database (not started)

RMAN> set dbid 1820932955 -- The dbid must be consistent with the original database.

RMAN> startup nomount

Startup failure: ORA-01078: failure in processing system parameters
LRM-00109: cocould not open parameter file '/u01/app/oracle/product/10.2.0/db_1/dbs/init1_l. ora'

Starting Oracle instance without parameter file for retrival of spfile
Oracle instance started

Total System Global Area 159383552 bytes

Fixed Size 1218268 bytes
Variable Size 54528292 bytes
Database Buffers 100663296 bytes
Redo Buffers 2973696 bytes

RMAN> restore spfile to pfile '/u01/app/oracle/product/10.2.0/db_1/dbs/init1_l. ora' from '/u02/ftp/full_backup_20120628_37 ';

Starting restore at 29-JUN-12
Using target database control file instead of recovery catalog
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: sid = 36 devtype = DISK

Channel ORA_DISK_1: autobackup found:/u02/ftp/full_backup_20120628_37
Channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 29-JUN-12


The backup set full_backup_20120628_3 contains the parameter file. During data backup, the parameter file is backed up by default. You can use list backup in the original database to view the file. The output content of list backup is as follows:

BS Key Type LV Size Device Type Elapsed Time Completion Time
-------------------------------------------------------------
35 Full 80.00 k disk 00:00:01 28-JUN-12
BP Key: 35 Status: AVAILABLE Compressed: NO Tag: TAG20120628T184555
Piece Name:/u02/rman_backup/full_backup/full_backup_20120628_37
SPFILE encoded ded: Modification time: 28-JUN-12

The parameter file initstml is restored. after ora, because the paths of the files in the original library and target library are inconsistent, You need to modify the parameter file as follows:

*. Audit_file_dest = '/u02/mydb/L/adump'
*. Background_dump_dest = '/u02/mydb/L/bdump'
*. Control_files = '/u02/mydb/oradata/oracl/control01.ctl', '/u02/mydb/oradata/oracl/control02.ctl', '/u02/mydb/oradata/oracl/control03.ctl'
*. Core_dump_dest = '/u02/mydb/L/cdump'
*. Db_recovery_file_dest = '/u02/mydb/flash_recovery_area'
*. User_dump_dest = '/u02/mydb/L/udump'

7. Use the edited parameter file to start the database to the nomount state and restore the control file

SQL> startup nomount pfile =/u01/app/oracle/product/10.2.0/db_1/dbs/init1_l. ora
ORACLE instance started.

Total System Global Area 1048576000 bytes
Fixed Size 1223368 bytes
Variable Size 310379832 bytes
Database Buffers 734003200 bytes
Redo Buffers 2969600 bytes
SQL>

Restore Control File
RMAN> restore controlfile from '/u02/ftp/full_backup_20120628_36 ';

Starting restore at 29-JUN-12
Using target database control file instead of recovery catalog
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: sid = 155 devtype = DISK

Channel ORA_DISK_1: restoring control file
Channel ORA_DISK_1: restore complete, elapsed time: 00:00:05
Output filename =/u02/mydb/oradata/oracl/control01.ctl
Output filename =/u02/mydb/oradata/oracl/control02.ctl
Output filename =/u02/mydb/oradata/oracl/control03.ctl
Finished restore at 29-JUN-12

Like the parameter file, the control file is backed up by default during data backup. The backup set full_backup_20120628_36 contains the control file, which can also be viewed in the original database using list backup, the output part of list backup is as follows:

BS Key Type LV Size Device Type Elapsed Time Completion Time
-------------------------------------------------------------
34 Full 6.98 m disk 00:00:02 28-JUN-12
BP Key: 34 Status: AVAILABLE Compressed: NO Tag: TAG20120628T184555
Piece Name:/u02/rman_backup/full_backup/full_backup_20120628_36
Control File Included: Ckp SCN: 1545845 Ckp time: 28-JUN-12

,

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.