您好,登錄后才能下訂單哦!
注意:本文檔操作系統環境以Linux為主,假設要恢復金融數據庫;
本文當主要以數據庫恢復為主,操作系統安裝、數據庫安裝配置和NBU客戶端安裝配置忽略;
1. 確定要恢復的數據庫信息,如果數據庫和操作系統可以正常訪問,則可以登錄數據庫和操作系統查看和恢復信息相關的信息,如果數據庫甚至是操作系統不可訪問,則可以參考《oracle數據庫信息收集》文檔,里面記錄了oracle數據庫恢復的相關信息;
2. 為了確保恢復后的數據庫可以盡快使用,盡量減少應用程序的修改,恢復完以后修改主機IP地址和原數據庫地址保持一致;
1. 根據《oracle數據庫信息收集》文檔,安裝操作系統和數據庫軟件,其中操作系統的版本盡量相同,數據庫版本則需要一致;
2. 根據《oracle數據庫信息收集》文檔,掛載合適的存儲,主要是存儲的大小,所掛載的存儲不可小于要恢復的數據庫總容量大小,并配置合適的ASM磁盤組,磁盤組的大小和名稱建議原來一樣,磁盤組的容量可以大于原磁盤組;
3. 在客戶端安裝好NBU client,并保證通過NBU client可以正常訪問備份文件;
在操作系統上執行如下命令:
/usr/openv/netbackup/bin/bplist -C fxzmd -t 4 -l -R /
列出數據庫備份信息,部分信息如下:
-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
本文檔選取 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
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
關閉數據庫:
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
最后重啟下數據庫,恢復完成;
lsnrctl start
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結束#######################
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。