Chinaunix

标题: 求助Networker 7.4 + NMS3.0 + Sybase 12.54 无法自动备份,谢谢大家 [打印本页]

作者: —_—!搏    时间: 2010-05-28 17:27
标题: 求助Networker 7.4 + NMS3.0 + Sybase 12.54 无法自动备份,谢谢大家
1.现在备份sybase、在sybase用户可以手工备份,自动备份会报错,无法进行下去

手动备份可以
bash-3.00$ /usr/sbin/nsrsybsv -U sa -P sybase -s sc1 -l full SYBASE:/SC
Backing up database master.
Truncating transaction log for database "master".
Backing up database model.
Truncating transaction log for database "model".
Backing up database sybsystemdb.
Truncating transaction log for database "sybsystemdb".
Backing up database sybsystemprocs.
Truncating transaction log for database "sybsystemprocs".
24193:nsrsybsv:******** SUMMARY OF SYBASE BACKUP ********
53359:nsrsybsv:sc1: SYBASE:/SC/master Level=full, 6193 KB 00:00:10
53360:nsrsybsv:Completion time for NMS backup=1210963573
53359:nsrsybsv:sc1: SYBASE:/SC/model Level=full, 366 KB 00:00:10
53360:nsrsybsv:Completion time for NMS backup=1210963573
53359:nsrsybsv:sc1: SYBASE:/SC/sybsystemdb Level=full, 416 KB 00:00:10
53360:nsrsybsv:Completion time for NMS backup=1210963573
53359:nsrsybsv:sc1: SYBASE:/SC/sybsystemprocs Level=full, 86 MB 00:00:10
53360:nsrsybsv:Completion time for NMS backup=1210963573
24196:nsrsybsv:******* END OF SYBASE SUMMARY *********



2.自动报错输出和在root用户下备份的报错是一样的,怀疑为console服务器不能控制用哪个用户进行备份,或者是哪里没设置对。备份命令nsrsybsv不能在root用户下进行。
   在脚本nsrsyb没有找到可以定义备份用户的地方。

root@sc1 # /usr/sbin/nsrsybsv -Usa -Psybase -s sc1 -l full SYBASE:/SC
Backing up database master.
24146:nsrsybsv:Error from server SC_BS: Msg 412402, Level 2, State 1
        Backup Server: 4.124.2.1: Archive API error for device='bms::sc1.SC.master../nsr/tmp/sysDaaBi::00': Vendor application name=Legato, Library version=200, API routine=syb_open(), Message=unable to create environment variables.
24146:nsrsybsv:Error from server SC: Msg 8009, Level 16, State 1
        Error encountered by Backup Server.  Please refer to Backup Server messages for details.
24115:nsrsybsv:Error: unable to dump database master in instance SC.


3.nms_config 做过,/nsr/tmp 也设成777或者4755,都试过。到库下,手动dump也是可以的。感觉没什么办法了。


4./usr/sbin/nsrsyb里面是否可以加su - sybase,应该如何加?


请指教,不胜感激



作者: michael1983    时间: 2010-05-28 17:35
重启下备份服务器试试
作者: —_—!搏    时间: 2010-05-28 17:39
回复 2# michael1983


    感谢,,重启过啊,感觉不解决问题啊,呵呵
作者: michael1983    时间: 2010-05-28 17:41
什么时候开始出错的?
以前有备份成功吗?
作者: —_—!搏    时间: 2010-05-28 17:44
呵呵,从来就没有成功过,新开局的,但是数据库部分已经上线。就差备份这点了,压力大啊。

弄不明白,为什么手动备份可以,自动备份就不行。看了很多帖子说nsrsyb的问题,但没能解决。

谢谢
作者: yddll    时间: 2010-05-28 18:04
说了半天,nsrsyb的脚本贴出来啊


普通用户可以,root不行,脚本变量有问题吧
作者: —_—!搏    时间: 2010-05-28 18:08
哈哈,看见有关于networker的帖子就有您在。

除了加了SYBASE=xxxxxx,其他都没动

###########################################################################
# This value MUST be set for scheduled backups to run.
###########################################################################
#
# Variable: SYBASE
# Default value:
# Description: Specifies where the Sybase RDBMS is installed.
# For ASE version 12.0, set this variable to the directory
# where Sybase OCS version 12.5 software is installed.
# For ASE version 12.5 and later, set this variable to the
# directory where Sybase ASE software is installed.
# This *must* be set for scheduled backups to be able to find the
# Sybase libraries and executables.
#
SYBASE=/opt/sybase
. $SYBASE/SYBASE.sh
###########################################################################


