欢迎来到Doc100.Net免费学习资源知识分享平台!
您的位置:首页 > 程序异常 >

,请教怎么获取sybase数据库中各个表的大小?

更新时间: 2014-01-05 02:21:33 责任编辑: Author_N1

 

各位高手,请问如何获取sybase数据库中各个表的大小??
如何列举出sybase数据库中所有表的大小并按从大到小的顺序排列,请各位高手指教,谢谢!

--参考方法--

select name = o.name,
iname = i.name,
i.id,
low = d.low,
rowtotal = 0,
reserved = convert(numeric(20, 9), 0),
data = convert(numeric(20, 9), i.doampg),
index_size = convert(numeric(20, 9), i.ioampg),
unused = convert(numeric(20, 9), 0)
into #pagecounts
from sysobjects o, sysindexes i, master.dbo.spt_values d
where o.id = i.id
and d.number = 1
and d.type = "E "

update #pagecounts set
rowtotal = rowcnt(data),
reserved = convert(numeric(20, 9),
(reserved_pgs(id, data) +
reserved_pgs(id, index_size))),
data = convert(numeric(20, 9), data_pgs(id, data)),
index_size = convert(numeric(20, 9),
data_pgs(id, index_size)),
unused = convert(numeric(20, 9),
((reserved_pgs(id, data) +
reserved_pgs(id, index_size)) -
(data_pgs(id, data) +
data_pgs(id, index_size))))

select name = convert(char(20), name),
rowtotal = convert(char(11), sum(rowtotal)),
reserved = convert(char(15), convert(varchar(11),
convert(numeric(11, 0), sum(reserved) *
(low / 1024))) + " " + "KB "),
data = convert(char(15), convert(varchar(11),convert(numeric(11, 0), sum(data) * (low / 1024))) + " " + "KB "),
index_size = convert(char(15), convert(varchar(11),
convert(numeric(11, 0), sum(index_size) *
(low / 1024))) + " " + "KB "),
unused = convert(char(15), convert(varchar(11),
convert(numeric(11, 0), sum(unused) *
(low / 1024))) + " " + "KB ")
from #pagecounts
group by name
order by sum(data)+ sum(index_size) desc
上一篇:上一篇
下一篇:下一篇

 

随机推荐程序问答结果

 

 

如对文章有任何疑问请提交到问题反馈,或者您对内容不满意,请您反馈给我们DOC100.NET论坛发贴求解。
DOC100.NET资源网,机器学习分类整理更新日期::2014-01-05 02:21:33
如需转载,请注明文章出处和来源网址:http://www.doc100.net/bugs/t/8875/
本文WWW.DOC100.NET DOC100.NET版权所有。