- 论坛徽章:
- 0
|
NBU 5.0 for Sybase 12.5.2 备份不了
能不能明确提示一下,单路和多路在脚本的哪里限制一下!还有,你说的$DATABASE_TYPE环境变量我在脚本中根本找不到呀!我把我最新的脚本贴出来,你再帮忙看一眼!
还有一个问题根本解决不了,就是Sybase_config根本就执行不成功,上面的帖子中有错误信息。下面是我的脚本:
# more nms_sybase_backup.sh
#!/bin/sh
# sybase_mydb_backup $Revision: 1.3 $
#bcpyrght
#***************************************************************************
#* $VRTScprght: Copyright 1993 - 2003 VERITAS Software Corporation, All Rights Reserved $ *
#***************************************************************************
#ecpyrght
#***************************************************************************
# Replace /usr/sybase12 below with the actual Sybase home directory
#***************************************************************************
SYBASE=/sybase
#***************************************************************************
# Replace SYBASE12 below with the actual name of the SQL Server
#***************************************************************************
SYBSERVER=SYBASE
#***************************************************************************
# Replace SYB_DB below with the actual name of your Sybase database
#***************************************************************************
DATABASE_NAME=model
#***************************************************************************
# Replace syb_files below with your actual name of the NetBackup
# server Policy to be used to backup the directory with Sybase script files
#***************************************************************************
SYB_FILES_POLICY=nms_sybase_backup
#***************************************************************************
# Replace /usr/sybase12/scripts below with your actual path of the Sybase files
#***************************************************************************
SYB_FILES_DIR=/sybase
#***************************************************************************
# Determine the SYBASE_ASE and SYBASE_OCS env variables for Sybase 12.x
#***************************************************************************
OCS_QUAL=
if [ -f "${SYBASE}"/SYBASE.csh ] ; then
SYBASE_ASE=`grep "setenv SYBASE_ASE" "${SYBASE}"/SYBASE.csh | cut -f3 -d" " | sort -u | head -1`
SYBASE_OCS=`grep "setenv SYBASE_OCS" "${SYBASE}"/SYBASE.csh | cut -f3 -d" " | sort -u | head -1`
export SYBASE_ASE
export SYBASE_OCS
OCS_QUAL=/$SYBASE_OCS
elif [ -f "${SYBASE}"/SYBASE.sh ] ; then
SYBASE_ASE=`grep "SYBASE_ASE=" "${SYBASE}"/SYBASE.sh | cut -f2 -d"=" | sort -u | head -1`
SYBASE_OCS=`grep "SYBASE_OCS=" "${SYBASE}"/SYBASE.sh | cut -f2 -d"=" | sort -u | head -1`
export SYBASE_ASE
export SYBASE_OCS
OCS_QUAL=/$SYBASE_OCS
fi
echo "Started `date`"
SYBASE=$SYBASE; export SYBASE
# These environment variables are set by NetBackup
echo "SYBACKUP_SERVER = $SYBACKUP_SERVER"
echo "SYBACKUP_POLICY = $SYBACKUP_POLICY"
echo "SYBACKUP_SCHED = $SYBACKUP_SCHED"
echo "SYBACKUP_CLIENT = $SYBACKUP_CLIENT"
echo "SYBACKUP_SCHEDULED = $SYBACKUP_SCHEDULED"
echo "SYBACKUP_USER_INITIATED = $SYBACKUP_USER_INITIATED"
RETURN_STATUS=0
#***************************************************************************
# Replace "database_dump" below with your actual NetBackup schedule name
# which is used for a full backup of the Sybase database.
#***************************************************************************
if [ "${SYBACKUP_SCHED}" = "database_dump" ]
then
############# NetBackup has started a "database_dump" backup ##############
DUMP_TYPE=DATABASE
else
############# NetBackup has started a "transaction log" backup ##############
DUMP_TYPE=TRANSACTION
fi
#***************************************************************************
# Replace "Default-Application-Backup" below with your actual NetBackup
# Application Backup type schedule name for the Sybase database.
#***************************************************************************
echo dump $DUMP_TYPE $DATABASE_NAME to \"sybackup::-SERV $SYBACKUP_SERVER -CLIENT $SYBACKUP_CLIENT -POL $SYBACK
UP_POLICY -SCHED database_dump\" >; ./syb_${DATABASE_NAME}_dump
#**************************************************************************
# Remove the '#' from the beginning of the line below if you are going to
# use multiple stripes for the backup. Repeat this line for each stripe.
# Replace "Default-Application-Backup" below with your actual NetBackup
# Application Backup type schedule name for the Sybase database.
# **************************************************************************
echo stripe on \"sybackup::-SERV $SYBACKUP_SERVER -CLIENT $SYBACKUP_CLIENT -POL $SYBACKUP_POLICY -SCHED databas
e_dump\" >;>; ./syb_${DATABASE_NAME}_dump
echo go >;>; ./syb_${DATABASE_NAME}_dump
#***************************************************************************
# Log the isql command. This line may appear in NetBackup log files.
# Do NOT replace "xxxxxxxx" with a user id or password.
#***************************************************************************
echo "$SYBASE$OCS_QUAL/bin/isql -Uxxxxxxxx -Pxxxxxxxx -I$SYBASE/interfaces -S$SYBSERVER < ./syb_${DATABASE_NAME
}_dump"
#***************************************************************************
# Replace "sa" with your Sybase server Administrator's login name.
# Replace "manager" with your Sybase server Administrator's password.
#***************************************************************************
$SYBASE$OCS_QUAL/bin/isql -Usa -P123456 -I$SYBASE/interfaces -S$SYBSERVER < ./syb_${DATABASE_NAME}_dump
RETURN_STATUS=$?
if [ "${DUMP_TYPE}" = "DATABASE" ]
then
# Initiate a backup of any file related to the Sybase database, such as script files.
echo "bpbackup -c $SYB_FILES_POLICY $SYB_FILES_DIR"
/usr/openv/netbackup/bin/bpbackup -c $SYB_FILES_POLICY $SYB_FILES_DIR
BPBACKUP_STATUS=$?
if [ "$BPBACKUP_STATUS" -ne 0 ]
then
echo ""
echo "bpbackup of $SYB_FILES_DIR returned $BPBACKUP_STATUS"
fi
fi
echo "Finished `date`"
echo "exit $RETURN_STATUS"
echo ""
exit $RETURN_STATUS |
|