#
# Configuration variables, modifiable by users.
#
###########################################################################
# The following lines may be edited to change the default settings.  These
# are for advanced tailoring of backups and should be edited carefully.
###########################################################################

#
# Variable: USE_CONSISTENCY_CHECK
# Default value: true
# If set, this puts a consistency check into the PRECMD variable.
# To disable this, set the USE_CONSISTENCY_CHECK value as follows:
# USE_CONSISTENCY_CHECK=
#
# If this is on, it will set the PRECMD to do a consistency check.
# If you need to customize the PRECMD to do other work, unset this
# value and perform any desired consistency checks in your own
# script.
#
USE_CONSISTENCY_CHECK=true

#
# Variable: DBCCOPT
# Default value: none
# If set, these are the options that the nsrsybcc program uses in its
# consistency check.  If not set, the options will be the program defaults
# from the nsrsybcc program.
#
DBCCOPT=

#
# Variable: PRECMD
# Default value:
# Description: This variable can be used to run a command before nsrsybsv.
#
# If USE_CONSISTENCY_CHECK is set, the PRECMD will be constructed to perform
# a nsrsybcc check on the given saveset.  A PRECMD that you set here will
# not be overwritten by a consistency check, however.
#
PRECMD=

#
# Variable: POSTCMD
# Default value: NONE
# Description: This variable can be used to run a command after nsrsybsv
# has completed.
#
POSTCMD=

#
# Variable: BACKUP_OPT
# Default value: none
# If set, these are the options that will be passed to the nsrsybsv
# program in addition to the ones set from savegrp.  This is useful
# for setting the debug level.
# Passing -N option is not recommended as it will be overwritten by
# what is passed from the savegroup.
#
#BACKUP_OPT="-D 4"
#
BACKUP_OPT=

#
# Variable: NSR_DATA_VOLUME_POOL
# Default value: none
# Description: If this variable is set to name a media pool, then database
# backups will be directed to the named media pool.
#
NSR_DATA_VOLUME_POOL=

#
# Variable: NSR_LOG_VOLUME_POOL
# Default value: none
# Description: If this variable is set to name a media pool, then
# transaction log backups will be directed to the named media pool.
#
NSR_LOG_VOLUME_POOL=

#
# Variable: NSR_COMPRESSION
# Default value: FALSE
# Description: This environment variable specifies whether client-side
# compression is performed on the data.
#
NSR_COMPRESSION=FALSE

#
# Variable: NSR_ENCRYPTION
# Default value: FALSE
# Description: This environment variable specifies whether encryption
# is used between the client and server.
#
NSR_ENCRYPTION=FALSE


您看我需要怎么改改?
作者: michael1983    时间: 2010-05-28 18:10
完全不懂了
作者: —_—!搏    时间: 2010-05-28 18:12
本帖最后由 —_—!搏 于 2010-05-28 18:27 编辑
说了半天,nsrsyb的脚本贴出来啊


普通用户可以,root不行,脚本变量有问题吧
yddll 发表于 2010-05-28 18:04



    请问,脚本变量应该如何加呢。
   

   就是nsrsyb,这个脚本不能在root下成功运行

   或者说console 服务器不能用sybase用户调用nsrsyb脚本

   
   哪种方法能实现呢?

   谢谢
作者: yddll    时间: 2010-05-28 18:38
检查你的SYBASE变量是不是正确的
检查$SYBASE下的SYBASE.sh里的内容是符合现状,SYBASE.sh是安装sybase的时候,sybase为sybase用户创建的环境变量脚本,以root用户执行这个脚本,即是给root用户加载sybase用户的环境变量,有可能谁在安装sybase之后做过手工修改,而没有体现到这个脚本里去

另外,把USE_CONSISTENCY_CHECK注释掉
作者: —_—!搏    时间: 2010-05-28 19:01
回复 10# yddll


    Thk U!我明天试试,谢谢 谢谢
作者: 100心    时间: 2010-05-28 19:36
参见此帖

