现象
1、SYSAUX表空间容量异常,确认没有业务数据
2、WRM$打头的表占用大量空间
(select a.owner,a.segment_name,a.segment_type,a.bytes/1024/1024/1024 from dba_segments a where a.tablespace_name='SYSAUX' order by 3 desc;)
处理流程
检查快照策略正常
select * from dba_hist_wr_control;
DBID SNAP_INTERVAL RETENTION TOPNSQL CON_ID
3266178832 +00000 01:00:00.0 +00008 00:00:00.0 DEFAULT 0
检查发现从建库至今的快照信息都还保留着
select min(a.SNAP_ID),max(a.SNAP_ID) from dba_hist_snapshot a;
select min(SNAP_ID),max(SNAP_ID) from wrm$_snapshot;
清理历史快照
exec dbms_workload_repository.drop_snapshot_range(low_snap_id => 1,high_snap_id => 40000,dbid => 3266178832);
或
begin
dbms_workload_repository.drop_snapshot_range(
low_snap_id => 1,
high_snap_id => 40000,
dbid => 3266178832);
end;
注意:1、清理历史快照会产生大量日志,占用大量UNDO ,需要留意归档等空间
2、清理后注意验证,个别版本会出现没法清除的情况,可查看官方文档ID 1489801.1和ID 9797851.8,打上对应的补丁
3、进一步检查发现环境的自动任务在建库之初被人为停止,暂时没能验证是否与Automatic Segment Advisor任务没有启用有关。
自动任务
select client_name, task_name, operation_name, status from dba_autotask_task;
select program_type, program_action, enabled from dba_scheduler_programs where program_name='GATHER_STATS_PROG';
select window_name, repeat_interval, duration, enabled from dba_scheduler_windows where enabled='TRUE';