`

Sybase优化

阅读更多
*增加Master和tempdb值
*操作系统3G开关:  
  
....修改boot.ini文件,在启动windows项中添加 /3G 参数。修改过后的boot.ini文件应该类似以下内容:  
[boot loader]   
	timeout=8   
	default=multi(0)disk(0)rdisk(0)partition(1) 
	[operating systems]   
	multi(0)disk(0)rdisk(0)partition(1)="Microsoft Windows 2000 Advanced Server" /3G /fastdetect   


注意在启动win2K AdvServer的一栏里,多了一个 /3G 参数。这个参数的作用,就是让windows启动时,
将自己的内核及支持程序装载到内存地址 0xC0000000 到 0xFFFFFFFF 之间,给应用程序留出3G的空间来。  

*设置虚拟内存超过3G
*在/ASE-12_5/bin目录下执行:imagecfg sqlsrvr

执行后如果显示下面的内容则说明2G开关未打开
sqlsrvr.exe contains the following configuration information:
	   Subsystem Version of 4.0
	   Stack Reserve Size: 0x20000
	   Stack Commit Size: 0x4
如果2G开关未打开,则执行:imagecfg -l sqlsrvr.exe
再执行imagecfg sqlsrvr.exe,应显示下面内容:
sqlsrvr.exe updated with the following configuration information:
	   Subsystem Version of 4.0
	   Image can handle large (>;2GB) addresses
	   Stack Reserve Size: 0x20000
	   Stack Commit Size: 0x4
此时sybase的2G开关已经被打开。

注:
editbin.exe /LARGEADDRESSAWARE sqlsrvr.exe


*
sp_configure 'total memory', 100000 
优化数据库的内存,应根据不同机器配置设置, 建议为一半的物理内存大小。
以db_block为单位,即每个单位为2k,上例为200M,默认为24M.

*
sp_configure 'shared memory starting address', 23662592


*
sp_configure "lock scheme" , 1,"datarows
" 系统默认为表级锁,优化为行锁
sp_configure "number of locks" , 10000 
加大最大锁进程数, 默认为5000。(如果设置一个已经存在的表(tabel)的锁方式为行锁,则执行:alter table table_name lock datarows)
sp_configure 'procedure cache percent' ,30 
缺省值:20 建议值:procedure使用频率高时采用较大的值,不超过30
sp_configure "number of user connections",100 
最大用户连接数,默认为25,每个连接要占70k内存
sp_configure 'number of devices',2
0 将最大设备文件数据改为15个
sp_configure ‘number of Open databases’,20 
最大打开数据库个数,对于需在一台数据库服务上打个多个数据库则需加大此参数,默认为15
Sp_configure ‘max online engines CPU’,2
缺省值:1 建议值:采用实际机器的CPU个数
Sp_configure ‘total data cache size’,60000 
缺省值:0 建议值:使用SQL SERVER内存的30%
如果上述参数改动后SYBASE启动不正常,则可检查SYBASE的错误日志,把SYBASE.cfg中的相应选项修改为较小的值。

*采用大数据包减少网络I/O的。
sp_configure "default network packet size",2048 
设置网络传送包的大小(需要重启动)
sp_configure "max network packet size",2048


*sp_configure 'max online engines',4
go
--配置启动cpu个数
sp_configure 'number of engines at startup',4
go
--配置最大内存数
sp_configure 'max memory' ,2097151
go
--分配最大存储过程缓存
sp_configure 'procedure cache',102400
go
--配置高速缓存
sp_cacheconfig  'default data cache' , '700M'
go
--缺省缓存分配页大小
sp_poolconfig 'default data cache','200M','16K'
go
--网络包大小
sp_configure 'max network packet size',1024
go

--最大连接数
sp_configure 'number of user connections',500
go
--最大打开对象
sp_configure  'number of open object',9000
go
--最大索引
sp_configure  'number of open index',10000
go
--最大锁数
sp_configure  'number of locks',100000
go

--增加网络内存
--sp_configure  'additional network memory',1024
go

--锁内存
sp_configure  'lock shared memory',512
go

--优化tempdb
select dbid, name,segmap
from sysusages,  sysdevices
where sysdevices.low  <= sysusages.size +vstart
and sysdevices.high >=sysusages.size+vstart -1
and dbid =2
and (status=2 or status=3)
go
use tempdb
go
sp_dropsegment  'default',tempdb,master
go
sp_dropsegment  'logsegment',tempdb,master
go


select dbid, name,segmap
from sysusages,  sysdevices
where sysdevices.low  <= sysusages.size +vstart
and sysdevices.high >=sysusages.size+vstart -1
and dbid =2
and (status=2 or status=3)
go

sp_cacheconfig tempdb_cache, '100M'
go
sp_poolconfig tempdb_cache,'50M','16K'
go
sp_bindcache 'tempdb_cache',tempdb
go
sp_helpcache tempdb_cache

select name,id from syscharsets

dbcc traceon(3604)
dbcc memusage


缺省情况下
操作系统方面:
32位可以支持2G memory。
sybase:
max memory 超不过1.5G
步骤:
1) windowns支持超过2G内存:boot.ini文件加/3GB或/PAE,我加/3GB
2 )sybase可用超过1.5G:sp_configure 'shared memory starting address', 23662592改后重启sybase就可以使用1.5G以上内存但不能超过2G
3)sybase可用超过2G:网上都说是执行imagecfg.exe -l sqlsrver.exe,可是我按他们说得从NT4。0的安装盘得到或下载的imagecfg.exe都无-l选项,怎么也不行,不知谁有?给我一个试试。可以用vc的editbin.exe,执行
editbin.exe /LARGEADDRESSAWARE sqlsrvr.exe即可。执行editbin还需要link.exe和MSPDB60.DLL,sybase重启可配置2G以上内存,但最多不能超过3G
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics