Plug in PDB in .pdb archive in the originating CDB, getting ORA-65018

Oracle Plug in problems with .pdb archive. Gahan saying: I don't get it.

For reasons I had to unplug a PDB from a CDB to make room for some other PDB temporary, and after the other PDB was removed, plug in the original PDB again. Of course I could back up the whole CDB with the including PDB and restore this state later, but I wanted to try this with a .pdb archive, as mentioned in the Oracle documentation.

So I unplugged the PDB like this:

sqlplus / as sysdba
show pdbs
alter pluggable database chappy close immediate;
show pdbs;
alter pluggable database chappy unplug into '/backup/20230331_backup_chappy_from_cdb1/chappy.pdb';
show pdbs;
drop pluggable database chapy including datafiles;
show pdbs;

So this took some time, pretty large PDB, but succeed. After that I did my stuff with some temporary PDB and after unplugging and dropping that one also, I wanted to plug in my chappy.pdb again:

So I copied my chappy.pdb to the original location:

cp -p /backup/20230331_backup_chappy_from_cdb1/chappy.pdb /u01/cdb1/chappy/

And first check if there are no pdb’s left but pdbseed

sqlplus / as sysdba
show pdbs

Only pdbseed present:

show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO

And now to plugin my .pdb archive:

create pluggable database chappy using '/u01/cdb1/chappy/chappy.pdb';

Looks good right? According to Oracle docs:

“Example 9-9 Plugging In an Unplugged PDB Using an Archive File

This example assumes the following factors:

The unplugged PDB is in a .pdb archive file named sales.pdb. The archive file includes the XML metadata file and the PDB’s files (such as the data files and wallet file) in compressed form, and these files are extracted to the current directory of the .pdb archive file when the CREATE PLUGGABLE DATABASE statement is run.”

SQL> create pluggable database chappy using '/u01/cdb1/chappy/chappy.pdb';
create pluggable database chappy using '/u01/cdb1/chappy/chappy.pdb'
ERROR at line 1:
ORA-65018: FILE_NAME_CONVERT or NOCOPY must be specified

When you look in the same Oracle Documentation it says that NOCOPY is for .xml archives and not for .pdb archives. So I added NOCOPY:

SQL> create pluggable database chappy using '/u01/cdb1/chappy/chappy.pdb' nocopy;
create pluggable database chappy using '/u01/cdb1/chappy/chappy.pdb' nocopy
ERROR at line 1:
ORA-65314: cannot use NOCOPY when plugging in a PDB using an archive file

So that is not going to work. I guess documentation is not updated or there’s a bug. So after discussing this in our team, my colleague Jeroen Nijholt mentioned that giving a ‘dummy convert’ might work, we also use this as a workaround for DUPLICATE TARGET DATABASE FOR STANDBY … statements, adding a dummy log_file_name _convert.

SQL> create pluggable database chappy using '/u01/cdb1/chappy/chappy.pdb' FILE_NAME_CONVERT= ('/u01/cdb1/chappy','/u01/cdb1/chappy');

And this works! The plug in is performed without further errors. Happy unplugging and plugging!

Gerelateerd bericht

Geef een reactie