http://bbs.chinaunix.net/viewthr ... p;extra=&page=1
作者: bond2200    时间: 2010-05-28 22:05
别用那个配置文件了,自动备份做不了
我成功的经验
在backup command里直接写:
nsrsybsv -Usa -Psybase

save set里写数据库实例
作者: 100心    时间: 2010-05-28 22:42
如果不用配置文件,那恢复的时候怎样操作呢?
作者: —_—!搏    时间: 2010-05-31 11:08
别用那个配置文件了,自动备份做不了
我成功的经验
在backup command里直接写:
nsrsybsv -Usa -Psybase ...
bond2200 发表于 2010-05-28 22:05



    兄弟,我试了试您这个办法,还真不行报OCS lib 的PATH不对。是不是我哪儿里没设置正确呢?

43394:nsrsybsv:Failed to open OCS library. Please ensure dynamic library path is set to appropriate OCS library path.
   
   还请指教!谢谢
作者: —_—!搏    时间: 2010-05-31 11:25
本帖最后由 —_—!搏 于 2010-05-31 11:28 编辑
检查你的SYBASE变量是不是正确的
检查$SYBASE下的SYBASE.sh里的内容是符合现状,SYBASE.sh是安装sybase的时 ...
yddll 发表于 2010-05-28 18:38



    HI,师兄
  
   我试了试您这个办法,SYBASE是俺自己装的,也没改其他的什么东西,所以SYBASE.sh应该是符合现状的。

   启动组备份的时候,还是老报错,不知道现在问题出在哪里了?

   nsrsyb脚本是用root用户调用的,所以必须保证nsrsyb在root用户下正常运行,(只要给root用户加载sybase用户的用户变量,就应该正常)是这样理解吧?


    谢谢
作者: yddll    时间: 2010-05-31 12:43
报错信息贴出来啊,贴全的,详细的
作者: michael1983    时间: 2010-05-31 13:14
等事态发展,汲取经验
作者: —_—!搏    时间: 2010-05-31 14:09


谢谢各位,我现在通过设置后,还是报同样的错误,不知道我的client设置是否正确,请指教,谢谢
作者: yddll    时间: 2010-05-31 16:01
nsrsyb的脚本能不能给偶发一个啊
我没有环境
作者: —_—!搏    时间: 2010-05-31 16:07
#!/bin/sh
#
# $Id: nsrsyb.sh,v 1.13.84.11 2007/05/11 12:08:56 sharmh Exp $ Copyright (c) 2007, EMC Corporation.
#
#
# Copyright (c) 2007, EMC Corporation.
#
# All rights reserved.  This is an UNPUBLISHED work, and
# comprises proprietary and confidential information of EMC.  
# Unauthorized use, disclosure, and distribution are strictly
# prohibited.  Use, duplication, or disclosure of the software
# and documentation by the U.S. Government is subject to
# restrictions set forth in a license agreement between the
# Government and EMC or other written agreement specifying
# the Government's rights to use the software and any applicable
# FAR provisions, such as FAR 52.227-19.
#
# nsrsyb
#
# This script is part of the Networker Module for Sybase.
# Modification of this script should be done with care and only after reading
# the administration manual included with this product.
#
# This script should only be run as part of a scheduled savegroup.
#
# Returns 0 on success; 1 on failure.
#


###########################################################################
# This value MUST be set for scheduled backups to run.
###########################################################################
#
# Variable: SYBASE
# Default value:
# Description: Specifies where the Sybase RDBMS is installed.
# Set this variable to the directory where Sybase ASE
# software is installed. This *must* be set for scheduled backups
# to be able to find the Sybase libraries and executables.
#
SYBASE=/export/home/sybase/ASE-12_5
. $SYBASE/SYBASE.sh
###########################################################################


#
# Configuration variables, modifiable by users.
#
###########################################################################
# The following lines may be edited to change the default settings.  These
# are for advanced tailoring of backups and should be edited carefully.
###########################################################################

#
# Variable: USE_CONSISTENCY_CHECK
# Default value: true
# If set, this puts a consistency check into the PRECMD variable.
# To disable this, set the USE_CONSISTENCY_CHECK value as follows:
# USE_CONSISTENCY_CHECK=
#
# If this is on, it will set the PRECMD to do a consistency check.
# If you need to customize the PRECMD to do other work, unset this
# value and perform any desired consistency checks in your own
# script.
#
USE_CONSISTENCY_CHECK=true

