Oracle 11.2.0.4 awr过期快照无法自动清理解决

栏目: 数据库 · Oracle · 发布时间: 7年前

内容简介:理论上AWR数据应当根据保留时间,自动清理,但是实际上,经常碰到这样的:col segment_name for a32;set linesize 500;

理论上AWR数据应当根据保留时间,自动清理,但是实际上,经常碰到这样的:

col segment_name for a32;

set linesize 500;

set pagesize 500;

with t1 as (

select round(sum(bytes)/1024/1024) MB,segment_name from dba_segments where owner='SYS'

group by segment_name

order by 1 desc )

select * from t1 where rownum<16;

然后WRH$开头的几个表占十几个G的情况,也就是AWR数据并没有完全被清理掉,检查策略一切正常:

SQL> select INSTANCE_NUMBER, min(SAMPLE_TIME), max(SAMPLE_TIME) from

WRH$_ACTIVE_SESSION_HISTORY group by INSTANCE_NUMBER;  2 

INSTANCE_NUMBER MIN(SAMPLE_TIME)                                                            MAX(SAMPLE_TIME)

---------------  -------------------------            --------------------------------------------------

1 25-MAY-16 08.14.48.613 PM                                                  28-MAR-18 08.56.02.944 AM

SQL>  select snap_interval,retention from dba_hist_wr_control;

SNAP_INTERVAL                                                              RETENTION

------------------------------------ ---------------------------------------------------------------------------

+00000 01:00:00.0                                                          +00008 00:00:00.0

select min(snap_id),max(snap_id) ,dbid from sys.WRH$_EVENT_HISTOGRAM group by dbid;

MOS查一下BUG号14084247,从 11.2.0.3之后几乎都有这个问题,并且打了14084247 之后,貌似也不能解决,MOS又发一篇文章,手动清理,DOCID387914.1,步骤如下:

1检查分区情况

SELECT owner,

segment_name,

partition_name,

segment_type,

bytes/1024/1024/1024 Size_GB

FROM dba_segments

WHERE segment_name='WRH$_ACTIVE_SESSION_HISTORY';

2 修改隐含参数:

alter session set "_swrf_test_action" = 72;

3 再次检查分区情况

4 统计各个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;

/

5 删除不需要的数据

DBMS_WORKLOAD_REPOSITORY.DROP_SNAPSHOT_RANGE(

low_snap_id IN NUMBER,

high_snap_id IN NUMBER

dbid IN NUMBER DEFAULT NULL);

6 运行 @?/rdbms/admin/awrinfo.sql再次检查下

7 最后建议重启一下MMON刷新:

alter system set "_swrf_mmon_flush"=false;

alter system set "_swrf_mmon_flush"=true;

更多Oracle相关信息见 Oracle 专题页面 https://www.linuxidc.com/topicnews.aspx?tid=12

Linux公社的RSS地址https://www.linuxidc.com/rssFeed.aspx

本文永久更新链接地址: https://www.linuxidc.com/Linux/2019-04/158094.htm


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

ACM国际大学生程序设计竞赛题解

ACM国际大学生程序设计竞赛题解

赵端阳//袁鹤 / 电子工业 / 2010-6 / 38.00元

《ACM国际大学生程序设计竞赛题解(1)》可以作为高等院校有关专业的本科和大专学生参加国际大学生程序设计竞赛的辅导教材,或者作为高等院校数据结构、C/C++程序设计或算法设计与分析等相关课程的教学参考书。随着各大专院校参加ACM/ICPC热情的高涨,迫切需要有关介绍ACM国际大学生程序设计竞赛题解的书籍。《ACM国际大学生程序设计竞赛题解(1)》根据浙江大学在线题库的前80题,进行了解答(个别特别......一起来看看 《ACM国际大学生程序设计竞赛题解》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

MD5 加密
MD5 加密

MD5 加密工具