Friday, 3 July 2015

ORA-38029: object statistics are locked
ORA-06512: at "SYS.DBMS_DDL", line 257
ORA-06512: at "SYS.DBMS_UTILITY", line 458
ORA-06512: at line 1


SQL> EXEC DBMS_UTILITY.analyze_schema('SCHEMA_NAME','ESTIMATE', estimate_rows => 100);
BEGIN DBMS_UTILITY.analyze_schema('SCHEMA_NAME','ESTIMATE', estimate_rows => 100); END;

*
ERROR at line 1:

ORA-38029: object statistics are locked
ORA-06512: at "SYS.DBMS_DDL", line 257
ORA-06512: at "SYS.DBMS_UTILITY", line 458
ORA-06512: at line 1


Solution :

Execute the following :


select 'exec DBMS_STATS.UNLOCK_TABLE_STATS ('''|| owner ||''','''|| table_name ||''');' from dba_tab_statistics where owner = 'SCHEMA_NAME' and stattype_locked is not null;


And then :

exec DBMS_STATS.UNLOCK_TABLE_STATS('SCHEMA_NAME','Object_NAME');


Cheers!







No comments:

Post a Comment