#
# Variable: DBCCOPT
# Default value: none
# If set, these are the options that the nsrsybcc program uses in its
# consistency check.  If not set, the options will be the program defaults
# from the nsrsybcc program.
#
DBCCOPT="-o ckdb"

#
# Variable: PRECMD
# Default value:
# Description: This variable can be used to run a command before nsrsybsv.
#
# If USE_CONSISTENCY_CHECK is set, the PRECMD will be constructed to perform
# a nsrsybcc check on the given saveset.  A PRECMD that you set here will
# not be overwritten by a consistency check, however.
#
PRECMD=

#
# Variable: POSTCMD
# Default value: NONE
# Description: This variable can be used to run a command after nsrsybsv
# has completed.
#
POSTCMD=

#
# Variable: BACKUP_OPT
# Default value: none
# If set, these are the options that will be passed to the nsrsybsv
# program in addition to the ones set from savegrp.  This is useful
# for setting the debug level.
# Passing -N option is not recommended as it will be overwritten by
# what is passed from the savegroup.
#
#BACKUP_OPT="-D 4"
#
BACKUP_OPT="-b sybasefull"

#
# Variable: NSR_DATA_VOLUME_POOL
# Default value: none
# Description: If this variable is set to name a media pool, then database
# backups will be directed to the named media pool.
#
NSR_DATA_VOLUME_POOL=

#
# Variable: NSR_LOG_VOLUME_POOL
# Default value: none
# Description: If this variable is set to name a media pool, then
# transaction log backups will be directed to the named media pool.
#
NSR_LOG_VOLUME_POOL=

#
# Variable: NSR_COMPRESSION
# Default value: FALSE
# Description: This environment variable specifies whether client-side
# compression is performed on the data.
#
NSR_COMPRESSION=FALSE

#
# Variable: NSR_AES_ENCRYPTION
# Default value: FALSE
# Description: This environment variable specifies whether AES encryption
# is used between the client and server.
#
NSR_AES_ENCRYPTION=FALSE

#
# Variable: NSR_ASE_PASSWORD
# Default value: None
# Description: This environment variable specifies the password
# to be used while dumping for ASE 12.5.2 onwards.
#
NSR_ASE_PASSWORD=

#
# Variable: NSR_ASE_VERIFY
# Default value: None
# Description: This environment variable specifies the verify
# clause to be used while issuing dump command for ASE 12.5.4 onwards.
# The valid values can be either "header" or "full". The value
# is case insensitive. The option header will verify only the
# header before dump. The option full will verify both
# header and row structure.
# Note that the verify clause does not work with ASE 15.0.
#
NSR_ASE_VERIFY=

#
# Variable: NSR_DEBUG_FILE
# Default value: /nsr/applogs/xbsa.messages
# Description: This environment variable specifies which file the XBSA
# messages should be written to.
#
NSR_DEBUG_FILE=/nsr/applogs/xbsa.messages

###########################################################################
# Do not edit anything below this line.
###########################################################################

# Set up the PATH environment variable.  This must be configured to include
# the path to the "nsrsybrc", "nsrsybsv", and "nsrsybcc" executables.
PATH=:/bin:/usr/sbin:/opt/networker/bin:/usr/bin:/usr/sbin/nsr

Pid=0                                # process to kill if we are cancelled
nsrsybsv_status=0                # did it work?




#
# Make sure all environment variables are exported
#
export_environment_variables()
{
        if [ "$NSR_COMPRESSION" != "" ]
        then
                export NSR_COMPRESSION
        fi

        if [ "$NSR_AES_ENCRYPTION" != "" ]
        then
                export NSR_AES_ENCRYPTION
        fi

        if [ "$NSR_LOG_VOLUME_POOL" != "" ]
        then
                export NSR_LOG_VOLUME_POOL
        fi

        if [ "$NSR_DATA_VOLUME_POOL" != "" ]
        then
                export NSR_DATA_VOLUME_POOL
        fi

        if [ "$NSR_GROUP" != "" ]
        then
                export NSR_GROUP
        fi

        if [ "$PRECMD" != "" ]
        then
                export PRECMD
        fi

        if [ "$POSTCMD" != "" ]
        then
                export POSTCMD
        fi

        if [ "$SYBASE" != "" ]
        then
                export SYBASE
        fi

        if [ "$PATH" != "" ]
        then
                export PATH
        fi
       
        if [ "$NSR_ASE_PASSWORD" != "" ]
        then
                export NSR_ASE_PASSWORD
        fi

        if [ "$NSR_ASE_VERIFY" != "" ]
        then
                export NSR_ASE_VERIFY
        fi

        if [ "$NSR_DEBUG_FILE" != "" ]
        then
                export NSR_DEBUG_FILE
        fi
}


