使用RMAN恢復一個資料庫到另一個目錄結構不同的資料庫中
Information in this document applies to any platform.
GoalRestoring Rman backup on a different node with different backup directory structures and different database directory structures .
++ Rman backup of database is done on NODE 1.
++ The database has to be has to be restored from the Rman backup on NODE 2.
++ The directory structures for the backups and the database files are different on NODE 2.
++ The Rman backups have to put in new directory structure on NODE 2 unlike as they were on NODE 1.
++ Also the database has to be restored to a different directory structure on NODE 2.
Solution
ASSUMPTIONS
-----------------------
++ The database files on NODE 1 are in '/node1/database/prod'
++ The backups on NODE 2 will be in location '/node2/database/backup'
++ The database files on NODE 2 will be restored to '/node2/database/prod
Steps to acheive the goal:
1) Connect to the target database using rman and backup the database ---> ON NODE 1
Recovery Manager: Release 10.2.0.1.0 - Production on Tue Feb 13 00:29:33 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORA10G (DBID=3932056136)
RMAN> backup database plus archivelog;
Starting backup at 13-FEB-07
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=143 recid=109 stamp=614392105
channel ORA_DISK_1: starting piece 1 at 13-FEB-07
channel ORA_DISK_1: finished piece 1 at 13-FEB-07
piece handle=/node1/database/backup/o1_mf_annnn_TAG20070213T002825_2x21kbds
_.bkp tag=TAG20070213T002825 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 13-FEB-07
Starting backup at 13-FEB-07
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00003 name=/node1/database/prod/sysaux01.dbf
input datafile fno=00001 name=/node1/database/prod/system01.dbf
input datafile fno=00002 name=/node1/database/prod/undotbs01.dbf
input datafile fno=00004 name=/node1/database/prod/users01.dbf
input datafile fno=00005 name=/node1/database/prod/1.dbf
input datafile fno=00006 name=/node1/database/prod/sysaux02.dbf
input datafile fno=00007 name=/node1/database/prod/undotbs02.dbf
channel ORA_DISK_1: starting piece 1 at 13-FEB-07
channel ORA_DISK_1: finished piece 1 at 13-FEB-07
piece handle=/node1/database/backup/o1_mf_nnndf_TAG20070213T002827_2x21kd12
_.bkp tag=TAG20070213T002827 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:55
Finished backup at 13-FEB-07
Starting backup at 13-FEB-07
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=144 recid=110 stamp=614392165
channel ORA_DISK_1: starting piece 1 at 13-FEB-07
channel ORA_DISK_1: finished piece 1 at 13-FEB-07
piece handle=/node1/database/backup/o1_mf_annnn_TAG20070213T002925_2x21m6ty
_.bkp tag=TAG20070213T002925 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 13-FEB-07
Starting Control File and SPFILE Autobackup at 13-FEB-07
piece handle=/u01/oracle/product/ora10g/dbs/c-3932056136-20070213-02 comment=NONE
Finished Control File and SPFILE Autobackup at 13-FEB-07
RMAN> exit 2) Move the following files to the NODE 2:+ The database backup pieces to location '/node2/database/backup'
+ Controlfile backup piece to the location '/node2/database/backup'
+ The parameter file i.e init.ora file to the default location i.e $ORACLE_HOME/dbs
3) Edit the PFILE on NODE 2 to change the environment specific parameters like .
user_dump_dest =background_dump_dest =
control_files = 4) Once the PFILE is suitably modified invoke Rman on the NODE 2 after setting the Oracle environment variables and start the database in nomount mode:
[oracle@test-br test]$ export ORACLE_HOME=/u01/oracle/product/ora10g
[oracle@test-br test]$ export ORACLE_SID=ora10g
[oracle@test-br test]$ export PATH=$ORACLE_HOME/bin:$PATH
[oracle@test-br test]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Tue Feb 13 00:36:55 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database (not started)
RMAN> startup nomount
Oracle instance started
Total System Global Area 205520896 bytes
Fixed Size 1218508 bytes
Variable Size 75499572 bytes
Database Buffers 121634816 bytes
Redo Buffers 7168000 bytes
5) Restore the controlfile from the backup piece.
RMAN> restore controlfile from '/node2/database/backup/c-3932056136-20070213-02';Starting restore at 13-FEB-07
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:02
output filename=/node2/database/prod/control01.ctl
Finished restore at 13-FEB-07
6) Mount the database
RMAN > alter database mount7) Now catalog the backup pieces that were shipped from NODE 1
RMAN> catalog backuppiece '/node2/database/backup/o1_mf_annnn_TAG20070213T002825_2x21kbds_.bkp';
RMAN> catalog backuppiece '/node2/database/backup/o1_mf_nnndf_TAG20070213T002827_2x21kd12_.bkp'; This feature of cataloging backup pieces is available from ORACLE 10g versions. Prior to Oracle 10g we were not able to catalog the backup pieces. For more information on cataloging options refer the metalink note 470463.1
8) Get to know the last sequence available in the archivelog backup using the following command.This will help us in recovering the database till that archivelog.
RMAN > list backup of archivelog all;Let us assume the last sequence of last archivelog in the backup is 50.9) Rename the Redologfiles,so that they can be created in new locations when opened the database is opened in resetlogs
SQL> alter database rename file '/node1/database/prod/redo01.log' to '/node2/database/prod/redo01.log';......
......
......
10) Now restore the datafiles to new locations and recover. Since we are recovering the database here till the archivelog sequence 50 the sequence number in the SET UNTIL SEQUENCE clause should be 50 (+1)
RMAN> run{
set until sequence 51;
set newname for datafile 1 to '/node2/database/prod/sys01.dbf';
set newname for datafile 2 to '/node2/database/prod/undotbs01.dbf';
set newname for datafile 3 to '/node2/database/prod/sysaux01.dbf';
set newname for datafile 4 to '/node2/database/prod/users01.dbf';
set newname for datafile 5 to '/node2/database/prod/1.dbf';
set newname for datafile 6 to '/node2/database/prod/sysaux02.dbf';
set newname for datafile 7 to '/node2/database/prod/undotbs02.dbf';
restore database;
switch datafile all;
recover database;
alter database open resetlogs;
}
If we are restoring the Rman backups from tapes,then we should ensure the same media manager variables that were used during backups are maintained during restore too.
The below article gives the information of various media manager Environment Variables.
NOTE.312737.1 RMAN and Specific Media Managers Environment Variables.
- RMAN 'Duplicate Database' Feature in Oracle9i / Oracle 10G
- RMAN: Restoring an RMAN Backup to Another Node
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/11411056/viewspace-734422/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- RMAN恢復目錄資料庫的搭建資料庫
- 【RMAN】資料庫到恢復目錄的註冊過程資料庫
- rman不使用恢復目錄恢復資料庫示例及問題資料庫
- 【備份恢復】RMAN catalog 恢復目錄資料庫資料庫
- 兩個資料庫結構相同,但使用者、表空間名稱都不同,如何把一個資料庫中的使用者導到另一個資料庫
- 利用RMAN恢復整個資料庫資料庫
- 兩個資料庫結構相同,但使用者、表空間名稱都不同,如何把一個資料庫中的使用者導到另一個使用者中(zt)資料庫
- SqlServer將資料庫中的表複製到另一個資料庫SQLServer資料庫
- 【RMAN】使用恢復目錄catalog備份目標資料庫的演示資料庫
- 玩轉恢復目錄資料庫(一)資料庫
- RMAN-在恢復目錄中註冊和取消資料庫資料庫
- RMAN恢復資料庫資料庫
- rman備份資料庫後到另一臺機器上恢復的例子資料庫
- 生產庫的恢復目錄被RMAN恢復出來的資料庫庫使用後出現的問題資料庫
- 玩轉恢復目錄資料庫(二)資料庫
- 玩轉恢復目錄資料庫(四)資料庫
- rman 可否克隆rac資料庫到另外一個rac環境的資料庫中?資料庫
- 【RMAN】rman使用NORESTELOGS 方式恢復資料庫REST資料庫
- rman 全庫恢復asm資料庫ASM資料庫
- 【備份恢復】之RMAN 恢復目錄庫(客戶端備份資訊註冊到目標庫恢復目錄中)客戶端
- 在恢復目錄中註冊和登出資料庫資料庫
- 【備份恢復】下:還原和恢復資料庫(即將一個庫還原到另外一個庫)資料庫
- 【備份恢復】上:還原和恢復資料庫(即將一個庫還原到另外一個庫)資料庫
- 使用RMAN恢復完全損壞的資料庫資料庫
- 使用RMAN還原和恢復資料庫資料庫
- Sql Server 匯入另一個資料庫中的表資料SQLServer資料庫
- 恢復目錄資料庫備份指令碼資料庫指令碼
- 在另一個資料庫中建立一個與原來資料庫中許可權一樣的使用者資料庫
- mysqldump 恢復單個資料庫MySql資料庫
- 資料庫不同故障的恢復方式資料庫
- oracle之rman恢復資料庫Oracle資料庫
- LianTong rman資料庫恢復資料庫
- Oracle資料庫RMAN小結之恢復部分Oracle資料庫
- RAC資料庫的RMAN備份異機恢復到單節點資料庫資料庫
- 使用RMAN將生產庫資料恢復到另外環境追溯先前的資料資料恢復
- PG 資料庫檔案損壞的另一個不完全恢復方案.資料庫
- RMAN 資料庫修復(restore)與資料庫恢復(recover)介紹資料庫REST
- 【資料庫資料恢復】SAP資料庫資料恢復案例資料庫資料恢復