sybase 备份和恢复

為{幸葍}努か 提交于 2020-03-18 13:24:13
use master
go

dump transaction MBFEWKDB with no_log
go

dump transaction MBFEHISDB with no_log
go

use master
go
dump database MBFEWKDB to 'MBFEWKDB.bak'
go

use master
go
dump database MBFEHISDB to 'MBFEHISDB.bak'
go

use master
go

dump transaction MBFEWKDB with no_log
go

dump transaction MBFEHISDB with no_log
go

quit

------------------------------------------------------------

use master
go

dump transaction DIRWAYSDB with no_log
go

dump transaction DISWAYSDB with no_log
go

use master
go
dump database DIRWAYSDB to 'DIRWAYSDB.bak'
go

use master
go
dump database DISWAYSDB to 'DISWAYSDB.bak'
go

use master
go

dump transaction DIRWAYSDB with no_log
go

dump transaction DISWAYSDB with no_log
go

quit

备份脚本;
DATE=`date "+%Y%m%d"`
. ~/.bash_profile
isql -Usa -P <<!
dump database cddb to '/home/sybase/dbbak/$DATE.cddb.bak'
go
dump database hddb to '/home/sybase/dbbak/$DATE.hddb.bak'
go
dump transaction cddb with no_log
go
dump transaction hddb with no_log
go
!


清理日志脚本;
$ cat /sybase/sbin/logclear
#!/bin/ksh

SYBASE=/sybase
DSQUERY=SYBASE
PATH=$SYBASE:$SYBASE/bin:$SYBASE/install:$PATH:.
LD_LIBRARY_PATH=/sybase/lib:$LD_LIBRARY_PATH
export SYBASE DSQUERY PATH LD_LIBRARY_PATH

EDITOR=vi;export EDITOR
cat $HOME/sbin/logclear.sql |isql -Usa -P
$ cat $HOME/sbin/logclear.sql
use master
go

dump transaction MBFEWKDB with no_log
go

dump transaction MBFEHISDB with no_log
go

dump transaction DIRWAYSDB with no_log
go

dump transaction DISWAYSDB with no_log
go


恢复SYBASE:
isql -Usa -P <<!
load database cddb from '/home/sybase/dbbak/$DATE.cddb.bak'
go
online database cddb
go
load database hddb from '/home/sybase/dbbak/$DATE.hddb.bak'
go
online database hddb
go
shutdown SYB_BACKUP
go
shutdown
go
!

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!