暂无图片
如何查询数据库表大小和库大小
我来答
分享
暂无图片 匿名用户
如何查询数据库表大小和库大小

如何查询数据库表大小和库大小

我来答
添加附件
收藏
分享
问题补充
1条回答
默认
最新
Panda攀

堆表大小查询:

SQL> select table_name,table_id from dba_tables;
SQL> select cnt*8 as table_size from (select count(*) as cnt from sys_gstores where head_no=(select gsto_no from dba_tables where table_id=1048576));
或者
SQL> select count(*)*8||'M'  from sys_gstores where head_no=(select t.gsto_no from sys_tables t join sys_schemas s on t.schema_id=s.schema_id and t.db_id=s.db_id inner join sys_databases d on t.db_id=d.db_id where t.table_name='表名' and schema_name='模式名' and d.db_name='库名');

分区表大小查询:

SQL> select table_name,table_id from dba_tables;
SQL> select cnt*8 as table_size from (select count(*) as cnt from sys_gstores where head_no in (select GSTO_NOS from dba_partis where table_id=1048586));
或者
SQL> select count(*)*8||'M'  from sys_gstores where head_no in (select gsto_nos from sys_tables t join sys_partis p on t.table_id=p.table_id and t.db_id=p.db_id join sys_schemas s on t.schema_id=s.schema_id and s.db_id=s.db_id join sys_databases d on t.db_id=d.db_id and s.db_id=d.db_id  where t.table_name='表名' and s.schema_name='模式名' and d.db_name='库名');

库大小查询:

SQL> select db_name,db_id from sys_databases;
SQL> select cnt*8 as db_size from (select count(*) as cnt  from sys_gstores where db_id=5);
或者
SQL> select count(*)*8 from sys_gstores where db_id=(select db_id from sys_databases where db_name='数据库名');
暂无图片 评论
暂无图片 有用 0
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
暂无图片墨值悬赏