错误处理 ORA-20005: object statistics are locked (stattype = ALL)

本地测试环境,遇到错误如下:

 

SQL> exec dbms_stats.gather_table_stats('AA','BB');
 
begin dbms_stats.gather_table_stats('AA','BB'); end;
 
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 2
 
SQL>

 

立马google一下,解锁之后重新执行。

SQL> exec dbms_stats.unlock_table_stats('AA','BB');
 
PL/SQL procedure successfully completed
 
SQL> exec dbms_stats.gather_table_stats('AA','BB');
 
PL/SQL procedure successfully completed
 
SQL> select t.num_rows, t.blocks, t.empty_blocks from user_tables t where t.table_name = 'BB';
 
  NUM_ROWS     BLOCKS EMPTY_BLOCKS
---------- ---------- ------------
     12155        152           15
 
SQL>

 

参考了如下URL:

http://www.banping.com/2010/03/19/statistics_is_zero/

 

 

你可能感兴趣的:(sql,object,Google,测试,table,statistics)