查看数据库表空间使用情况时发现,系统的sysaux表空间数据文件使用已经接近最大32G
正常情况下sysaux使用不会很大,查看sysaux下的对象情况:
SELECT D.SEGMENT_NAME, D.SEGMENT_TYPE,SUM(BYTES)/1024/1024 as M
FROM DBA_SEGMENTS D
WHERE D.TABLESPACE_NAME = 'SYSAUX'
GROUP BY D.SEGMENT_NAME, D.SEGMENT_TYPE
ORDER BY SIZE_M ;
OWNER SEGMENT_NAME SEGMENT_TYPE M
------------- ------------------------------------------------ ------------------ ----------
SYS WRH$_ACTIVE_SESSION_HISTORY TABLE PARTITION 19456
可以看到活动会话历史数据占了很多空间,继续查询表的分区情况:
select segment_name,PARTITION_NAME,segment_type,bytes/1024/1024 from dba_segments where tablespace_name='SYSAUX' and segment_name='WRH$_ACTIVE_SESSION_HISTORY' order by 3;
SEGMENT_NAME PARTITION_NAME SEGMENT_TYPE BYTES/1024/1024
----------------------------------------------- ---------------------- ------------------ ---------------
WRH$_ACTIVE_SESSION_HISTORY WRH$_ACTIVE_1400637121_77293 TABLE PARTITION 19125.3125
WRH$_ACTIVE_SESSION_HISTORY WRH$_ACTIVE_SES_MXDB_MXSN TABLE PARTITION .0625
接下来进行分区数据删除(若存在本地空间问题,先把分区数据删除,然后让系统对表进行分区。如果空间足够应该先分区在删除数据)
alter table sys.wrh$_active_session_history truncate partition WRH$_ACTIVE_1400637121_77293 update global indexes;
alter session set "_swrf_test_action" = 72; --让系统对表进行分区
再次查看分区情况:
select segment_name,PARTITION_NAME,segment_type,bytes/1024/1024 from dba_segments where tablespace_name='SYSAUX' and segment_name='WRH$_ACTIVE_SESSION_HISTORY' order by 3;
SEGMENT_NAME PARTITION_NAME SEGMENT_TYPE BYTES/1024/1024
----------------------------------------------- ---------------------- ------------------ ---------------
WRH$_ACTIVE_SESSION_HISTORY WRH$_ACTIVE_1400637121_77293 TABLE PARTITION .0625
WRH$_ACTIVE_SESSION_HISTORY WRH$_ACTIVE_SES_MXDB_MXSN TABLE PARTITION .0625
WRH$_ACTIVE_SESSION_HISTORY WRH$_ACTIVE_1400637121_88057 TABLE PARTITION .0625
可参见官方文档(Doc ID 387914.1)
|