溫馨提示×

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

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

NBU Linux上oracle單實(shí)例恢復(fù)到單實(shí)例

發(fā)布時(shí)間:2020-07-01 10:27:52 來(lái)源:網(wǎng)絡(luò) 閱讀:552 作者:春秋小記 欄目:關(guān)系型數(shù)據(jù)庫(kù)

注意:本文檔操作系統(tǒng)環(huán)境以Linux為主,假設(shè)要恢復(fù)金融數(shù)據(jù)庫(kù);

本文當(dāng)主要以數(shù)據(jù)庫(kù)恢復(fù)為主,操作系統(tǒng)安裝、數(shù)據(jù)庫(kù)安裝配置和NBU客戶端安裝配置忽略;

要恢復(fù)的數(shù)據(jù)庫(kù)信息:

1. 確定要恢復(fù)的數(shù)據(jù)庫(kù)信息,如果數(shù)據(jù)庫(kù)和操作系統(tǒng)可以正常訪問(wèn),則可以登錄數(shù)據(jù)庫(kù)和操作系統(tǒng)查看和恢復(fù)信息相關(guān)的信息,如果數(shù)據(jù)庫(kù)甚至是操作系統(tǒng)不可訪問(wèn),則可以參考《oracle數(shù)據(jù)庫(kù)信息收集》文檔,里面記錄了oracle數(shù)據(jù)庫(kù)恢復(fù)的相關(guān)信息;

2. 為了確保恢復(fù)后的數(shù)據(jù)庫(kù)可以盡快使用,盡量減少應(yīng)用程序的修改,恢復(fù)完以后修改主機(jī)IP地址和原數(shù)據(jù)庫(kù)地址保持一致;

準(zhǔn)備環(huán)境:

1. 根據(jù)《oracle數(shù)據(jù)庫(kù)信息收集》文檔,安裝操作系統(tǒng)和數(shù)據(jù)庫(kù)軟件,其中操作系統(tǒng)的版本盡量相同,數(shù)據(jù)庫(kù)版本則需要一致;

2. 根據(jù)《oracle數(shù)據(jù)庫(kù)信息收集》文檔,掛載合適的存儲(chǔ),主要是存儲(chǔ)的大小,所掛載的存儲(chǔ)不可小于要恢復(fù)的數(shù)據(jù)庫(kù)總?cè)萘看笮?,并配置合適的ASM磁盤(pán)組,磁盤(pán)組的大小和名稱(chēng)建議原來(lái)一樣,磁盤(pán)組的容量可以大于原磁盤(pán)組;

3. 在客戶端安裝好NBU client,并保證通過(guò)NBU client可以正常訪問(wèn)備份文件;

恢復(fù)步驟:
恢復(fù)文件說(shuō)明:

在操作系統(tǒng)上執(zhí)行如下命令:

/usr/openv/netbackup/bin/bplist -C fxzmd -t 4 -l -R /

列出數(shù)據(jù)庫(kù)備份信息,部分信息如下:

-rw-rw---- oracle oinstall 12058624 Aug 26 2014 /c-1492422082-20140826-02

-rw-rw---- oracle oinstall 11796480 Aug 26 2014 /cntrl_365_1_856616015

-rw-rw---- oracle oinstall 12058624 Aug 26 2014 /c-1492422082-20140826-01

-rw-rw---- oracle oinstall 262144 Aug 26 2014 /al_363_1_856615969

-rw-rw---- oracle oinstall 45088768 Aug 26 2014 /al_362_1_856615942

-rw-rw---- oracle oinstall 52166656 Aug 26 2014 /al_361_1_856615942

-rw-rw---- oracle oinstall 12058624 Aug 26 2014 /c-1492422082-20140826-00

-rw-rw---- oracle oinstall 10640128K Aug 26 2014 /bk_358_1_856615605

-rw-rw---- oracle oinstall 9893632K Aug 26 2014 /bk_359_1_856615605

-rw-rw---- oracle oinstall 12058624 Aug 25 19:19 /c-1492422082-20140825-02

信息說(shuō)明:

cntrl_365_1_856616015 表示控制文件

c-1492422082-20140826-01 表示參數(shù)文件

al_362_1_856615942 表示歸檔文件

bk_359_1_856615605 表示數(shù)據(jù)文件

c-1492422082-20140826-01 表示dbid

恢復(fù)spfile文件:

本文檔選取 c-1492422082-20140826-02作為恢復(fù)對(duì)象,設(shè)置數(shù)據(jù)庫(kù)DBID,并把數(shù)據(jù)庫(kù)啟動(dòng)到nomount狀態(tài):

[oracle@FXZMD ~]$ rman target /

Recovery Manager: Release 10.2.0.5.0 - Production on Tue Aug 26 12:47:21 2014

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

connected to target database (not started)

RMAN> set DBID=1492422082

executing command: SET DBID

RMAN> startup nomount

startup failed: ORA-01078: failure in processing system parameters

