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 Ruijie登录命令

    cd rjsupplicant chmod +x rjsupplicant.sh sudo ./rjsupplicant.sh -u 1550590×××× -p ××××× -d 1

  2. MySQL 查看最大连接数, 当期连接数.

    查看最大连接数 select VARIABLE_VALUE from information_schema.GLOBAL_VARIABLES where VARIABLE_NAME='MAX_CONN ...

  3. HTK学习1:安装编译

    选自:http://www.cnblogs.com/mingzhao810/archive/2012/08/03/2617674.html HTK(HMM Toolkit)一款基于hmm模型的语音处理 ...

  4. 使用html5 FileReader获取图片,并异步上传到服务器(不使用iframe)

    使用html5 FileReader获取图片,并异步上传到服务器(不使用iframe)   原理: 1.使用FileReader 读取图片的base64编码 2.使用ajax,把图片的base64编码 ...

  5. 【GoLang】golang 中可变参数的 定义、传递 示例

    支持可变长参数列表的函数可以支持任意个传入参数,比如fmt.Println函数就是一个支持可变长参数列表的函数. package main import "fmt" // 这个函数 ...

  6. Oracle: SQL组合不同字段作为一个查询条件

    前端程序传过来的值是有三个字段组合之后的结果,后端程序处理,并且将查询的数据反馈给前端. PS:不能直接使用字段RPT_NO的,因为在这条记录中RPT_NO恰好等于其他三个字段的组合值. 正确的做法是 ...

  7. linux grep 查找字符串

    2015年8月27日 12:04:58 在当前文件夹查找 public function abc() grep -re 'public function abc\b' . // 可以不加e, 适合函数 ...

  8. 实验二 PHP基本语法实验

    实验二 PHP基本语法实验 0 实验准备 0.1实验环境和相关工具软件 具体到的机房环境,请在Windowsxp环境下做本实验: l  操作系统:Windowsxp l  Web服务器:Apache ...

  9. 2076 Problem F Quick Brown Fox

    题目描述 A pangram is a phrase that includes at least one occurrence of each of the 26 letters, ‘a’. . . ...

  10. Ubuntu 配置 Tomcat

    系统环境:Ubuntu 10.10(linux-kernel 2.6.35-22) 安装版本:apache-tomcat-7.0.29.tar.gz(官方网址:Apache Tomcat) 安装步骤: ...