#
# Handle cancel signals sent by savegrp when user stops the group.
#
handle_signal()
{
        if [ $Pid != 0 ]; then
                kill -2 $Pid
        fi
        exit 1
}


#
# Utility function for adding parameters on to the existing precmd.
# This is used to build up the precmd from the command line arguments.
#
add_arg_to_pre_command()
{
        if [ "$1" != "" ]
        then
                PRECMD=$PRECMD" ""$1"
        fi
}


#
# Process the arguments to find the saveset name.
# this will be used in the PRECMD for the database
# consistency check.  The only things we check for
# are parameters that we'll need to use for the
# nsrsybcc program.
#
# This also builds the actual backup command.  Group
# names are problematic since the quoting doesn't work
# quite right, so we always export the group name.
#
processargs()
{
        DBCC_SAVESET_NAME=
        DBCC_USERNAME=
        DBCC_PASSWORD=
        DBCC_CLIENT=
        DBCC_SERVER=
        DBCC_DEBUG=
        DBCC_QUIET=
        DBCC_VERBOSE=

        # Add the backup options to the backup command.
        BACKUP_COMMAND="nsrsybsv"
        if [ "${BACKUP_OPT}" != "" ];
        then
                BACKUP_COMMAND=$BACKUP_COMMAND" ""$BACKUP_OPT"
        fi


        while test $# -gt 0
        do
                case "$1" in
                -N)        # Get the save set name
                        DBCC_SAVESET_NAME="$2"
                        BACKUP_COMMAND=$BACKUP_COMMAND" ""$1 $2"
                        shift
                        shift
                        ;;

                -g)        # get the group name
                        NSR_GROUP=$2
                        shift
                        shift
                        ;;

                -U)        # get the user name
                        DBCC_USERNAME="$1 $2"
                        BACKUP_COMMAND=$BACKUP_COMMAND" ""$1 $2"
                        shift
                        shift
                        ;;

                -P)        # get the password
                        DBCC_PASSWORD="$1 $2"
                        BACKUP_COMMAND=$BACKUP_COMMAND" ""$1 $2"
                        shift
                        shift
                        ;;

                -c)        # get the client
                        DBCC_CLIENT="$1 $2"
                        BACKUP_COMMAND=$BACKUP_COMMAND" ""$1 $2"
                        shift
                        shift
                        ;;

                -s)        # get the server
                        DBCC_SERVER="$1 $2"
                        BACKUP_COMMAND=$BACKUP_COMMAND" ""$1 $2"
                        shift
                        shift
                        ;;

                -D)        # get the debug level
                        DBCC_DEBUG="$1 $2"
                        BACKUP_COMMAND=$BACKUP_COMMAND" ""$1 $2"
                        shift
                        shift
                        ;;

                -q)        # get the quiet flag
                        DBCC_QUIET="$1"
                        BACKUP_COMMAND=$BACKUP_COMMAND" ""$1"
                        shift
                        ;;

                -v)        # get the verbose flag
                        DBCC_VERBOSE="$1"
                        BACKUP_COMMAND=$BACKUP_COMMAND" ""$1"
                        shift
                        ;;

                *)        # it is some other argument that we will skip
                        BACKUP_COMMAND=$BACKUP_COMMAND" ""$1"
                        shift
                        ;;
                esac

        done

        #
        # If we don't already have a PRECMD and we are supposed to
        # do a database consistency check, we'll build the PRECMD
        # to be a database consistency check of the save set name
        # supplied. We'll take the default nsrsybcc options.
        # To change the options the consistency check uses, edit the PRECMD line
        # with the desired options.
        #
        if [ "${PRECMD}" = "" ] && [ "${USE_CONSISTENCY_CHECK}" != "" ]
        then
                PRECMD=nsrsybcc

                add_arg_to_pre_command "$DBCCOPT"
                add_arg_to_pre_command "$DBCC_USERNAME"
                add_arg_to_pre_command "$DBCC_PASSWORD"
                add_arg_to_pre_command "$DBCC_CLIENT"
                add_arg_to_pre_command "$DBCC_SERVER"
                add_arg_to_pre_command "$DBCC_DEBUG"
                add_arg_to_pre_command "$DBCC_QUIET"
                add_arg_to_pre_command "$DBCC_VERBOSE"
                add_arg_to_pre_command "$DBCC_SAVESET_NAME"
        fi
}


