Amazon books

Showing posts with label ORA-38029. Show all posts
Showing posts with label ORA-38029. Show all posts

Monday, May 10, 2010

Generating statistics facing "ORA-38029: object statistics are locked" error

--If you try to analyze an object, or an entirely schema or even all database objects (using dbms_utility for instance) and face this error below:
ORA-38029: object statistics are locked
ORA-06512: at "SYS.DBMS_DDL", line 257
ORA-06512: at "SYS.DBMS_UTILITY", line 488
ORA-06512: at line 2


Fix this problem by following these next steps:

1-Find which schemas have locked tables
select
owner,
table_name,
stattype_locked
from
dba_tab_statistics
where
stattype_locked is not null;

2-Unlock table or all schema statistics using dbms_stats package:

begin
dbms_stats.unlock_schema_stats(ownname => 'SYS');
dbms_stats.unlock_schema_stats(ownname => 'USER1');
dbms_stats.unlock_schema_stats(ownname => 'USER2');
end;
/

3-Execute the analyze_database procedure again (or the procedure that you attempted before). (it must work).


Best Regards,
Paulo Portugal