溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

RAC怎么進(jìn)行從帶庫到單實(shí)例的恢復(fù)

發(fā)布時(shí)間:2021-11-30 16:19:21 來源:億速云 閱讀:215 作者:柒染 欄目:關(guān)系型數(shù)據(jù)庫

本篇文章給大家分享的是有關(guān)RAC怎么進(jìn)行從帶庫到單實(shí)例的恢復(fù),小編覺得挺實(shí)用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。

備份軟件:HP-DP
原庫:生產(chǎn)RAC 2節(jié)點(diǎn),IP:192.168.160.2和192.168.160.3
目標(biāo)庫:?jiǎn)螌?shí)例庫,IP:192.168.160.129
0. 準(zhǔn)備環(huán)境
    配置好目標(biāo)服務(wù)器的監(jiān)聽,讓備份服務(wù)器可以鏈接到目標(biāo)服務(wù)器。
1. 恢復(fù)控制文件
 對(duì)于備份軟件恢復(fù)控制文件,是直接將其恢復(fù)到目標(biāo)服務(wù)器的os上的,一般是在var目錄下。
 登陸備份服務(wù)器,點(diǎn)開DP軟件,選擇RESTORE,找到原庫的備份。然后在SOURCE選擇"CONTROL FILE FROM DP MANAGED BACKUP",在OPTIONS中配置:Clinet=恢復(fù)的目標(biāo)服務(wù)器,user name=oracle(目標(biāo)服務(wù)器的oracle軟件的os用戶),User group=oinstall,Restore mode=Normal,Restore unitl=selected time,我這里選擇的是20131227 22:00點(diǎn)。在Settings中配置目標(biāo)服務(wù)器的sys密碼和service_name。然后點(diǎn)擊restore即可。隨后去目標(biāo)服務(wù)器(160.129)的/var/opt/omni/tmp/下找新產(chǎn)生的控制文件。
備注:Client這里要選擇在備份服務(wù)器中配置的192.168.160.129所對(duì)應(yīng)的別名,這里的別名一般都是主機(jī)名。
2. 恢復(fù)spfile
 現(xiàn)在已經(jīng)有控制文件,其實(shí)參數(shù)文件,我們自己造一個(gè)就行,但如果想恢復(fù)的話,也是可以的。首先自己造一個(gè)參數(shù)文件,或者直接startup nomount force也行。隨后恢復(fù)控制文件,并啟動(dòng)到mount,然后恢復(fù)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
  現(xiàn)在可以用恢復(fù)的spfile和控制文件,將數(shù)據(jù)庫啟動(dòng)到mount狀態(tài)。但需要注意的是,需要修改歸檔目錄,dump目錄等。
3. 恢復(fù)數(shù)據(jù)文件
 對(duì)于rac到單實(shí)例的恢復(fù),肯定是要做set newname的,因?yàn)閞ac的數(shù)據(jù)文件都存在在磁盤組里,而本來都是在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';
}
 靜靜的等待很久,最后恢復(fù)成功。
4. 恢復(fù)歸檔文件
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';     
 }
由于我在此之前已經(jīng)設(shè)置好新的歸檔目錄,所以待恢復(fù)歸檔完畢后,去我的歸檔目錄下查看,就會(huì)發(fā)現(xiàn)有幾個(gè)歸檔文件。
5 執(zhí)行recover
RMAN>recover database;
6 執(zhí)行open resetlogs
 再此之前需要設(shè)置好閃回恢復(fù)區(qū)的大小,因?yàn)榇藭r(shí)oracle可能會(huì)將新的onlinelog放在你的閃回恢復(fù)區(qū)中,所有要設(shè)置好大小正好,才可以啟動(dòng)成功。

以上就是RAC怎么進(jìn)行從帶庫到單實(shí)例的恢復(fù),小編相信有部分知識(shí)點(diǎn)可能是我們?nèi)粘9ぷ鲿?huì)見到或用到的。希望你能通過這篇文章學(xué)到更多知識(shí)。更多詳情敬請(qǐng)關(guān)注億速云行業(yè)資訊頻道。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

rac
AI