以下是在使用sybase数据库开发应用时常用的配置技巧,总结一下,希望对大家有用。
防止数据崩溃时主键猛增,在sybase测试库时一般会出现此类问题。
修改表id步长
修改所有表id步长 存偖过程
查询所有表名称
查询页大小
12.5之前,只有2k页面,用select @@pagesize查询
12.5之后,用select @@maxpagesize查询
更改默认字符集为 cp936,也就是中文。
方法一:(命令行中)。
1. (这里 SYBASE 的安装路径为 c:\sybase)
方法二:(在 SQL 环境中)。
1. 执行 select name,id from syscharsets(会列出字符集对应的 id 号) -对应master库
2. 找到 name 为cp936 对应的 id(假设为 171)
3. 执行 sp_configure "default character set id",171
4. 重启 server两次(注:第一次启动后,server 会自动宕掉,需要第二次重启后才
能使用)
防止数据崩溃时主键猛增,在sybase测试库时一般会出现此类问题。
sp_configure "identity burning set factor", 1
sp_configure "identity grab size", 10
修改表id步长
EXEC sp_chgattribute 'DEPT_USER','identity_gap',10
修改所有表id步长 存偖过程
if exists (select 1
from sysobjects
where id = object_id('dbo.gapUpdate')
and type = 'P')
drop procedure dbo.gapUpdate
go
create procedure dbo.gapUpdate as
declare cur_ins CURSOR for
select sysobjects.name from sysobjects where name like '%' and type='U'
declare @tableName varchar(200)
begin
open cur_ins
fetch cur_ins into @tableName
while @@sqlstatus=0
begin
EXEC sp_chgattribute @tableName,'identity_gap',10
fetch cur_ins into @tableName
end
close cur_ins
end
go
查询所有表名称
select name from sysobjects where name like '%' and type='U'
查询页大小
12.5之前,只有2k页面,用select @@pagesize查询
12.5之后,用select @@maxpagesize查询
更改默认字符集为 cp936,也就是中文。
方法一:(命令行中)。
1. (这里 SYBASE 的安装路径为 c:\sybase)
c:\>cd \sybase\charsets\cp936
2. c:\sybase\charsets\cp936> charset -Usa -P -Ssysbase启动服务(服务实例) binary.srt
cp936
方法二:(在 SQL 环境中)。
1. 执行 select name,id from syscharsets(会列出字符集对应的 id 号) -对应master库
2. 找到 name 为cp936 对应的 id(假设为 171)
3. 执行 sp_configure "default character set id",171
4. 重启 server两次(注:第一次启动后,server 会自动宕掉,需要第二次重启后才
能使用)