기본 콘텐츠로 건너뛰기

통계정보 LOCK


http://m.blog.naver.com/shadouman/80122594664

STATTYPE_LOCKED 컬럼에 ALL 값이 존재하면 통계정보 생성을 하지 못하게 락이 걸려 있는것이며
값이 없다면 통계정보를 생성할 수 있는 것이다.


select OWNER,TABLE_NAME,STATTYPE_LOCKED from dba_tab_statistics
WHERE OWNER = 'SCOTT'
AND TABLE_NAME = 'EMP';

OWNER                          TABLE_NAME                     STATTYPE_LOCKED
------------------------------ ------------------------------ ---------------
SCOTT                           EMP                                                 ALL


OWNER                          TABLE_NAME                     STATTYPE_LOCKED
------------------------------ ------------------------------ ---------------
SCOTT                           EMP     



exec dbms_stats.lock_table_stats('SCOTT','EMP'); 
exec dbms_stats.unlock_table_stats('SCOTT','EMP');

ex) statistics lock 걸려 있을경우 아래와 같은 에러 발생됨.
SQL> exec dbms_stats.gather_table_stats('SCOTT','EMP');
BEGIN dbms_stats.gather_table_stats('SCOTT','EMP'); END;

*
ERROR at line 1:
ORA-20005: object statistics are locked (stattype = ALL)
ORA-06512: at "SYS.DBMS_STATS", line 13437
ORA-06512: at "SYS.DBMS_STATS", line 13457
ORA-06512: at line 1

댓글

이 블로그의 인기 게시물

sql id 별 AWR SQL Stat History 확인

-- AWR SQL Stat History 확인 with w_sqlstat as (     select /*+ inline use_nl(a,b,c) leading(a) index(a (sql_id))*/            a.*,            to_char(b.begin_interval_time,'mm/dd hh24:mi') snap_time     from   dba_hist_sqlstat a          , dba_hist_snapshot b     where  b.dbid             = a.dbid     and    b.instance_number  = a.instance_number     and    b.snap_id          = a.snap_id     and    a.sql_id = '7s4bffkwdq1r4' --    and    a.module like 'BTmapsc090%' --    and    b.instance_number  = 1 --    and    b.dbid = 3107085369 --    and    a.snap_id >= 15817     --and    b.snap_id = 55925     --and   ...