一、關閉sybase主服務 shutdown with nowait go
二、關閉sybase某一服務 shutdown SYB_BACKUP(服務名) go
三、查看服務名 sp_helpserver go
四、查看sybase版本 select @@version go
五、查看sybase的數據設備信息 sp_helpdevice/select *from master..sysdevices go
六、設備管理
(1)建立
use master go
disk init
name = 'test',physname='/opt/sybase/data/test.dat',vdevno=2,size='1024m',vstart=0,cntrltype=0,dsync=true
go
(2)刪除
use master go
exec sp_dropdevice 'test'
gosql
(3)修改最大的虛擬設備號
sp_configure 'number of devices',25 go
七、數據庫管理
(1)建立
use master go
create database test on test='1024M' go
use test go
exec sp_changedbowner 'sa' go
(2)查看當前數據庫 select db_name() go
(3)查看數據庫信息 sp_helpdb syk go
(4)刪除 drop database syk go
(5)空間使用狀況
use syk go
sp_spaceused go
八、默認排序方式、字符集等信息 sp_helpsort
九、執行數據庫腳本
isql -Usa -P -SABC -i /opt/sybase/test.sql -o /opt/sybase/test.log
isql -Usa(用戶名) -P(密碼) -SABC(服務名)
isql參數詳解
usage: isql [-b] [-e] [-F] [-p] [-n] [-v] [-X] [-Y] [-Q]
[-a display_charset] [-A packet_size] [-c cmdend] [-D database]
[-E editor [-h header [-H hostname [-i inputfile]
[-I interfaces_file] [-J client_charset] [-K keytab_file]
[-l login_timeout] [-m errorlevel] [-M labelname labelvalue]
[-o outputfile] [-P password] [-R remote_server_principal]
[-s col_separator] [-S server_name] [-t timeout] [-U username]
[-V [security_options]] [-w column_width] [-z localename]
[-Z security_mechanism]
(2)執行 isql –Usa –Ppasswd –Sservername –i bcpout.sh –o bcpout.txt
十、查看用戶信息 sp_helpuser
十一、用戶鎖定操做 sp_locklogin /sp_locklogin username,’lock/unlock’
十二、查看登陸用戶 sp_displaylogin [loginname]/sp_who數據庫
1三、bcp
bcp dbname..tablename out /opt/sybase/test.bcp –Usa –P –Sservername –c ————數據備份
bcp dbname..tablename in /opt/sybase/test.bcp –Usa –P –Sservername –c ————數據還原
一次性導出全部表
(1)創建導出腳本文件(bcpout.sh):
use test go
select ‘bcp test..’+name+’out /opt/sybase/test.txt’+’-Usa –P –Sservername -c’from sysobjects where type=’U’U表示爲用戶表。
1四、列出全部庫 sp_helpdb
1五、查看錶信息 sp_help [tablename]spa
1六、數據庫死進程 select * from master..syslogshold.net