NetBackup For Oracle 配置指導手冊腳本_第1頁
NetBackup For Oracle 配置指導手冊腳本_第2頁
NetBackup For Oracle 配置指導手冊腳本_第3頁
NetBackup For Oracle 配置指導手冊腳本_第4頁
NetBackup For Oracle 配置指導手冊腳本_第5頁
已閱讀5頁,還剩19頁未讀 繼續免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、NetBackup For Oracle_Win安裝配置指南修訂記錄日期修訂版本修改描述 作者目 錄一、Client Agent安裝31.1 主機名解釋31.2 安裝過程3二、編輯備份腳本32.1 檢查oracle歸檔狀態32.2 獲取oracle相關變量42.3 修改oracle備份腳本5三、oracle備份123.1 創建oracle備份策略123.2 檢查備份作業14四、oracle恢復224.1恢復控制文件224.2恢復數據文件23一、Client Agent安裝1.1 主機名解釋1)在oracle客戶端編輯c:windowssystem32driversetchosts文件,添加備份

2、服務器ip及主機名條目2)確保ping通備份服務器1.2 安裝過程3)安裝過程略二、編輯備份腳本2.1 檢查oracle歸檔狀態1)使用netbackup for oracle進行rman熱備份,必須使數據庫處于歸檔模式SQL> alter database open;數據庫已更改。SQL> archive log list;數據庫日志模式 存檔模式自動存檔 啟用存檔終點 USE_DB_RECOVERY_FILE_DEST最早的聯機日志序列 1下一個存檔日志序列 3當前日志序列 3SQL>2)如果沒啟用歸檔則讓DBA開啟歸檔,參照以下步驟SQL> archive log

3、 list;數據庫日志模式 非存檔模式自動存檔 禁用存檔終點 USE_DB_RECOVERY_FILE_DEST最早的聯機日志序列 1當前日志序列 3SQL> shutdown immediate數據庫已經關閉。已經卸載數據庫。ORACLE 例程已經關閉。SQL> startup mount;ORACLE 例程已經啟動。Total System Global Area 348127232 bytesFixed Size 2004200 bytesVariable Size 109054744 bytesDatabase Buffers 234881024 bytesRedo Buf

4、fers 2187264 bytes數據庫裝載完畢。SQL> alter database archivelog;數據庫已更改。SQL> alter database open;數據庫已更改。SQL> archive log list;數據庫日志模式 存檔模式自動存檔 啟用存檔終點 USE_DB_RECOVERY_FILE_DEST最早的聯機日志序列 1下一個存檔日志序列 3當前日志序列 3SQL>2.2 獲取oracle相關變量1)打開注冊表,導航到HKEY_LOCAL_MACHINE->SOFTWARE->ORACLE->SYSTEM->Or

5、acleDB2)分別雙擊ORACLE_HOMEORACLE_SID,記錄ORACLE_HOME及ORACLE_SID2.3 修改oracle備份腳本1)在oracle客戶端找到備份腳本模版,然后修改路徑如下C:Program FilesVeritasNetBackupDbExtOracleSamplesrman備份腳本hot_database_backup.cmd2)修改以下條目為合適的值set ORACLE_HOME=E:oracleproduct10.2.0db_1set ORACLE_SID=orclset TARGET_CONNECT_STR=/該備份腳本同時備份database da

6、tafile、歸檔日志、控制文件另外ARCHIVELOG ALL DELETE INPUT表示備份完歸檔后即刪除之,如果不需要刪除則去掉 delete input;REM $Header: hot_database_backup.cmd,v 1.3 2005/11/28 19:01:53 $REM bcpyrghtREM * REM * $VRTScprght: Copyright 1993 - 2007 Symantec Corporation, All Rights Reserved $ * REM * REM ecpyrghtREMREM -REM hot_database_backup

7、.cmdREM -REM This script uses Recovery Manager to take a hot (inconsistent) databaseREM backup. A hot backup is inconsistent because portions of the database areREM being modified and written to the disk while the backup is progressing.REM You must run your database in ARCHIVELOG mode to make hot ba

8、ckups. REMREM NOTE information for running proxy backups has been included. These REM information sections begin with a comment line of PROXY REM -setlocal ENABLEEXTENSIONSREM -REM No need to echo the commands.REM -echo offREM -REM Put output in the same filename, different extension.REM -set RMAN_L

