oracle+system空间满了,oracle审计导致system表空间爆满的处理方法
現象描述:
開發人員通過plsql登錄或者操作數據庫,提示如下錯誤:
ORA-00604: error occurred at recursive SQL level 1
ORA-01653: unable to extend table SYS.AUD$ by 8192 in tablespace SYSTEM
ORA-02002: error while writing to audit trail
ORA-00604: error occurred at recursive SQL level 1
ORA-01653: unable to extend table SYS.AUD$ by 8192 in tablespace SYSTEM
解決方法:
根據提示很明顯是system空間無法擴展,審計記錄無法寫入,表面上是system表空間不足,其實不然,從錯誤信息可以看出,該環境審計功能是開啟的,這種情況大多數都是由于審計信息太多,導致系統表空間緊張導致的,清空審計信息就可以解決,此處就是由于審計信息記錄太大導致的,如果沒有審計需求,可以關閉審計功能。以下是清理審計的方法:
先通過以下語句查出審計表占用的空間大小:
select?owner,
table_name,
sum(decode(seg_type,?'table',?size_mb))?"數據段大小",
sum(decode(seg_type,?'index',?size_mb))?"索引段大小",
sum(decode(seg_type,?'lob',?size_mb))?"大字段大小",
sum(size_mb)?"表總大小"
from?(
---所有表大小
select?t.owner,
t.table_name,
sum(s.bytes)?/?1024?/?1024?size_mb,
'table'?seg_type
from?dba_segments?s,?dba_tables?t
where?s.owner?=?t.owner
and?s.segment_name?=?t.table_name
group?by?t.owner,?t.table_name
union?all
---大字段大小
select?l.owner,
l.table_name,
sum(s.bytes)?/?1024?/?1024?size_mb,
'lob'?seg_type
from?dba_segments?s,?dba_lobs?l
where?s.owner?=?l.owner
and?s.segment_name?=?l.segment_name
group?by?l.owner,?l.table_name
union?all
---索引段大小
select?i.table_owner,
i.table_name,
sum(s.bytes)?/?1024?/?1024?size_mb,
'index'?seg_type
from?dba_segments?s,?dba_indexes?i
where?s.owner?=?i.owner
and?s.segment_name?=?i.index_name
group?by?i.table_owner,?i.table_name)
where?owner?=?'SYS'?and?table_name='AUD$'
group?by?owner,?table_name;
根據查出的審計表的大小分段釋放空間,如查出來大小10G
,分5段釋放
,逐次將審計表中的數據清除,使之逐步釋放空間,過程語句如下:
TRUNCATE?TABLE?sys.aud$?reuse?storage;
ALTER?TABLE?sys.aud$?deallocate?unused?keep?10800M;
ALTER?TABLE?sys.aud$?deallocate?unused?keep?6144M;
ALTER?TABLE?sys.aud$?deallocate?unused?keep?4096M;
ALTER?TABLE?sys.aud$?deallocate?unused?keep?2048M;
ALTER?TABLE?sys.aud$?deallocate?unused?keep?0M;
總結
以上是生活随笔為你收集整理的oracle+system空间满了,oracle审计导致system表空间爆满的处理方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 一个人合租房子住是什么感觉?
- 下一篇: 马云交接后阿里会怎么样 合伙人制度是关键