我需要plsql脚本才能找到架构下每个表的总行数和大小。
答案 0 :(得分:1)
select table_name, num_rows, bytes/1047586 MB
from dba_tables t
Inner join dba_segments s
On table_name =segment_name and t.owner =s.owner
Where segment_type='TABLE'
And s.owner='schema'
答案 1 :(得分:0)
这是表的大小
SELECT owner, segment_name, segment_type, tablespace_name, bytes/1048576 MB FROM DBA_SEGMENTS WHERE OWNER = 'table owner' AND SEGMENT_NAME = 'table name' AND SEGMENT_TYPE = 'TABLE';
这是行数:
select
table_name,
num_rows counter
from
dba_tables
where
owner = 'XXX'
order by
table_name;
请记住,num_rows是估计值,它不能为您提供确切的行数。
两者都
select table_name, num_rows, bytes/1047586 MB
from dba_tables t
Inner join dba_segments s
On table_name =segment_name and t.owner =s.owner
Where segment_type='TABLE'
And s.owner='schema'