Clean WRH$_ACTIVE_SESSION_HISTORY in SYSAUX
Tablespace SYSAUX grows quickly. Run Oracle script awrinfo.sql to find what is using the space. One section of the report shows that ACTIVE_SESSION_HISTORY is the biggest consumer.
SQL> @$ORACLE_HOME/rdbms/admin/awrinfo.sql COMPONENT MB SEGMENT_NAME - % SPACE_USED SEGMENT_TYPE
--------- ----- ------------------------------ -------------- ---------------
ASH 408.0 WRH$_ACTIVE_SESSION_HISTORY - 98% TABLE PARTITION
.WRH$_ACTIVE_21536658_7139e
ASH 41.0 WRH$_ACTIVE_SESSION_HISTORY_PK - 98% INDEX PARTITION
.WRH$_ACTIVE_21536658_7139
FIXED 36.0 WRH$_SYSMETRIC_HISTORY - 98% TABLE
FIXED 26.0 WRH$_SYSMETRIC_HISTORY_INDEX - 98% INDEX --
-- Check the Snapshot retention, it works fine (only 8 snapshots exist).
--
SQL> SELECT snap_interval, retention, most_recent_purge_time
FROM sys.wrm$_wr_control; SNAP_INTERVAL RETENTION MOST_RECENT_PURGE_TIME
----------------- ----------------- -------------------------
+00000 01:00:00.0 +00007 00:00:00.0 27-NOV-13 12.06.06.995 AM SQL> select dbid, count(*) from SYS.WRM$_SNAPSHOT group by dbid; DBID COUNT(*)
---------- ----------
21536658 8 -- One interesting thing is DBA_HIST_SNAPSHOT and SYS.WRM$_SNAPSHOT are different
SQL> select * from DBA_HIST_SNAPSHOT; no rows selected --
-- Run below query to identify the big tables in SYSAUX
--
SQL> SELECT *
FROM ( SELECT bytes / 1024 / 1024 dim_Mb, segment_name, segment_type
FROM dba_segments
WHERE tablespace_name = 'SYSAUX'
ORDER BY dim_Mb DESC)
WHERE ROWNUM < 5; DIM_MB SEGMENT_NAME SEGMENT_TYPE
---------- ------------------------------ ------------
544 WRH$_ACTIVE_SESSION_HISTORY TABLE PARTITION
128 I_WRI$_OPTSTAT_H_OBJ#_ICOL#_ST INDEX
88 WRI$_OPTSTAT_HISTGRM_HISTORY TABLE
64 WRH$_SYSMETRIC_HISTORY TABLE --
-- Follow Oracle DOC ID 387914.1 to clean table WRH$_ACTIVE_SESSION_HISTORY
--
SQL> select table_name,partition_name
2 from dba_tab_partitions
3 where table_name = 'WRH$_ACTIVE_SESSION_HISTORY'; TABLE_NAME PARTITION_NAME
------------------------------ ------------------------------
WRH$_ACTIVE_SESSION_HISTORY WRH$_ACTIVE_21536658_7139
WRH$_ACTIVE_SESSION_HISTORY WRH$_ACTIVE_SES_MXDB_MXSN SQL> select count(*) from WRH$_ACTIVE_SESSION_HISTORY; COUNT(*)
----------
1653076 SQL> alter session set "_swrf_test_action" = 72; Session altered. SQL>
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_21536658_7139 Min 7139 21536658
WRH$_ACTIVE_21536658_7139 Max 7881 21536658
--- PL/SQL procedure successfully completed. -- After above PL/SQL block ran, it became three partitions
SQL> select table_name,partition_name
from dba_tab_partitions
where table_name = 'WRH$_ACTIVE_SESSION_HISTORY'; TABLE_NAME PARTITION_NAME
------------------------------ ------------------------------
WRH$_ACTIVE_SESSION_HISTORY WRH$_ACTIVE_21536658_7139
WRH$_ACTIVE_SESSION_HISTORY WRH$_ACTIVE_21536658_7884
WRH$_ACTIVE_SESSION_HISTORY WRH$_ACTIVE_SES_MXDB_MXSN -- Run drop Procedure
SQL> exec DBMS_WORKLOAD_REPOSITORY.DROP_SNAPSHOT_RANGE(low_snap_id =>7139,high_snap_id =>7881); PL/SQL procedure successfully completed. -- Now, WRH$_ACTIVE_SESSION_HISTORY has no rows
SQL> select count(*) from WRH$_ACTIVE_SESSION_HISTORY; COUNT(*)
----------
0 SQL> SELECT *
FROM ( SELECT bytes / 1024 / 1024 dim_Mb, segment_name, segment_type
FROM dba_segments
WHERE tablespace_name = 'SYSAUX'
ORDER BY dim_Mb DESC)
WHERE ROWNUM < 5; DIM_MB SEGMENT_NAME SEGMENT_TYPE
---------- ------------------------------ -----------
128 I_WRI$_OPTSTAT_H_OBJ#_ICOL#_ST INDEX
88 WRI$_OPTSTAT_HISTGRM_HISTORY TABLE
64 WRH$_SYSMETRIC_HISTORY TABLE
55 I_WRI$_OPTSTAT_H_ST INDEX -- But partitions were NOT dropped
SQL> select table_name,partition_name
from dba_tab_partitions
where table_name = 'WRH$_ACTIVE_SESSION_HISTORY'; TABLE_NAME PARTITION_NAME
------------------------------ ------------------------------
WRH$_ACTIVE_SESSION_HISTORY WRH$_ACTIVE_21536658_7139
WRH$_ACTIVE_SESSION_HISTORY WRH$_ACTIVE_21536658_7884
WRH$_ACTIVE_SESSION_HISTORY WRH$_ACTIVE_SES_MXDB_MXSN --
-- Follow DOC ID 287679.1 to shrink the tablespace
--
SQL> SELECT COUNT(1) Orphaned_ASH_Rows
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
); ORPHANED_ASH_ROWS
-----------------
0 -- To reclaim the freed space (since row movement is enabled on WRH$_ACTIVE_SESSION_HISTORY by default)
SQL> alter table WRH$_ACTIVE_SESSION_HISTORY shrink space; Table altered. SQL> column OCCUPANT_NAME format a15
SQL> SELECT occupant_name,
occupant_desc,
space_usage_kbytes
FROM v$sysaux_occupants
WHERE occupant_name LIKE '%AWR%'; OCCUPANT_NAME OCCUPANT_DESC SPACE_USAGE_KBYTES
------------- ------------------------------------------------------ ------------------
SM/AWR Server Manageability - Automatic Workload Repository 300416 --
-- Check again after a few days:
-- It seems the old partition was dropped automatically and a new one was created.
SQL> select table_name,partition_name
from dba_tab_partitions
where table_name = 'WRH$_ACTIVE_SESSION_HISTORY'; TABLE_NAME PARTITION_NAME
------------------------------ ------------------------------
WRH$_ACTIVE_SESSION_HISTORY WRH$_ACTIVE_21536658_7885
WRH$_ACTIVE_SESSION_HISTORY WRH$_ACTIVE_SES_MXDB_MXSN -- And new entries are written into table WRH$_ACTIVE_SESSION_HISTORY
SQL> select count(*) from WRH$_ACTIVE_SESSION_HISTORY; COUNT(*)
----------
31569 -- while the Snapshot retention keeps unchanged.
SQL> SELECT snap_interval, retention, most_recent_purge_time
FROM sys.wrm$_wr_control; SNAP_INTERVAL RETENTION MOST_RECENT_PURGE_TIME
----------------- ----------------- -------------------------
+00000 01:00:00.0 +00007 00:00:00.0 11-DEC-13 12.00.29.165 AM
Clean WRH$_ACTIVE_SESSION_HISTORY in SYSAUX的更多相关文章
- Oralce sysaux WRH$_ACTIVE_SESSION_HISTORY清理
In this Document Symptoms Cause Solution References Symptoms sysaux表空間的WRH$_ACTIVE_SESSION_HISTORY表變 ...
- Oracle 12c SYSAUX表空间不足处理-清理audsys.cli_swp$a9b5f52c$1$1表
今天在检查一台测试环境的表空间时,发现SYSAUX的使用率已经达到99.91% TABLESPACE_NAME FILES Freesize(MB) Usedsize(MB) Filesize(MB) ...
- Excessive AWR Growth From Partitioned Objects Such as SYS.WRH$_EVENT_HISTOGRAM Causing Sysaux to Grow
AWR数据增长较快,导致sysaux表空间使用较高 SQL> select f.tablespace_name, 2 a.total, 3 f.free, 4 round((f.free / a ...
- 手动purge优化器的统计信息与AWR快照,减少对sysaux表空间的占用
1.运行以下脚本,计算当前优化器统计信息和AWR快照表占用sysaux的空间 SQL> conn / as sysdba SQL> @?/rdbms/admin/awrinfo.sql 2 ...
- 案例:AWR手工创建快照失败,SYSAUX表空间剩余不足处理
案例:AWR手工创建快照失败,SYSAUX表空间剩余不足处理 版本:Oracle 11.2.0.4 RAC 问题现象:AWR手工创建快照失败,SYSAUX表空间剩余不足. 1. 查看SYSAUX表空间 ...
- SYSAUX表空间如何清理
############################################################ 操作方案################################### ...
- Oracle 11.2.0.4在线(Online mode)打补丁14084247解决WRH$_ACTIVE_SESSION_HISTORY不会自动切割的问题
安装了Oracle Database Release 11.2.0.4之后,发现WRH$_ACTIVE_SESSION_HISTORY始终不会自动分割删除, 后来才发现需要应用补丁:14084 ...
- Oracle案例08——xx.xx.xx.xx,表空间 SYSAUX 使用率>95%%
本实例主要针对Oracle表空间饱满问题处理方法做个步骤分享. 一.告警信息 收到zabbix告警信息,表空间 SYSAUX 使用率>95%%,系统表空间sysaux使用率超过了95%. 二. ...
- 由Oracle 11g SYSAUX 和 SYSTEM 表空间回收引发的联想
0x00--目的 整理一下以前一个SYSTEM表空间和SYSAUX表空间使用率达到99%上限的处理思路和相关知识点,好记性不如烂笔头 0x01--表空间使用率现状 通过查询可得知目前表空间使用情况如下 ...
随机推荐
- ETL 工具下载全集 包括 Informatica Datastage Cognos( 持续更新)
Datastage 8.0 BT种子下载:http://files.cnblogs.com/taven/Datastage_8.0.rar Informatica PowerCenter 8.6.0 ...
- sencha touch 手势识别左右滑动
sencha touch 中添加手势识别非常简单,就是监听 dom 元素的 move 事件: 1. 为你的 view 注册 swipe 事件 // 为当前 view 注册手势滑动事件 Ext.get( ...
- PHP正则表达式(转载)
这个星期要攻破PHP正则表达式 正则表达式定义 正则表达式(regular expression)描述了一种字符串匹配的模式,可以用来检查一个串是否含有某种子串.将匹配的子串做替换或者从某个串中取 ...
- SpringMVC的参数绑定
一.@RequestMapping注解说明 通过@RequestMapping注解可以定义不同的处理器映射规则. URL路径映射 @RequestMapping(value="/item ...
- Java入门系列-12-成员方法
类的方法 无参方法 语法: public 返回值类型 方法名(参数列表){ //方法的主体 } 敲一敲:无返回值方法 public void sayHi(){ System.out.println(& ...
- python-爬虫之re模块
re模块中常用功能函数 1.compile() 编译正则表达式模式,返回一个对象的模式.(可以把那些常用的正则表达式编译成正则表达式对象,这样可以提高一点效率.) 格式: re.compile(pat ...
- SqlServer function 函数
SqlServer的数据库Tsql还是很强大,以此来纪念下表值函数的语法吧. -- ============================================= -- Author: & ...
- C++(笔)001.
1.编程范式 编程范式是指计算机编程的基本风格,C++可容纳多种程度范式,如面向对象编程.泛型编程及传统的过程式编程. 2.与C相比较 C++在C语言的基础上新加的特性如下: a.类和对象.继承 b. ...
- 静态代码块,构造代码块,main()
静态代码块 随Class 加载而加载,为Class 作初始化: 在main() 之前加载: 只执行一次: 构造代码块 随对象的创建而加载,为对象作初始化 public class day04 { pu ...
- 三、Bean的初始化
一.使用构造器实例化Bean:这是最简单的方式,Spring IOC容器既能使用默认空构造器也能使用有参构造器两种方式创建bean 空构造器 <bean name="bean1&quo ...