① nbu 6.5 如何備份oracle
應該有個agent會需要裝到跑有oracle的伺服器上,啟動該伺服器上的agent,nbu就會與agent建立通訊,然後就是設定策略、排程之類的。
讀一讀隨軟體附帶的manual吧。。
② nbu怎樣恢復oracle資料庫
1、安裝操作系統
2、安裝資料庫系統
3、安裝nbu軟體及配置
--安裝客戶端
上傳SYMCnbclient_Linux-RedHat2.6.18_7.5.0.2.tar編輯本機hosts
vi /etc/hosts
添加:192.168.99.252 hdnbu1
解壓:
[root@scmtest u01]# tar -xvf SYMCnbclient_Linux-RedHat2.6.18_7.5.0.2.tar[root@scmtest u01]# cd SYMCnbclient_Linux-RedHat2.6.18_7.5.0.2[root@scmtest SYMCnbclient_Linux-RedHat2.6.18_7.5.0.2]# ./install過程當中要輸入備份服務端:hdnbu1
然後再用oracle用戶執行:
[root@scmtest bin]# su - oracle
[oracle@scmtest ~]$ cd /usr/openv/netbackup/bin[oracle@scmtest bin]$ ./oracle_link
Thu Feb 21 14:03:02 CST 2013
All Oracle instances should be shutdown before running this script.
Please log into the Unix system as the Oracle owner for running this scriptDo you want to continue? (y/n) [n] y
LIBOBK path: /usr/openv/netbackup/bin
ORACLE_HOME: /software/oracle/proct/10.2.0/db1Oracle version: 10.2.0.5.0
Platform type: x86_64
Linking LIBOBK:
ln -s /usr/openv/netbackup/bin/libobk.so64 /software/oracle/proct/10.2.0/db1/lib/libobk.soDone
Please check the trace file located in /tmp/make_trace.23602to make sure the linking process was successful.
4、編輯初始參數文件
這時候,需要進行修改,比如原來用的什麼盤,現在用什麼盤等編輯後如下:
*._addm_auto_enable=FALSE
*._b_tree_bitmap_plans=FALSE
*._db_block_numa=1
*._enable_NUMA_optimization=FALSE
*._optimizer_cartesian_enabled=FALSE
*._optimizer_skip_scan_enabled=FALSE
*.archive_lag_target=1800
*.audit_file_dest='/software/oracle/admin/ncerp/amp'
*.background_mp_dest='/software/oracle/admin/ncerp/bmp'
*.compatible='10.2.0.5.0'
*.control_files='/u01/ncerp/control/control01.ctl','/u01/ncerp/control/control02.ctl'
*.core_mp_dest='/software/oracle/admin/ncerp/cmp'
*.db_block_size=8192
*.db_cache_size=4294967296
*.db_create_file_dest='/u01/ncerp/flash_recover'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='ncerp'
*.java_pool_size=33554432
*.job_queue_processes=10
*.large_pool_size=33554432
*.log_archive_dest_1='location=/u01/ncerp/arch'
*.log_archive_format='%s_%t_%r.log'
*.max_mp_file_size='1024'
*.open_cursors=1000
*.optimizer_dynamic_sampling=4
*.optimizer_index_cost_adj=40
*.parallel_max_servers=5
*.pga_aggregate_target=2147483648
*.processes=800
*.recyclebin='OFF'
*.shared_pool_size=838860800
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
5、根據參數文件,建相應的目錄
[oracle@scmtest ~]$ mkdir -p /u01/ncerp/control/[oracle@scmtest u01]$ mkdir -p /app/oracle/admin/ncerp/cmp[oracle@scmtest u01]$ mkdir -p /app/oracle/admin/ncerp/bmp[oracle@scmtest u01]$ mkdir -p /app/oracle/admin/ncerp/amp[oracle@scmtest u01]$ mkdir -p /app/oracle/admin/ncerp/pfile[oracle@scmtest u01]$ mkdir -p /u01/ncerp/flash_recover[oracle@scmtest u01]$ mkdir -p /u01/ncerp/arch[oracle@scmtest ncerp]$ mkdir oradata
注意:這些要與參數文件對應,要不然無法啟動!
6、恢復控制文件
export ORACLE_SID=ncerp
[oracle@scmtest u01]$ rman target /
Recovery Manager: Release 10.2.0.5.0 - Proction on Thu Feb 21 14:17:10 2013Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database (not started)RMAN> startup nomount pfile='/u01/ncpfile.ora';Oracle instance started
Total System Global Area 5217714176 bytesFixed Size 2103536 bytesVariable Size 905971472 bytesDatabase Buffers 4294967296 bytesRedo Buffers 14671872 bytes從nbu的伺服器上查詢要恢復的控制文件
hdnbu1:/tmp # bplist -C RD162 -t 4 -R -b -l / | more-rw-rw---- oracle dba 10747904 Mar 28 11:26 /c-3383507379-20130328-0b-rw-rw---- oracle dba 11010048 Mar 28 11:25 /c-2177845250-20130328-0d-rw-rw---- oracle dba 10747904 Mar 28 11:25 /cntrl_9202_1_811250475-rw-rw---- oracle dba 10747904 Mar 28 11:25 /cntrl_7788_1_811250456-rw-rw---- oracle dba 10747904 Mar 28 11:25 /c-3383507379-20130328-0a-rw-rw---- oracle dba 11010048 Mar 28 11:24 /c-2177845250-20130328-0c-rw-rw---- oracle dba 114032640 Mar 28 11:17 /al_7786_1_811249961-rw-rw---- oracle dba 123207680 Mar 28 11:17 /al_7785_1_811249961-rw-rw---- oracle dba 3670016 Mar 28 11:17 /al_9200_1_811249960-rw-rw---- oracle dba 3932160 Mar 28 11:17 /al_9199_1_811249959-rw-rw---- oracle dba 11010048 Mar 28 09:25 /c-2177845250-20130328-0b-rw-rw---- oracle dba 10747904 Mar 28 09:25 /c-3383507379-20130328-09-rw-rw---- oracle dba 10747904 Mar 28 09:25 /cntrl_9197_1_811243259-rw-rw---- oracle dba 10747904 Mar 28 09:25 /cntrl_7783_1_811243253RMAN> run
2> {
3> allocate channel c1 type 'sbt_tape';
4> send 'NB_ORA_CLIENT=RD162';
5> restore controlfile from '/cntrl_24145_1_828414748';6> release channel c1;
7> }
using target database control file instead of recovery catalogallocated channel: c1
channel c1: sid=874 devtype=SBT_TAPE
channel c1: Veritas NetBackup for Oracle - Release 7.5 (2012050902)sent command to channel: c1
Starting restore at 2013-03-28 12:41:30
channel c1: restoring control file
channel c1: restore complete, elapsed time: 00:05:16output filename=/u02/ncerp/control/control01.ctloutput filename=/u02/ncerp/control/control02.ctlFinished restore at 2013-03-28 12:46:47
released channel: c1
7、還原資料庫文件
在這里要查一下資料庫是否已經mount
SQL> select status from v$instance;
STATUS
------------
MOUNTED
RMAN> run {
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
send 'NB_ORA_CLIENT=RD162';
set newname for datafile '/backup/ncerp/oradata/system01.dbf' to '/u02/ncerp/oradata/system01.dbf' ;set newname for datafile '/backup/ncerp/oradata/system02.dbf' to '/u02/ncerp/oradata/system02.dbf' ;set newname for datafile '/backup/ncerp/oradata/nnc_index03_1.dbf' to '/u02/ncerp/oradata/nnc_index03_1.dbf';set newname for datafile '/backup/ncerp/oradata/undotbs1.dbf' to '/u02/ncerp/oradata/undotbs1.dbf' ;set newname for datafile '/backup/ncerp/oradata/sysaux01.dbf' to '/u02/ncerp/oradata/sysaux01.dbf' ;set newname for datafile '/backup/ncerp/oradata/users01.dbf' to '/u02/ncerp/oradata/users01.dbf' ;set newname for datafile '/backup/ncerp/oradata/nnc_data01_1.dbf' to '/u02/ncerp/oradata/nnc_data01_1.dbf' ;set newname for datafile '/backup/ncerp/oradata/nnc_data01_2.dbf' to '/u02/ncerp/oradata/nnc_data01_2.dbf' ;set newname for datafile '/backup/ncerp/oradata/nnc_data01_3.dbf' to '/u02/ncerp/oradata/nnc_data01_3.dbf' ;set newname for datafile '/backup/ncerp/oradata/nnc_data01_4.dbf' to '/u02/ncerp/oradata/nnc_data01_4.dbf' ;set newname for datafile '/backup/ncerp/oradata/nnc_data02_1.dbf' to '/u02/ncerp/oradata/nnc_data02_1.dbf' ;set newname for datafile '/backup/ncerp/oradata/nnc_data02_2.dbf' to '/u02/ncerp/oradata/nnc_data02_2.dbf' ;set newname for datafile '/backup/ncerp/oradata/nnc_data03_1.dbf' to '/u02/ncerp/oradata/nnc_data03_1.dbf' ;set newname for datafile '/backup/ncerp/oradata/nnc_data03_2.dbf' to '/u02/ncerp/oradata/nnc_data03_2.dbf' ;set newname for datafile '/backup/ncerp/oradata/nnc_data03_3.dbf' to '/u02/ncerp/oradata/nnc_data03_3.dbf' ;set newname for datafile '/backup/ncerp/oradata/nnc_data03_4.dbf' to '/u02/ncerp/oradata/nnc_data03_4.dbf' ;set newname for datafile '/backup/ncerp/oradata/nnc_index02_1.dbf' to '/u02/ncerp/oradata/nnc_index02_1.dbf';set newname for datafile '/backup/ncerp/oradata/nnc_index01_1.dbf' to '/u02/ncerp/oradata/nnc_index01_1.dbf';set newname for datafile '/backup/ncerp/oradata/nnc_index01_2.dbf' to '/u02/ncerp/oradata/nnc_index01_2.dbf';set newname for datafile '/backup/ncerp/oradata/nnc_index01_3.dbf' to '/u02/ncerp/oradata/nnc_index01_3.dbf';set newname for datafile '/backup/ncerp/oradata/nnc_index01_4.dbf' to '/u02/ncerp/oradata/nnc_index01_4.dbf';set newname for datafile '/backup/ncerp/oradata/iufo01.dbf' to '/u02/ncerp/oradata/iufo01.dbf' ;set newname for datafile '/backup/ncerp/oradata/iufo02.dbf' to '/u02/ncerp/oradata/iufo02.dbf' ;set newname for datafile '/backup/ncerp/oradata/nnc_data03_5.dbf' to '/u02/ncerp/oradata/nnc_data03_5.dbf' ;Restore database;
Switch datafile all;
}
vi res_test.sh 內容如下:
export ORACLE_SID=ncerp
rman target / < run {
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
send 'NB_ORA_CLIENT=RD162';
做一次恢復測試看看
說明需要3556這個歸檔日誌
所以恢復時,從這個日誌進行恢復!
也可以採用後台運行方式
9、資料庫恢復
SQL>
cancel
說明,如果上面日誌可能有點大的時候,我們需要調整,比如說刪除日誌組等,然後還重新添加日誌到新位置10、打開資料庫
SQL> alter database open resetlogs;
Database altered.
11、創建臨時表空間
③ 如何使用NBU熱備份Oracle系統
按照備份的工具,可以分為EXP/IMP備份和RMAN。一般來說,Exp/Imp是oracle的一個好的轉儲工具,特別是在小型資料庫的轉儲,表空間的遷移,表的抽取,檢測邏輯和物理沖突等中有很強的功能。但是目前主要最廣泛的Oracle備份恢復工具是rman 。RMAN是Oracle提供的一個資料庫備份和恢復工具,利用rman可以方便進行資料庫的冷備份和熱備份。此外,有一些個人用戶,會使用OS拷貝,但是它的缺點是佔用空間大,而且拷貝文件的內容一般與系統環境有很大關系,轉移到其他機器不容易恢復,不是企業用戶的選擇。
注意,筆者假設用於已經閱讀過前作《用NBU備份oracle系統-冷備份》,故在講述中會忽略一些基本的配置過程,重點在於將冷備份和熱備份的區別。所以如果對細節不是很清楚的用戶,可以翻閱前作。