When you plug the same PDB many times you have to specify “AS COPY” in the syntax:
1 |
CREATE PLUGGABLE DATABASE ludo AS CLONE USING '/u01/app/oradata/ludo/ludo.xml'; |
Otherwise, you will get an error similar to:
1 2 |
ERROR at line 1: ORA-65122: Pluggable database GUID conflicts with the GUID of an existing container. |
There are cases, however, where you cannot do it. For example, it the existing PDB should have been the clone, or if you are converting a copy of the same database from Non-CDB to PDB using autoupgrade (with autoupgrade you cannot modify the CREATE PLUGGABLE DATABASE statement).
In this case, the solution might be to change the DBID of the existing PDB, via unplug/plug:
1 2 3 4 5 6 |
ALTER PLUGGABLE DATABASE vico CLOSE; ALTER PLUGGABLE DATABASE vico UNPLUG INTO '/u01/app/oradata/ludo/ludo.xml'; DROP PLUGGABLE DATABASE vico KEEP DATAFILES; CREATE PLUGGABLE DATABASE vico AS CLONE USING '/u01/app/oradata/ludo/ludo.xml' NOCOPY; ALTER PLUGGABLE DATABASE vico OPEN; ALTER PLUGGABLE DATABASE vico SAVE STATE; |
EDIT 2024-01-03: If you use Transparent Data Encryption, you have to export the key before you can unplug the PDB, or you will encounter:
1 |
ORA-46680: master keys of the container database must be exported |
Before closing the PDB, just run:
1 2 3 4 5 6 |
alter session set container=vico; ADMINISTER KEY MANAGEMENT EXPORT ENCRYPTION KEYS WITH SECRET "secret" TO '/secure_path/ludo.p12' FORCE KEYSTORE IDENTIFIED BY "secret" ; alter session set container=cdb$root; |
After opening the PDB, you’ll need to import the key again:
1 2 3 4 5 |
alter session set container=vico; ADMINISTER KEY MANAGEMENT IMPORT ENCRYPTION KEYS WITH SECRET "secret" FROM '/secure_path/ludo.p12' FORCE KEYSTORE IDENTIFIED BY "secret" WITH BACKUP USING 'plug_vico'; |
Don’t forget to keep your master key exports in a secure place.
—
Ludo
Latest posts by Ludovico (see all)
- New views in Oracle Data Guard 23c - January 3, 2024
- New in Data Guard 21c and 23c: Automatic preparation of the primary - December 22, 2023
- Does FLASHBACK QUERY work across incarnations or after a Data Guard failover? - December 13, 2023