`

Get the TableSpace usage in Oracle

 
阅读更多

1.To get the table space usage in oracle use this query:


SELECT a.tablespace_name,
  ROUND(a.bytes / 1024000) 'Used (MB)',
  ROUND(b.bytes / 1024000) 'Free (MB)',
  ROUND(((a.bytes -b.bytes) / a.bytes) *100,   2) '% USED'
FROM
  (SELECT tablespace_name,
     SUM(bytes) bytes
   FROM dba_data_files
   GROUP BY tablespace_name)
a,
    (SELECT tablespace_name,
     SUM(bytes) bytes,
     MAX(bytes) largest
   FROM dba_free_space
   GROUP BY tablespace_name)
b
WHERE a.tablespace_name = b.tablespace_name
AND a.tablespace_name LIKE '%'
ORDER BY((a.bytes -b.bytes) / a.bytes) DESC;

If You want to list a particular table space  replace  a.TABLESPACE_NAME like ‘%’ with a.TABLESPACE_NAME like ‘MY_TABLE_SPACE’

 

2.To get the temporary tablespace usuage use this query:

 

SELECT tablespace_name,
  SUM(bytes_used),
  SUM(bytes_free)
FROM v$temp_space_header
GROUP BY tablespace_name;




 

分享到:
评论

相关推荐

    ora分析脚本

    - sort_usage: tell how temp tablespace is used in detail - sgasnap [] Snapshot the sga advice stats - sgaadv [-s []] [-o graphfile] generate a graph from v and v and store it in a file if the -o ...

    Oracle 8i Supplied PL/SQL Packages Reference

    - **示例**:`DBMS_UTILITY.GET_TABLESPACE_USAGE` 可以查询表空间的使用情况。 2. **DBMS_ALERT** - **功能**:提供了一种机制来实现服务器之间的通信和同步,特别适用于分布式数据库环境。 - **示例**:使用`...

    oracle常用性能监控SQL语句

    select b.file_id, b.tablespace_name, b.bytes, (b.bytes - sum(nvl(a.bytes, 0))) as 'Used', sum(nvl(a.bytes, 0)) as 'Free', sum(nvl(a.bytes, 0))/(b.bytes)*100 as 'Usage %' from dba_free_space a, dba_...

    Oracle运维最佳实践-下.pdf 带书签

    - 分析`v$system_event`中的`CPU usage by sessions`事件以识别CPU瓶颈。 - 使用`v$resource_limit`视图来检查资源限制。 - **2.1.8 IO基准测试** - IO性能直接影响数据库的响应速度,因此进行IO基准测试对于...

    Oracle10g数据库日常维护手册

    - **方法**: 使用`dbms_space.admin`包中的`get_next_extent`和`get_max_extent`函数。 - **关键字段**: - 对象名(`object_name`)。 - 下一扩展(`next_extent`)。 - 最大扩展(`max_extent`)。 #### 五、检查...

Global site tag (gtag.js) - Google Analytics