#
# The main portion of this shell.
#


#
# Make sure we respond to savegrp cancellations.
#
trap handle_signal 2 15


#
# Build the nsrsybsv command
#

#
# Find the saveset name to use for the database consistency check
# and construct the BACKUP_COMMAND to call nsrsybsv.
#
processargs "$@"


#
# Export all necessary environment variables
#
export_environment_variables

#
# Call nsrsybsv to do the backups.
#

# echo ${BACKUP_COMMAND}

${BACKUP_COMMAND} &
Pid=$!
wait $Pid

nsrsybsv_status=$?
if [ $nsrsybsv_status != 0 ] ; then
        echo "nsrsybsv returned status of "$nsrsybsv_status
        echo  $0 "exiting."
        exit 1
fi

exit 0

























谢谢你啦
作者: yddll    时间: 2010-05-31 16:07
兄弟,我试了试您这个办法,还真不行报OCS lib 的PATH不对。是不是我哪儿里没设置正确呢?

43 ...
—_—!搏 发表于 2010-05-31 11:08



还是变量的问题啊
作者: yddll    时间: 2010-05-31 16:18
还有让你注释掉的也没注释掉
作者: yddll    时间: 2010-05-31 16:19
把sybase的env输出和root的env输出比较一下
作者: yddll    时间: 2010-05-31 16:27
还有就是可以把nsrsyb加上-x选项,看看那里报错
就是sh -x nsrsyb xxxxx    xxxxx 是备份选项
或者脚本第一行改成#!/bin/sh -x
这样可以看到脚本执行的每一步
作者: —_—!搏    时间: 2010-05-31 17:13
回复 22# yddll


    但是我没有OCS的lib啊。
作者: redwaves    时间: 2010-05-31 17:21
SYBASE=/export/home/sybase/ASE-12_5
. $SYBASE/SYBASE.sh
这个参数一定要设对

另外这两个参数必设
NSR_DATA_VOLUME_POOL=
NSR_LOG_VOLUME_POOL=
作者: —_—!搏    时间: 2010-05-31 17:27
好的,多谢你们大伙

nsrsyb的这个脚本我怎么控制用solaris系统用户sybase执行,而不是用solaris系统用户root执行呢


我现在就是sybase用户下执行这个脚本,一点问题没有。
但在console服务器图形化界面,就不行。root用户下执行这个脚本,也不行。报错是一样一样的
作者: wolfheader    时间: 2010-05-31 21:48
好的,多谢你们大伙

在console服务器图形化界面,就不行。root用户下执行这个脚本,也不行。报错是一样一样的
—_—!搏 发表于 2010-05-31 17:27



    yddll说的对,关键是root和sybase的env。

查一下SYBASE.SH,看看少哪些些变量补进去,可以在sybase的profile里找。比如SYBASE_OCS,LIBPATH等,都是必须的~~

把这个/nsr/applogs/xbsa.messages贴一下看看能找到有价值的信息么~

如果实在搞不定的话,也可以考虑用savepnpc的方法,自己写脚本,指定su 到sybase执行nsrsybsv+savegrp的办法~
作者: —_—!搏    时间: 2010-06-01 22:26
十分感谢你们!

现在我感觉问题不是出在env或者是SYBASE.sh。

按大家所说的我都做过了。

感觉是nsrsyb脚本调用nsrsybsv这个备份命令,这个备份命令在指导书上说不能在root用户下运行,所以必须在sybase用户运行。

我就想在nsrsyb脚本里加上su - sybase,但是不懂shell语句,导致备份命令和su - sybase 用户不能结合使用啊

# Set up the PATH environment variable.  This must be configured to include
# the path to the "nsrsybrc", "nsrsybsv", and "nsrsybcc" executables.
PATH=:/bin:/usr/sbin:/opt/networker/bin:/usr/bin:/usr/sbin/nsr

