In this Document

Symptoms

Cause

Solution

References

Symptoms

sysaux表空間的WRH$_ACTIVE_SESSION_HISTORY表變得很大,把SYSAUX表空間撐得報警。

Cause

AWR 表沒有根據sys.wrm$_wr_control的設定清除數據,行數不斷累積,表段變得非常的大。

Solution

從dba_hist_wr_control視圖查看當前的快照保留時間

SQL> select a.snap_interval,a.retention,a.topnsql from dba_hist_wr_control a;

SNAP_INTERVAL                       RETENTION                          TOPNSQL
-------------------------------------------------- -------------------------------------------------- ------------------------------
+00000 01:00:00.0                   +00007 00:00:00.0                         100

從dba_hist_snapshot視圖查看當前快照id

SELECT * FROM dba_hist_snapshot t ORDER BY t.snap_id ASC;

如下程式會從WRH$_ACTIVE_SESSION_HISTORY 表中得到一個最小和最大的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;

 

>EXECUTE DBMS_WORKLOAD_REPOSITORY.DROP_SNAPSHOT_RANGE(102, 105); --選擇清除一個快照範圍

實際去測試這句的時候,不知道是卡很久還是太慢,沒有成功。使用之前需再次測試。

>alter table WRH$_ACTIVE_SESSION_HISTORY shrink space;  --把表縮小

另一種方式

alter session set "_swrf_test_action" = 72;

會將WRH$_ACTIVE_SESSION_HISTORY分區表劃分成更細的一個分區表(SYSAUX表空間下的其他分區表其實也會被分多一個分區)

然後我直接將那個小分區給幹掉了,這樣做會刪掉最小那個分區全部的snapshot

SQL> alter table WRH$_ACTIVE_SESSION_HISTORY drop partition WRH$_ACTIVE_1015375936_0  ;

Table altered.

重複運行上面的alter session set "_swrf_test_action" = 72;會重新建立一個分區。

我麼刪掉了快照歷史,去看ASH報告,就會得到沒有數據的提示。

No data exists for this section of the report.

Back to Load Profile
Back to Top

Top SQL Command Types

No data exists for this section of the report.

Back to Load Profile
Back to Top

Reference

   【1】WRH$_ACTIVE_SESSION_HISTORY Does Not Get Purged Based Upon the Retention Policy (Doc ID 387914.1)

   【2】 http://blog.itpub.net/26764973/viewspace-1853612/

Oralce sysaux WRH$_ACTIVE_SESSION_HISTORY清理的更多相关文章

  1. SYSAUX表空间清理

    最近zabbix告警某业务sysaux表空间使用率超过95%,使用sql查看sysaux表空间设置了32G,32G的表空间竟然使用了95%.一般来讲除开业务数据存放的表空间,DBA要着重关注SYSTE ...

  2. AWR Report 关键参数详细分析

    WORKLOAD REPOSITORY report for DB Name DB Id Instance Inst num Startup Time Release RAC CALLDB 12510 ...

  3. Oracle 12c SYSAUX表空间不足处理-清理audsys.cli_swp$a9b5f52c$1$1表

    今天在检查一台测试环境的表空间时,发现SYSAUX的使用率已经达到99.91% TABLESPACE_NAME FILES Freesize(MB) Usedsize(MB) Filesize(MB) ...

  4. 清理SYSAUX表空间

    1.查看SYSAUX表空间中数据分布情况 col SEGMENT_NAME for a30 set lines 999 select * from (select segment_name,PARTI ...

  5. SYSAUX表空间如何清理

    ############################################################ 操作方案################################### ...

  6. Clean WRH$_ACTIVE_SESSION_HISTORY in SYSAUX

    Tablespace SYSAUX grows quickly. Run Oracle script awrinfo.sql to find what is using the space. One ...

  7. ORACLE 清理SYSAUX表空间

    在数据库检查中发现SYSAUX表空间占用过大,SYSAUX是ORACLE10G开始提供的功能,用于数据库为SYSTEM表空间减负. 用以下语句查出相应的表空间值 select a.tablespace ...

  8. Oracle10g以上sysaux表空间的维护和清理

    SYSAUX表空间在Oracle 10g中引入,其作为SYSTEM表空间的辅助表空间.之前,一些使用独立表空间或系统表空间的数据库组件,现在SYSAUX表空间中存在.通过分离这些组件,减轻了SYSTE ...

  9. 清理SYSAUX表空间的WRH$_LATCH_CHILDREN表

    周六 被突然起来的短信 轰醒. 一看有63条短信. 都是来之与监控中的.有关表空间大小超过某个警戒值. 发现 SYSAUX表空间超过了15GB 通过以下代码查看SYSAUX表空间的功能占用情况 SEL ...

随机推荐

  1. linux下git安装

    Download for Linux and Unix It is easiest to install Git on Linux using the preferred package manage ...

  2. linux下logrotate 配置和理解

    对于Linux 的系统安全来说,日志文件是极其重要的工具.系统管理员可以使用logrotate 程序用来管理系统中的最新的事件,对于Linux 的系统安全来说,日志文件是极其重要的工具.系统管理员可以 ...

  3. 【Eclipse】eclipse che 协作开发

    http://www.eclipse.org/che/ http://blog.csdn.net/ccfeng2008/article/details/50881024 http://www.osch ...

  4. C#的is和as操作符来进行强制类型转换&&值类型的拆箱、装箱

    if(o is Employee) { Employee e=(Employee)o; //在if语句剩余的部分中使用e; } Employee e=o as Employee; if(e!=null ...

  5. Remove Invalid Parentheses

    Remove the minimum number of invalid parentheses in order to make the input string valid. Return all ...

  6. Python 路谱

    20160214--->20160824 一口气爬过高山 Happy Valentine’s Day https://docs.python.org/2.7/library/index.html ...

  7. 谷歌 Uncaught SecurityError: Failed to execute 'replaceState' on 'History 错误

    今天在用sui mobil做一个内联页面的时候遇到了这个问题. 然而这个问题只出现在chrome浏览器中,在火狐中没有一点问题. 他说明的是一个安全问题,chrome中有了新的安全机制

  8. c/c++与Python的语法差异

    1.程序块语法方面: c/c++中用一对“{}”将多段语句括起来,表示一个程序块,并以右大括号表明程序块结束 ;i<n;i++) { cout<<a[i]; j+=; } Pytho ...

  9. 【leetcode】Binary Tree Right Side View(middle)

    Given a binary tree, imagine yourself standing on the right side of it, return the values of the nod ...

  10. UVA 11827 Maximum GCD

    F - Maximum GCD Time Limit:1000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Given the ...