Tuesday, March 27, 2012

OWB: ORA-20005: object statistics are locked (stattype = ALL)

After doing a database import (structures and tables) we had a lot of "ORA-20005: object statistics are locked (stattype = ALL)" errors. This was caused because the export was made when the statistics package was still running on the source machine.

I used this query to generate unlock statements:
SELECT distinct 'exec dbms_stats.unlock_table_stats('''||owner||''', '''||table_name||''');'
FROM all_tab_statistics
where stattype_locked = 'ALL'
and OWNER not in ( 'SYS' , 'SYSTEM', 'WMSYS')
You need analyse any table priveleges.

Till Next Time