Pid=0                                # process to kill if we are cancelled
nsrsybsv_status=0                # did it work?




#
# Make sure all environment variables are exported
#
export_environment_variables()
{
        if [ "$NSR_COMPRESSION" != "" ]
        then
                export NSR_COMPRESSION
        fi

        if [ "$NSR_AES_ENCRYPTION" != "" ]
        then
                export NSR_AES_ENCRYPTION
        fi

        if [ "$NSR_LOG_VOLUME_POOL" != "" ]
        then
                export NSR_LOG_VOLUME_POOL
        fi

        if [ "$NSR_DATA_VOLUME_POOL" != "" ]
        then
                export NSR_DATA_VOLUME_POOL
        fi

        if [ "$NSR_GROUP" != "" ]
        then
                export NSR_GROUP
        fi

        if [ "$PRECMD" != "" ]
        then
                export PRECMD
        fi

        if [ "$POSTCMD" != "" ]
        then
                export POSTCMD
        fi

        if [ "$SYBASE" != "" ]
        then
                export SYBASE
        fi

        if [ "$PATH" != "" ]
        then
                export PATH
        fi
       
        if [ "$NSR_ASE_PASSWORD" != "" ]
        then
                export NSR_ASE_PASSWORD
        fi

        if [ "$NSR_ASE_VERIFY" != "" ]
        then
                export NSR_ASE_VERIFY
        fi

        if [ "$NSR_DEBUG_FILE" != "" ]
        then
                export NSR_DEBUG_FILE
        fi
}


#
# Handle cancel signals sent by savegrp when user stops the group.
#
handle_signal()
{
        if [ $Pid != 0 ]; then
                kill -2 $Pid
        fi
        exit 1
}


#
# Utility function for adding parameters on to the existing precmd.
# This is used to build up the precmd from the command line arguments.
#
add_arg_to_pre_command()
{
        if [ "$1" != "" ]
        then
                PRECMD=$PRECMD" ""$1"
        fi
}


#
# Process the arguments to find the saveset name.
# this will be used in the PRECMD for the database
# consistency check.  The only things we check for
# are parameters that we'll need to use for the
# nsrsybcc program.
#
# This also builds the actual backup command.  Group
# names are problematic since the quoting doesn't work
# quite right, so we always export the group name.
#
processargs()
{
        DBCC_SAVESET_NAME=
        DBCC_USERNAME=
        DBCC_PASSWORD=
        DBCC_CLIENT=
        DBCC_SERVER=
        DBCC_DEBUG=
        DBCC_QUIET=
        DBCC_VERBOSE=

        # Add the backup options to the backup command.
        BACKUP_COMMAND="nsrsybsv"
        if [ "${BACKUP_OPT}" != "" ];
        then
                BACKUP_COMMAND=$BACKUP_COMMAND" ""$BACKUP_OPT"
        fi


        while test $# -gt 0
        do
                case "$1" in
                -N)        # Get the save set name
                        DBCC_SAVESET_NAME="$2"
                        BACKUP_COMMAND=$BACKUP_COMMAND" ""$1 $2"
                        shift
                        shift
                        ;;

                -g)        # get the group name
                        NSR_GROUP=$2
                        shift
                        shift
                        ;;

                -U)        # get the user name
                        DBCC_USERNAME="$1 $2"
                        BACKUP_COMMAND=$BACKUP_COMMAND" ""$1 $2"
                        shift
                        shift
                        ;;

                -P)        # get the password
                        DBCC_PASSWORD="$1 $2"
                        BACKUP_COMMAND=$BACKUP_COMMAND" ""$1 $2"
                        shift
                        shift
                        ;;

                -c)        # get the client
                        DBCC_CLIENT="$1 $2"
                        BACKUP_COMMAND=$BACKUP_COMMAND" ""$1 $2"
                        shift
                        shift
                        ;;

                -s)        # get the server
                        DBCC_SERVER="$1 $2"
                        BACKUP_COMMAND=$BACKUP_COMMAND" ""$1 $2"
                        shift
                        shift
                        ;;

                -D)        # get the debug level
                        DBCC_DEBUG="$1 $2"
                        BACKUP_COMMAND=$BACKUP_COMMAND" ""$1 $2"
                        shift
                        shift
                        ;;

                -q)        # get the quiet flag
                        DBCC_QUIET="$1"
                        BACKUP_COMMAND=$BACKUP_COMMAND" ""$1"
                        shift
                        ;;

                -v)        # get the verbose flag
                        DBCC_VERBOSE="$1"
                        BACKUP_COMMAND=$BACKUP_COMMAND" ""$1"
                        shift
                        ;;

                *)        # it is some other argument that we will skip
                        BACKUP_COMMAND=$BACKUP_COMMAND" ""$1"
                        shift
                        ;;
                esac

        done

        #
        # If we don't already have a PRECMD and we are supposed to
        # do a database consistency check, we'll build the PRECMD
        # to be a database consistency check of the save set name
        # supplied. We'll take the default nsrsybcc options.
        # To change the options the consistency check uses, edit the PRECMD line
        # with the desired options.
        #
        if [ "${PRECMD}" = "" ] && [ "${USE_CONSISTENCY_CHECK}" != "" ]
        then
                PRECMD=nsrsybcc

                add_arg_to_pre_command "$DBCCOPT"
                add_arg_to_pre_command "$DBCC_USERNAME"
                add_arg_to_pre_command "$DBCC_PASSWORD"
                add_arg_to_pre_command "$DBCC_CLIENT"
                add_arg_to_pre_command "$DBCC_SERVER"
                add_arg_to_pre_command "$DBCC_DEBUG"
                add_arg_to_pre_command "$DBCC_QUIET"
                add_arg_to_pre_command "$DBCC_VERBOSE"
                add_arg_to_pre_command "$DBCC_SAVESET_NAME"
        fi
}


