Oracle NBU備份&異機恢復 for Linux
1. NBU Linux客戶端軟件安裝
A. 增加NBU Server到linux服務器
B. 運行安裝軟件
上傳軟件到linux服務器
修改/etc/hosts文件。增加NBU server
[root@SWHAP1DB01~]# cat /etc/hosts
#Do not remove the following line, or various programs
#that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.1.1 servername
運行安裝軟件
[root@SWHAP1DB01 NetBackup_7.5_CLIENTS]# pwd
/root/NetBackup_7.5_CLIENTS
[root@SWHAP1DB01 NetBackup_7.5_CLIENTS]# ./install
……
Do you wish to continue? [y,n] (y) y
Do you want to install the NetBackup client software for thisclient? [y,n] (y) y
……
Enter the name of the NetBackup server : servername
Would you like to use "SWHAP1DB01" as the configured
name of the NetBackup client? [y,n] (y) y
………
File /usr/openv/tmp/install_trace.32057 contains a trace of thisinstall.
That file can be deleted after you are sure the install wassuccessful.
安裝結束。
2. NBU備份
步驟:
A. 客戶端建立link庫文件
B. Oracle服務器生成備份腳本
C. NBU服務器製作排程
客戶端建立link 库文件libobk.so
[root@SWHAP1DB01~]# su - oracle
[oracle@SWHAP1DB01~]$ /usr/openv/netbackup/bin/oracle_link
WedNov 27 09:03:37 CST 2013
AllOracle instances should be shutdown before running this script.
Pleaselog into the Unix system as the Oracle owner for running this script
Do youwant to continue? (y/n) [n] y
LIBOBKpath: /usr/openv/netbackup/bin
ORACLE_HOME:/u01/app/oracle/product/11.2.0/dbhome_1
Oracleversion: 11.2.0.3.0
Platformtype: x86_64
LinkingLIBOBK:
ln-s/usr/openv/netbackup/bin/libobk.so64 /u01/app/oracle/product/11.2.0/dbhome_1/lib/libobk.soDone
Pleasecheck the trace file located in /tmp/make_trace.1699
to make sure the linking process wassuccessful.----link成功
創建備份腳本
/ usr/openv/netbackup/ext/db_ext/oracle/rman/samples/rman下的hot_database_backup.sh修改一下。
主要修改$ORACLE_HONE,$ORACLE_SID,ORACLE_USER
服務器端設置Policy,这里就不截图了,相对简单
3. 異機恢復
a、在NBU server上增加異機恢復文件
C:\ProgramFiles\Veritas\NetBackup\db\
此目錄是A服務器上NBU的安裝目錄)這個目錄下新建altnames文件夾,然後在文件夾內新建No.Restrictions文件即可
b、查看備份記錄(查看是否有controlfile、spfile等)
在NBU Server上cmd執行
C:\ProgramFiles\Veritas\NetBackup\bin>bplist -C xxxxx -t 4 -R -l /
前面路徑是nbu軟件所在位置,xxxx處寫源備份機電腦名)
如果出現跟蹤文件不對,則需檢查adump文件有不有,查看init*SID.ora文件中的路徑是否在目標機上都有
c.恢復spfile(RMAN中執行,數據啟動到nomount階段)
run{
ALLOCATECHANNEL ch00 TYPE 'SBT_TAPE';
send'NB_ORA_SERV=xxxx1,NB_ORA_CLIENT=localhost.localdomain';
restore spfile from 'xxxxx3';
release channel ch00;
}
(其中xxx1是NBU server電腦名,xxxx2是源備份主機名,xxxxx3是根據步驟2查到的spfile備份文件名)
d.恢復controlfile(RMAN中執行,數據啟動到nomount階段)
run{
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
send'NB_ORA_SERV=whfs02,NB_ORA_CLIENT=swhhmddb03.ecmms.foxconn';
restorecontrolfile from 'controlfile_nbutest_20131213';
release channelch00;
}
e.mount數據庫
f.恢復database(RMAN中執行,數據啟動到mount階段)
run {
allocate channel ch00 type 'SBT_TAPE';
send'nb_ora_serv=scqdbatest001.ecmms.foxconn,nb_ora_client=localhost.localdomain';
restoredatabase;
recover database;
release channelch00;
}
g.打開數據庫
alter databaseopen resetlogs;
特別要注意init*SID.ora文件中的每個路徑要存在,切在5步驟的時候注意數據文件是否恢復成功,不成功則多半是目錄不存在導致