RAC從帶庫到單例項的恢復

531968912發表於2017-12-19

備份軟體:HP-DP
原庫:生產RAC 2節點,IP:192.168.160.2和192.168.160.3
目標庫:單例項庫,IP:192.168.160.129
0. 準備環境
    配置好目標伺服器的監聽,讓備份伺服器可以連結到目標伺服器。
1. 恢復控制檔案
 對於備份軟體恢復控制檔案,是直接將其恢復到目標伺服器的os上的,一般是在var目錄下。
 登陸備份伺服器,點開DP軟體,選擇RESTORE,找到原庫的備份。然後在SOURCE選擇"CONTROL FILE FROM DP MANAGED BACKUP",在OPTIONS中配置:Clinet=恢復的目標伺服器,user name=oracle(目標伺服器的oracle軟體的os使用者),User group=oinstall,Restore mode=Normal,Restore unitl=selected time,我這裡選擇的是20131227 22:00點。在Settings中配置目標伺服器的sys密碼和service_name。然後點選restore即可。隨後去目標伺服器(160.129)的/var/opt/omni/tmp/下找新產生的控制檔案。
備註:Client這裡要選擇在備份伺服器中配置的192.168.160.129所對應的別名,這裡的別名一般都是主機名。
2. 恢復spfile
 現在已經有控制檔案,其實引數檔案,我們自己造一個就行,但如果想恢復的話,也是可以的。首先自己造一個引數檔案,或者直接startup nomount force也行。隨後恢復控制檔案,並啟動到mount,然後恢復spfile,具體如下:
SQL> startup nomount force
RMAN> restore controlfile from '/var/opt/omni/tmp/ctrl_ORCLDB.dbf';
RMAN> alter database mount;
RMAN> run {
 allocate channel 'dev_0' type 'sbt_tape'
 parms 'SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.so,ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=mubiao_dbname,OB2BARLIST=mubiao_dbname)';
send device type 'sbt_tape' 'OB2BARHOSTNAME=yuanku_hostname';
 restore spfile to '/home/orazkf/spfileORCL1.ora' from autobackup;
release channel 'dev_0';
 }
released channel: ORA_DISK_1
allocated channel: dev_0
channel dev_0: SID=893 instance=ORCL1 device type=SBT_TAPE
channel dev_0: Data Protector A.06.20/PHSS_42081/DPSOL_00448/DPLNX_00154
sent command to channel: dev_0
Starting restore at 07-JAN-14
channel dev_0: looking for AUTOBACKUP on day: 20140107
channel dev_0: AUTOBACKUP found: c-3400117082-20140107-00
channel dev_0: restoring spfile from AUTOBACKUP c-3400117082-20140107-00
channel dev_0: SPFILE restore from AUTOBACKUP complete
Finished restore at 07-JAN-14
released channel: dev_0
  現在可以用恢復的spfile和控制檔案,將資料庫啟動到mount狀態。但需要注意的是,需要修改歸檔目錄,dump目錄等。
3. 恢復資料檔案
 對於rac到單例項的恢復,肯定是要做set newname的,因為rac的資料檔案都存在在磁碟組裡,而本來都是在fs中。
RMAN>run {
allocate channel 'dev_0' type 'sbt_tape'
parms 'SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.so,ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=mubiao_dbname,OB2BARLIST=mubiao_dbname)';
send device type 'sbt_tape' 'OB2BARHOSTNAME=yuanku_hostname';
set newname for datafile  1 to '/pmsdb/oradata/ORCL1/data1/system.345.760169914';
set newname for datafile 2 to '/pmsdb/oradata/ORCL1/data1/sysaux.564.760187953';
set newname for datafile 3 to '/pmsdb/oradata/ORCL1/data1/undotbs1.124.760889985';
set newname for datafile 4 to '/pmsdb/oradata/ORCL1/data1/undotbs2.456.760990001';
set newname for datafile 5 to '/pmsdb/oradata/ORCL1/data1/users.167.760190409';
set newname for datafile 6 to '/pmsdb/oradata/ORCL1/data1/undotbs1.281.760310569';
set newname for datafile 7 to '/pmsdb/oradata/ORCL1/data1/undotbs2.282.760110751';
set newname for datafile 24 to '/pmsdb/oradata/ORCL1/data1/ORCLrddata101.dbf';
set newname for datafile 25 to '/pmsdb/oradata/ORCL1/data1/ORCLrddata102.dbf';
set newname for datafile 26 to '/pmsdb/oradata/ORCL1/data1/ORCLrddata103.dbf';
set newname for datafile 27 to '/pmsdb/oradata/ORCL1/data1/ORCLrddata104.dbf';
set newname for datafile 28 to '/pmsdb/oradata/ORCL1/data1/ORCLrddata105.dbf';
set newname for datafile 29 to '/pmsdb/oradata/ORCL1/data1/ORCLrddata106.dbf';
set newname for datafile 30 to '/pmsdb/oradata/ORCL1/data1/ORCLrddata107.dbf';
set newname for datafile 31 to '/pmsdb/oradata/ORCL1/data1/ORCLrddata108.dbf';
set newname for datafile 32 to '/pmsdb/oradata/ORCL1/data1/ORCLrdindex101.dbf';
set newname for datafile 33 to '/pmsdb/oradata/ORCL1/data1/ORCLrdindex102.dbf';
set newname for datafile 34 to '/pmsdb/oradata/ORCL1/data1/ORCLrdindex103.dbf';
set newname for datafile 35 to '/pmsdb/oradata/ORCL1/data1/ORCLrdindex104.dbf';
set newname for datafile 36 to '/pmsdb/oradata/ORCL1/data1/ORCLrdindex105.dbf';
set newname for datafile 37 to '/pmsdb/oradata/ORCL1/data1/ORCLrdindex106.dbf';
set newname for datafile 38 to '/pmsdb/oradata/ORCL1/data1/ORCLrdindex107.dbf';
set newname for datafile 39 to '/pmsdb/oradata/ORCL1/data1/ORCLrdindex108.dbf';
restore database;
switch datafile all;
release channel 'dev_0';
}
 靜靜的等待很久,最後恢復成功。
4. 恢復歸檔檔案
RMAN>run {
 allocate channel 'dev_0' type 'sbt_tape'
 parms 'SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.so,ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORCL1,OB2BARLIST=ORCL1)';
  send device type 'sbt_tape' 'OB2BARHOSTNAME=yuanku_hostname';
 restore archivelog time between "to_date('2013-12-27 22:00:00','YYYY-MM-DD HH24:MI:SS')" and "to_date('2013-12-27 22:30:00','YYYY-MM-DD HH24:MI:SS')";
  release channel 'dev_0';     
 }
由於我在此之前已經設定好新的歸檔目錄,所以待恢復歸檔完畢後,去我的歸檔目錄下檢視,就會發現有幾個歸檔檔案。
5 執行recover
RMAN>recover database;
6 執行open resetlogs
 再此之前需要設定好閃回恢復區的大小,因為此時oracle可能會將新的onlinelog放在你的閃回恢復區中,所有要設定好大小正好,才可以啟動成功。

 

 


 

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

相關文章