Der Autor ist zurzeit bei einem Kunden damit beschäftigt, eine größere Anzahl von Datenbanken von Solaris x86 nach Solaris SPRAC zu migrieren. Aufgrund des unterschiedlichen Endian-Formats wurde entschieden, die Migration via Export/Import (expdp/impdp) durchzuführen.
Das Vorgehen ist dann ja eigentlich recht einfach:
- Neue Datenbank erstellen
- Full Export der "alten" Datenbank
- Dumpfile(s) auf neuen Server
- Import in neue Datenbank
Und dann kam die Überraschung, als folgende Fehlermeldungen im Logfile zu sehen waren:
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/STATISTICS/TABLE_STATISTICS Processing object type DATABASE_EXPORT/STATISTICS/MARKER <INDEX_NAME>: sqlerrm = ORA-20000: Unable to set values for index <INDEX_NAME>: does not exist or insufficient privileges <INDEX_NAME>: sqlerrm = ORA-20000: Unable to set values for index <INDEX_NAME>: does not exist or insufficient privileges <INDEX_NAME>: sqlerrm = ORA-20000: Unable to set values for index <INDEX_NAME>: does not exist or insufficient privileges <INDEX_NAME>: sqlerrm = ORA-20000: Unable to set values for index <INDEX_NAME>: does not exist or insufficient privileges <INDEX_NAME>: sqlerrm = ORA-20000: Unable to set values for index <INDEX_NAME>: does not exist or insufficient privileges <INDEX_NAME>: sqlerrm = ORA-20000: Unable to set values for index <INDEX_NAME>: does not exist or insufficient privileges
Wie kann das sein? Sowohl Export als auch Import wurden mit "SYS" gemacht, das sollte doch wohl ausreichend sein.
Dann stellt sich die Frage, ob die Indizes vorhanden sind. Ein kurzer Check zeigt: Die Indizes sind auf der Source-Datenbank vorhanden, aber nicht auf der Destination-Datenbank.
Das ließ den Autor dann doch etwas ratlos zurück. Beim Export gab es keine Fehlermeldungen, dass irgendetwas nicht exportiert wurde. Bei der Erstelllung der Indizes während des Imports gab es ebenfalls keine Hinweise, dass Indizes nicht erstellt wurden.
Wo sind die Indizes geblieben? Hat sich mal wieder irgendwas bei Oracle geändert? Is this a bug or a feature? Hilfe bietet in so einem Fall dann nur noch MOS (My Oracle Support) und nach einer kurzen Recherche waren dann auch alle Irritationen beigelegt, denn das gesehene Verhalten ist in Note (Doc ID 951994.1) «Primary Key Indexes Not Created During Import» beschrieben:
1.1 SYMPTOMS
After performing an import operation you may notice that indexes that exist on the source database to support primary key constraints do not exist on the target database.
This happens with both Datapump and conventional export/import tools.1.2. CAUSE
Import will create the objects in the following order:
- creates the tables
- creates the index
- creates the primary key constraint with the USING INDEX clause. As there is an index existing at constraint creation time it will use the above created index (as per documentation)
This is slightly different from how the table was initially created: when the table was created the index did not exist and was created by the constraint.
So the import does not need to create an index explicitly for the primary key constraint. The order in which the import creates the objects allows the primary key constraint to use the existing index because it includes the primary key column(s).
1.3. SOLUTION
This is the intended behavior of import. All the primary key constraints will be built on existing indexes.
Also schnell ein Blick auf die Original-Tabelle und richtig: Dort wurden Constraints mit separaten Indizes erstellt, das Problem war gelöst und der Autor konnte wieder beruhigt schlafen, alles war in Ordnung.
Wie man der Note entnehmen kann, ist dieses Verhalten beim Import bereits seit Oracle 8 implementiert, aber selbst in Version 19c kann das einen langgedienten DBA irritieren, wenn man nicht regelmäßg über dieses Phänomen "stolpert".
Ich wünsche Ihnen alles Gute und bleiben Sie weiterhin gesund!
Jürgen Vitek
Stellv. Themenverantwortung Hochverfügbarkeit,
Stellv. Themenverantwortung Open-Source


