加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Oracle 查看表空间、数据文件的大小及使用情况

发布时间:2020-12-12 14:05:21 所属栏目:百科 来源:网络整理
导读:查看表空间使用情况 --1G=1024MB --1M=1024KB --1K=1024Bytes --1M=11048576Bytes --1G=1024*11048576Bytes=11313741824Bytes SELECT a.tablespace_name "表空间名" ,total "表空间大小" ,free "表空间剩余大小" ,(total - free) "表空间使用大小" ,total /

查看表空间使用情况

--1G=1024MB
--1M=1024KB
--1K=1024Bytes
--1M=11048576Bytes
--1G=1024*11048576Bytes=11313741824Bytes
SELECT a.tablespace_name "表空间名",total "表空间大小",free "表空间剩余大小",(total - free) "表空间使用大小",total / (1024 * 1024 * 1024) "表空间大小(G)",free / (1024 * 1024 * 1024) "表空间剩余大小(G)",(total - free) / (1024 * 1024 * 1024) "表空间使用大小(G)",round((total - free) / total,4) * 100 "使用率 %" FROM (SELECT tablespace_name,SUM(bytes) free FROM dba_free_space GROUP BY tablespace_name) a,(SELECT tablespace_name,SUM(bytes) total FROM dba_data_files GROUP BY tablespace_name) b WHERE a.tablespace_name = b.tablespace_name;

查看表数据文件情况

select   b.file_name 物理文件名,  b.tablespace_name 表空间,  b.bytes / 1024 / 1024 大小M,  (b.bytes - sum(nvl(a.bytes,0))) / 1024 / 1024 已使用M,  substr((b.bytes - sum(nvl(a.bytes,0))) / (b.bytes) * 100,1,5) 利用率   from dba_free_space a,dba_data_files b   where a.file_id = b.file_id   group by b.tablespace_name,b.file_name,b.bytes   order by b.tablespace_name;

查看数据库的版本 

SELECT version FROM product_component_version WHERE substr(product,6) = 'Oracle';

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读