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

转载于:https://www.cnblogs.com/MC1225/p/8109197.html

你可能感兴趣的:(Informix数据库查看数据库大小)