ORA-20000: Unable to set values for index xxx: does not exist or insuf

打印 上一主题 下一主题

主题 882|帖子 882|积分 2646

使用expdp/impdp导出导入数据时,遇到ORA-2000错误,如下所示:
  1. Processing object type SCHEMA_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
  2. Processing object type SCHEMA_EXPORT/TABLE/COMMENT
  3. Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
  4. Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
  5. Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
  6. Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
  7. Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
  8. Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
  9. xxxx.xxxxx : sqlerrm = ORA-20000: Unable to set values for index xxx: does not exist or insufficient privileges
  10. Importing statistics failed for 1 object(s); 
复制代码
导出环境为Oracle 12c,导入的数据库环境为Oracle 19c,具体版本为19.16.0.0.0,查了一下Oracle Support,刚好是遇到了Bug 30978304,关于为什么会出现这个错误,ORA-20000 from Data Pump Import (IMPDP) when PK Constraint does not Create a New Index (Doc ID 2679433.1)[1]中,有详细的案例描述,这里就没有必要自己再构造一个案例来描述出现ORA-20000错误的场景,具体如下所示:
  1. APPLIES TO:
  2. Oracle Database - Enterprise Edition - Version 19.1.0.0.0 and later
  3. Information in this document applies to any platform.
  4. SYMPTOMS
  5. While running Data Pump Import (IMPDP) with STATISTICS, the order of creating indexes and constraints allowed a primary key constraint to reference a user created index rather than creating a new index as it should.
  6.  
  7. A simplified test case:
  8. SQL> drop user INDEXTEST cascade;
  9. SQL> create user INDEXTEST identified by INDEXTEST;
  10. SQL> grant dba to INDEXTEST;
  11. SQL> connect INDEXTEST/INDEXTEST
  12. SQL> create table i_test (id number, t1 varchar2(100), t2 varchar2(100));
  13. SQL> alter table i_test add constraint i_test_pk primary key (id, t1, t2);
  14. SQL> insert into i_test values (1,1,1);
  15. SQL> commit;
  16. SQL> create unique index i_test_idx on i_test(id, t2, t1);
  17. SQL> select index_name from user_indexes;
  18. SQL> select constraint_name from user_constraints;
  19. SQL> EXEC DBMS_STATS.GATHER_SCHEMA_STATS('INDEXTEST');
  20. SQL> !expdp system/<Password> schemas=INDEXTEST dumpfile=INDEXTEST reuse_dumpfiles=y
  21. SQL> connect system/<Password>
  22. SQL> drop user INDEXTEST cascade;
  23. SQL> !impdp system/<Password> schemas=INDEXTEST dumpfile=INDEXTEST

  24. Import: Release 19.0.0.0.0 - Production on Mon Mar 2 19:08:53 2020 Version 19.3.0.0.0

  25. Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

  26. Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
  27. Master table "SYSTEM"."SYS_IMPORT_SCHEMA_01" successfully loaded/unloaded
  28. Starting "SYSTEM"."SYS_IMPORT_SCHEMA_01": system/******** schemas=INDEXTEST
  29. dumpfile=INDEXTEST
  30. Processing object type SCHEMA_EXPORT/USER
  31. Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
  32. Processing object type SCHEMA_EXPORT/ROLE_GRANT
  33. Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
  34. Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
  35. Processing object type SCHEMA_EXPORT/TABLE/TABLE
  36. Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
  37. . . imported "INDEXTEST"."I_TEST" 5.898 KB 1 rows
  38. Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
  39. Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
  40. Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
  41. Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
  42. Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
  43. INDEXTEST.I_TEST_PK : sqlerrm = ORA-20000: Unable to set values for index I_TEST_PK: does not exist or insufficient privileges Importing statistics failed for 1 object(s);
  44. Job "SYSTEM"."SYS_IMPORT_SCHEMA_01" completed with 2 error(s) at Mon Mar 2
  45. 19:09:13 2020 elapsed 0 00:00:19

  46. SQL> connect INDEXTEST/INDEXTEST
  47. SQL> select index_name from user_indexes;
  48. SQL> select constraint_name from user_constraints;
  49. SQL> exit;
  50.  
  51. Note:  It was reported that this issue also exists when the column order is the same, but the user created index has an extra column.
  52.  
  53. CHANGES
  54. The database was upgraded to 19c release or higher.  The issue did not reproduce in 12.2 or 18c environments.
  55.  
  56. CAUSE

  57. This issue is caused by a product defect.
  58. It was investigated in:
  59.      unpublished Bug 30978304 - ORA-20000 DURING IMPDP WITH STATS AND THE UNIQUE INDEX FOR THE PK IS NOT CREATED
  60. Reference:
  61.      Bug 30978304 - ORA-20000 During Data Pump Import While Importing Statistics (Document 30978304.8)
复制代码
Bug 30978304 - ORA-20000 During Data Pump Import While Importing Statistics (Doc ID 30978304.8)[2]影响的版本还蛮多的,如下截图所示
Bug 30978304的详细描述如下所示:
  1. Description
  2. ORA-20000 error was occurring with Data Pump importing statistics, with certain combinations of indexes.
  3. This has now been fixed.
  4.  
  5. What Happens?
  6.  
  7. After importing a transportable tablespace, extents belonging to an index are
  8. incorrectly marked as unallocated in the tablespace bitmaps. This leads to
  9. objd mismatch asserts because such extents could eventually be allocated to
  10. another object.
  11.  
  12. Conditions
  13.  
  14. The export-side must have the following properties:
  15.  
  16. There is a user-created table with a multi-column PK constraint in the table
  17. DDL. This constraint has a system-generated unique index (say ABC).
  18. There is a user-created unique index (say XYZ) on the same columns as the PK,
  19. but the column ordering differs.
  20. Note that if the column ordering matches, XYZ creation would have failed with
  21. ORA-1408 and this bug wont occur.
  22.  
  23. Fix
  24.  
  25. The fix forces the creation of ABC earlier. This resolves the corruption
  26.  
  27. REDISCOVERY INFORMATION:
  28.  
  29. ORA-20000 occurring while impdp is importing statistics, when two or more indexes exist on a table and
  30. one of them is a primary key index.
  31.  
  32. Additional symptoms:
  33.  
  34. TTS import from a 12.1 DB to 19c corrupts the Tablespace bitmaps which can
  35. result in the following errors being raised for operations on segments
  36. belonging to the Tablespace :
  37.  
  38. 1. ORA-8103
  39. 2. ORA-600 [kcl_mismatch_1]
  40. 3. ORA-600 [kdifind:kcbz_objdchk]
  41. 4. ORA-600 [ktrget2:kcbz_objdchk]
  42. 5. ORA-600 [ktspffbmb:objdchk_kcbnew_3]
  43. 6. ORA-600 [ktspgtb2:kcbz_objdchk]
  44.  
  45. Workaround
  46. None.
  47.  
  48. You can likely get this fix in:
  49. Data Pump Recommended Proactive Patches For 19.10 and Above (Doc ID 2819284.1)
复制代码
这里记录一下今天遇到的案例,了解一下问题的来龙去脉。
参考资料

[1]  : https://support.oracle.com/epmos/faces/SearchDocDisplay?_adf.ctrl-state=g9qrlq9os_4&_afrLoop=203438157763988
[2]  : https://support.oracle.com/epmos/faces/SearchDocDisplay?_afrLoop=211126172370682&_afrWindowMode=0&_adf.ctrl-state=iqtartzdc_4
扫描上面二维码关注我如果你真心觉得文章写得不错,而且对你有所帮助,那就不妨帮忙“推荐"一下,您的“推荐”和”打赏“将是我最大的写作动力!本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接.
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

十念

金牌会员
这个人很懒什么都没写!
快速回复 返回顶部 返回列表