#
# The main portion of this shell.
#


#
# Make sure we respond to savegrp cancellations.
#
trap handle_signal 2 15


#
# Build the nsrsybsv command
#

#
# Find the saveset name to use for the database consistency check
# and construct the BACKUP_COMMAND to call nsrsybsv.
#
processargs "$@"


#
# Export all necessary environment variables
#
export_environment_variables

#
# Call nsrsybsv to do the backups.
#

# echo ${BACKUP_COMMAND}

${BACKUP_COMMAND} &
Pid=$!
wait $Pid

nsrsybsv_status=$?
if [ $nsrsybsv_status != 0 ] ; then
        echo "nsrsybsv returned status of "$nsrsybsv_status
        echo  $0 "exiting."
        exit 1
fi

exit 0


请高手帮忙看下,如何使su - sybase 与此环境结合使用呢。
作者: —_—!搏    时间: 2010-06-17 11:28
HI,ALL

这个问题得到圆满的解决,十分感谢大家的帮助和支持

①换了一个nsrsybsv的命令文件

②在SYBASE.sh文件中加入下面行

NSR_SERVER=
export NSR_SERVER
PATH="/usr/sbin:/usr/bin:/var/nsr/bin:/var/nsr/tmp"PATH
export PATH
NSR_CLIENT=
export NSR_CLIENT

③经实验,可以成功备份
作者: wolfheader    时间: 2010-06-17 11:42
呵呵,最关键的是这个nsrsybsv是哪来的?哪个版本的
作者: —_—!搏    时间: 2010-06-17 14:47
呵呵,最关键的是这个nsrsybsv是哪来的?哪个版本的
wolfheader 发表于 2010-06-17 11:42



    这个确实是关键中的关键,但是没查出来这命令是那个版本的,我再查查
作者: 100心    时间: 2010-06-17 18:35
我先在这个贴留个名字,回头我再研究这个东西。
作者: windwux    时间: 2010-06-24 14:55
我也留个名吧
作者: 100心    时间: 2010-06-25 11:03
LZ能贡献您的安装指导么{:3_200:},CU全体人员感谢您。{:3_189:}
作者: michael1983    时间: 2010-06-26 18:37
HI,ALL

这个问题得到圆满的解决,十分感谢大家的帮助和支持

①换了一个nsrsybsv的命令文件

②在SY ...
—_—!搏 发表于 2010-06-17 11:28



    兄弟是怎么换的nsrsybsv文件啊?从哪里搞的?
作者: __Aaron    时间: 2010-06-26 18:54
LZ能贡献您的安装指导么,CU全体人员感谢您。
100心 发表于 2010-06-25 11:03



    是啊
作者: redwaves    时间: 2010-06-28 11:13
nsrsybsv哪里来的?




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2