ITPub博客

首页 > Linux操作系统 > Linux操作系统 > ORA-20005的解决方法

ORA-20005的解决方法

原创 Linux操作系统 作者:tolywang 时间:2009-11-29 17:26:07 0 删除 编辑

 

Applies to:

Oracle Server - Enterprise Edition - Version: 10.2.0.1 to 10.2.0.3

This problem can occur on any platform.

DataPump Import without data (CONTENT=METADATA_ONLY) locks statistics.

Executing the DBMS_STATS.GATHER_TABLE_STATS to collect the statistics on the table imported, it fails with:

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

This is an expected behavior. in 10.2.0

The statistics are locked during a DataPump Import if export or import were performed with CONTENT = METADATA_ONLY.

This is because automatic statistics gathering is enabled by default in 10g. Therefore, the imported statistics, if not locked, are lost the next time the auto-stats job runs

To avoid the ORA-20005:

- Unlock the table statistics after the import:

   execute DBMS_STATS.UNLOCK_TABLE_STATS('','

');

OR

- Do not import the table statistics (EXCLUDE=TABLE_STATISTICS impdp parameter)

运行下列SQL

SQL> select owner, table_name, stattype_locked from dba_tab_statistics where stattype_locked is not null;

OWNER TABLE_NAME STATT


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


APPLSYS WF_NOTIFICATION_OUT ALL

1 row selected.

SQL> exec dbms_stats.unlock_table_stats('APPLSYS','WF_NOTIFICATION_OUT');

PL/SQL procedure successfully completed.

SQL> select owner, table_name, stattype_locked from dba_tab_statistics where stattype_locked is not null;

no rows selected

问题解决。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/35489/viewspace-620936/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
Oracle , MySQL, SAP IQ, SAP HANA, PostgreSQL, Tableau 技术讨论,希望在这里一起分享知识,讨论技术,畅谈人生 。

注册时间:2007-12-10

  • 博文量
    5595
  • 访问量
    14695370