1、查询某个表空间上对象的大小
select owner,segment_name,segment_type,sum(bytes)/1024/1024 as segment_size
from dba_segments
where tablespace_name='xxx'
group by owner,segment_name,segment_type
order by 4;
2、查询某个用户下所有表的记录总数数量的语句生成语句
select 'select '''||table_name||''' as table_name,count(*) as cnt from '||table_name||' union all ' from all_tables where owner='xxx';
3、查询表空间的大小及使用大小
SELECT a.tablespace_name,
total / (1024 * 1024 * 1024) "大小(G)",
free / (1024 * 1024 * 1024) "剩余大小(G)",
(total - free) / (1024 * 1024 * 1024) "使用大小(G)",
round((total - free) / total, 4) * 100 "使用率 %"
FROM (SELECT tablespace_name, SUM(bytes) free
FROM dba_free_space
GROUP BY tablespace_name) a,
(SELECT tablespace_name, SUM(bytes) total
FROM dba_data_files
GROUP BY tablespace_name) b
WHERE a.tablespace_name = b.tablespace_name;
select owner,segment_name,segment_type,sum(bytes)/1024/1024 as segment_size
from dba_segments
where tablespace_name='xxx'
group by owner,segment_name,segment_type
order by 4;
2、查询某个用户下所有表的记录总数数量的语句生成语句
select 'select '''||table_name||''' as table_name,count(*) as cnt from '||table_name||' union all ' from all_tables where owner='xxx';
3、查询表空间的大小及使用大小
SELECT a.tablespace_name,
total / (1024 * 1024 * 1024) "大小(G)",
free / (1024 * 1024 * 1024) "剩余大小(G)",
(total - free) / (1024 * 1024 * 1024) "使用大小(G)",
round((total - free) / total, 4) * 100 "使用率 %"
FROM (SELECT tablespace_name, SUM(bytes) free
FROM dba_free_space
GROUP BY tablespace_name) a,
(SELECT tablespace_name, SUM(bytes) total
FROM dba_data_files
GROUP BY tablespace_name) b
WHERE a.tablespace_name = b.tablespace_name;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29911917/viewspace-2149561/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29911917/viewspace-2149561/