重庆思庄Oracle、KingBase、PostgreSQL、Redhat认证学习论坛

标题: 数据库升级到12.2, 18c, 19c时失败在SYS.DBMS_STATS上发生 ORA-01422, ORA-06512错误 [打印本页]

作者: 刘泽宇    时间: 7 天前
标题: 数据库升级到12.2, 18c, 19c时失败在SYS.DBMS_STATS上发生 ORA-01422, ORA-06512错误
现象:
当从早期数据库版本升级到12.2.0.1,18c 或 19c 时,报错 ORA-01422

catupgrd0.log


ORA-01422: exact fetch returns more than requested number of rows
ORA-06512: at "SYS.DBMS_STATS", line 36873
ORA-06512: at "SYS.DBMS_STATS", line 36507
ORA-06512: at "SYS.DBMS_STATS", line 35428
ORA-06512: at "SYS.DBMS_STATS", line 34760
ORA-06512: at "SYS.DBMS_STATS_INTERNAL", line 22496
ORA-06512: at "SYS.DBMS_STATS_INTERNAL", line 22483
ORA-06512: at "SYS.DBMS_STATS", line 34416
ORA-06512: at "SYS.DBMS_STATS", line 35168
ORA-06512: at "SYS.DBMS_STATS", line 36230
ORA-06512: at "SYS.DBMS_STATS", line 36716
ORA-06512: at line 1

dbms_stats.gather_table_stats 命令报错

SQL> execute dbms_stats.gather_table_stats('SYS', 'USER$');
BEGIN dbms_stats.gather_table_stats('SYS', 'USER$'); END;

*
ERROR at line 1:
ORA-01422: exact fetch returns more than requested number of rows
ORA-06512: at "SYS.DBMS_STATS", line 39132
ORA-06512: at "SYS.DBMS_STATS", line 38420
ORA-06512: at "SYS.DBMS_STATS", line 37314
ORA-06512: at "SYS.DBMS_STATS", line 36451



原因:
升级数据库到12.2, 18c, 或者19c。

如果有通过 dblink 远程引用到另一个数据库的 user$,本地数据库的obj$中会有多个条目,其中有一个条目的linkname不是空。
由于OBJ$表包含两个关于USER$对象的条目,导致升级遇到ORA-01422错误失败。

此问题已在未公开 bug 中解决
(Unpublished) BUG 29213893 - DBMS_STATS FAILING WITH ERROR ORA-01422 WHEN GATHERING STATS FOR USER$ TABLE


解决方案

1. 从如下链接或者MOS下载补丁29213893
https://updates.oracle.com/download/29213893.html

2. 还原数据库

3. 在开始升级之前 ,在目标Oracle Home安装补丁(参考补丁README中的安装步骤)

4. 重新升级数据库






欢迎光临 重庆思庄Oracle、KingBase、PostgreSQL、Redhat认证学习论坛 (http://bbs.cqsztech.com/) Powered by Discuz! X3.2