oracle SYSTEM表空間不足問題

2021-10-04 17:23:11 字數 2483 閱讀 7485

雜症二、system表空間不足報錯

一、雜症:

plsql登入,報錯:

ora-00604: 遞迴 sql 層  出現錯誤

ora-01653: 表.無法通過(在表空間中)擴充套件

ora-02002: 寫入審記線索時出錯

二、病理:

1、表空間不足

2、資料庫的審計功能已經開啟引起(sys.aud$表)

三、**定位:

先連線上資料庫:

# su oracle

# sqlplus /nolog

sql> conn /as sysdba          //重新連線

sql> startup mount;             //掛起

sql> alter database open;   //開啟資料庫

執行下面sql,檢視表空間使用情況

select

upper(f.tablespace_name) "tablespace_name",

d.tot_grootte_mb "tablespace_size(m)",

d.tot_grootte_mb - f.total_bytes "tablespace_used(m)",

to_char (round((d.tot_grootte_mb - f.total_bytes) / d.tot_grootte_mb * 100,2),'990.99') "tablespace_used_bi",

f.total_bytes "tablespace_free(m)"

from

(select tablespace_name, round(sum(bytes) /(1024 * 1024), 2) total_bytes, round(max(bytes) /(1024 * 1024), 2) max_bytes from sys.dba_free_space group by tablespace_name) f,

(select dd.tablespace_name, round(sum(dd.bytes) / (1024 * 1024), 2) tot_grootte_mb from sys.dba_data_files dd group by dd.tablespace_name) d

where

d.tablespace_name = f.tablespace_name

order by 4 desc;

system表空間使用比 已經達到 99.81。

四、**:

表空間不足**:

方案一:若表空間不是自增,則修改為自增模式。(不適合此次原因)

先檢視表空間是否自增

sql > select file_name,tablespace_name,autoextensible from dba_data_files;

yes 說明是自增的

如果是no則執行下面 sql,修改模式:

注:根據自己system對應的的資料檔案路徑填寫,50m為每次自增的大小。

方案二:擴大表空間對應的資料檔案大小 (不適合此次原因)

可得 對應的表空間檔案已經 32g了。

規定 表空間所對應的資料檔案不能超過32g。

若沒有達到則可以通過 擴大表空間對應檔案的大小,sql為:

方案三:為system表空間增加乙個資料檔案system02.dbf (不適合此次問題原因)

大小:500m ,  自增大小:50m

注:乙個表空間能對應多個資料檔案,但乙個資料檔案只能對應乙個表空間

方案四:清空aud$表資料並關閉審計功能(根本原因,筆者使用了該方案)

1、查sys.aud$及其索引 占用大小

sql> select t.owner, t.segment_name,sum(bytes)/1024/1024/1024 as size_g

from dba_segments t

where t.tablespace_name = 'system' and t.segment_name='aud$'

group by t.owner,t.segment_name

order by sum(bytes) desc;

可怕,就是這個審計表,達到了31個g了,問題就在此。

2、清空aud$:

sql> truncate table aud$;

3、檢視審計功能

sql> show parameter audit

4、關閉審計功能:

sql> alter system set audit_trail='none' scope=spfile;

如果只是清理 aud$表,問題已經解決,但是時間久後,問題還是會復現,如果不需要審計資料可以關閉審計功能永久解決。

注:此上方案解決後,需要重啟

sql> shutdown immediate;   //關閉

sql> startup mount;             //掛起

sql> alter database open;   //開啟資料庫

Oracle SYSTEM表空間說明

每個oracle資料庫都包含乙個名為 system 的表空間 tablespace 她在數 據庫建立時由oracle自動建立。只要資料庫處於開啟 open 狀態,system 表空間就一定是聯機 online 的。管理員可以建立本地管理的 locally managed system 表空間 tab...

oracle system表空間已滿,如何解決?

1.登入資料庫 sqlplus nolog conn as sysdba 2.查詢表空間使用狀況 select upper f.tablespace name 表空間名 d.tot grootte mb 表空間大小 m d.tot grootte mb f.total bytes 已使用空間 m t...

Oracle SYSTEM表空間突然持續爆滿

一般情況下,我們建完資料庫後,都會給資料庫指定乙個新的預設表空間,不然會占用資料庫系統表空間資源,導致資料庫效能下降。我們可以同過sql語句找出改表空間占用空間前10的物件 這是我們發現是sys使用者下的aud 表占用了大部分空間資源,因為資料庫11g起預設是開了審計功能,所以會不斷統計收集使用者登...