How to restore Oracle backup to a different machine

Source: Internet
Author: User

Scenario Description:

A friend asked, ms SQL server will back up the database to restore to other machines is very convenient, basically is a silly operation, Oracle control files, parameter files a bunch of things, I think the restoration is very complicated; otherwise, I took some time to give a simple demonstration of the case. For more information, see! To make it simple and fast, I use RMAN for backup and restoration.

-- Note:
(1) db_name must be the same when RMAN is backed up to recovery from different machines.

If you want to change to another instance name, you can use the nid command to modify it after the recovery is successful. The instance name information is recorded in the control file. Therefore, if the instance names are inconsistent during restoration, an error is returned.


(2 ). when the recovery path is inconsistent with the source database, you need to use the set command in the restore command to specify a new location, and use switch datafile all to update the change information to the control file.

Test environment:

Source database server A, installed on E, and the backup directory is already on the E disk; source database server B, installed on the F disk.

------------------------------------

I. source database preparation

------------------------------------

-- 1. query DBID

 

SQL> select name, dbid from v $ database;

NAME DBID
-------------------
ORCL 1320546556

 

-- 2. Back up the source database

Run {
Configure retention policy to recovery window of 14 days;
Configure controlfile autobackup on; -- automatically enable control file backup
Configure controlfile autobackup format for device type disk to 'e: \ backup \ controlfile \ bak _ % F ';
Allocate channel c1 device type disk format 'e: \ backup \ data \ bak _ % U ';
Allocate channel c2 device type disk format 'e: \ backup \ data \ bak _ % U ';
SQL 'alter system archive log current ';
Backup incremental level = 0 database skip inaccessible
Plus archivelog filesperset 20
Delete all input;
Release channel c1;
Release channel c2;
}
Allocate channel for maintenance device type disk;
Crosscheck backupset;
Delete noprompt obsolete;


-- Or

Run {
Configure retention policy to recovery window of 14 days;
Allocate channel c1 device type disk format 'e: \ backup \ data \ bak _ % U ';
Allocate channel c2 device type disk format 'e: \ backup \ data \ bak _ % U ';
SQL 'alter system archive log current ';
Backup incremental level = 0 database skip inaccessible
Plus archivelog filesperset 20
Delete all input;
-- Manually specify the backup file name and Path
Backup current controlfile tag = 'bak _ ctrollfile' format = 'e: \ backup \ controlfile \ bak_ctl_file _ % U _ % T ';
Backup spfile tag = 'bak _ spfile' format = 'e: \ backup \ controlfile \ bak_spfile _ % U _ % T ';
Release channel c1;
Release channel c2;
}
Allocate channel for maintenance device type disk;
Crosscheck backupset;
Delete noprompt obsolete;

 

-- 3. Manually back up spfile

Create pfile = 'e: \ backup \ inittest. ora 'from spfile;


------------------------------------

Ii. Preparations for the target database:

------------------------------------

--- Step 1. Create a password file

-- If yes, you do not need to create a new one.

Orapwd file = F: \ app \ Administrator \ product \ 11.2.0 \ dbhome_1 \ database \ PWDorcl. ora password = password

 

-- Step 2. Restore the parameter file


-- Method 1: copy the source database spfile to database B server


\ 192.168.2.25 \ e $ \ backup \ inittest. ORA
Copy
E: \ bk \ inittest. ORA

 

 


-- Step 3. edit the file path in the parameter file

If the path is the same as the original one, you do not need to modify it.

Eg:
-* _ DUMP_DEST
-LOG_ARCHIVE_DEST *
-CONTROL_FILES


--- Instance:

Orcl. _ db_cache_size = 939524096
Orcl. _ Java _pool_size = 16777216
Orcl. _ large_pool_size = 16777216
Orcl. _ oracle_base = 'f: \ app \ Administrator '# modify the path
Orcl. _ pga_aggregate_target = 855638016
Orcl. _ sga_target = 2550136832
Orcl. _ shared_io_pool_size = 0
Orcl. _ shared_pool_size = 1526726656
Orcl. _ streams_pool_size = 16777216
*. Audit_file_dest = 'f: \ app \ Administrator \ admin \ orcl \ adump '# modify the path
*. Audit_trail = 'db'
*. Compatible = '11. 2.0.0.0'
# Modify the path
*. Control_files = 'f: \ app \ Administrator \ oradata \ orcl \ control01.ctl ', 'f: \ app \ Administrator \ oradata \ orcl \ control02.ctl', 'f: \ app \ Administrator \ oradata \ orcl \ control03.ctl'
*. Db_block_size = 8192
*. Db_domain =''
*. Db_name = 'orcl'
*. Db_recovery_file_dest = 'f: \ arch '# modify the path
*. Db_recovery_file_dest_size = 6442450944
*. Diagnostic_dest = 'f: \ app \ Administrator '# modify the path
*. Dispatchers = '(PROTOCOL = TCP) (SERVICE = orclXDB )'
*. Log_archive_dest_1 = 'location = f: \ arch '# modify the path
*. Nls_date_format = 'yyyy-mm-dd hh: mi: ss'
*. Open_cursors = 300
*. Optimizer_capture_ SQL _plan_baselines = TRUE
*. Pga_aggregate_target = 845152256
*. Processses = 150
*. Remote_login_passwordfile = 'clusive'
*. Sga_target = 2536505344
*. Skip_unusable_indexes = TRUE
*. Undo_tablespace = 'undotbs1'

 

-- Step 4. Restart the instance and use the edited parameter file

Database B server will be started to nomout state with pfile

Rman target/

Startup nomount pfile = 'e: \ bk \ inittest. ora'

  • 1
  • 2
  • 3
  • 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.