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

来源:https://www.cnblogs.com/kerrycode/archive/2023/07/04/17527407.html
-Advertisement-
Play Games

使用expdp/impdp導出導入數據時,遇到ORA-2000錯誤,如下所示: Processing object type SCHEMA_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANTProcessing object type SCHEMA_EXPORT/ ...


使用expdp/impdp導出導入數據時,遇到ORA-2000錯誤,如下所示:

Processing object type SCHEMA_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
xxxx.xxxxx : sqlerrm = ORA-20000: Unable to set values for index xxx: does not exist or insufficient privileges
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錯誤的場景,具體如下所示:

APPLIES TO:
Oracle Database - Enterprise Edition - Version 19.1.0.0.0 and later
Information in this document applies to any platform.
SYMPTOMS
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.
 
A simplified test case:
SQL> drop user INDEXTEST cascade;
SQL> create user INDEXTEST identified by INDEXTEST;
SQL> grant dba to INDEXTEST;
SQL> connect INDEXTEST/INDEXTEST
SQL> create table i_test (id number, t1 varchar2(100), t2 varchar2(100));
SQL> alter table i_test add constraint i_test_pk primary key (id, t1, t2);
SQL> insert into i_test values (1,1,1);
SQL> commit;
SQL> create unique index i_test_idx on i_test(id, t2, t1);
SQL> select index_name from user_indexes;
SQL> select constraint_name from user_constraints;
SQL> EXEC DBMS_STATS.GATHER_SCHEMA_STATS('INDEXTEST');
SQL> !expdp system/<Password> schemas=INDEXTEST dumpfile=INDEXTEST reuse_dumpfiles=y
SQL> connect system/<Password>
SQL> drop user INDEXTEST cascade;
SQL> !impdp system/<Password> schemas=INDEXTEST dumpfile=INDEXTEST

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

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

Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Master table "SYSTEM"."SYS_IMPORT_SCHEMA_01" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_SCHEMA_01": system/******** schemas=INDEXTEST
dumpfile=INDEXTEST
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. . imported "INDEXTEST"."I_TEST" 5.898 KB 1 rows
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
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);
Job "SYSTEM"."SYS_IMPORT_SCHEMA_01" completed with 2 error(s) at Mon Mar 2
19:09:13 2020 elapsed 0 00:00:19

SQL> connect INDEXTEST/INDEXTEST
SQL> select index_name from user_indexes;
SQL> select constraint_name from user_constraints;
SQL> exit;
 
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.
 
CHANGES
The database was upgraded to 19c release or higher.  The issue did not reproduce in 12.2 or 18c environments.
 
CAUSE

This issue is caused by a product defect.
It was investigated in:
     unpublished Bug 30978304 - ORA-20000 DURING IMPDP WITH STATS AND THE UNIQUE INDEX FOR THE PK IS NOT CREATED
Reference:
     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的詳細描述如下所示:

Description
ORA-20000 error was occurring with Data Pump importing statistics, with certain combinations of indexes.
This has now been fixed.
 
What Happens?
 
After importing a transportable tablespace, extents belonging to an index are
incorrectly marked as unallocated in the tablespace bitmaps. This leads to
objd mismatch asserts because such extents could eventually be allocated to
another object.
 
Conditions
 
The export-side must have the following properties:
 
There is a user-created table with a multi-column PK constraint in the table
DDL. This constraint has a system-generated unique index (say ABC).
There is a user-created unique index (say XYZ) on the same columns as the PK,
but the column ordering differs.
Note that if the column ordering matches, XYZ creation would have failed with
ORA-1408 and this bug wont occur.
 
Fix
 
The fix forces the creation of ABC earlier. This resolves the corruption
 
REDISCOVERY INFORMATION:
 
ORA-20000 occurring while impdp is importing statistics, when two or more indexes exist on a table and
one of them is a primary key index.
 
Additional symptoms:
 
TTS import from a 12.1 DB to 19c corrupts the Tablespace bitmaps which can
result in the following errors being raised for operations on segments
belonging to the Tablespace :
 
