ORACLE表空间检查语句

Select d.tablespace_name TS_Name,
d.contents TS_Type,
     d.status TS_Status,
     d.extent_management TS_ExtentManagement,
     Round(NVL(a.bytes / 1024 / 1024, 0),2) TS_Size,
     Round(NVL(a.bytes - NVL(f.bytes, 0), 0) / 1024 / 1024, 2) TS_UsedSize,
     Round(NVL((a.bytes - NVL(f.bytes, 0)) / a.bytes, 0), 4) TS_Used,
      Round(NVL(a.maxbytes / 1024 / 1024, 0),2) TS_Size,
      Round((NVL(a.bytes - NVL(f.bytes, 0), 0)) /NVL(a.maxbytes,0), 4) TS_AllUSED,
     Round(a.incrementBy*NVL((select BLOCK_SIZE from dba_tablespaces where tablespace_name=a.tablespace_name), 0)/1024/1024, 2)  incrementBy
  From sys.dba_tablespaces d,
     (Select tablespace_name, Sum(bytes) bytes,sum(maxbytes) maxbytes,sum(increment_by) incrementBy From dba_data_files Group By tablespace_name) a,
     (Select tablespace_name, Sum(bytes) bytes From dba_free_space Group By tablespace_name) f Where d.tablespace_name = a.tablespace_name(+) And d.tablespace_name = f.tablespace_name(+) And Not (d.extent_management Like 'LOCAL' And d.contents Like 'TEMPORARY')     
Union All
Select d.tablespace_name TS_Name,
     d.contents TS_Type,
     d.status TS_Status,
     d.extent_management TS_ExtentManagement,
     Round(NVL(a.bytes / 1024 / 1024, 0), 2) TS_Size,
     Round(NVL(t.bytes, 0) / 1024 / 1024, 2) TS_UsedSize,
     Round(NVL(t.bytes / a.bytes, 0), 4) TS_Used,
      Round(NVL(a.maxbytes / 1024 / 1024, 0),2) TS_Size,
      Round( NVL(t.bytes, 0) /NVL(a.maxbytes,0), 4) TS_AllUSED,
     Round(a.incrementBy*NVL((select BLOCK_SIZE from dba_tablespaces where tablespace_name=a.tablespace_name), 0)/1024/1024, 2)  incrementBy
     
  From sys.dba_tablespaces d,
     (Select tablespace_name,Sum(bytes) bytes,sum(maxbytes) maxbytes,sum(increment_by) incrementBy From dba_temp_files Group By tablespace_name) a,
     (Select tablespace_name, Sum(bytes_cached) bytes From v$temp_extent_pool Group By tablespace_name) t
 Where d.tablespace_name = a.tablespace_name(+) And
     d.tablespace_name = t.tablespace_name(+) And
     d.extent_management Like 'LOCAL' And
     d.contents Like 'TEMPORARY'

 Order By TS_Name


TS_NAM表空间

TS_TYPE空间类型

TS_STATUS状态

TS_ExtentManagement 管理方式

TS_Size 文件大小

TS_UsedSize 当前使用大小

TS_Used,  当前使用率

TS_Size 总扩展大小

TS_AllUSED, 总扩展大小使用率

incrementBy 自增量

单位:MB

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值