SYSAUX 表空間作爲 SYSTEM 表空間的輔助表空間,主要存放 EM 相關的內容以及表統計信息,AWR快照,審計信息等,而若是 SYSAUX 表空間在默認條件下你若是不作任何配置,隨着時間的推移,會膨脹的愈來愈大。sql
select occupant_name, schema_name, occupant_desc, space_usage_kbytes from v$sysaux_occupants order by space_usage_kbytes desc
能夠看到是主要是 AWR 佔用了空間。數據庫
SQL> connect / as sysdba SQL> @?/rdbms/admin/catnoawr.sql SQL> @?/rdbms/admin/catawrtb.sql
SELECT B.TABLESPACE_NAME 表空間, B.FILE_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 GROUP BY B.TABLESPACE_NAME, B.FILE_NAME, B.BYTES ORDER BY B.TABLESPACE_NAME
SELECT B.TABLESPACE_NAME 表空間, B.FILE_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 GROUP BY B.TABLESPACE_NAME, B.FILE_NAME, B.BYTES ORDER BY B.TABLESPACE_NAME
Alter tablespace USERS add datafile '/ordata/orcl/users17.dbf' size 20G;
SELECT B.TABLESPACE_NAME 表空間, B.FILE_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 GROUP BY B.TABLESPACE_NAME, B.FILE_NAME, B.BYTES ORDER BY B.TABLESPACE_NAME
從dba_segments中找出佔用SYSTEM表空間中排名前10位的大對象。ide
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;
system表空間滿了之後,對審計表進行清空,用新的審計表覆蓋舊的審計表,若是用處不大,咱們能夠選擇關閉審計功能,以下spa
sqlplus / nolog connect sys/sys as sysdba alter system set audit_trail='NONE' scope=spfile; shutdown immediate; startup;
truncate table SYS.AUD$;
alter tablespace system add datafile '/data/orcl/system02.dbf' size 2G;