ITPub博客

首页 > 数据库 > Oracle > 执行DBMS_SQLTUNE优化sql或dbms_stats收集统计信息报错:ORA-20003

执行DBMS_SQLTUNE优化sql或dbms_stats收集统计信息报错:ORA-20003

原创 Oracle 作者:running_life 时间:2017-05-26 15:12:11 0 删除 编辑
os:rhel6.8 64 2.6.32
db:oracle 11.2.0.3.11 rac

执行DBMS_SQLTUNE优化sql或dbms_stats收集统计信息报错:ORA-20003: Specified bug number (16470836) does not exist
这个错误很早之前就遇到了,当时查了mos,已经大概找到原因。但是一直没有停机窗口来维护。这次在执行DBMS_SQLTUNE优化sql时又遇上了,这里做一个简单的记录。

这套系统是从windows平台rac迁移到linux平台rac的,由于两个平台没有互相匹配的补丁号,当时在安装linux的rac时,找了一个与windows上版本(patch bundle 31)相近的11.2.0.3.11来打补丁,使用物理dg做迁移,在迁移完成后没有执行upgrade的sql。

mos上说的原因:This issue is caused by a mismatch between the DBMS_STATS package and the binary executable.包与实际的二进制可执行文件不匹配,联想到当时迁移后没有执行upgrade,基本确认就是这个问题。
解决方法是重建dbms_stats包。
mos原文如下:
Gathering Statistics with DBMS_STATS Fails Raising 'ORA-20003: Specified Bug Number (%s) Does Not Exist' Where the Bug number Reported is 5099019 or 16470836 (Doc ID 1180514.1)

To BottomTo Bottom

In this Document


Symptoms

Changes

Cause

Solution

References


Applies to:

Oracle Database - Enterprise Edition - Version 10.2.0.1 and later
Information in this document applies to any platform.

Symptoms

Executing DBMS_STATS fails with either of the following error messages:

SQL> set serveroutput on
SQL> exec dbms_stats.gather_table_stats(ownname=> 'SCHEMA',tabname=>
'TABLE_NAME', degree=>4 , cascade=>TRUE, estimate_percent=>25);

BEGIN dbms_stats.gather_table_stats(ownname=> 'SCHEMA',tabname=> 'TABLE_NAME', degree=>4 , cascade=>TRUE, estimate_percent=>25); END;
*
ERROR at line 1:
ORA-20003: Specified bug number (5099019) does not exist
ORA-06512: at "SYS.DBMS_STATS", line 13474
ORA-06512: at "SYS.DBMS_STATS", line 13494
ORA-06512: at line 1

or

SQL error -20003 at location stats_tab_collect-21, SQL statement:
'BEGIN DBMS_STATS.GATHER_TABLE_STATS (OWNNAME => '"SCHEM"', TABNAME => '"TABLE_NAME"', ESTIMATE_PERCENT => NULL, METHOD_OPT => 'FOR ALL COLUMNS SIZE 1', DEGREE => NULL, CASCADE => TRUE, NO_INVALIDATE => FALSE); END;'
ORA-20003: Specified bug number (16470836) does not exist
ORA-06512: at "SYS.DBMS_STATS", line 24301
ORA-06512: at "SYS.DBMS_STATS", line 24352
ORA-06512: at line 1

Changes

An upgrade may have occurred, but this is not necessary to trigger this issue.

Cause

This issue is caused by a mismatch between the DBMS_STATS package and the binary executable. If one has been updated and the other has not then errors will occur. The cause of the issue is one of:

1) Problems with validity of the dictionary objects upon which DBMS_STATS package depends.  This is documented in the following bug:

Bug 8643809 ORA-20003: SPECIFIED BUG NUMBER (5099019) DOES NOT EXIST

Post installation steps should install / validate these packages. If this was not done then this can cause the issue.

2) Relinking of the binary executable files has not occurred following a patch application. This can occur when multiple patches are applies and the -no_relink flag has been used on the opatch command to avoid linking every time. If this option is used on all the applications then necessary relinking will not occur. See opatch help:

opatch apply -help

-no_relink
             The nolink option does not perform any make operations.
             This option can be used during multiple patch
             applications and perform the linking step only once.
             OPatch does not keep track of the make operations it
             did not perform. It is the job of the OPatch users to
             make sure the execute OPatch without this option at
             the end, so that compilation happens once


Solution

The following have resolved the issue:

1) Recreate DBMS_STATS package by running the following scripts:

  @?/rdbms/admin/dbmsstat.sql
  @?/rdbms/admin/prvtstas.plb
  @?/rdbms/admin/prvtstat.plb

We recommend running these scripts during maintenance window while database in restricted mode to avoid problems that can be caused when other sessions access the same objects.

2) If a patch or an upgrade has been performed, relink the binaries after applying the patch. See the following for details:

Document 1467060.1 Relinking Oracle Home FAQ ( Frequently Asked Questions)


References


NOTE:868717.1 - EMCA Fails with: ORA-20003: Specified Bug Number (5099019) Does Not Exist
NOTE:1467060.1 - Relinking Oracle Home FAQ ( Frequently Asked Questions)
NOTE:16470836.8 - Bug 16470836 - High DML rate against MON_MODS$ related to DBMS_STATS

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

请登录后发表评论 登录
全部评论

注册时间:2014-08-24

  • 博文量
    23
  • 访问量
    31251