search论坛时,发现以前好多不错的讨论都没了 所以粗略整理了一下,建议大家在浏览本坛时,将不错的贴子留下
1) 关于定事备份 http://www.chinaunix.net/cgi-bin/bbs/topic.cgi?forum=10&topic=1233&show=390 crontab 中可以这样写: 00 23 * * * /sybase/ASE-12_0/bin/DUMPDB.sh >>/sybase/ASE-12_0/install/DUMPDB.out
放那里都无所谓,一个dumpdb.sh的例子: #SUN Solaris 8 #!/bin/ksh export SYBASE=/sybase export SYBASE_FTS=FTS-12_0 export PATH=/sybase/ASE-12_0/bin:/sybase/OCS-12_0/bin:$PATH:/sybase/ASE-12_0/install:/usr/sbin export SYBASE_OCS=OCS-12_0 export SYBASE_ASE=ASE-12_0 export LM_LICENSE_FILE=/sybase/SYSAM-1_0/licenses/license.dat:$LM_LICENSE_FILE export LD_LIBRARY_PATH=/sybase/ASE-12_0/lib:/usr/local/openwin/lib:/sybase/FTS-12_0/lib:/sybase/OCS-12_0/lib:/usr/local/openwin/lib:/usr/lib:/sybase/SQLRemote/lib:$LD_LIBRARY_PATH export SYBASE_SYSAM=SYSAM-1_0 export HOME=$SYBASE $SYBASE_OCS/bin/isql -Usa -SSYBASE -P <<! dump database YOURDBNAME to "/sybdump/dump.01" stripe on "/sybdump/dump.02" stripe on "/sybdump/dump.03" stripe on "/sybdump/dump.04" stripe on "/sybdump/dump.05" go ! 这里是一个典型的脚本,用于实现full备份! #!/usr/bin/sh # ************************************************************************* #for full backup after excuted dbcc operation # ************************************************************************* SHLIB_PATH=/opt/sybase/ASE-12_0/lib:/opt/sybase/FTS-12_0/lib:/opt/sybase/OCS-12_0/lib:/usr/lib:/lib:/usr/lib/Motif1.2:/opt/sybase/SQLRemote/ lib export SHLIB_PATH SYBASE_OCS=OCS-12_0 export SYBASE_OCS SYBASE=/opt/sybase export SYBASE
ISQL="/opt/sybase/OCS-12_0/bin" ymd=`date +%y%m%d` bk_user="unb" bk_pwd="******" bk_db="SYB_HP" cd /sybase/backup mkdir $ymd LOG="/sybase/backup/$ymd" echo $ymd >$LOG/backup.log echo "\n11*************************" >>$LOG/backup.log echo "Check database $bk_db..." >>$LOG/backup.log d1=`date` su - sybase -c "isql -SSYB_HP -Usa -P****** <<DBCC >$LOG/dbcc-$ymd.log 2>&1 dbcc traceon(3604) go dbcc checkdb($bk_db) go dbcc traceoff(3604) go DBCC echo $d1,`date` >>$LOG/backup.log echo "\n22*************************" >>$LOG/backup.log d1=`date` dump_file="/sybase/backup/$dump-unb-full-$ymd.dat" echo "Dump database $bk_db to " $dump_file >>$LOG/backup.log su - sybase -c "isql -SSYB_HP -Usa -P****** <<DUMP >$LOG/dump-$ymd.log 2>&1 dump database $bk_db to "$dump_file" go DUMP echo $d1,`date` >>$LOG/backup.log echo "\n33*************************" >>$LOG/backup.log 请根据自身系统,调试后再使用! 至于备份日志的脚本与此类似,自己根据sybase的相关语法,稍加变动即可!
2) 有个关于游标的问题,请教各位大虾 http://www.chinaunix.net/cgi-bin/bbs/topic.cgi?forum=10&topic=429&show=390 在sybase数据库中用游标操作完表a的记录后,关闭close游标,在free游标。但接着想drop此表a,结果失败,显示的错误信息是"游标在使用"(记得不是很清楚了,大概是这个意思)。 请碰到过这类问题的大虾支持支持。在informix和oracle中释放游标是用free,在sybase也是用free吗?
sybase 中正确操作游标的顺序是: 1、DECLARE CUR_ACCTINFO CURSOR FOR SELECT ..... (定义) 2、OPEN CUR_ACCTINFO (打开) 3、WHILE @@SQLSTATUS = 0 (判断是否成功) BEGIN 4、 FETCH CUR_ACCTINFO INTO ....... (取数据) IF @@SQLSTATUS <> 0 begin ...... end ........... 5、 CLOSE CUR_ACCTINFO (关闭) 6、 DEALLOCATE CURSOR CUR_ACCTINFO (释放)
3) 在sybase中有没有进行数据类型转换的函数 http://www.chinaunix.net/cgi-bin/bbs/topic.cgi?forum=10&topic=1346&show=330
四舍五入用round,如round(123.4567,1)=123.5或round(123.4567,0)=123或round(123.67,0)=124 去尾用floor,如floor(123.4567)=123 进尾用ceiling,如ceiling(123.4567)=124
4) 新手问题:为什么我的SYBASE的RUN_BACKUP老是自己DOWN啊!? http://www.chinaunix.net/cgi-bin/bbs/topic.cgi?forum=10&topic=1335&show=330 为什么我的SYBASE的RUN_BACKUP老是自己DOWN啊!? 我用NetTerm登陆运行,但只要一退出NetTerm,BACKUP就自己DOWN了 加&运行也不行,怎么办啊?
命令前加nohup 试试
那是因为你的backup进程是以你的登录用户起动的,所以当该用户退出unix时, 进程也跟着退出操作系统了
5) 什么是BYPASS RECOVERY mode? http://www.chinaunix.net/cgi-bin/bbs/topic.cgi?forum=10&topic=1371&show=300
在客户端出现提示: Attempt to BEGIN TRANsaction in database "****" failed because database is in BYPASS RECOVERY mode. 请问如何解决?
select name,status from master..sysdatabases where db_name="你所说的数据库" 看status是否是-32768 ,若是,sysdatabases系统表相应记录的status字段改为0,reboot数据库服务器就可以了。
谢谢各位,问题已解决。中午去SYBASE网站查找到有关这个问题的详细信息,包括问题成因及解决办法: Error 3908 Severity 16 Error Message
Attempt to BEGIN TRANsaction in database '%.*s' failed because database is in BYPASS RECOVERY mode. Explanation Adaptive Server can start various types of transactions such as local (in response to a local command), internal (for the server's own use), external (started by an external client like a TP Monitor) and subordinate (child transactions started by a parent transaction in parallel). Bypass recovery starts Adaptive Server without recovering one or more databases. A database in this mode can be accessed even though it is not recovered. You use this mode to allow access to the database for problem analysis, to copy out data, and so on. Error 3908 is raised when a transaction is attempted while the database is in bypass recovery. Although certain commands are permissible in this mode, no transactions - regardless of type - can be started when the database is in bypass recovery. Error 3908 is raised in the following states:
State Meaning 1 Attempted to start a transaction when the database is not available for update. Applies to all possible transaction types. 2 Attempted to start a subordinate transaction when the database is not available for update. Action Do not attempt to start a transaction while the database is in bypass recovery. Check if any automated jobs may have submitted a batch job that attempted such a transaction. First restore the database to the original working status it had (prior to bypass status) before attempting any transactions. Use the following steps to reset the database status:[1] [2] [3] [4] 下一页 |