Oracle 11g系统自动收集统计信息的一些知识
SELECT w.window_name, w.repeat_interval, w.duration, w.enabled
FROM dba_autotask_window_clients c, dba_scheduler_windows w
WHERE c.window_name = w.window_name
AND c.optimizer_stats = ‘ENABLED‘;
WINDOW_NAME REPEAT_INTERVAL DURATION
-------------------- ------------------------------------------------------------ ---------------
SUNDAY_WINDOW freq=daily;byday=SUN;byhour=6;byminute=0; bysecond=0 +000 20:00:00
FRIDAY_WINDOW freq=daily;byday=FRI;byhour=22;byminute=0; bysecond=0 +000 04:00:00
WEDNESDAY_WINDOW freq=daily;byday=WED;byhour=22;byminute=0; bysecond=0 +000 04:00:00
SATURDAY_WINDOW freq=daily;byday=SAT;byhour=6;byminute=0; bysecond=0 +000 20:00:00
THURSDAY_WINDOW freq=daily;byday=THU;byhour=22;byminute=0; bysecond=0 +000 04:00:00
TUESDAY_WINDOW freq=daily;byday=TUE;byhour=22;byminute=0; bysecond=0 +000 04:00:00
MONDAY_WINDOW freq=daily;byday=MON;byhour=22;byminute=0; bysecond=0 +000 04:00:00
--禁用自动收集
exec DBMS_AUTO_TASK_ADMIN.DISABLE(client_name => ‘auto optimizer stats collection‘,operation => NULL,window_name => NULL);
--启用自动收集
exec DBMS_AUTO_TASK_ADMIN.ENABLE(client_name => ‘auto optimizer stats collection‘,operation => NULL,window_name => NULL);
--查看job
select client_name,status from dba_autotask_client;
CLIENT_NAME STATUS
---------------------------------------------------------------- --------
auto optimizer stats collection ENABLED
auto space advisor ENABLED
sql tuning advisor ENABLED
exec dbms_stats.gather_database_stats(user);
--收集当前数据库用户下所有对象的统计信息
exec dbms_stats.gather_schema_stats(user);
--收集数据字典的统计信息
exec dbms_stats.gather_dictionary_stats();
--获取global的统计信息收集设置选项
select dbms_stats.get_prefs(‘method_opt‘) from dual;
select dbms_stats.get_prefs(‘concurrent‘) from dual;
select dbms_stats.get_prefs(‘GRANULARITY‘) from dual;
--设置global的统计信息收集选项
EXEC DBMS_STATS.SET_PARAM(‘DEGREE‘,4);
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。