In this Document
| Purpose |
| Questions and Answers |
| What kind of statistics do the Automated tasks collect |
| How do I revert to a previous set of statistics? |
| Does the automatic statistic collection jobs populate CHAIN_CNT? |
| 11g+ Automatic Maintenance Tasks |
| What are the default windows for the automated maintenance task to run? |
| Whats new /changed in 11g with respect to automatic statistics collection? |
| How to enable auto stats collection? |
| How to disable the auto stats collection? |
| How can I check the status of the 'auto optimizer stats collection'? |
| How can I see the history of the automatic stats job for each day? |
| How to manually execute the Optimizer Statistics Auto Task? |
| How do to check values of parameter( estimate percent, type of histograms etc) used by the job? |
| How to set preference for the next maintenance job run to pick? |
| What is the AUTOSTAT_TARGET of SET_GLOBAL_PREFS? |
| 10g Collection: Via GATHER_STATS_JOB |
| What are the default windows for the GATHER_STATS_JOB ? |
| How do you disable the GATHER_STATS_JOB? |
| How do you enablethe GATHER_STATS_JOB? |
| How do you Determine That the GATHER_STATS_JOB Completed |
| How to Change the NEXT_RUN_DATE on the GATHER_STATS_JOB ? |
The statistics jobs automatically gather Missing and Stale statistics for the Cost Based Optimizer (CBO).
From Oracle 10g, Oracle retains collected statistics for 31 days after they are changed.
Refer to:
No. Chain count is not a statistic used as by the Optimizer and as such the job does not populate the chained rows information. Historically the legacy analyze command could be used to capture chain count but this functionality was not included in the DBMS_STATS package and is not collected by the automated jobs.
You can use the Automatic segment advisor for the purpose; it provides Chained row analysis??.
select CLIENT_NAME from DBA_AUTOTASK_CLIENT
CLIENT_NAME
----------------------------------------------------------------
auto optimizer stats collection
auto space advisor
sql tuning advisorexec DBMS_AUTO_TASK_ADMIN.ENABLE(
client_name => 'auto optimizer stats collection',
operation => NULL,
window_name => NULL);exec DBMS_AUTO_TASK_ADMIN.DISABLE(
client_name => 'auto optimizer stats collection',
operation => NULL,
window_name => NULL);select client_name, JOB_SCHEDULER_STATUS
from DBA_AUTOTASK_CLIENT_JOB
where client_name='auto optimizer stats collection';
SELECT client_name, window_name, jobs_created, jobs_started, jobs_completed
FROM dba_autotask_client_history
WHERE client_name like '%stats%';
CLIENT_NAME WINDOW_NAME JOBS JOBS JOBS
CREATED STARTED COMPLETED
------------------------------- ---------------- ------- -------- ----------
auto optimizer stats collection THURSDAY_WINDOW 1 1 1
auto optimizer stats collection SUNDAY_WINDOW 3 3 3
auto optimizer stats collection MONDAY_WINDOW 1 1 1
auto optimizer stats collection SATURDAY_WINDOW 2 2 2SQL> exec DBMS_AUTO_TASK_IMMEDIATE.GATHER_OPTIMIZER_STATS;DBMS_STATS.GET_PARAM (pname IN VARCHAR2) RETURN VARCHAR2;DBMS_STATS.GET_PREFS (pname IN VARCHAR2,ownname IN VARCHAR2 DEFAULT NULL, tabname IN VARCHAR2 DEFAULT NULL)
RETURN VARCHAR2;exec DBMS_STATS.SET_GLOBAL_PREFS('STALE_PERCENT','5');SQL> exec sys.dbms_scheduler.disable ('GATHER_STATS_JOB');SQL> exec sys.dbms_scheduler.enable (?"SYS"."GATHER_STATS_JOB");SELECT job_name, state
FROM dba_scheduler_jobs
WHERE job_name='GATHER_STATS_JOB';begin
dbms_scheduler.disable('gather_stats_job');
dbms_scheduler.set_attribute_null('gather_stats_job','schedule_name');
dbms_scheduler.set_attribute(
'gather_stats_job','repeat_interval','freq=minutelty;byminute=1,11,21,31,41,51;byhour=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,22,23;bysecond=0');
dbms_scheduler.enable('gather_stats_job');
end;SQL> exec sys.dbms_scheduler.disable( '"SYS"."GATHER_STATS_JOB"' );
SQL> exec sys.dbms_scheduler.set_attribute( name => '"SYS"."GATHER_STATS_JOB"', attribute =>'schedule_name', value => 'SYS.WEEKEND_WINDOW');
SQL> exec sys.dbms_scheduler.enable( '"SYS"."GATHER_STATS_JOB"' );| 欢迎光临 重庆思庄Oracle、KingBase、PostgreSQL、Redhat认证学习论坛 (http://bbs.cqsztech.com/) | Powered by Discuz! X3.2 |