六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 64|回复: 0

sybase配置常用技巧

[复制链接]

升级  82%

9

主题

9

主题

9

主题

童生

Rank: 1

积分
41
 楼主| 发表于 2013-1-26 16:02:14 | 显示全部楼层 |阅读模式
以下是在使用sybase数据库开发应用时常用的配置技巧,总结一下,希望对大家有用。

防止数据崩溃时主键猛增,在sybase测试库时一般会出现此类问题。
sp_configure "identity burning set factor", 1sp_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.gapUpdategocreate procedure dbo.gapUpdate asdeclare 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_insendgo

查询所有表名称
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 会自动宕掉,需要第二次重启后才
能使用)
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表