查询表空间使用情况

  select ts_name
,        extensible_bytes               extensible
,        allocated_bytes                allocated
,        alloc_free
,        allocated_bytes - alloc_free   used
,        100 * (allocated_bytes - alloc_free) / allocated_bytes pct_used
,        to_number(decode(allocated_bytes, extensible_bytes, NULL,
         extensible_bytes
      - (allocated_bytes - alloc_free))) ne
,        to_number(decode(allocated_bytes, extensible_bytes, NULL, 
         100 * (extensible_bytes - (extensible_bytes - (allocated_bytes - alloc_free)))
       / extensible_bytes))             pct_used_ext
    from (  
  select a.tablespace_name              ts_name
,        sum(decode(b.autoextensible, 'YES', b.maxbytes, b.bytes))
       / count(distinct a.file_id||'.'||a.block_id) extensible_bytes
,        sum(b.bytes)/count(distinct a.file_id||'.'||a.block_id)  allocated_bytes
,        sum(a.bytes)/count(distinct b.file_id) alloc_free
    from sys.dba_free_space             a
,        sys.dba_data_files             b
   where a.tablespace_name              = b.tablespace_name (+)
group by a.tablespace_name
,        b.tablespace_name)
order by 6 desc;

TS_NAMEEXTENSIBLEALLOCATEDALLOC_FREEUSEDPCT_USEDNEPCT_USED_EXT
SYSTEM34,359,721,984786,432,0006,684,672779,747,32899.1533,579,974,6562.2693644854
SYSAUX34,359,721,984587,202,56037,617,664549,584,89693.5937533,810,137,0881.5995033262
USERS34,359,721,9845,242,8803,866,6241,376,25626.2534,358,345,7280.004005434
UNDOTBS134,359,721,98494,371,84073,465,85620,905,98422.152777777834,338,816,0000.0608444504
TESTTBS68,719,443,968209,715,200207,618,0482,097,152168,717,346,8160.0030517593
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值