1. ORA-8103
2. ORA-600 [kcl_mismatch_1]
3. ORA-600 [kdifind:kcbz_objdchk]
4. ORA-600 [ktrget2:kcbz_objdchk]
5. ORA-600 [ktspffbmb:objdchk_kcbnew_3]
6. ORA-600 [ktspgtb2:kcbz_objdchk]
 
Workaround
None.
 
You can likely get this fix in:
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

掃描上面二維碼關註我 如果你真心覺得文章寫得不錯,而且對你有所幫助,那就不妨幫忙“推薦"一下,您的“推薦”和”打賞“將是我最大的寫作動力! 本文版權歸作者所有,歡迎轉載,但未經作者同意必須保留此段聲明,且在文章頁面明顯位置給出原文連接.
您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • `numpy` 數組通常是用於數值計算的多維數組,而排序功能可以快速、準確地對數據進行排序,從而得到更加清晰、易於分析的結果。 在數據分析和處理過程中,常常需要對數據進行排序,以便更好地理解和發現其中的規律和趨勢。 排序會應用在很多場景中,比如: 1. 數據分類:將數據按照一定的特征進行分類,可以通 ...
  • ## 前言 閱讀此篇前,可先閱讀[尾碼數組](https://www.cnblogs.com/pdpdzaa/p/17436993.html) ## LCP ```LCP``` 就是最長公共首碼,在尾碼數組中,$LCP(i,j)$ 就代表從 $sa_i$ 開始的尾碼和從 $sa_j$ 開始的尾碼的最 ...
  • 我在不要更新挑戰中堅持了一年🎉🎉🎉,你也來試試吧(咕咕咕)! 好言歸正傳,本次更新帶來的是經典游戲掃雷,基於JavaFX實現。篇幅有限,文章主要介紹核心操作實現,不會列出所有代碼。需要完整源碼或是想預覽最終效果,可以點擊下方鏈接。後續會逐步更新細節實現方面的內容,將來吧反正(肯定不鴿!) 視頻 ...
  • ## 背景 隨著所在公司的發展,應用服務的規模不斷擴大,原有的垂直應用架構已無法滿足產品的發展,幾十個工程師在一個項目里並行開發不同的功能,開發效率不斷降低。 於是公司開始全面推進服務化進程,把團隊內的大部分工程師主要精力全部都集中到服務化中。服務化可以讓每個工程師僅在自己負責的子項目中進行開發,提 ...
  • 寫java時不管是我們自己new對象還是spring管理bean,儘管我們天天跟對象打交道,那麼對象的結構和記憶體佈局有多少人知道呢,這篇文章可帶你入門,瞭解java對象記憶體佈局。 本文涉及到JVM指針壓縮的知識點,不熟悉的小伙伴可以看前面寫過的一篇關於指針壓縮的文章。 [JVM之指針壓縮](http ...
  • 記憶體“泄露”是開發中常見的問題之一,它會導致應用程式占用越來越多的記憶體資源,最終可能導致系統性能下降甚至崩潰。軟體開發者需要瞭解在程式中出現記憶體泄露的情況,以避免軟體出現該的問題。 **什麼是記憶體“泄露”?** 記憶體泄露是申請了記憶體空間的變數一直在占用,無法釋放。比如申請了一塊記憶體空間,沒有回收一直 ...
  • 一般來說,單片機的時鐘電路是使用外部的無源晶振和負載電容組合實現連接到單片機的Xin和Xout引腳上,無源晶振自身無法振蕩,因此需要匹配外部諧振電路才可以輸出振動信號。 但是在實際電路設計中,也會在晶振兩端並聯一個電阻。這個電阻叫做反饋電阻。​ 那麼並聯的這個反饋電阻有什麼作用呢? 首先來看下時鐘電 ...
  • Linux下PAM認證詳解(以centos7為例) PAM簡介(Pluggable Authentication Modules,可插拔認證模塊) Sun公司於1995年開發的一種與認證相關的通用框架機制:PAM(可插拔認證模塊)是實現認證工作的一個模塊。 因為每個服務都用到不同的認證方式,所以就需 ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...