Informix数据库查看数据库大小教程
【查看数据库空间,不看清单】
select dbsname,count(*) num\_of\_extents,sum(pe\_size)
from sysmaster:systabnames,sysmaster:sysptnext
where partnum = pe\_partnum and dbsname=“dbname”
group by 1
order by 2 desc,3 desc;
查所有库的,如果有informix用户,可以这样:
dbaccess sysmaster<<!
SELECT dbsname[1,15] database\_name, SUM(pe\_size) size
FROM sysmaster:sysptnext,
OUTER sysmaster:systabnames
WHERE pe\_partnum = partnum
GROUP BY 1
ORDER BY 2 DESC;
!
–查每个表(如果1page=16K)
select dbsname,tabname,count(*) num\_of\_extents,sum(pe\_size)*16/1024/1024
from sysmaster:systabnames,sysmaster:sysptnext
where partnum = pe\_partnum and dbsname=“dbname”
group by 1,2
order by 3 desc,4 desc;
–查整个库(如果1page=16K)
select dbsname,count(*) num\_of\_extents,sum(pe\_size)*16/1024/1024
from sysmaster:systabnames,sysmaster:sysptnext
where partnum = pe\_partnum and dbsname=“dbname”
group by 1
order by 2 desc,3 desc;
–查所有库(如果1page=16K)
dbaccess sysmaster<<!
SELECT dbsname[1,15] database\_name, SUM(pe\_size) size*16/1024/1024
FROM sysmaster:sysptnext,
OUTER sysmaster:systabnames
WHERE pe\_partnum = partnum
GROUP BY 1
ORDER BY 2 DESC;
!
【查看系统page size的方法,不知道对不对】:
oncheck -pr|grep Page查到以下一堆page size,16k才是当前的!
Page Size 2048 (b)
Index Page Logging OFF
Logical log position at Ckpt 0x4f46018 (Page 20294, byte 24)
Log contains last checkpoint: Page 20294, byte 24
Pagesize (k) 2
Pagesize (k) 2
Pagesize (k) 2
Pagesize (k) 2
Pagesize (k) 16