无法获取AWR
造成无法获取AWR的原因,可能是未开启收集有关系。
确定是否开启
查询AWR当前配置信息
col SNAP_INTERVAL for a20
col RETENTION for a20
select * from dba_hist_wr_control;
DBID SNAP_INTERVAL RETENTION TOPNSQL
———- ——————– ——————– ———-
2197530720 +00000 01:00:00.0 +00008 00:00:00.0 DEFAULT
检查是否启动基线
SQL> show parameter statistics_level
如果 STATISTICS_LEVEL=TYPICAL 或 ALL,则默认启用基线。
AWR开头显示:
WARNING: Since the DB Time is less than one second, there was minimal foreground activity in the snapshot period. Some of the percentage values will be invalid.
alter system set control_management_pack_access=”DIAGNOSTIC+TUNING” scope=both;
SQL> show parameter control_management_pack_access
NAME TYPE VALUE
———————————— ———– ——————————
control_management_pack_access string NONE
SQL> alter system set control_management_pack_access=”DIAGNOSTIC+TUNING” scope=both;
System altered.
SQL> show parameter control_management_pack_access
NAME TYPE VALUE
———————————— ———– ——————————
control_management_pack_access string DIAGNOSTIC+TUNING
由于默认是每小时才生产一份AWR数据,所以等待一个小时或更长时间后在看看。
在分析数据库性能的时候,突然发现awr不完整,
重新生成AWR,发现如下错误:
ERROR:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at “SYS.DBMS_WORKLOAD_REPOSITORY”, line 919
ORA-06512: at line 1
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at “SYS.DBMS_WORKLOAD_REPOSITORY”, line 919
ORA-06512: at line 1
–数据库版本
SQL> SELECT * FROM V$VERSION;
BANNER
——————————————————————————
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – 64bit Production
PL/SQL Release 11.2.0.3.0 – Production
CORE 11.2.0.3.0 Production
TNS for IBM/AIX RISC System/6000: Version 11.2.0.3.0 – Production
NLSRTL Version 11.2.0.3.0 – Production
–设置errorstack
alter session set events ‘6502 trace name errorstack level 12’;
—获取trace name
oradebug setmypid
oradebug tracefile_name
分析错误:
—– Error Stack Dump —–
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
—– Current SQL Statement for this session (sql_id=572fbaj0fdw2b) —–
select output from table(dbms_workload_repository.awr_report_html( :dbid,
:inst_num,
:bid, :eid,
:rpt_options ))
—– PL/SQL Stack —–
—– PL/SQL Call Stack —–
object line object
handle number name
7000011f4948398 919 package body SYS.DBMS_WORKLOAD_REPOSITORY
700001222708fd0 1 anonymous block
—– Call Stack Trace —–
calling call entry argument values in hex
location type point (? means dubious value)
——————– ——– ——————– —————————-
skdstdst()+40 bl 107c66680 FFFFFFFFFFF0320 ? 000000001 ?
00000000C ? 000000000 ?
000000000 ? 000000001 ?
00000000C ? 000000000 ?
ksedst1()+112 call skdstdst() FFFFFFFFFFF03F8 ? 000002004 ?
110A5E8C0 ? 10A6D12F4 ?
10A6D0848 ? FFFFFFFFFFF0720 ?
FFFFFFFFFFF0500 ? 110A5E8C0 ?
ksedst()+40 call ksedst1() 10A6D12E8 ? 7000000000282 ?
10A6D12BC ? B000000000000 ?
10A6D0848 ? 000000000 ?
E800000000 ? 1974B073CFBD6 ?
dbkedDefDump()+1516 call ksedst() 000000000 ? 000000000 ?
000000000 ? 000000000 ?
000000003 ? 00000FA50 ?
000000000 ? 000000000 ?
ksedmp()+72 call dbkedDefDump() C06471240 ? 000000000 ?
10ABE01D8 ? 110D5AC08 ?
10ABE01D8 ? 110A5E8C0 ?
……
这是11.2.0.3上的bug,已经在12.1和11.2.0.3.3上修复
Bug 13527323 : AWR REPORT GENERATION COULD FAIL WITH ORA-6502 WITH MULTIBYTE CHARS IN SQL TEXT
Bug 13527323 – ORA-6502 generating HTML AWR report using awrrpt.sql in Multibyte characterset database (文档 ID 13527323.8)
解决方法:
1、(未验证)
update WRH$_SQLTEXT set sql_text = SUBSTR(sql_text, 1, 1000);
commit;
2、(推荐)升级到11.2.0.3.3以上版本