12_system表空間爆滿(mǎn)解決方法
時(shí)間:2023-05-05 07:18:02 | 來(lái)源:網(wǎng)站運(yùn)營(yíng)
時(shí)間:2023-05-05 07:18:02 來(lái)源:網(wǎng)站運(yùn)營(yíng)
12_system表空間爆滿(mǎn)解決方法: 問(wèn)題描述:
對(duì)數(shù)據(jù)庫(kù)做檢查,發(fā)現(xiàn)system表空間持續(xù)占滿(mǎn)99%。使用如下語(yǔ)句查看:
SQL> select 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 and b.tablespace_name='SYSTEM' group by b.tablespace_name,b.file_name,b.bytes order by b.tablespace_name;
表空間 大小M 已使用M 利用率
------------- ---------- ---------- ----------
SYSTEM 6770 6505 96.08%
從dba_segments中找出占用SYSTEM表空間中排名前10位的大對(duì)象:
SQL> col segment_name for a15;
SQL> SELECT * FROM (SELECT SEGMENT_NAME, SUM(BYTES) / 1024 / 1024 MB FROM DBA_SEGMENTS WHERE TABLESPACE_NAME = 'SYSTEM' GROUP BY SEGMENT_NAME ORDER BY 2 DESC) WHERE ROWNUM < 10;
SEGMENT_NAME MB
-------------------- ----------
AUD$ 6016
IDL_UB1$ 280
SOURCE$ 80
IDL_UB2$ 33
C_TOID_VERSION# 24
C_OBJ#_INTCOL# 18
I_SOURCE1 16
ARGUMENT$ 13
C_OBJ# 13
JAVA$MC$ 12
發(fā)現(xiàn)是AUD$審計(jì)表占用資源量大。為了避免對(duì)整體性能造成影響,決定把AUD$遷移到其他表空間
解決步驟:
1,新建aud_space表空間和aud_index索引表空間
2,執(zhí)行遷移命令,將AUD$表相關(guān)移到審計(jì)表空間中:
SQL> alter table aud$ move tablespace aud_space;
SQL> alter table audit$ move tablespace aud_space;
SQL> alter index i_audit rebuild online tablespace aud_index;
SQL> alter table audit_actions move tablespace aud_space;
SQL> alter index i_audit_actions rebuild online tablespace aud_index;
3,再此查看SYSTEM表空間使用狀態(tài):
SQL> select 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 and b.tablespace_name='SYSTEM' group by b.tablespace_name,b.file_name,b.bytes order by b.tablespace_name;
表空間 大小M 已使用M 利用率
------------- ---------- ---------- ----------
SYSTEM 6770 792.3125 11.70
可見(jiàn)SYSTEM表空間已經(jīng)降下來(lái)了。
4,為了安全起見(jiàn),AUD$表數(shù)據(jù)目前3千多萬(wàn),數(shù)據(jù)量大,后期考慮truncate此表,清空數(shù)據(jù)。