Oracle 11.2.0.4 awr過期快照無法自動清理
事件:SYSAUX表空間專案儲存比重較大
#檢查佔用空間最大的前20物件
SQL> select * from (select owner,segment_name,partition_name,bytes/1024/1024 from dba_segments where tablespace_name='SYSAUX' order by 4 desc) where rownum <=20;
#檢查策略
SQL> select * from dba_hist_wr_control;
DBID SNAP_INTERVAL RETENTION TOPNSQL
---------- --------------------------------------------------------------------------- --------------------------------------------------------------------------- ----------
3560543255 +00000 01:00:00.0 +00008 00:00:00.0 DEFAULT
SQL> show parameter statistics;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
optimizer_use_pending_statistics boolean FALSE
statistics_level string TYPICAL
timed_os_statistics integer 0
timed_statistics boolean TRUE
SQL> select dbms_stats.get_stats_history_retention from dual;
GET_STATS_HISTORY_RETENTION
---------------------------
15
#策略檢查一切正常,修改統計資訊保留10天
SQL> exec dbms_stats.alter_stats_history_retention(10);
PL/SQL procedure successfully completed.
SQL> exec dbms_stats.purge_stats(systimestamp -11);
PL/SQL procedure successfully completed.
SQL> select dbms_stats.get_stats_history_retention from dual;
GET_STATS_HISTORY_RETENTION
---------------------------
10
#建立新的分割槽
alter session set "_swrf_test_action" = 72;
#檢查分割槽
SQL> select table_name,partition_name,high_value from dba_tab_partitions where table_name='WRH$_SYSSTAT';
TABLE_NAME PARTITION_NAME HIGH_VALUE
--------------- ------------------------------ --------------------------------------------------------------------------------
WRH$_SYSSTAT WRH$_SYSSTAT_MXDB_MXSN MAXVALUE, MAXVALUE
WRH$_SYSSTAT WRH$_SYSSTA_3560543255_1322 3560543255, 30532
WRH$_SYSSTAT WRH$_SYSSTA_3560543255_30532 3560543255, MAXVALUE
#檢查快照ID
SQL> select min(snap_id),max(snap_id) from dba_hist_snapshot;
MIN(SNAP_ID) MAX(SNAP_ID)
------------ ------------
30530 30531
SQL> select min(snap_id),max(snap_id) from wrh$_active_session_history;
MIN(SNAP_ID) MAX(SNAP_ID)
------------ ------------
30530 30531
SQL> select max(SNAP_ID),min(SNAP_ID) from WRH$_PARAMETER;
MAX(SNAP_ID) MIN(SNAP_ID)
------------ ------------
30531 1322
SQL> select max(SNAP_ID),min(SNAP_ID) from WRH$_SQLSTAT;
MAX(SNAP_ID) MIN(SNAP_ID)
------------ ------------
30531 1322
--檢查awr佔用情況,發現過期快照無法自動清理Bug 14084247 - ORA-1555 or ORA-12571 Failed AWR purge can lead to continued SYSAUX space use (文件 ID 14084247.8)
@?/rdbms/admin/awrinfo.sql
#統計各個WRH表的最大,最小snap_id
set serveroutput on
declare
CURSOR cur_part IS
SELECT partition_name from dba_tab_partitions
WHERE table_name = 'WRH$_ACTIVE_SESSION_HISTORY';
query1 varchar2(200);
query2 varchar2(200);
TYPE partrec IS RECORD (snapid number, dbid number);
TYPE partlist IS TABLE OF partrec;
Outlist partlist;
begin
dbms_output.put_line('PARTITION NAME SNAP_ID DBID');
dbms_output.put_line('--------------------------- ------- ----------');
for part in cur_part loop
query1 := 'select min(snap_id), dbid from sys.WRH$_ACTIVE_SESSION_HISTORY partition ('||part.partition_name||') group by dbid';
execute immediate query1 bulk collect into OutList;
if OutList.count > 0 then
for i in OutList.first..OutList.last loop
dbms_output.put_line(part.partition_name||' Min '||OutList(i).snapid||' '||OutList(i).dbid);
end loop;
end if;
query2 := 'select max(snap_id), dbid from sys.WRH$_ACTIVE_SESSION_HISTORY partition ('||part.partition_name||') group by dbid';
execute immediate query2 bulk collect into OutList;
if OutList.count > 0 then
for i in OutList.first..OutList.last loop
dbms_output.put_line(part.partition_name||' Max '||OutList(i).snapid||' '||OutList(i).dbid);
dbms_output.put_line('---');
end loop;
end if;
end loop;
end;
/
PARTITION NAME SNAP_ID DBID
--------------------------- ------- ----------
WRH$_ACTIVE_3560543255_1322 Min 30530 3560543255
WRH$_ACTIVE_3560543255_1322 Max 30531 3560543255
---
WRH$_ACTIVE_3560543255_30532 Min 30532 3560543255
WRH$_ACTIVE_3560543255_30532 Max 30548 3560543255
---
PL/SQL procedure successfully completed.
#再次清理歷史分割槽的快照
SQL> begin
dbms_workload_repository.drop_snapshot_range(
low_snap_id =>30530,
high_snap_id =>30531,
dbid =>3560543255);
end;
/
PL/SQL procedure successfully completed.
#重啟一下MMON重新整理:
SQL> alter system set "_swrf_mmon_flush"=false;
System altered.
SQL> alter system set "_swrf_mmon_flush"=true;
System altered.
#過半小時左右,再次檢查過期快照已清理完畢
SQL> select * from (select owner,segment_name,partition_name,bytes/1024/1024 from dba_segments where tablespace_name='SYSAUX' order by 4 desc) where rownum <=20;
SQL> select max(SNAP_ID),min(SNAP_ID) from WRH$_PARAMETER;
MAX(SNAP_ID) MIN(SNAP_ID)
------------ ------------
30549 30532
SQL> select max(SNAP_ID),min(SNAP_ID) from WRH$_SQLSTAT;
MAX(SNAP_ID) MIN(SNAP_ID)
------------ ------------
30549 30532
SQL> select min(snap_id),max(snap_id) from dba_hist_snapshot;
MIN(SNAP_ID) MAX(SNAP_ID)
------------ ------------
30532 30549
SQL> select min(snap_id),max(snap_id) from wrh$_active_session_history;
MIN(SNAP_ID) MAX(SNAP_ID)
------------ ------------
30532 30549
#檢查分割槽已清理
SQL> select table_name,partition_name,high_value from dba_tab_partitions where table_name='WRH$_SYSSTAT';
TABLE_NAME PARTITION_NAME HIGH_VALUE
--------------- ------------------------------ --------------------------------------------------------------------------------
WRH$_SYSSTAT WRH$_SYSSTAT_MXDB_MXSN MAXVALUE, MAXVALUE
WRH$_SYSSTAT WRH$_SYSSTA_3560543255_30532 3560543255, MAXVALUE
#檢查表空間使用率
註釋:
1.關於_swrf_test_action引數,由於此引數屬於隱含引數,沒有明確的文件介紹此引數,只能確認此引數的部分的取值的作用,比如:
_swrf_test_action = 72;------------>強制分割AWR分割槽,以用於刪除原有分割槽
_swrf_test_action = 82;------------->手工重新設定最後一次的AWR清理時間,從而觸發MMON程式再次執行
_swrf_test_action=53;------------->手工重新整理dba_feature_usage_statistics資訊
--------------------------------
_swrf_test_action = 28;------------->啟用MMON的trace
_swrf_test_action = 10; ------------->啟用快照重新整理 trace
----------------------------------
_swrf_test_action = 11; ------------->關閉快照重新整理 trace
_swrf_test_action = 29;------------->關閉MMON的trace
--------------------------------
2.
dba_hist_snapshot,
wrh$_active_session_history,
WRH$_PARAMETER,
WRH$_SQLSTAT:
dba_hist_snapsho檢視:記錄的是AWR快照的資訊
wrh$_active_session_history表記錄的是基於v$active_session_history的資訊建立的表
WRH$_PARAMETER表記錄的是基於v$parameter的資訊建立的表
WRH$_SQLSTAT表記錄的是v$sql和v$sqltext資訊建立的表
透過分析以上檢視和表的DDL語句,他們之間並沒有關聯,他們都有snap_id列,如果其中任何一個表中的資訊清理失敗,都會造成snap_id不一致。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30327022/viewspace-2221760/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle AWR無法生成快照(ORA-32701)Oracle
- oracle awr快照點不記錄問題Oracle
- ORACLE RAC 11.2.0.4 FOR RHEL6叢集無法啟動的處理Oracle
- 【手摸手玩轉 OceanBase 168】如何自動清理過期備份?
- ORACLE RAC 11.2.0.4 for RHEL6.8無法啟動之ORA000205&ORA17503&ORA01174Oracle
- ORACLE AWROracle
- oracle密碼過期處理辦法Oracle密碼
- 11.2.0.4 RAC CSSD服務無法啟動故障 unable to set priority to 4CSS
- oracle 11g awr不自動生成的臨時解決辦法Oracle
- Oracle無法自動排程DBMS_JOB&DBMS_SCHEDULER案例分析Oracle
- 自動清理 binlog
- pbootcms模板自動清理runtime快取,自動清理快取boot快取
- oracle工具 awr formatOracleORM
- 【AWR】Oracle資料庫建立awr基線Oracle資料庫
- 【AWR】Oracle批量生成awr報告指令碼Oracle指令碼
- Oracle 11.2.0.4 透過透明閘道器訪問mysql 8.0.16OracleMySql
- 密碼過期引起的ssh無法登陸密碼
- Oracle的快照standbyOracle
- awr報告每天自動生成指令碼指令碼
- Redis鍵不會自動過期 - AblyRedis
- Oracle Haip無法啟動問題學習OracleAI
- Hazel for Mac自動化清理Mac
- Oracle 10.2.0.5升級至11.2.0.4Oracle
- oracle之 11.2.0.4 bbed安裝Oracle
- ORACLE 11.2.0.4 DG(Broker) for linux 部署OracleLinux
- ORACLE 11.2.0.4 for solaris更換硬體後主機時間改變導致一節點叢集服務無法啟動Oracle
- oracle之 AWR固定基線Oracle
- 【AWR】Oracle awr相關檢視及體系介紹Oracle
- 訂單自動過期實現方案 - 轉
- [20211013]Oracle 19c新特性Listener自動清理(Network Log File Segmentation).txtOracleSegmentation
- oracle adg主庫通過rman無法刪除歸檔Oracle
- Oracle:Oracle RAC 11.2.0.4 升級為 19cOracle
- 如何執行自動 Mac 清理Mac
- oracle rac 11.2.0.3 升級到11.2.0.4Oracle
- 一次Oracle監聽無法動態註冊處理過程排查分析Oracle
- html網頁無法自動播放音樂HTML網頁
- oracle 10G特性之awrOracle 10g
- Oracle 客戶端生成AWR方法Oracle客戶端