Monday, September 24, 2012

ERROR: While GATHER_TABLE_STATS: ***ORA-20005: object statistics are locked (stattype = ALL)***

ERROR: While GATHER_TABLE_STATS: ***ORA-20005: object statistics are locked (stattype = ALL)***

Connect as a dba user and use the following statement to unlock the statistics:

sqlplus / as sysdba or sqlplus system/****

SQL>EXEC DBMS_STATS.UNLOCK_SCHEMA_STATS('SCOTT');

SQL>exec dbms_stats.gather_schema_stats('SCOTT',options=>'GATHER', estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE);



No comments: