UNIX环境下nbu下oracle备份脚本.doc_第1页
UNIX环境下nbu下oracle备份脚本.doc_第2页
UNIX环境下nbu下oracle备份脚本.doc_第3页
UNIX环境下nbu下oracle备份脚本.doc_第4页
UNIX环境下nbu下oracle备份脚本.doc_第5页
免费预览已结束,剩余1页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

全选,复制到一个文本文件。更改后缀名为.bat(如ora_bk.bat),放到客户端路径下(d:orascriptora_bk.bat)。更改下面红色部分。删除上面中文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.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 backups. 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_LOG_FILE=%dpn0.outREM -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=D:oracleora92(oracle_home的路径)REM -REM Replace ora81, below, with the Oracle SID.REM -set ORACLE_SID=newoa(实例名)REM -REM Replace sys/manager, below, with the target connect string.REM -set TARGET_CONNECT_STR=sys/sys(管理员账号密码)REM -REM Set the Oracle Recovery Manager.REM -set RMAN=%ORACLE_HOME%binrman.exeREM -REM PROXYREM For a PROXY backup, uncomment 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 (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 below 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 ORACLE_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 -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_FILE%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, NetBackupREM 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 CUMULATIVEREMREM 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=1REM set BACKUP_TYPE=INCREMENTAL LEVEL=1 CUMULATIVEREMREM 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 of 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 DEFINED 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 / 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 at 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. Then use the cmdfileREM 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 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 bk_u%u_s%s_p%p_t%tREM 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;echo ALLOCATE CHANNEL ch01 TYPE SBT_TAPE;echo BACKUPecho %BACKUP_TYPE%echo FORMAT bk_u%u_s%s_p%p_t%techo DATABASE;echo sql alter system archive log current;echo RELEASE CHANNEL ch00;echo RELEASE CHANNEL ch01;echo # Backup all archive logsecho ALLOCATE CHANNEL ch00 TYPE SBT_TAPE;echo BACKUPecho FILESPERSET 20echo FORMAT arch-s%s-p%pecho ARCHIVELOG ALL DELETE INPUT;echo RELEASE CHANNEL ch00;echo ALLOCATE CHANNEL ch00 TYPE SBT_TAPE;echo BACKUP CURRENT CONTROLFILE;echo RELEASE CHANNEL ch00;) | %RMAN% target %TARGET_CONNECT_STR% nocatalog msglog %RMAN_LOG_FILE% appendset ERRLEVEL=%ERRORLEVEL%REM -REM Net

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论