sybase_mdb_backup.cmd script
The sybase_mydb_backup.cmd script is as follows:
@setlocal
@echo off
@REM **************************************************************************
@REM Replace C:\Sybase below with your actual Sybase home directory
@REM **************************************************************************
@set SYBASE=C:\Sybase
@REM **************************************************************************
@REM Replace Sybase below with the actual name of your SQL Server
@REM **************************************************************************
@set SYBSERVER=SYBASE
@REM **************************************************************************
@REM Replace SYB_DB below with the actual name of your Sybase database
@REM **************************************************************************
@set DATABASE_NAME=SYB_DB
if "%SYBASE_OCS%" == "" goto notsyb12
@REM ********* Sybase 12.0 or later ***********
@set OCS_QUAL=\%SYBASE_OCS%
goto cont1
:notsyb12
@REM ********* Sybase 11.9.2 or earlier **********
@set OCS_QUAL=
:cont1
@REM **************************************************************************
@REM These environment variables are set by NetBackup.
@REM **************************************************************************
@echo SYBACKUP_SERVER = %SYBACKUP_SERVER%
@echo SYBACKUP_POLICY = %SYBACKUP_POLICY%
@echo SYBACKUP_SCHED = %SYBACKUP_SCHED%
@echo SYBACKUP_SCHEDULED = %SYBACKUP_SCHEDULED%
@echo SYBACKUP_USER_INITIATED = %SYBACKUP_USER_INITIATED%
@REM **************************************************************************
@REM Replace "database_dump" below with your actual NetBackup schedule name
@REM which is used for a full backup of the Sybase database.
@REM **************************************************************************
if "%SYBACKUP_SCHED%" == "database_dump" goto dbdump
@REM *********** NetBackup has started a "transaction_dump" backup ***********
set DUMP_TYPE=TRANSACTION
goto entercmd
:dbdump
@REM *********** NetBackup has started a "database_dump" backup ***********
set DUMP_TYPE=DATABASE
:entercmd
@REM **************************************************************************
@REM Replace "Default-Application-Backup" below with your actual NetBackup
@REM Application Backup type schedule name for the Sybase database.
@REM **************************************************************************
@echo dump %DUMP_TYPE% %DATABASE_NAME% to "sybackup::-SERV %SYBACKUP_SERVER% -POL
%SYBACKUP_POLICY% -SCHED Default-Application-Backup -STAT_FILE %STATUS_FILE%" > .
\syb_%DATABASE_NAME%_dump
@REM **************************************************************************
@REM Remove the REM from the beginning of the line below if you are going to
@REM use multiple stripes for the backup. Repeat this line for each stripe.
@REM Replace "Default-Application-Backup" below with your actual NetBackup
@REM Application Backup type schedule name for the Sybase database.
@REM **************************************************************************
@REM echo stripe on "sybackup::-SERV %SYBACKUP_SERVER% -POL %SYBACKUP_POLICY% -SCHED
Default-Application-Backup -STAT_FILE %STATUS_FILE%" >> .\syb_%DATABASE_NAME%_dump
@echo go >> .\syb_%DATABASE_NAME%_dump
@REM **************************************************************************
@REM Replace "manager" with your Sybase server Administrator's Password
@REM **************************************************************************
set CMD_LINE=%SYBASE%%OCS_QUAL%\bin\isql -Usa -Pmanager -I%SYBASE%\ini\sql.ini
-S%SYBSERVER% -i .\syb_%DATABASE_NAME%_dump
@echo %CMD_LINE%
%CMD_LINE%
@REM **************************************************************************
@REM This script will return an error status back to the NetBackup client if
@REM the isql command fails.
@REM **************************************************************************
if errorlevel 0 goto end
echo Execution of isql command failed - exiting
if "%STATUS_FILE%" == "" goto end
if exist "%STATUS_FILE%" echo 1 > "%STATUS_FILE%"
:end
@echo on
@endlocal
More Information