ORACLE表空间不足

 

解决办法:

一:加表空间

二:释放审计,删除审计

三:释放空间

 

下面是查看具体的表空间的使用

 

--查看表空间使用情况

select a.tablespace_name,a.bytes bytes_used,b.largest,round(((a.bytes - b.bytes)/a.bytes)*100,2) percent_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 order by ((a.bytes - b.bytes) / a.bytes) desc

 

SELECT a.tablespace_name "表空间名",
total "表空间大小",
free "表空间剩余大小",
(total - free) "表占用空间大小",
ROUND((total - free) / total * 100, 2) || '%' "已使用空间百分比"
FROM (SELECT tablespace_name, SUM(bytes) / 1024 / 1024 total
FROM dba_data_files
GROUP BY tablespace_name) a,
(SELECT tablespace_name, SUM(bytes) / 1024 / 1024 free
FROM dba_free_space
GROUP BY tablespace_name) b
WHERE a.tablespace_name = b.tablespace_name
ORDER BY (total - free) DESC;

 

--查看某一表空间具体用户的使用情况

select owner from dba_segments where tablespace_name='ZMCC_NMC' group by owner;

 

--查看某用户下表使用的表情况

select OWNER, t.segment_name, t.segment_type, sum(t.bytes / 1024 / 1024) mmm from dba_segments t where t.owner
= '用户名' and t.segment_type='TABLE' group by OWNER, t.segment_name, t.segment_type order by mmm desc;

 

 

找到具体的表,查看原因

 

 

 

 

select t.owner,t.segment_name,t.tablespace_name,bytes/1024/1024/1024 as sizes,q.num_rows,t.segment_type
from dba_segments t
left join dba_tables q
on t.segment_name=q.table_name
and t.owner=q.owner where t.segment_type='TABLE'
and t.tablespace_name='TS_AAA' --需要查看的表空间 order by 4 desc


SELECT t.segment_name,TO_CHAR(SUM(BYTES)/(1024*1024),'999G999D999') CNT_MB
FROM user_segments t
WHERE SEGMENT_TYPE LIKE 'TABLE%'
GROUP BY t.segment_name order by 2 desc;
posted @ 2020-07-16 16:01  不会游泳的鱼丶  阅读(214)  评论(0编辑  收藏  举报