enterprise manager console 或者脚本: select a.file_id "FileNo",a.tablespace_name "Tablespace_name", round(a.bytes/1024/1024,4) "Total MB", round((a.bytes-sum(nvl(b.bytes,0)))/1024/1024,4) "Used MB", round(sum(nvl(b.bytes,0))/1024/1024,4) "Free MB", round(sum(nvl(b.bytes,0))/a.bytes*100,4) "%Free" from dba_data_files a, dba_free_space b where a.file_id=b.file_id(+) group by a.tablespace_name, a.file_id,a.bytes order by a.tablespace_name
如果只是看数据库表空间的大小,直接查找表空间的数据文件,将它们的大小加加就是了 select sum(bytes)/1024/1024||'MB' from dba_data_files where TABLESPACE_NAME='...';
MAX_EXTENTS ?TABLESPACE_NAME
BLOCK_SIZE
INITIAL_EXTENT
NEXT_EXTENT
MIN_EXTENTS
MAX_EXTENTS
PCT_INCREASE
MIN_EXTLEN
STATUS
CONTENTS
LOGGING
FORCE_LOGGING
EXTENT_MANAGEMENT
ALLOCATION_TYPE
SEGMENT_SPACE_MANAGEMENT
maxextents是段中区的最大个数
block_size数据块的大小
initial是第一个区的大小,单位bytes,k,m
next 下一个区的大小.第二个以后的next=前一个next*(1+pctincrease)
initail和next以及通过pctincrease计算得到的结果必须是数据块的整数倍
pctincrease 从第三个区开始相对于上一个区所增加的百分比ex:
create table emp(…) //这个就省了吧
storage(initial 40k
next 40k
minextents 2
maxextents 4
pctincrease 50); //这里就不考虑block_size的整数倍啦
第一个区 40k, 第二个区40k,第三个40*(1+50%)=60k,第四个60*(1+50%)=90k
所以最大空间是40+40+60+90=230k
或者脚本:
select a.file_id "FileNo",a.tablespace_name "Tablespace_name",
round(a.bytes/1024/1024,4) "Total MB",
round((a.bytes-sum(nvl(b.bytes,0)))/1024/1024,4) "Used MB",
round(sum(nvl(b.bytes,0))/1024/1024,4) "Free MB",
round(sum(nvl(b.bytes,0))/a.bytes*100,4) "%Free"
from dba_data_files a, dba_free_space b
where a.file_id=b.file_id(+)
group by a.tablespace_name,
a.file_id,a.bytes order by a.tablespace_name
select sum(bytes)/1024/1024||'MB' from dba_data_files where TABLESPACE_NAME='...';