当前位置:Gxlcms > 数据库问题 > oracle 查看各表空间剩余量

oracle 查看各表空间剩余量

时间:2021-07-01 10:21:17 帮助过:11人阅读

 

1、查看所有表空间大小、剩余量:

select dbf.tablespace_name,
dbf.totalspace "总量(M)",
dbf.totalblocks as 总块数,
dfs.freespace "剩余总量(M)",
dfs.freeblocks "剩余块数",
(dfs.freespace / dbf.totalspace) * 100 "空闲比例" 
from (select t.tablespace_name,
sum(t.bytes) / 1024 / 1024 totalspace,
sum(t.blocks) totalblocks
from dba_data_files t
group by t.tablespace_name) dbf,
(select tt.tablespace_name,
sum(tt.bytes) / 1024 / 1024 freespace,
sum(tt.blocks) freeblocks
from dba_free_space tt
group by tt.tablespace_name) dfs
where trim(dbf.tablespace_name) = trim(dfs.tablespace_name)

2、查看当前用户各表所占表空间

Select Segment_Name,Sum(bytes)/1024/1024 From User_Extents Group By Segment_Name

3.  使用如下语句查看一下谁在用临时段
SELECT se.username, se.SID, se.serial#, se.sql_address, se.machine, se.program, su.TABLESPACE,  su.segtype,  su.CONTENTS
FROM v$session se, v$sort_usage su
    WHERE se.saddr = su.session_addr;

oracle 查看各表空间剩余量

标签:pos   important   blog   session   sum   tab   比例   table   oracl   

人气教程排行