HelloDBA [中文]
Search Internet Search HelloDBA
  Oracle Technology Site. email: fuyuncat@gmail.com  MSN: fuyuncat@hotmail.com Add to circle  acoug  acoug 

HowTo: Trace the statistics data gathtering

[中文]

Author:  fuyuncat

Source:  www.HelloDBA.com

Date:  2009-11-19 05:59:21

Share to  Twitter Facebook GMail Blogger Orkut Google Bookmarks Sina Weibo QQ Renren Tieba Kaixin Douban Taobao

    Sometimes, we want to know which objects failed to be gathered the stats data after the gathering job complete? What's the reason? We may set an undocumented parameter "TRACE" to capture such information.

    There are several levels for this setting, which are bit flags.
 

  •   1 (DSC_DBMS_OUTPUT_TRC); // output the trace log, not into trace file
  •   2 (DSC_SESSION_TRC); // trace in session only, will not modify the value of TRACE parameter
  •   4 (DSC_TAB_TRC);  // trace log when gathering table stats data
  •   8 (DSC_IND_TRC);  // trace log when gathering index stats data
  •   16 (DSC_COL_TRC);  // trace log when gathering column stats data
  •   32 (DSC_AUTOST_TRC); // save session state log into sys.stats_target$_log
  •   64 (DSC_SCALING_TRC); // trace the scaling log
  •   128 (DSC_ERROR_TRC);  // trace the errors/exceptions
  •   256 (DSC_DUBIOUS_TRC);  // trace the dubious stats data
  •   512 (DSC_AUTOJOB_TRC);  // trace the auto gathering job's event & error
  •   1024 (DSC_PX_TRC);  // trace the parallel log
  •   2048 (DSC_Q_TRC);  // dump the queries during gathering stats data
  •   4096 (DSC_CCT_TRC);  // trace the internal process of gathering MV stats data
  •   8192 (DSC_DIFFST_TRC);  // trace the differences of stats data before/after gathering

    You can check the setting by query SYS.OPTSTAT_HIST_CONTROL$.
 

SQL代码
  1. HELLODBA.COM>select spare1, spare2, spare3, spare4, spare5, spare6 from SYS.OPTSTAT_HIST_CONTROL$ wh   
  2. ere sname='TRACE';   
  3.   
  4.     SPARE1     SPARE2     SPARE3    SPARE4     SPARE5     SPARE6   
  5. ---------- ---------- ---------- --------- ---------- ----------   
  6.                                        512   

    For example, set it to be 512, it will trace the events & error of auto gathering job.
 

SQL代码
  1. HELLODBA.COM>exec dbms_stats.set_param('TRACE', 512);   
  2.   
  3. PL/SQL procedure successfully completed.   
  4.   
  5. HELLODBA.COM>alter session set tracefile_identifier=stats_trace;   
  6.   
  7. Session altered.   
  8.   
  9. HELLODBA.COM>exec dbms_stats.GATHER_DATABASE_STATS_JOB_PROC();   
  10.   
  11. PL/SQL procedure successfully completed.   

    And you will find a trace file under UDUMP folder after your job started. It traced the events and errors.
 

SQL代码
  1. *** 2009-11-19 12:01:07.539   
  2. *** SERVICE NAME:(SYS$USERS) 2009-11-19 12:01:07.461   
  3. *** SESSION ID:(310.812) 2009-11-19 12:01:07.461   
  4. *** gather_database_stats_job_proc started: sid,ser#=310,812   
  5. *** 2009-11-19 12:01:28.915   
  6. ORA-03001: unimplemented feature   
  7. *** 2009-11-19 12:01:28.915   
  8. GATHER_STATS_JOB: GATHER_INDEX_STATS('"DEMO"','"NOR_INDEX_DEMO"','""', ...)   
  9. ORA-03001: unimplemented feature   
  10. GATHER_STATS_JOB: Stopped by Scheduler.   
  11. Consider increasing the maintenance window duration if this happens frequently.   
  12. The following objects/segments were not analyzed due to timeout:   
  13.   TABLE"SYS"."WRI$_ALERT_OUTSTANDING".""  
  14.   TABLE"SYS"."WRH$_LATCH_MISSES_SUMMARY"."WRH$_LATCH__1712582900_31484"  
  15. ...   
  16. *** 2009-11-19 12:04:20.982   
  17. *** gather_database_stats_job_proc finished   

    --- Fuyuncat Mark ---

Top

Copyright ©2005, HelloDBA.Com All reseverd.

Declaration
by fuyuncat