Sunday, 30 August 2020

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

 ACTIVITY:

Gather statistics on table levels:

SQL> EXEC DBMS_STATS.gather_table_stats('HR', 'CUSTOMER', estimate_percent => 15);

ERROR:

*

ERROR at line 1:

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

ORA-06512: at "SYS.DBMS_STATS", line 23829

ORA-06512: at "SYS.DBMS_STATS", line 23880

ORA-06512: at line 1

SOLUTIONS:

SQL>select owner,table_name,STATTYPE_LOCKED from dba_tab_statistics where table_name='CUSTOMER' and owner='HR';

OWNER        TABLE_NAME                     STATT

------------ ------------------------------ -----

HR     CUSTOMER ALL

Elapsed: 00:00:00.15

+++++++++ To unlock_table_stats  +++++++++++++

SQL>EXEC DBMS_STATS.unlock_table_stats('HR','CUSTOMER');

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.11

SQL>select owner,table_name,STATTYPE_LOCKED from dba_tab_statistics where table_name='CUSTOMER' and owner='HR';

OWNER        TABLE_NAME                     STATT

------------ ------------------------------ -----

HR     CUSTOMER

Elapsed: 00:00:00.01

SQL>EXEC DBMS_STATS.gather_table_stats('HR', 'CUSTOMER', estimate_percent => 15);

PL/SQL procedure successfully completed.

No comments:

Post a Comment

OS Watcher Installation in RAC

 Step:1 Download and untar the oswbb812.tar under the grid user in RAC on the both nodes. Follow the OS Watcher User's Guide (Doc ID 153...