LRM-00109: could not open parameter file '/app/oracle/product/10.2/db_1/dbs/initREPORT.ora'

starting Oracle instance without parameter file for retrival of spfile

Oracle instance started

Total System Global Area 159383552 bytes

Fixed Size 2094736 bytes

Variable Size 71305584 bytes

Database Buffers 79691776 bytes

Redo Buffers 6291456 bytes

RMAN> run {

2> allocate channel c1 type 'SBT_TAPE';

3> send 'NB_ORA_SERV=NBUServer,NB_ORA_CLIENT= FXZMD';

4> restore spfile from 'c-1492422082-20140826-02';

5> release channel c1;

6> }

using target database control file instead of recovery catalog

allocated channel: c1

channel c1: sid=35 devtype=SBT_TAPE

channel c1: Veritas NetBackup for Oracle - Release 7.5 (2012020801)

sent command to channel: c1

Starting restore at 27-AUG-14

channel c1: autobackup found: c-1492422082-20140826-02

channel c1: SPFILE restore from autobackup complete

Finished restore at 27-AUG-14

released channel: c1

RMAN>

Spfile

創(chuàng)建pfile 修改pfile文件:

SQL> create pfile='/home/oracle/initfxzmd.ora' from spfile;

File created.

編輯pfile:

根據(jù)$ORACLE_BASE、$ORACLE_HOME創(chuàng)建相應(yīng)的目錄:

mkdir –p /app/oracle/admin/fxzmd/adump

mkdir –p /app/oracle/admin/fxzmd/bdump

mkdir –p /app/oracle/admin/fxzmd/cdump

mkdir –p /app/oracle/admin/fxzmd/udump

用修改過(guò)的pfile 創(chuàng)建spfile:

關(guān)閉數(shù)據(jù)庫(kù):

SQL> shutdown immediate

ORA-01507: database not mounted

ORACLE instance shut down.

用新的pfile啟動(dòng)數(shù)據(jù)庫(kù)到nomount:

SQL> startup nomount pfile='/home/oracle/initfxzmd.ora';

ORACLE instance started.

Total System Global Area 4.2446E+10 bytes

Fixed Size 2174824 bytes

Variable Size 3422552216 bytes

Database Buffers 3.9007E+10 bytes

Redo Buffers 14602240 bytes

SQL>

創(chuàng)建spfile:

SQL> create spfile from pfile='/home/oracle/initfxzmd.ora';

File created.

關(guān)閉數(shù)據(jù)庫(kù)并啟動(dòng)數(shù)據(jù)庫(kù)到nomount狀態(tài):

SQL> shutdown immediate

ORA-01507: database not mounted

ORACLE instance shut down.

SQL> startup nomount

ORACLE instance started.

Total System Global Area 4.2446E+10 bytes

Fixed Size 2174824 bytes

Variable Size 3422552216 bytes

Database Buffers 3.9007E+10 bytes

Redo Buffers 14602240 bytes

SQL>

恢復(fù)控制文件:

[oracle@bridge ~]$ rman target /

Recovery Manager: Release 10.2.0.5.0 - Production on Wed Aug 27 14:40:44 2014

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

connected to target database: fxzmd (not mounted)

RMAN> run

2> {

3> allocate channel c1 type 'SBT_TAPE';

4> send 'NB_ORA_SERV=NBUServer,NB_ORA_CLIENT=FXZMD';

5> restore controlfile from 'cntrl_365_1_856616015';

6> release channel c1;

7> }

using target database control file instead of recovery catalog

allocated channel: c1

channel c1: sid=870 devtype=SBT_TAPE

channel c1: Veritas NetBackup for Oracle - Release 7.5 (2012020801)

sent command to channel: c1

Starting restore at 27-AUG-14

channel c1: restoring control file

channel c1: restore complete, elapsed time: 00:00:52

output filename=+DGROUP1/fxzmd/controlfile/current.256.856708891

Finished restore at 27-AUG-14

released channel: c1

RMAN>

恢復(fù)數(shù)據(jù)庫(kù)文件:

啟動(dòng)數(shù)據(jù)庫(kù)到mount狀態(tài):

RMAN> alter database mount;

database mounted

恢復(fù)數(shù)據(jù)文件:

RMAN> run

2> {

3> allocate channel c1 type 'SBT_TAPE';

4> allocate channel c2 type 'SBT_TAPE';

5> allocate channel c3 type 'SBT_TAPE';

6> send 'NB_ORA_SERV=NBUServer,NB_ORA_CLIENT=FXZMD';

7> restore database;

8> recover database;

9> release channel c1;

10> release channel c2;

11> release channel c3;

12> }

allocated channel: c1

channel c1: sid=870 devtype=SBT_TAPE

channel c1: Veritas NetBackup for Oracle - Release 7.5 (2012020801)

allocated channel: c2

channel c2: sid=866 devtype=SBT_TAPE

