查看某个表的统计信息 SQL> alter session set NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'; Session altered. SQL> select t.TABLE_NAME,t.NUM_ROWS,t.BLOCKS,t.LAST_ANALYZED from user_tables t where table_name in ('T1','T2'); TABLE_NAME NUM_ROWS …
查询统计信息的收集所对应的task,以及当前状态 col CLIENT_NAME for a50col TASK_NAME for a20SELECT client_name, task_name, status FROM dba_autotask_task WHERE client_name = 'auto optimizer stats collection'; auto optimizer stats collection gather_stats_prog ENABLED; CLIENT…
在11g中,默认自动收集统计信息的时间为晚上10点(周一到周五,4个小时),早上6点(周六,周日,20个小时), select a.window_name, a.repeat_interval,a.duration from dba_scheduler_windows a, dba_scheduler_wingroup_members b where a.window_name = b.window_name and b.window_group_name = 'MAINTE…
DECLARE CURSOR STALE_TABLE IS SELECT OWNER, SEGMENT_NAME, CASE WHEN SIZE_GB < 0.5 THEN 30 WHEN SIZE_GB >= 0.5 AND SIZE_GB < 1 THEN 20 WHEN SIZE_GB >= 1 AND SIZE_GB < 5 THEN 10 WHEN SIZE_GB >= 5 AND SIZE_GB < 10 THEN 5 WHEN SIZE_GB >…