近期接连遇到AWR 及STATSPACK的snapshot不能自动生成排查。
STATSPACK的snapshot不能自动生成原因是存放快照的基表:ORA-01631: max # extents (505) reached in table PERFSTAT.STATS$FILESTATXS
AWR不能自动生成快照是因为之前系统进程数达到上限,数据库也HANG住;MMON进程异常;通过os层面kill MMON进程后,数据库实例自动又启动MMON,之后恢复正常。
问题与排查如下:
1.STATSPACK的snapshot不能自动生成排查
ALERT日志中信息:
Mon Apr 4 15:01:00 2016 ORA-1631: max # extents 505 reached in table PERFSTAT.STATS$FILESTATXS Mon Apr 4 15:01:00 2016 Errors in file /oracle/8.1.7/admin/prod/bdump/snp0_150774_prod.trc: ORA-12012: error on auto execute of job 403 ORA-01631: max # extents (505) reached in table PERFSTAT.STATS$FILESTATXS ORA-06512: at "PERFSTAT.STATSPACK", line 1167 ORA-06512: at "PERFSTAT.STATSPACK", line 71 ORA-06512: at line 1 Mon Apr 4 17:38:19 2016 查看快照生成情况: 14232 04 Apr 2016 01:00 5 14233 04 Apr 2016 02:00 5 14234 04 Apr 2016 03:00 5 Specify the Begin and End Snapshot Ids ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Enter value for begin_snap: 查看生成快照的JOB的运行情况: SQL> conn perfstat/perfstat Connected. select job,schema_user,to_char(next_date,'yyyy/mm/dd hh24:mi:ss') as next_D,interval,what from user_jobs; SQL> SQL> JOB SCHEMA_USER NEXT_D INTERVAL WHAT ---------- ------------ ------------------ --------------- -------------------- 423 PERFSTAT <span style="color:#FF0000;">4000/01/01 </span>00:00:0 trunc(SYSDATE+1 statspack.snap; 0 /24,'HH') ----可以看到下次执行是2000年以后。。 SQL> exec dbms_job.remove(423); PL/SQL procedure successfully completed. SQL> @?/rdbms/admin/spauto.sql PL/SQL procedure successfully completed. Job number for automated statistics collection for this instance ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Note that this job number is needed when modifying or removing the job: JOBNO ---------- 443 Job queue process ~~~~~~~~~~~~~~~~ Below is the current setting of the job_queue_processes init.ora parameter - the value for this parameter must be greater than 0 to use automatic statistics gathering: NAME TYPE VALUE ------------------------------------ ------- ------------------------------ job_queue_processes integer 1 Next scheduled run ~~~~~~~~~~~~~~~~~~ The next scheduled run for this job is: JOB NEXT_DATE NEXT_SEC ---------- --------- ---------------- 443 29-APR-16 11:00:00 SQL> select job,schema_user,to_char(next_date,'yyyy/mm/dd hh24:mi:ss') as next_D,interval,what from user_jobs; JOB SCHEMA_USER NEXT_D INTERVAL WHAT ---------- ------------ ------------------ --------------- -------------------- 443 PERFSTAT 2016/04/29 11:00:0 trunc(SYSDATE+1 statspack.snap; 0 /24,'HH')
2.到AWR 的snapshot不能自动生成排查
参考文档:Troubleshooting: Missing Automatic Workload Repository (AWR) Snapshots and Other Collection Issues (文档 ID 1301503.1)按顺序进行排查,主要是查看MMON/MMNL进程的TRACE信息,发现其中MMON进程TRACE不存在;手动执行生成快照命令exec dbms_workload_repository.create_snapshot;也无法正常完成,但是未发现相关表是被锁:结合文档 ID 1301503.1中的排查思路进行排查后,惟一存在异常的是MMON进程,然后在OS层面KILL MMON进程,之后实例自动启动MMON,之后可以正常生成快照。