- 最后登录
- 2016-11-23
- 在线时间
- 34 小时
- 威望
- 11
- 金钱
- 258
- 注册时间
- 2012-7-17
- 阅读权限
- 10
- 帖子
- 64
- 精华
- 0
- 积分
- 11
- UID
- 620
|
2#
发表于 2012-7-19 09:39:03
不好意思较多无用内容:- @REM $Header: hot_database_backup.cmd,v 1.3 2005/11/28 19:01:53 $
- @REM bcpyrght
- @REM ***************************************************************************
- @REM * $VRTScprght: Copyright 1993 - 2009 Symantec Corporation, All Rights Reserved $ *
- @REM ***************************************************************************
- @REM ecpyrght
- @REM
- @REM ---------------------------------------------------------------------------
- @REM hot_database_backup.cmd
- 。。。省略备份注释内容
- @setlocal ENABLEEXTENSIONS
- @REM ---------------------------------------------------------------------------
- @REM No need to echo the commands.
- @REM ---------------------------------------------------------------------------
- @echo off
- @REM ---------------------------------------------------------------------------
- @REM Put output in the same filename, different extension.
- @REM ---------------------------------------------------------------------------
- @set RMAN_LOG_FILE="%~dpn0.out"
- @REM ---------------------------------------------------------------------------
- @REM You may want to delete the output file so that backup information does
- @REM not accumulate. If not, delete the following command.
- @REM ---------------------------------------------------------------------------
- @if exist %RMAN_LOG_FILE% del %RMAN_LOG_FILE%
- @REM ---------------------------------------------------------------------------
- @REM Replace H:\oracle\ora81, below, with the Oracle home path.
- @REM ---------------------------------------------------------------------------
- @set ORACLE_HOME=D:\app\Administrator\product\11.2.0\dbhome_1
- @REM ---------------------------------------------------------------------------
- @REM Replace ora81, below, with the Oracle SID.
- @REM ---------------------------------------------------------------------------
- @set ORACLE_SID=orcl
- @REM ---------------------------------------------------------------------------
- @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%\bin\rman.exe
- @REM ---------------------------------------------------------------------------
- @REM PROXY
- @REM For a PROXY backup, uncomment the line below and replace the value.
- @REM
- @REM NB_ORA_PC_STREAMS - specifies the number of parallel backup streams
- @REM 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 %%q
- @for /F %%p in ('time /T') do @set DATE=%DATE% %%p
- @echo ==== started on %DATE% ==== >> %RMAN_LOG_FILE%
- @echo Script name: %0 >> %RMAN_LOG_FILE%
- 省略部分注释内容.....
- @set NLS_LANG=american
- @set NLS_DATE_FORMAT=YYYY-MM-DD:hh24:mi:ss
- @REM ---------------------------------------------------------------------------
- @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 PROXY
- @REM 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 would
- @REM be the place to verify that.
- @REM ---------------------------------------------------------------------------
- @REM ---------------------------------------------------------------------------
- @REM If this script is executed from a NetBackup schedule, NetBackup
- @REM sets an NB_ORA environment variable based on the schedule type.
- @REM For example, when:
- @REM schedule type is BACKUP_TYPE is
- @REM ---------------- --------------
- @REM Automatic Full INCREMENTAL LEVEL=0
- @REM Automatic Differential Incremental INCREMENTAL LEVEL=1
- @REM Automatic Cumulative Incremental INCREMENTAL LEVEL=1 CUMULATIVE
- @REM
- @REM For user initiated backups, BACKUP_TYPE defaults to incremental
- @REM level 0 (Full). To change the default for a user initiated
- @REM backup to incremental or incrementatl cumulative, uncomment
- @REM one of the following two lines.
- @REM @set BACKUP_TYPE="INCREMENTAL LEVEL=1"
- @REM @set BACKUP_TYPE="INCREMENTAL LEVEL=1 CUMULATIVE"
- @REM
- @REM Note that we use incremental level 0 to specify full backups.
- @REM That is because, although they are identical in content, only
- @REM the incremental level 0 backup can have incremental backups of
- @REM 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=0
- @if "%NB_ORA_INCR%" EQU "1" @set BACKUP_TYPE=INCREMENTAL Level=1
- @if "%NB_ORA_CINC%" EQU "1" @set BACKUP_TYPE=INCREMENTAL Level=1 CUMULATIVE
- @if NOT DEFINED BACKUP_TYPE @set BACKUP_TYPE=INCREMENTAL Level=0
- @REM ---------------------------------------------------------------------------
- @REM Call Recovery Manager to initiate the backup. This example does not use a
- @REM 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>@<tns alias>' statement.
- @REM
- @REM ---------------------------------------------------------------------------
- @REM PROXY
- @REM For a PROXY backup, you must use a send command to specify
- @REM 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 BACKUP
- @REM echo PROXY
- @REM echo FORMAT '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 proxy
- @REM copy method. Rman will initiate non-proxy copy sessions to backup the
- @REM controlfile and archivelogs.
- @REM ---------------------------------------------------------------------------
- @(
- echo RUN {
- echo ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
- echo ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE';
- echo BACKUP
- echo %BACKUP_TYPE%
- echo FORMAT 'd:\backup\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 logs
- echo ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
- echo BACKUP
- echo FILESPERSET 20
- echo FORMAT 'arch-s%%s-p%%p'
- echo ARCHIVELOG LIKE 'D:\archive_log\ARCHIVE%' DELETE INPUT;
- echo RELEASE CHANNEL ch00;
- echo # Backup controlfile
- echo ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
- echo BACKUP
- echo FORMAT 'cntrl_s%%s_p%%p_t%%t'
- echo CURRENT CONTROLFILE;
- echo RELEASE CHANNEL ch00;
- echo }
- ) | %RMAN% target %TARGET_CONNECT_STR% nocatalog msglog '%RMAN_LOG_FILE%' append
- @set ERRLEVEL=%ERRORLEVEL%
- @set LOGMSG=ended successfully
- @if "%STATUS_FILE%" EQU "" goto end
- @echo 0 > "%STATUS_FILE%"
- @goto end
- :err
- @set LOGMSG=ended in error
- @if "%STATUS_FILE%" EQU "" @goto end
- @echo 1 > "%STATUS_FILE%"
- :end
- @REM ---------------------------------------------------------------------------
- @REM Log the completion of this script.
- @REM ---------------------------------------------------------------------------
- @for /F "tokens=1*" %%p in ('date /T') do @set DATE=%%p %%q
- @for /F %%p in ('time /T') do @set DATE=%DATE% %%p
- @echo # >> %RMAN_LOG_FILE%
- @echo %==== %LOGMSG% on %DATE% ==== >> %RMAN_LOG_FILE%
- @endlocal
- @REM End of Main Program -----------------------------------------------------
复制代码 |
|