NBULinux上oracle單實例恢復(fù)到單實例

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

創(chuàng)新互聯(lián)公司是一家做網(wǎng)站、成都網(wǎng)站制作,提供網(wǎng)頁設(shè)計,網(wǎng)站設(shè)計,網(wǎng)站制作,建網(wǎng)站,按需網(wǎng)站開發(fā),網(wǎng)站開發(fā)公司,自2013年創(chuàng)立以來是互聯(lián)行業(yè)建設(shè)者,服務(wù)者。以提升客戶品牌價值為核心業(yè)務(wù),全程參與項目的網(wǎng)站策劃設(shè)計制作,前端開發(fā),后臺程序制作以及后期項目運營并提出專業(yè)建議和思路。

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

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

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

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

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

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

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

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

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

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

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

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

-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

信息說明:

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ù)對象,設(shè)置數(shù)據(jù)庫DBID,并把數(shù)據(jù)庫啟動到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

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

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

SQL> shutdown immediate

ORA-01507: database not mounted

ORACLE instance shut down.

用新的pfile啟動數(shù)據(jù)庫到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ù)庫并啟動數(shù)據(jù)庫到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ù)庫文件:

啟動數(shù)據(jù)庫到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ù)庫,恢復(fù)完成;

數(shù)據(jù)庫正常恢復(fù)后配置:
修改主機(jī)的IP地址:
啟動監(jiān)聽:

lsnrctl start

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

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ù)庫:

SQL> show parameter spfile;

NAME TYPE VALUE

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

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

修改成功,spfile成功放入ASM磁盤組中;

5. 為了才dbca中能正常看到恢復(fù)過來的數(shù)據(jù)庫,需要在

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

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

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

網(wǎng)頁名稱:NBULinux上oracle單實例恢復(fù)到單實例
網(wǎng)頁URL:http://bm7419.com/article16/jdgegg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供響應(yīng)式網(wǎng)站、網(wǎng)站內(nèi)鏈用戶體驗、做網(wǎng)站搜索引擎優(yōu)化、網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)頁設(shè)計公司