生活生产服务其它数据库

Informix数据库日常维护脚本

为了提高日常维护IDS的效率,特提供以下脚本供大家参考。检查各个dbspaces的空间使用状况:select name dbspace,sum(chksize) allocated,sum(nfree) free,round(((sum(chksize)-sum(nfree))/sum(chksize))*100)||"%" pcusedform sysdbspaces d,syschunks cwhere d.dbsnum=c....显示全部
为了提高日常维护IDS的效率,特提供以下脚本供大家参考。


检查各个dbspaces的空间使用状况:
select name dbspace,sum(chksize) allocated,sum(nfree) free,round(((sum(chksize)-sum(nfree))/sum(chksize))*100)||"%" pcused
form sysdbspaces d,syschunks c
where d.dbsnum=c.dbsnum group by name order by 4 desc
剩余空间肯定是越大越好了

显示各个dbspaces的I/O状况:
select d.name,fname path_name,sum(pagesread) diskreads,sum(pageswritten) diskwrites
from syschkio c,syschunks k,sysdbspaces d
where d.dbsnum=k.dbsnum and k.chknum=c.chunknum
group by 1,2 order by 3 desc
根据各个dbspaces的I/O来调整表的布局,使整个系统I/O均衡

检查哪个表具有最多的磁盘I/0:
select dbsname, tabname, (isreads + pagreads) diskreads, (iswrites + pagwrites) diskwrites
from sysptprof
order by 3 desc,4 desc
同上。


检查表的extent的分布状况:
select t.tabname, count(*) num_ext
from sysextents e, npmdb:systables t
where e.tabname=t.tabname
and dbsname = "npmdb"
and t.tabname not like "sys%"
group by 1
having count(*) > 1
order by 2 desc
表的extent建议最大不超过30个,如果太大,就需要重建表修改extent size的大小从而修改extent的数量

检查表中索引的层数(越少越好):
select idxname, levels from sysindexes order by 2 desc

检查命中率不高的索引(nrows和unique越接近越好):
select tabname, idxname, nrows, nunique
from systables t, sysindexes I
where t.tabid =i.tabid and t.tabid > 99
and nrows > 0 and nunique > 0
当索引的效率不高的时候,需要根据实际情况修改收起
参与5

查看其它 4 个回答zxe的回答

zxezxe软件开发工程师建行
谢谢!!!!!!
互联网服务 · 2011-01-27
浏览626

回答者

zxe
软件开发工程师建行

zxe 最近回答过的问题

回答状态

  • 发布时间:2011-01-27
  • 关注会员:0 人
  • 回答浏览:626
  • X社区推广