9、OG_FILE="%dpn0.out"REM -REM You may want to delete the output file so that backup information doesREM not accumulate. If not, delete the following command.REM -if exist %RMAN_LOG_FILE% del %RMAN_LOG_FILE%REM -REM Replace H:oracleora81, below, with the Oracle home path.REM -set ORACLE_HOME=

10、d:orantREM -REM Replace ora81, below, with the Oracle SID.REM -set ORACLE_SID=orclREM -REM Replace sys/manager, below, with the target connect string.REM -set TARGET_CONNECT_STR=/REM -REM Set the Oracle Recovery Manager.REM -set RMAN=%ORACLE_HOME%binrman.exeREM -REM PROXYREM For a PROXY backup, unco

11、mment the line below and replace the value. REMREM NB_ORA_PC_STREAMS - specifies the number of parallel backup streamsREM to be started.REM -REM set NB_ORA_PC_STREAMS=3 REM -REM Log the start of this scripts.REM -for /F "tokens=1*" %p in ('date /T') do set DATE=%p %qfor /F %p in (&

12、#39;time /T') do set DATE=%DATE% %pecho = started on %DATE% = >> %RMAN_LOG_FILE%echo Script name: %0 >> %RMAN_LOG_FILE%REM -REM Several RMAN commands use time parameters that require NLS_LANG and REM NLS_DATE_FORMAT to be set. This example uses the standard date format.REM Replace be

13、low with the desired language values.REM -set NLS_LANG=americanset NLS_DATE_FORMAT=YYYY-MM-DD:hh24:mi:ssREM -REM Print out environment variables set in this script.REM -echo # >> %RMAN_LOG_FILE%echo RMAN : %RMAN% >> %RMAN_LOG_FILE%echo NLS_LANG : %NLS_LANG% >> %RMAN_LOG_FILE%echo O

14、RACLE_HOME : %ORACLE_HOME% >> %RMAN_LOG_FILE%echo ORACLE_SID : %ORACLE_SID% >> %RMAN_LOG_FILE%echo NLS_DATE_FORMAT : %NLS_DATE_FORMAT% >> %RMAN_LOG_FILE%echo RMAN_LOG_FILE : %RMAN_LOG_FILE% >> %RMAN_LOG_FILE%REM -REM PROXYREM For a PROXY backup, uncomment the line below. REM

15、-REM echo NB_ORA_PC_STREAMS : %NB_ORA_PC_STREAMS% >> %RMAN_LOG_FILE%REM -REM Print out environment variables set in bphdb.REM -echo NB_ORA_SERV : %NB_ORA_SERV% >> %RMAN_LOG_FILE%echo NB_ORA_FULL : %NB_ORA_FULL% >> %RMAN_LOG_FILE%echo NB_ORA_INCR : %NB_ORA_INCR% >> %RMAN_LOG_F

16、ILE%echo NB_ORA_CINC : %NB_ORA_CINC% >> %RMAN_LOG_FILE%echo NB_ORA_CLASS : %NB_ORA_CLASS% >> %RMAN_LOG_FILE%REM -REM We assume that the database is properly opened. If desired, this wouldREM be the place to verify that.REM -REM -REM If this script is executed from a NetBackup schedule, N

17、etBackupREM sets an NB_ORA environment variable based on the schedule type.REM For example, when:REM schedule type is BACKUP_TYPE isREM - -REM Automatic Full INCREMENTAL LEVEL=0REM Automatic Differential Incremental INCREMENTAL LEVEL=1REM Automatic Cumulative Incremental INCREMENTAL LEVEL=1 CUMULATI

18、VEREMREM For user initiated backups, BACKUP_TYPE defaults to incrementalREM level 0 (Full). To change the default for a user initiatedREM backup to incremental or incrementatl cumulative, uncommentREM one of the following two lines.REM set BACKUP_TYPE="INCREMENTAL LEVEL=1"REM set BACKUP_TY

19、PE="INCREMENTAL LEVEL=1 CUMULATIVE"REMREM Note that we use incremental level 0 to specify full backups.REM That is because, although they are identical in content, onlyREM the incremental level 0 backup can have incremental backups ofREM level > 0 applied to it.REM -REM -REM What kind o

20、f backup will we perform.REM -if "%NB_ORA_FULL%" EQU "1" set BACKUP_TYPE=INCREMENTAL Level=0if "%NB_ORA_INCR%" EQU "1" set BACKUP_TYPE=INCREMENTAL Level=1if "%NB_ORA_CINC%" EQU "1" set BACKUP_TYPE=INCREMENTAL Level=1 CUMULATIVEif NOT DEFINE

21、D BACKUP_TYPE set BACKUP_TYPE=INCREMENTAL Level=0REM -REM Call Recovery Manager to initiate the backup. This example does not use aREM Recovery Catalog. If you choose to use one, remove the option, nocatalog,REM from the rman command line below and add a REM 'rcvcat <userid>/<passwd>

22、<tns alias>' statement.REMREM NOTE WHEN USING TNS ALIAS: When connecting to a databaseREM using a TNS alias, you must use a send command or a parms operand to REM specify environment variables. In other words, when accessing a databaseREM through a listener, the environment variables set a

23、t the system level are not REM visible when RMAN is running. For more information on the environmentREM variables, please refer to the NetBackup for Oracle Admin. Guide.REMREM If you are getting an error that the input line is too long, you will needREM to put the RMAN run block in a separate file.

24、Then use the "cmdfile"REM option of RMAN. For more information on the "cmdfile" options pleaseREM refer to the RMAN documentation.REM -REM -REM PROXYREM For a PROXY backup, you must use a send command to specifyREM the NB_ORA_PC_STREAMS environment variable. For example,REM echo

25、ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE'REM echo SEND 'NB_ORA_PC_STREAMS=%NB_ORA_PC_STREAMS%' REM REM %BACKUP_TYPE% must also be removed and replaced with the PROXY parameter REM in the RMAN section associated with the data files. For example,REM echo BACKUPREM echo PROXYREM echo FORMAT

26、 'bk_u%u_s%s_p%p_t%t'REM echo DATABASE;REM .REM . REM Note that the controlfiles and archivelogs are not backed up using proxyREM copy method. Rman will initiate non-proxy copy sessions to backup theREM controlfile and archivelogs.REM -(echo RUN echo ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE&

27、#39;echo ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE'echo BACKUPecho %BACKUP_TYPE%echo FORMAT 'bk_u%u_s%s_p%p_t%t'echo DATABASE;echo sql 'alter system archive log current'echo RELEASE CHANNEL ch00;echo RELEASE CHANNEL ch01;echo # Backup all archive logsecho ALLOCATE CHANNEL ch00 TYP

28、E 'SBT_TAPE'echo BACKUPecho FILESPERSET 20echo FORMAT 'arch-s%s-p%p'echo ARCHIVELOG ALL DELETE INPUT;echo RELEASE CHANNEL ch00;echo # Control file backupecho ALLOCATE CHANNEL ch00 echo TYPE 'SBT_TAPE'echo BACKUPecho FORMAT 'ctrl_u%u_s%s_p%p_t%t'echo CURRENT CONTROLFIL

29、E;echo RELEASE CHANNEL ch00;echo ) | %RMAN% target %TARGET_CONNECT_STR% nocatalog msglog '%RMAN_LOG_FILE%' appendset ERRLEVEL=%ERRORLEVEL%REM -REM NetBackup (bphdb) stores the name of a file in an environment variable, REM called STATUS_FILE. This file is used by an automatic schedule toREM

30、communicate status information with NetBackup's job monitor. It is up to REM the script to write a 0 (passed) or 1 (failure) to the status file.REM -if %ERRLEVEL% NEQ 0 goto errset LOGMSG=ended successfullyif "%STATUS_FILE%" EQU "" goto endecho 0 > "%STATUS_FILE%"

31、;goto end:errset LOGMSG=ended in errorif "%STATUS_FILE%" EQU "" goto endecho 1 > "%STATUS_FILE%":endREM -REM Log the completion of this script.REM -for /F "tokens=1*" %p in ('date /T') do set DATE=%p %qfor /F %p in ('time /T') do set DATE=%D

32、ATE% %pecho # >> %RMAN_LOG_FILE% echo %= %LOGMSG% on %DATE% = >> %RMAN_LOG_FILE%endlocalREM End of Main Program -三、oracle備份3.1 創建oracle備份策略1)策略類型為oracle2)backup selections選擇備份腳本3.2 檢查備份作業1)發起備份作業后,根據備份腳本及數據庫實際情況,將先后發起一個父作業,若干個子作業,如下圖2)備份作業完成后,將在備份腳本同一目錄下生成.out日志輸出,瀏覽該文件可以知道備份作業內容3)可以用記事本

33、或寫字板打開,可以看到該作業已經完成database、archivelog及controlfile的備份;= started on 2012-05-26 星期六 11:00 = Script name: "C:Program FilesVeritasNetBackupDbExtOracleSamplesrmanhot_database_backup.cmd" # RMAN : e:oracleproduct10.2.0db_1binrman.exe NLS_LANG : american ORACLE_HOME : e:oracleproduct10.2.0db_1 ORA

34、CLE_SID : orcl NLS_DATE_FORMAT : YYYY-MM-DD:hh24:mi:ss RMAN_LOG_FILE : "C:Program FilesVeritasNetBackupDbExtOracleSamplesrmanhot_database_backup.out" NB_ORA_SERV : nb75 NB_ORA_FULL : 1 NB_ORA_INCR : 0 NB_ORA_CINC : 0 NB_ORA_CLASS : Oracle_hot_full_bak Recovery Manager: Release 10.2.0.1.0 -

35、 Production on Sat May 26 11:00:06 2012Copyright (c) 1982, 2005, Oracle. All rights reserved.connected to target database: ORCL (DBID=1312067944)using target database control file instead of recovery catalogRMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 1

36、5> 16> 17> 18> 19> 20> 21> 22> 23> 24> 25> allocated channel: ch00channel ch00: sid=146 devtype=SBT_TAPEchannel ch00: Veritas NetBackup for Oracle - Release 7.5 (20120207)allocated channel: ch01channel ch01: sid=153 devtype=SBT_TAPEchannel ch01: Veritas NetBackup for

37、 Oracle - Release 7.5 (20120207)Starting backup at 2012-05-26:11:00:18channel ch00: starting incremental level 0 datafile backupsetchannel ch00: specifying datafile(s) in backupsetinput datafile fno=00001 name=E:ORACLEPRODUCT10.2.0ORADATAORCLSYSTEM01.DBFinput datafile fno=00004 name=E:ORACLEPRODUCT1

38、0.2.0ORADATAORCLUSERS01.DBFchannel ch00: starting piece 1 at 2012-05-26:11:00:21channel ch01: starting incremental level 0 datafile backupsetchannel ch01: specifying datafile(s) in backupsetinput datafile fno=00003 name=E:ORACLEPRODUCT10.2.0ORADATAORCLSYSAUX01.DBFinput datafile fno=00005 name=E:ORAC

39、LEPRODUCT10.2.0ORADATAORCLEXAMPLE01.DBFinput datafile fno=00002 name=E:ORACLEPRODUCT10.2.0ORADATAORCLUNDOTBS01.DBFchannel ch01: starting piece 1 at 2012-05-26:11:00:21channel ch00: finished piece 1 at 2012-05-26:11:06:43piece handle=bk_u01nbumi4_s1_p1_t784292420 tag=TAG20120526T110019channel ch00: b

40、ackup set complete, elapsed time: 00:06:24channel ch00: starting incremental level 0 datafile backupsetchannel ch00: specifying datafile(s) in backupsetincluding current control file in backupsetchannel ch00: starting piece 1 at 2012-05-26:11:06:58channel ch00: finished piece 1 at 2012-05-26:11:12:3

41、7piece handle=bk_u03nbumuf_s3_p1_t784292815channel ch00: backup set complete, elapsed time: 00:05:44channel ch00: starting incremental level 0 datafile backupsetchannel ch00: specifying datafile(s) in backupsetincluding current SPFILE in backupsetchannel ch00: starting piece 1 at 2012-05-26:11:12:41

42、channel ch01: finished piece 1 at 2012-05-26:11:12:51piece handle=bk_u02nbumi5_s2_p1_t784292421channel ch01: backup set complete, elapsed time: 00:12:31channel ch00: finished piece 1 at 2012-05-26:11:15:27piece handle=bk_u04nbun99_s4_p1_t784293161channel ch00: backup set complete, elapsed time: 00:0

43、2:46Finished backup at 2012-05-26:11:15:27sql statement: alter system archive log currentreleased channel: ch00released channel: ch01allocated channel: ch00channel ch00: sid=146 devtype=SBT_TAPEchannel ch00: Veritas NetBackup for Oracle - Release 7.5 (20120207)Starting backup at 2012-05-26:11:16:32c

44、urrent log archivedchannel ch00: starting archive log backupsetchannel ch00: specifying archive log(s) in backup setinput archive log thread=1 sequence=3 recid=1 stamp=784291996input archive log thread=1 sequence=4 recid=2 stamp=784292028input archive log thread=1 sequence=5 recid=3 stamp=784293371input archive log thread=1 sequence=6 recid=4 stamp=784293396channel ch00: starting piece 1 a

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論