channel c2: Veritas NetBackup for Oracle - Release 7.5 (2012020801)

allocated channel: c3

channel c3: sid=865 devtype=SBT_TAPE

channel c3: Veritas NetBackup for Oracle - Release 7.5 (2012020801)

sent command to channel: c1

sent command to channel: c2

sent command to channel: c3

Starting restore at 27-AUG-14

channel c1: starting datafile backupset restore

channel c1: specifying datafile(s) to restore from backup set

restoring datafile 00001 to +DGROUP1/fxzmd/datafile/system.260.851643721

restoring datafile 00004 to +DGROUP1/fxzmd/datafile/users.264.851643735

restoring datafile 00005 to +DGROUP1/fxzmd/datafile/fxzmd_data.266.851768783

restoring datafile 00007 to +DGROUP1/fxzmd/datafile/fxzmd_data.268.851768825

restoring datafile 00010 to +DGROUP1/fxzmd/datafile/tbs_ogg.276.852039351

channel c1: reading from backup piece bk_359_1_856615605

channel c2: starting datafile backupset restore

channel c2: specifying datafile(s) to restore from backup set

restoring datafile 00002 to +DGROUP1/fxzmd/datafile/undotbs1.261.851643729

restoring datafile 00003 to +DGROUP1/fxzmd/datafile/sysaux.262.851643729

restoring datafile 00006 to +DGROUP1/fxzmd/datafile/fxzmd_data.267.851768799

restoring datafile 00008 to +DGROUP1/fxzmd/datafile/fxzmd_ndx.269.851768923

restoring datafile 00009 to +DGROUP1/fxzmd/datafile/fxzmd_ndx.270.851768943

channel c2: reading from backup piece bk_358_1_856615605

channel c1: restored backup piece 1

piece handle=bk_359_1_856615605 tag=HOT_DB_BK_LEVEL0

channel c1: restore complete, elapsed time: 00:02:35

channel c2: restored backup piece 1

piece handle=bk_358_1_856615605 tag=HOT_DB_BK_LEVEL0

channel c2: restore complete, elapsed time: 00:05:20

Finished restore at 27-AUG-14

Starting recover at 27-AUG-14

starting media recovery

channel c1: starting archive log restore to default destination

channel c1: restoring archive log

archive log thread=1 sequence=1221

channel c1: restoring archive log

archive log thread=1 sequence=1222

channel c1: reading from backup piece al_363_1_856615969

channel c1: restored backup piece 1

piece handle=al_363_1_856615969 tag=TAG20140826×××25222

channel c1: restore complete, elapsed time: 00:00:26

archive log filename=+DGROUP1/fxzmd/archivelog/2014_08_27/thread_1_seq_1221.264.856710143 thread=1 sequence=1221

archive log filename=+DGROUP1/fxzmd/archivelog/2014_08_27/thread_1_seq_1222.258.856710143 thread=1 sequence=1222

unable to find archive log

archive log thread=1 sequence=1223

released channel: c1

released channel: c2

released channel: c3

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of recover command at 08/27/2014 15:02:36

RMAN-06054: media recovery requesting unknown log: thread 1 seq 1223 lowscn 64299772758

RMAN> alter database open;

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of alter db command at 08/27/2014 15:03:57

ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

RMAN> alter database open resetlogs;

database opened

最后重啟下數(shù)據(jù)庫(kù),恢復(fù)完成;

數(shù)據(jù)庫(kù)正?;謴?fù)后配置:
修改主機(jī)的IP地址:
啟動(dòng)監(jiān)聽(tīng):

lsnrctl start

把spfile從文件系統(tǒng)放到ASM磁盤(pán)組中:

1. 創(chuàng)建pfile:

SQL> create pfile='/home/oracle/initfxzmd.ora' from spfile;

2. 創(chuàng)建spfile:

SQL> create spfile='+DGROUP1' from pfile='/home/oracle/initfxzmd.ora';

3. 修改pfile:

在$ORACLE_HOME/dbs下創(chuàng)建initfxzmd.ora文件,內(nèi)容如下:

SPFILE='+DGROUP1/FXZMD/PARAMETERFILE/spfile.259.856714109'

4. 刪除$ORACLE_HOME/dbs下的spfile,重啟數(shù)據(jù)庫(kù):

SQL> show parameter spfile;

NAME TYPE VALUE

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

spfile string +DGROUP1/fxzmd/parameterfile/spfile.259.856714109

修改成功,spfile成功放入ASM磁盤(pán)組中;

5. 為了才dbca中能正??吹交謴?fù)過(guò)來(lái)的數(shù)據(jù)庫(kù),需要在

/etc/oratab 文件結(jié)尾添加如下內(nèi)容:
fxzmd:/app/oracle/product/10.2/db_1:N

6. 最后做一個(gè)數(shù)據(jù)庫(kù)全備!

###############################恢復(fù)20140827結(jié)束#######################

向AI問(wèn)一下細(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)容。

AI