NBU Linux上oracle單實例恢復到單實例

注意:本文檔操做系統環境以Linux爲主,假設要恢復金融數據庫;數據庫

本文當主要以數據庫恢復爲主,操做系統安裝、數據庫安裝配置和NBU客戶端安裝配置忽略;oracle

要恢復的數據庫信息:

1. 肯定要恢復的數據庫信息,若是數據庫和操做系統能夠正常訪問,則能夠登陸數據庫和操做系統查看和恢復信息相關的信息,若是數據庫甚至是操做系統不可訪問,則能夠參考oracle數據庫信息收集》文檔,裏面記錄了oracle數據庫恢復的相關信息;app

2. 爲了確保恢復後的數據庫能夠儘快使用,儘可能減小應用程序的修改,恢復完之後修改主機IP地址和原數據庫地址保持一致;ide

準備環境:

1. 根據《oracle數據庫信息收集》文檔,安裝操做系統和數據庫軟件,其中操做系統的版本儘可能相同,數據庫版本則須要一致;操作系統

2. 根據《oracle數據庫信息收集》文檔,掛載合適的存儲,主要是存儲的大小,所掛載的存儲不可小於要恢復的數據庫總容量大小,並配置合適的ASM磁盤組,磁盤組的大小和名稱建議原來同樣,磁盤組的容量能夠大於原磁盤組;rest

3. 在客戶端安裝好NBU client,並保證經過NBU client能夠正常訪問備份文件;對象

恢復步驟:

恢復文件說明:

在操做系統上執行以下命令:ci

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

列出數據庫備份信息,部分信息以下:get

-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 表示參數文件

al_362_1_856615942 表示歸檔文件

bk_359_1_856615605 表示數據文件

c-1492422082-20140826-01 表示dbid

恢復spfile文件:

本文檔選取 c-1492422082-20140826-02做爲恢復對象,設置數據庫DBID,並把數據庫啓動到nomount狀態:

[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

建立pfile 修改pfile文件:

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

File created.

編輯pfile:

根據$ORACLE_BASE、$ORACLE_HOME建立相應的目錄:

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 建立spfile:

關閉數據庫:

SQL> shutdown immediate

ORA-01507: database not mounted

ORACLE instance shut down.

用新的pfile啓動數據庫到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>

建立spfile:

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

File created.

關閉數據庫並啓動數據庫到nomount狀態:

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>

恢復控制文件:

[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>

恢復數據庫文件:

啓動數據庫到mount狀態:

RMAN> alter database mount;

database mounted

恢復數據文件:

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

最後重啓下數據庫,恢復完成;

數據庫正常恢復後配置:

修改主機的IP地址:
啓動監聽:

lsnrctl start

把spfile從文件系統放到ASM磁盤組中:

1. 建立pfile:

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

2. 建立spfile:

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

3. 修改pfile:

在$ORACLE_HOME/dbs下建立initfxzmd.ora文件,內容以下:

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

4. 刪除$ORACLE_HOME/dbs下的spfile,重啓數據庫:

SQL> show parameter spfile;

NAME TYPE VALUE

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

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

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

5. 爲了才dbca中能正常看到恢復過來的數據庫,須要在

/etc/oratab 文件結尾添加以下內容:
fxzmd:/app/oracle/product/10.2/db_1:N

6. 最後作一個數據庫全備!

###############################恢復20140827結束#######################

相關文章
相關標籤/搜索