为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】:DM8
【操作系统】:
【CPU】:
【问题描述】*:如何查询数据库某个模式(例如DB_AAA)下的所有的表的大小
顶一下!!
1、可以查看USER_SEGMENTS或者DBA_SEGMENTS视图,这个可以参考DBA手册。
2、如果你的你的这个scheme单独占了一个表空间,也可以查看表空间的大小
select NAME as 名称,DECODE(TYPE$,‘1’,‘DB类型’,‘2’,‘临时表空间’)as 类型,DECODE(STATUS$,‘0’,‘ONLINE’,‘1’,‘OFFLINE’,‘2’,‘RES_OFFLINE’,‘3’,‘CORRUPT’)as 状态,TOTAL_SIZE*PAGE/1024/1024||‘MB’ as 总大小,FILE_NUM as 包含文件数 from v$tablespace;
–查看所有表空间数据文件使用情况
select
tablespace_name,
id ,
file_name ,
100 *(max-alloc+nvl(free, 0))/max AS file_per,
(max-alloc+nvl(free, 0))/1024/1024||‘M’ AS file_free,
(alloc - nvl(free, 0))/1024/1024||‘M’ as file_used,
max/1024/1024||‘M’ as file_max,
100 *nvl(free, 0)/alloc As per,
nvl(free, 0)/1024/1024 ||‘M’ as free,
(alloc - nvl(free, 0))/1024/1024 ||‘M’ as used,
alloc /1024/1024 ||‘M’ as max,
autoextends
from
(
select
f.tablespace_name tablespace_name,
f.file_id id,
f.file_name file_name,
f.bytes alloc ,
decode(f.maxbytes, 0, f.bytes, f.maxbytes) max,
s.bytes free,
f.autoextensible autoextends
from
dba_data_files f,
dba_free_space s
where
f.tablespace_name=s.tablespace_name(+)
and f.file_id =s.file_id
) t
order by 4,5;
???