标签:
step1. 确认到底是哪个段占用了sysaux空间:
select segment_name,sum(bytes)/1024/1024 from dba_segments where tablespace_name=‘SYSAUX‘ group by segment_name order by 2 desc
SEGMENT_NAME SUM(BYTES)/1024/1024
WRH$_ACTIVE_SESSION_HISTORY 7360.375
WRH$_ACTIVE_SESSION_HISTORY_PK 1400.257
从上面看就是ASH(v$active_session_history)历史记录没有清理造成
step2. 检查有多少条无效记录:
SQL> SELECT COUNT(1) Orphaned_ASH_Rows
2 FROM wrh$_active_session_history a
3 WHERE NOT EXISTS
4 (SELECT 1
5 FROM wrm$_snapshot
6 WHERE snap_id = a.snap_id
7 AND dbid = a.dbid
8 AND instance_number = a.instance_number
9 );
ORPHANED_ASH_ROWS
-----------------
23392228
step3.清楚多余记录,由于rows过多,清理速度有点慢。
SQL>DELETE FROM wrh$_active_session_history a
WHERE NOT EXISTS (SELECT 1
FROM wrm$_snapshot
WHERE snap_id = a.snap_id
AND dbid = a.dbid
AND instance_number = a.instance_number);
23392228 rows deleted.
SQL>commit;
期间需要注意归档日志的产生量,避免造成磁盘空间不足等麻烦。同时可以适当的多添加几组redolog来加速delete操作。
step4. shrink tablespace
alter table WRH$_ACTIVE_SESSION_HISTORY shrink space;
step5. re-check
column OCCUPANT_NAME format a15
SELECT occupant_name,
occupant_desc,
space_usage_kbytes
FROM v$sysaux_occupants
WHERE occupant_name LIKE ‘%AWR%‘;
step6 rebuild index
SQL> alter index sys.WRH$_ACTIVE_SESSION_HISTORY_PK rebuild partition WRH$_ACTIVE_2645903699_12505;
Index altered.
SQL> alter index sys.WRH$_ACTIVE_SESSION_HISTORY_PK rebuild partition WRH$_ACTIVE_2645903699_6157;
Index altered.
标签:
原文地址:http://www.cnblogs.com/yiyuf/p/4284448.html