【實驗】Oracle 10g RAC生產資料庫RMAN方式恢復到異地單機資料庫全程記錄

secooler發表於2009-08-24
【前言】這是一個RMAN備份有效性驗證的過程。

源端環境介紹:
生產資料庫是包含兩個節點的Oracle 10g 10.2.0.3 RAC資料庫:
ASM管理+裸裝置
資料庫名:racdb
第一節點的sid:racdb1
第一節點的sid:racdb2

異地單機資料庫(恢復Server)介紹:
單機
單例項
低配


下面將詳細記錄整個從RAC到單機的詳細恢復過程。

【實驗BEGIN】
1.將源端的RMAN備份的所有檔案複製到恢復Server上
指令碼如下,注意這裡使用了一個保證scp不會中斷的小技巧(sleep)
racdb1@testdb183 /orabak$ cat scp.sh
nohup scp -r oracle@172.193.192.26:/orabak/* /orabak &
sleep 10

2.修改源端生成的pfile檔案,去掉與RAC有關的內容。
將ASM格式的檔案路徑統統的修改成為檔案系統路徑的格式。
修改之前的pfile:
racdb1@testdb183 /oracle$ cat initracdb1.ora_backup_origin
racdb2.__db_cache_size=6543114240
racdb1.__db_cache_size=6056574976
racdb1.__java_pool_size=16777216
racdb2.__java_pool_size=16777216
racdb1.__large_pool_size=16777216
racdb2.__large_pool_size=16777216
racdb2.__shared_pool_size=1795162112
racdb1.__shared_pool_size=2281701376
racdb1.__streams_pool_size=0
racdb2.__streams_pool_size=0
*.audit_file_dest='/oracle/app/oracle/admin/racdb/adump'
*.background_dump_dest='/oracle/app/oracle/admin/racdb/bdump'
*.cluster_database_instances=2
*.cluster_database=true
*.compatible='10.2.0.3.0'
*.control_files='+ORADATA/racdb/controlfile/current.256.668538019'
*.core_dump_dest='/oracle/app/oracle/admin/racdb/cdump'
*.db_block_size=8192
*.db_create_file_dest='+ORADATA'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='racdb'
racdb2.instance_number=2
racdb1.instance_number=1
*.wbj_queue_processes=10
*.local_listener='local_listener_rac'
*.log_archive_dest_1='LOCATION=+ORADATA/racdb/'
*.log_archive_format='%t_%s_%r.arch'
*.open_cursors=300
*.pga_aggregate_target=2088763392
*.processes=800
*.remote_listener='LISTENERS_racdb'
*.remote_login_passwordfile='exclusive'
*.sessions=885
*.sga_max_size=5242880000
racdb1.sga_max_size=8388608000
racdb2.sga_max_size=8388608000
*.sga_target=1610612736
racdb1.sga_target=8388608000
racdb2.sga_target=8388608000
racdb2.thread=2
racdb1.thread=1
*.undo_management='AUTO'
racdb2.undo_tablespace='UNDOTBS2'
racdb1.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/oracle/app/oracle/admin/racdb/udump'

修改之後的pfile:
racdb1@testdb183 /oracle$ cat initracdb1.ora
*.audit_file_dest='/oracle/app/oracle/admin/racdb/adump'
*.background_dump_dest='/oracle/app/oracle/admin/racdb/bdump'
*.compatible='10.2.0.3.0'
*.control_files='/oracle/oradata/racdb/control01.ctl'
*.core_dump_dest='/oracle/app/oracle/admin/racdb/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='racdb'
*.wbj_queue_processes=10
*.log_archive_format='%t_%s_%r.arch'
*.open_cursors=300
*.pga_aggregate_target=2088763392
*.processes=800
*.remote_login_passwordfile='exclusive'
*.sessions=885
*.sga_max_size=524288000
*.sga_target=161061273
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/oracle/app/oracle/admin/racdb/udump'

3.根據上面引數檔案內容,在恢復Server上建立確實的目錄
$ mkdir -p /oracle/app/oracle/admin/racdb/cdump
$ mkdir -p /oracle/app/oracle/admin/racdb/udump
$ mkdir -p /oracle/app/oracle/admin/racdb/adump
$ mkdir -p /oracle/app/oracle/admin/racdb/bdump


4.登陸恢復端Server的RMAN命令列,設定成設定成生產RAC第一節點的dbid(這個需要提前確認好)
racdb1@testdb183 /oracle$ rman target /

Recovery Manager: Release 10.2.0.3.0 - Production on Mon Aug 24 20:32:13 2009

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database (not started)

RMAN> set dbid 3914926878

executing command: SET DBID

5.使用新pfile啟動例項到nomount狀態
RMAN> startup nomount pfile='/oracle/app/oracle/product/10.2.0/db_1/dbs/initracdb1.ora'

Oracle instance started

Total System Global Area     524288000 bytes

Fixed Size                     2074048 bytes
Variable Size                478153280 bytes
Database Buffers              37748736 bytes
Redo Buffers                   6311936 bytes


6.找到RMAN中控制檔案的的備份,恢復控制檔案      
RMAN> restore controlfile from '/orabak/week1/Saturday/c-3914926878-20090822-00';

Starting restore at 2009-08-24 20:33:59
using channel ORA_DISK_1

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
output filename=/oracle/oradata/racdb/control01.ctl
Finished restore at 2009-08-24 20:34:01

7.恢復完控制檔案之後,啟動資料庫到mount狀態
RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

8.根據生產資料庫對應的檔案目錄,將其修改到恢復Server的檔案路徑
需要到生產庫確定各個資料檔案的資訊
SQL> select name from v$datafile;

run  {
set newname for datafile'+ORADATA/racdb/datafile/smms.321.668623735' to '/oracle/oradata/racdb/smms.321.668623735';
set newname for datafile'+ORADATA/racdb/datafile/smmsdb.364.676804261' to '/oracle/oradata/racdb/smmsdb.364.676804261';
set newname for datafile'+ORADATA/racdb/datafile/gosd.329.668687127' to '/oracle/oradata/racdb/gosd.329.668687127';
set newname for datafile'+ORADATA/racdb/datafile/gosd.536.670002437' to '/oracle/oradata/racdb/gosd.536.670002437';
set newname for datafile'+ORADATA/racdb/datafile/gosdidx.333.668687233' to '/oracle/oradata/racdb/gosdidx.333.668687233';
set newname for datafile'+ORADATA/racdb/datafile/psdb_auib.283.676742737' to '/oracle/oradata/racdb/psdb_auib.283.676742737';
set newname for datafile'+ORADATA/racdb/datafile/psdb_smob_d.718.670098771' to '/oracle/oradata/racdb/psdb_smob_d.718.670098771';
set newname for datafile'+ORADATA/racdb/datafile/psdb_smob_d.284.670413675' to '/oracle/oradata/racdb/psdb_smob_d.284.670413675';
set newname for datafile'+ORADATA/racdb/datafile/psdb_smob_i.375.670413705' to '/oracle/oradata/racdb/psdb_smob_i.375.670413705';
set newname for datafile'+ORADATA/racdb/datafile/psdb_smob_i.666.670098753' to '/oracle/oradata/racdb/psdb_smob_i.666.670098753';
set newname for datafile'+ORADATA/racdb/datafile/psdb_odes.538.676804437' to '/oracle/oradata/racdb/psdb_odes.538.676804437';
set newname for datafile'+ORADATA/racdb/datafile/psdb_isn_d.409.676742365' to '/oracle/oradata/racdb/psdb_isn_d.409.676742365';
set newname for datafile'+ORADATA/racdb/datafile/psdb_isn_i.410.676742405' to '/oracle/oradata/racdb/psdb_isn_i.410.676742405';
set newname for datafile'+ORADATA/racdb/datafile/psdb_iise_d.301.668682663' to '/oracle/oradata/racdb/psdb_iise_d.301.668682663';
set newname for datafile'+ORADATA/racdb/datafile/psdb_iise_i.303.668682685' to '/oracle/oradata/racdb/psdb_iise_i.303.668682685';
set newname for datafile'+ORADATA/racdb/datafile/psdb_wbj_d.729.670098811' to '/oracle/oradata/racdb/psdb_wbj_d.729.670098811';
set newname for datafile'+ORADATA/racdb/datafile/psdb_wbj_i.652.670098831' to '/oracle/oradata/racdb/psdb_wbj_i.652.670098831';
set newname for datafile'+ORADATA/racdb/datafile/wbj.337.668615843' to '/oracle/oradata/racdb/wbj.337.668615843';
set newname for datafile'+ORADATA/racdb/datafile/perfstat.340.668616315' to '/oracle/oradata/racdb/perfstat.340.668616315';
set newname for datafile'+ORADATA/racdb/datafile/perfstat.626.670860931' to '/oracle/oradata/racdb/perfstat.626.670860931';
set newname for datafile'+ORADATA/racdb/datafile/sec.365.670416195' to '/oracle/oradata/racdb/sec.365.670416195';
set newname for datafile'+ORADATA/racdb/datafile/sec.280.668540851' to '/oracle/oradata/racdb/sec.280.668540851';
set newname for datafile'+ORADATA/racdb/datafile/sec_idx.282.668540885' to '/oracle/oradata/racdb/sec_idx.282.668540885';
set newname for datafile'+ORADATA/racdb/datafile/sysaux.263.668538117' to '/oracle/oradata/racdb/sysaux.263.668538117';
set newname for datafile'+ORADATA/racdb/datafile/system.261.668538061' to '/oracle/oradata/racdb/system.261.668538061';
set newname for datafile'+ORADATA/racdb/datafile/undotbs1.551.670001545' to '/oracle/oradata/racdb/undotbs1.551.670001545';
set newname for datafile'+ORADATA/racdb/datafile/undotbs1.594.670001207' to '/oracle/oradata/racdb/undotbs1.594.670001207';
set newname for datafile'+ORADATA/racdb/datafile/undotbs1.262.668538095' to '/oracle/oradata/racdb/undotbs1.262.668538095';
set newname for datafile'+ORADATA/racdb/datafile/undotbs2.544.670001557' to '/oracle/oradata/racdb/undotbs2.544.670001557';
set newname for datafile'+ORADATA/racdb/datafile/undotbs2.265.668538137' to '/oracle/oradata/racdb/undotbs2.265.668538137';
set newname for datafile'+ORADATA/racdb/datafile/undotbs2.562.670001221' to '/oracle/oradata/racdb/undotbs2.562.670001221';
set newname for datafile'+ORADATA/racdb/datafile/users.266.668538159' to '/oracle/oradata/racdb/users.266.668538159';
restore database ;
switch datafile all;
}

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 2009-08-24 20:40:25
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=872 devtype=DISK

channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00004 to /oracle/oradata/racdb/undotbs2.265.668538137
restoring datafile 00008 to /oracle/oradata/racdb/sec_idx.282.668540885
restoring datafile 00021 to /oracle/oradata/racdb/smmsdb.364.676804261
restoring datafile 00024 to /oracle/oradata/racdb/undotbs1.594.670001207
channel ORA_DISK_1: reading from backup piece /orabak/week1/Sunday/e1kms2ce_1_1_4545.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Sunday/e1kms2ce_1_1_4545.bak tag=DB0
channel ORA_DISK_1: restore complete, elapsed time: 00:01:06
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /oracle/oradata/racdb/system.261.668538061
restoring datafile 00006 to /oracle/oradata/racdb/sec.280.668540851
restoring datafile 00025 to /oracle/oradata/racdb/undotbs2.562.670001221
restoring datafile 00032 to /oracle/oradata/racdb/psdb_wbj_d.729.670098811
channel ORA_DISK_1: reading from backup piece /orabak/week1/Sunday/e2kms2ct_1_1_4546.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Sunday/e2kms2ct_1_1_4546.bak tag=DB0
channel ORA_DISK_1: restore complete, elapsed time: 00:01:15
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00002 to /oracle/oradata/racdb/undotbs1.262.668538095
restoring datafile 00014 to /oracle/oradata/racdb/smms.321.668623735
restoring datafile 00018 to /oracle/oradata/racdb/gosdidx.333.668687233
restoring datafile 00020 to /oracle/oradata/racdb/sec.365.670416195
channel ORA_DISK_1: reading from backup piece /orabak/week1/Sunday/dvkms2ce_1_1_4543.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Sunday/dvkms2ce_1_1_4543.bak tag=DB0
channel ORA_DISK_1: reading from backup piece /orabak/week1/Sunday/dvkms2ce_2_1_4543.bak
channel ORA_DISK_1: restored backup piece 2
piece handle=/orabak/week1/Sunday/dvkms2ce_2_1_4543.bak tag=DB0
channel ORA_DISK_1: restore complete, elapsed time: 00:01:40
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00007 to /oracle/oradata/racdb/psdb_isn_d.409.676742365
restoring datafile 00011 to /oracle/oradata/racdb/psdb_smob_i.375.670413705
restoring datafile 00019 to /oracle/oradata/racdb/psdb_auib.283.676742737
restoring datafile 00030 to /oracle/oradata/racdb/psdb_smob_i.666.670098753
channel ORA_DISK_1: reading from backup piece /orabak/week1/Sunday/e0kms2ce_1_1_4544.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Sunday/e0kms2ce_1_1_4544.bak tag=DB0
channel ORA_DISK_1: reading from backup piece /orabak/week1/Sunday/e0kms2ce_2_1_4544.bak
channel ORA_DISK_1: restored backup piece 2
piece handle=/orabak/week1/Sunday/e0kms2ce_2_1_4544.bak tag=DB0
channel ORA_DISK_1: restore complete, elapsed time: 00:01:50
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00005 to /oracle/oradata/racdb/users.266.668538159
restoring datafile 00013 to /oracle/oradata/racdb/perfstat.340.668616315
restoring datafile 00026 to /oracle/oradata/racdb/undotbs1.551.670001545
restoring datafile 00034 to /oracle/oradata/racdb/perfstat.626.670860931
channel ORA_DISK_1: reading from backup piece /orabak/week1/Sunday/e5kms2ep_1_1_4549.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Sunday/e5kms2ep_1_1_4549.bak tag=DB0
channel ORA_DISK_1: restore complete, elapsed time: 00:00:46
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00009 to /oracle/oradata/racdb/psdb_isn_i.410.676742405
restoring datafile 00010 to /oracle/oradata/racdb/psdb_smob_d.284.670413675
restoring datafile 00028 to /oracle/oradata/racdb/gosd.536.670002437
restoring datafile 00033 to /oracle/oradata/racdb/psdb_wbj_i.652.670098831
channel ORA_DISK_1: reading from backup piece /orabak/week1/Sunday/e3kms2e8_1_1_4547.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Sunday/e3kms2e8_1_1_4547.bak tag=DB0
channel ORA_DISK_1: reading from backup piece /orabak/week1/Sunday/e3kms2e8_2_1_4547.bak
channel ORA_DISK_1: restored backup piece 2
piece handle=/orabak/week1/Sunday/e3kms2e8_2_1_4547.bak tag=DB0
channel ORA_DISK_1: restore complete, elapsed time: 00:01:23
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00003 to /oracle/oradata/racdb/sysaux.263.668538117
restoring datafile 00016 to /oracle/oradata/racdb/psdb_iise_i.303.668682685
restoring datafile 00017 to /oracle/oradata/racdb/gosd.329.668687127
restoring datafile 00027 to /oracle/oradata/racdb/undotbs2.544.670001557
channel ORA_DISK_1: reading from backup piece /orabak/week1/Sunday/e4kms2e9_1_1_4548.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Sunday/e4kms2e9_1_1_4548.bak tag=DB0
channel ORA_DISK_1: reading from backup piece /orabak/week1/Sunday/e4kms2e9_2_1_4548.bak
channel ORA_DISK_1: restored backup piece 2
piece handle=/orabak/week1/Sunday/e4kms2e9_2_1_4548.bak tag=DB0
channel ORA_DISK_1: restore complete, elapsed time: 00:01:42
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00012 to /oracle/oradata/racdb/wbj.337.668615843
restoring datafile 00015 to /oracle/oradata/racdb/psdb_iise_d.301.668682663
restoring datafile 00022 to /oracle/oradata/racdb/psdb_odes.538.676804437
restoring datafile 00031 to /oracle/oradata/racdb/psdb_smob_d.718.670098771
channel ORA_DISK_1: reading from backup piece /orabak/week1/Sunday/e6kms2f9_1_1_4550.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Sunday/e6kms2f9_1_1_4550.bak tag=DB0
channel ORA_DISK_1: reading from backup piece /orabak/week1/Sunday/e6kms2f9_2_1_4550.bak
channel ORA_DISK_1: restored backup piece 2
piece handle=/orabak/week1/Sunday/e6kms2f9_2_1_4550.bak tag=DB0
channel ORA_DISK_1: restore complete, elapsed time: 00:01:41
Finished restore at 2009-08-24 20:51:50

datafile 14 switched to datafile copy
input datafile copy recid=57 stamp=695767910 filename=/oracle/oradata/racdb/smms.321.668623735
datafile 21 switched to datafile copy
input datafile copy recid=58 stamp=695767910 filename=/oracle/oradata/racdb/smmsdb.364.676804261
datafile 17 switched to datafile copy
input datafile copy recid=59 stamp=695767910 filename=/oracle/oradata/racdb/gosd.329.668687127
datafile 28 switched to datafile copy
input datafile copy recid=60 stamp=695767910 filename=/oracle/oradata/racdb/gosd.536.670002437
datafile 18 switched to datafile copy
input datafile copy recid=61 stamp=695767910 filename=/oracle/oradata/racdb/gosdidx.333.668687233
datafile 19 switched to datafile copy
input datafile copy recid=62 stamp=695767910 filename=/oracle/oradata/racdb/psdb_auib.283.676742737
datafile 31 switched to datafile copy
input datafile copy recid=63 stamp=695767910 filename=/oracle/oradata/racdb/psdb_smob_d.718.670098771
datafile 10 switched to datafile copy
input datafile copy recid=64 stamp=695767911 filename=/oracle/oradata/racdb/psdb_smob_d.284.670413675
datafile 11 switched to datafile copy
input datafile copy recid=65 stamp=695767911 filename=/oracle/oradata/racdb/psdb_smob_i.375.670413705
datafile 30 switched to datafile copy
input datafile copy recid=66 stamp=695767911 filename=/oracle/oradata/racdb/psdb_smob_i.666.670098753
datafile 22 switched to datafile copy
input datafile copy recid=67 stamp=695767911 filename=/oracle/oradata/racdb/psdb_odes.538.676804437
datafile 7 switched to datafile copy
input datafile copy recid=68 stamp=695767911 filename=/oracle/oradata/racdb/psdb_isn_d.409.676742365
datafile 9 switched to datafile copy
input datafile copy recid=69 stamp=695767911 filename=/oracle/oradata/racdb/psdb_isn_i.410.676742405
datafile 15 switched to datafile copy
input datafile copy recid=70 stamp=695767911 filename=/oracle/oradata/racdb/psdb_iise_d.301.668682663
datafile 16 switched to datafile copy
input datafile copy recid=71 stamp=695767911 filename=/oracle/oradata/racdb/psdb_iise_i.303.668682685
datafile 32 switched to datafile copy
input datafile copy recid=72 stamp=695767911 filename=/oracle/oradata/racdb/psdb_wbj_d.729.670098811
datafile 33 switched to datafile copy
input datafile copy recid=73 stamp=695767911 filename=/oracle/oradata/racdb/psdb_wbj_i.652.670098831
datafile 12 switched to datafile copy
input datafile copy recid=74 stamp=695767911 filename=/oracle/oradata/racdb/wbj.337.668615843
datafile 13 switched to datafile copy
input datafile copy recid=75 stamp=695767911 filename=/oracle/oradata/racdb/perfstat.340.668616315
datafile 34 switched to datafile copy
input datafile copy recid=76 stamp=695767911 filename=/oracle/oradata/racdb/perfstat.626.670860931
datafile 20 switched to datafile copy
input datafile copy recid=77 stamp=695767911 filename=/oracle/oradata/racdb/sec.365.670416195
datafile 6 switched to datafile copy
input datafile copy recid=78 stamp=695767911 filename=/oracle/oradata/racdb/sec.280.668540851
datafile 8 switched to datafile copy
input datafile copy recid=79 stamp=695767911 filename=/oracle/oradata/racdb/sec_idx.282.668540885
datafile 3 switched to datafile copy
input datafile copy recid=80 stamp=695767911 filename=/oracle/oradata/racdb/sysaux.263.668538117
datafile 1 switched to datafile copy
input datafile copy recid=81 stamp=695767911 filename=/oracle/oradata/racdb/system.261.668538061
datafile 26 switched to datafile copy
input datafile copy recid=82 stamp=695767911 filename=/oracle/oradata/racdb/undotbs1.551.670001545
datafile 24 switched to datafile copy
input datafile copy recid=83 stamp=695767911 filename=/oracle/oradata/racdb/undotbs1.594.670001207
datafile 2 switched to datafile copy
input datafile copy recid=84 stamp=695767911 filename=/oracle/oradata/racdb/undotbs1.262.668538095
datafile 27 switched to datafile copy
input datafile copy recid=85 stamp=695767911 filename=/oracle/oradata/racdb/undotbs2.544.670001557
datafile 4 switched to datafile copy
input datafile copy recid=86 stamp=695767911 filename=/oracle/oradata/racdb/undotbs2.265.668538137
datafile 25 switched to datafile copy
input datafile copy recid=87 stamp=695767911 filename=/oracle/oradata/racdb/undotbs2.562.670001221
datafile 5 switched to datafile copy
input datafile copy recid=88 stamp=695767911 filename=/oracle/oradata/racdb/users.266.668538159

RMAN>

9.sqlplus下,修改聯機日誌的路徑和名稱。目的是防止在open resetlogs時報錯
racdb1@testdb183 /oracle$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on Mon Aug 24 21:01:40 2009

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options

SQL> alter database rename file '+ORADATA/racdb/onlinelog/group_1.257.668538023' to '/oracle/oradata/racdb/group_1.257.668538023';
SQL> alter database rename file '+ORADATA/racdb/onlinelog/group_2.258.668538033' to '/oracle/oradata/racdb/group_2.258.668538033';
SQL> alter database rename file '+ORADATA/racdb/onlinelog/group_3.259.668538043' to '/oracle/oradata/racdb/group_3.259.668538043';
SQL> alter database rename file '+ORADATA/racdb/onlinelog/group_4.260.668538053' to '/oracle/oradata/racdb/group_4.260.668538053';
SQL> alter database rename file '+ORADATA/racdb/onlinelog/group_5.267.668539011' to '/oracle/oradata/racdb/group_5.267.668539011';
SQL> alter database rename file '+ORADATA/racdb/onlinelog/group_6.268.668539021' to '/oracle/oradata/racdb/group_6.268.668539021';
SQL> alter database rename file '+ORADATA/racdb/onlinelog/group_7.269.668539031' to '/oracle/oradata/racdb/group_7.269.668539031';
SQL> alter database rename file '+ORADATA/racdb/onlinelog/group_8.270.668539041' to '/oracle/oradata/racdb/group_8.270.668539041';

10.回到RMAN命令列,進行recover資料庫
racdb1@testdb183 /oracle$ rman target /

Recovery Manager: Release 10.2.0.3.0 - Production on Mon Aug 24 21:02:26 2009

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: racdb (DBID=3914926878, not open)

RMAN>

RMAN> recover database;

Starting recover at 2009-08-24 21:02:58
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=870 devtype=DISK
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00002: /oracle/oradata/racdb/undotbs1.262.668538095
destination for restore of datafile 00014: /oracle/oradata/racdb/smms.321.668623735
destination for restore of datafile 00018: /oracle/oradata/racdb/gosdidx.333.668687233
destination for restore of datafile 00020: /oracle/oradata/racdb/sec.365.670416195
channel ORA_DISK_1: reading from backup piece /orabak/week1/Saturday/gpknbsk7_1_1_4633.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Saturday/gpknbsk7_1_1_4633.bak tag=DB1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00007: /oracle/oradata/racdb/psdb_isn_d.409.676742365
destination for restore of datafile 00011: /oracle/oradata/racdb/psdb_smob_i.375.670413705
destination for restore of datafile 00019: /oracle/oradata/racdb/psdb_auib.283.676742737
destination for restore of datafile 00030: /oracle/oradata/racdb/psdb_smob_i.666.670098753
channel ORA_DISK_1: reading from backup piece /orabak/week1/Saturday/gqknbsk7_1_1_4634.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Saturday/gqknbsk7_1_1_4634.bak tag=DB1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:05
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00004: /oracle/oradata/racdb/undotbs2.265.668538137
destination for restore of datafile 00008: /oracle/oradata/racdb/sec_idx.282.668540885
destination for restore of datafile 00021: /oracle/oradata/racdb/smmsdb.364.676804261
destination for restore of datafile 00024: /oracle/oradata/racdb/undotbs1.594.670001207
channel ORA_DISK_1: reading from backup piece /orabak/week1/Saturday/grknbsk7_1_1_4635.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Saturday/grknbsk7_1_1_4635.bak tag=DB1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00003: /oracle/oradata/racdb/sysaux.263.668538117
destination for restore of datafile 00016: /oracle/oradata/racdb/psdb_iise_i.303.668682685
destination for restore of datafile 00017: /oracle/oradata/racdb/gosd.329.668687127
destination for restore of datafile 00027: /oracle/oradata/racdb/undotbs2.544.670001557
channel ORA_DISK_1: reading from backup piece /orabak/week1/Saturday/guknbsm8_1_1_4638.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Saturday/guknbsm8_1_1_4638.bak tag=DB1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:46
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: /oracle/oradata/racdb/system.261.668538061
destination for restore of datafile 00006: /oracle/oradata/racdb/sec.280.668540851
destination for restore of datafile 00025: /oracle/oradata/racdb/undotbs2.562.670001221
destination for restore of datafile 00032: /oracle/oradata/racdb/psdb_wbj_d.729.670098811
channel ORA_DISK_1: reading from backup piece /orabak/week1/Saturday/gsknbsm8_1_1_4636.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Saturday/gsknbsm8_1_1_4636.bak tag=DB1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00009: /oracle/oradata/racdb/psdb_isn_i.410.676742405
destination for restore of datafile 00010: /oracle/oradata/racdb/psdb_smob_d.284.670413675
destination for restore of datafile 00028: /oracle/oradata/racdb/gosd.536.670002437
destination for restore of datafile 00033: /oracle/oradata/racdb/psdb_wbj_i.652.670098831
channel ORA_DISK_1: reading from backup piece /orabak/week1/Saturday/gtknbsm8_1_1_4637.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Saturday/gtknbsm8_1_1_4637.bak tag=DB1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:36
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00005: /oracle/oradata/racdb/users.266.668538159
destination for restore of datafile 00013: /oracle/oradata/racdb/perfstat.340.668616315
destination for restore of datafile 00026: /oracle/oradata/racdb/undotbs1.551.670001545
destination for restore of datafile 00034: /oracle/oradata/racdb/perfstat.626.670860931
channel ORA_DISK_1: reading from backup piece /orabak/week1/Saturday/gvknbsnm_1_1_4639.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Saturday/gvknbsnm_1_1_4639.bak tag=DB1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:08
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00012: /oracle/oradata/racdb/wbj.337.668615843
destination for restore of datafile 00015: /oracle/oradata/racdb/psdb_iise_d.301.668682663
destination for restore of datafile 00022: /oracle/oradata/racdb/psdb_odes.538.676804437
destination for restore of datafile 00031: /oracle/oradata/racdb/psdb_smob_d.718.670098771
channel ORA_DISK_1: reading from backup piece /orabak/week1/Saturday/h0knbsnm_1_1_4640.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Saturday/h0knbsnm_1_1_4640.bak tag=DB1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:36

starting media recovery

channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=2 sequence=4105
channel ORA_DISK_1: reading from backup piece /orabak/week1/Saturday/h1knbson_1_1_4641.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Saturday/h1knbson_1_1_4641.bak tag=DB1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=5126
channel ORA_DISK_1: reading from backup piece /orabak/week1/Saturday/h2knbson_1_1_4642.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Saturday/h2knbson_1_1_4642.bak tag=DB1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
archive log filename=/oracle/app/oracle/product/10.2.0/db_1/dbs/arch1_5126_668538014.arch thread=1 sequence=5126
archive log filename=/oracle/app/oracle/product/10.2.0/db_1/dbs/arch2_4105_668538014.arch thread=2 sequence=4105
unable to find archive log
archive log thread=2 sequence=4106
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 08/24/2009 21:07:45
RMAN-06054: media recovery requesting unknown log: thread 2 seq 4106 lowscn 569488757

11.以open resetlogs的方式開啟資料庫,完成整個RMAN的恢復
RMAN> alter database open resetlogs;

database opened

RMAN>

12.驗證
登陸資料庫,檢查版本資訊。
sys@racdb> select * from v$version;

BANNER
----------------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
PL/SQL Release 10.2.0.3.0 - Production
CORE    10.2.0.3.0      Production
TNS for Linux: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production

13.後續工作還有很多,如一些引數的調整,這裡著重說明一下:需要全新的建立以下臨時檔案。更多資訊請參考alert警告檔案
透過RMAN恢復過來的臨時檔案是不可用的,需要處理一下。
報錯資訊如下:
sys@racdb> select tablespace_name,file_name,bytes/1024/1024 M from dba_temp_files;
select tablespace_name,file_name,bytes/1024/1024 M from dba_temp_files
                                                        *
ERROR at line 1:
ORA-01157: cannot identify/lock data file 201 - see DBWR trace file
ORA-01110: data file 201: '+ORADATA/racdb/tempfile/temp.264.668538129'

處理臨時檔案:
先建立一個臨時表空間temp1
sys@racdb> create temporary tablespace temp1 tempfile '/oracle/oradata/racdb/temp01.dbf' size 512m reuse autoextend on next 1m maxsize unlimited;

Tablespace created.

將預設的臨時表空間指定到這個新建的表空間上
sys@racdb> alter database default temporary tablespace temp1;

Database altered.

刪除透過RMAN回覆過來的臨時檔案。完成臨時檔案的整個處理過程。
sys@racdb> drop tablespace temp including contents and datafiles;

Tablespace dropped.

sys@racdb> col FILE_NAME for a40
sys@racdb> select tablespace_name,file_name,bytes/1024/1024 M from dba_temp_files;

TABLESPACE_NAME   FILE_NAME                             M
----------------- --------------------------------- -----
TEMP1             /oracle/oradata/racdb/temp01.dbf    512

14.到此整個RAC到異地單機的RMAN恢復任務已經完成。
注:這裡只是簡單的介紹一下恢復的過程,每一個細節都可以細細的斟酌,加以考量。

DBA的永恆的使命:“恢復資料庫”!

Goodluck everyone.

-- The End --

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/519536/viewspace-613110/,如需轉載,請註明出處,否則將追究法律責任。

相關文章