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

提交评论