Chinaunix首页 | 论坛 | 博客
  • 博客访问: 428936
  • 博文数量: 94
  • 博客积分: 3066
  • 博客等级: 中校
  • 技术积分: 908
  • 用 户 组: 普通用户
  • 注册时间: 2006-01-25 17:10
文章分类

全部博文(94)

文章存档

2016年(3)

2015年(4)

2014年(1)

2013年(9)

2012年(8)

2011年(1)

2010年(8)

2009年(4)

2008年(2)

2007年(6)

2006年(48)

我的朋友

分类: Sybase

2006-11-13 16:09:56

ddlgen 使用
===========================================================

ddlgen 使用

. 使用位置

$SYBASE/ASEP/bin/ddlgen

. 导出DDL 语句

ddlgen -Utips_prod -Ptips_prod -STIPS -Dtips_ini

导出tips_ini库中所有对象的DDL语句

/export/home/sybase/ASEP/bin/ddlgen -Utips_prod -Ptips_prod -STIPS -Dtips_ini -TU -Nt%

导出tips_ini库中tips_prod用户下所有以t开头的用户表的DDL语句

-T 所有数据库对象类型

C – cache I – index RS – remote server

DB – database KC – primary/unique key constraints SG – segment

D – default TR – trigger

DBD – database device L – login U – table

DPD – dump device P - stored procedure UDD – user-defined datatype

EC – execution class R – rule USR – user

EG – engine group RI – RI constraints V – view

GRP – user group RO – role XP – extended stored procedure

-X -F 可用与扩展或过滤对象类型

-N 对象名称 (必须同-T 一起使用,缺省 N% 语法: db_name.owner.table_name.index

XOU or –XOD: These options are used in combination with –TU:

with –XOU, only user tables are included;

with –XOD, only proxy tables.

Specifying just –TU, without –X,includes both user tables and proxy tables.

其他的参数选项:

-F{TR|I|KC|RI|%}: For user tables only, does not generate DDL for triggers (TR),

indexes (I), primary/unique key constraints

(KC), or RI constraints (RI) for those table(s). These

options may be combined with commas. % excludes all of the

above;

F alone has no effect.

O output_file: Output file name for the generated DDL (default=stdout)

E error_file: File to log errors into

J character_set: Client character set

v: Displays ddlgen version information



sybase 优化总结
===========================================================

一. SYBASE 系统参数调整
1.内存
sp_configure "max memory",1500000 重启生效(设置为共享内存的75%)
sp_configure "allocate max shared mem",1 启动的时候自动分配max memory指定的最大内存
sp_cacheconfig "default data cache","1500m" 设置数据缓存(设置为max memory的一半)
sp_cacheconfig "default data cache","cache_partition=2" 是CPU数量的倍数,对数据缓冲区分区
sp_poolconfig "default data cache","64m","16k" 设置16K 数据缓存
sp_poolconfig "default data cache","128m","8k" 设置8K 数据缓存
sp_configure "procedure cache size",90000 存储过程数据缓存sp_cacheconfig 'tempdb_cache','200m','mixed' 创建命名高速缓存sp_bindcache 'tempdb_cache',tempdb 捆绑临时数据库到tempdb_cache高速缓存

2.cpu
sp_configure "max online engines",2 设置使用的CPU数量
sp_configure "number of engines at startup",2 启动时使用CPU数量

3. 网络
sp_configure "default network packet size",2048 设置网络传送包的大小(重启动生效)
sp_configure "max network packet size",2048

4. 其他资源使用
sp_configure "number of locks",100000 锁使用数量
sp_configure "number of open indexes",5000 打开索引
sp_configure "number of open objects",5000 打开对象
sp_configure "number of user connections",1000 用户连接数
sp_configure "number of device",100 新建设备最大数量


二. sybase 设备调整

数据设备与日志设备必须分开,添加临时数据库设备

1. 数据设备
sp_deviceattr devname,"dsync",true
2. 日志设备
sp_deviceattr devname,"dsync",false
3. 临时数据库设备
sp_deviceattr devname,"dsync",false


三. sybase 数据结构调整

1. 数据库对象表、索引。。
(1)对表新建合理的索引,定期分析表
update statistics tabname (不锁表)
(2)整理数据库空间 (锁表,剩余空间必须为最大表的1.2倍)
reorg rebuild tabname
recreate clustered index
(3)重新编译存储过程与触发器
sp_recompile usertable (与表相关联的存储过程和触发器)


四. sybase 数据库监控

1. 数据库死进程
select * from master..syslogshold


五. sybase 数据库启动参数

-T3607 master
-T3608 其他数据
-m 单



===========================================================
SYBASE 移动日志文件到其他的设备
===========================================================

Moving the transaction log to another device

1> alter database dbname log on device19 = 10
1> sp_logdevice dbname, device19
The last-chance threshold for database dbname is now 1232 pages.
... sql inserts, to fill old log segment ...
1> dump tran dbname with truncate_only

1> sp_helplog dbname
2> go
In database 'dbname', the log starts on device 'device19'.
(return status = 0)
1>

feimei 发表于:2006.04.20 21:29 ::分类: ( SYBASE ) ::阅读:(63次) :: 评论 (0) :: 引用 (0)
===========================================================
SYBASE 序列异常跳转解决方法
===========================================================

identity burning set factor的问题
每次异常断电跳转的数目是:identity burning set factor*10的负7次方*表中identity列定义的长度,例如identity burning set factor=5000,identity列定义的长度numeric(10,0),则该数等于:5000*10的负7次方*1010的10次方,该数比较大


另外可以在建表时设置跳转的值,语法是 create table (...) with identity_gap = value. 修改当前表步长

EXEC sp_chgattribute 't_61e_tolltype','identity_gap',50


feimei 发表于:2006.04.19 21:50 ::分类: ( SYBASE ) ::阅读:(91次) :: 评论 (0) :: 引用 (0)
===========================================================
SYBASE 如何创建代理表
===========================================================

如何创建代理表
在interfaces文件中加入远程服务器条目
sp_addserver dblocal,local
sp_addserver dbremote,null,dbremote
sp_configure "enable cis",1
sp_addexternlogin dbremote,sa,sa,password
创建代理表
create existing table zz_proxy (id int not null,name varchar(10) not null)
at "sybase.master..zz"
或者
create proxy_table zz1
at "sybase.master..zz"

建代理表时,远程表的结构数据已经存储在了本地,并且不会检测该表的结构是否发生改变,因此远程表的结构发生改变时,本地是不知道的,需要重新创建代理表,相当于重新刷新本地的存储的结构.


feimei 发表于:2006.04.19 21:49 ::分类: ( SYBASE ) ::阅读:(108次) :: 评论 (0) :: 引用 (0)
===========================================================
SYBASE 远程备份
===========================================================

在interfaces中加入远程备份服务器的条目(ip地址或者是远程服务器的物理名称)
要注意加入的名称与远程备份服务器的名称要一致!!!

dump database to ... at bs_server_name


feimei 发表于:2006.04.19 21:48 ::分类: ( SYBASE ) ::阅读:(74次) :: 评论 (0) :: 引用 (0)
阅读(1699) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~