Is cloning a PDB from Oracle 12.1 to Oracle 12.2 possible?
A colleague raised this question recently. And a customer did ask me the same question a few days before at a user group conference. There are several ways to move a PDB from Oracle 12.1. to 12.2. But the documentation does not say explicitly if you can do a cloning operation between Oracle 12.1 and 12.2.
Please see also: Upgrade Testing – Online Clone a PDB to Oracle 19c
Cloning a PDB from Oracle 12.1 to Oracle 12.2
You can clone a non-CDB and make it a PDB but you need to run noncdb_to_pdb.sql afterwards. When I wrote this blog post, Oracle 12.2 was not available yet. Now, as it is available, I will clone a PDB between different Oracle versions.
You can redo the same steps by yourself with our Hands-On Lab environment if you have no Multitenant environment to play with.
Requirements and Prerequisites
Please see the description in the documentation:
The important topic to mention is whether the source CDB has local undo on or not. When cloning from an Oracle 126.96.36.199 database there’s no local undo – and therefore the source PDB has to remain in read-only mode during the entire operations.
Step by Step
At first, you must prepare the source PDB for the cloning.
Oracle 188.8.131.52 – CDB1
- Login as SYS as SYSDBA to the CDB$ROOT container
sqlplus / as sysdba
- Create a test PDB first, then open it:
create pluggable database pdb1 admin user adm identified by adm file_name_convert=('/u02/oradata/CDB1/pdbseed', '/u02/oradata/CDB1/pdb1'); alter pluggable database PDB1 open;
- Switch into the new PDB and prepare a cloning user.
Afterwards the PDB has to be set into read-only mode due to the non-existence of local undo in Oracle 184.108.40.206.:
alter session set container=PDB1; create user hugo identified by hugo; grant create session, create pluggable database to hugo; alter pluggable database PDB1 close; alter pluggable database pdb1 open read only;
Oracle 220.127.116.11 – CDB2
- Make sure you’ll have TNS setup correctly so PDB1 is visible and reachable. Then create a database link from the destination CDB into the source PDB1 and initiate the cloning operation.
create database link sourcedblink connect to hugo identified by hugo using 'PDB1'; create pluggable database CDB2_PDB1 from pdb1@sourcedblink file_name_convert=('/u02/oradata/CDB1/pdb1', '/u02/oradata/CDB2/pdb1'); alter pluggable database CDB2_PDB1 open;
- At this point you’ll see that the PDB1 will open but signal the following error:
Warning: PDB altered with errors.
PDB_PLUG_IN_VIOLATIONSto learn more about the error:
column name format a9 column cause format a20 column message format a50 column action format a36 set line 200 set pages 1000 select name, cause, message, action from PDB_PLUG_IN_VIOLATIONS where status<>'RESOLVED' and CON_ID=3 order by time;
This will result in the following output:
NAME CAUSE MESSAGE ACTION ---------- ------------------- -------------------------------------------------- ------------------------------------ CDB2_PDB1 VSN not match PDB's version does not match CDB's version: PDB's Either upgrade the PDB or reload the version 18.104.22.168.0. CDB's version 22.214.171.124.0. components in the PDB.
- You need to upgrade the CDB2_PDB1 now. In case you haven’t run
preupgrade.jarbefore cloning the PDB you should now switch PDB1 in CDB1 into read-write mode again and execute
preupgrade.jarwithin the source environment against it:
java -jar $OH12/rdbms/admin/preupgrade.jar -c "PDB1" TEXT TERMINAL
Fix potential issues and execute the
preupgrade_fixups.sqlin the destination environment.
Afterwards you can initiate the upgrade of the pluggable database.
cd $ORACLE_HOME/rdbms/admin $ORACLE_HOME/perl/bin/perl catctl.pl -c "CDB2_PDB1" -l /home/oracle catupgrd.sql
postupgrade_fixups.sqlonce the upgrade is completed.
For further details on how to upgrade a PDB please see Upgrade PDBs – One at a time.
And finally, I don’t know what the
or reload the components in the PDB” means.
OMF – ORA-1276
In case you try out any of the examples in ASM, please be aware that you can’t use FILE_NAME_CONVERT but instead need to control the destination via the init.ora parameter DB_CREATE_FILE_DEST.
See MOS Note: 1912436.1 – ORA-01276 Errors Reported in PDB for additional advice.
Further Information and Links
- Upgrade Testing – Online Clone a PDB into Oracle 19c
- MOS Note: 1912436.1 – ORA-01276 Errors Reported in PDB
when i try to create a new PDB On Version 12.2 from version 12.1 i get the follwing error:
SQL> create pluggable database PDB2 from pdb1l@pdb121_link;
create pluggable database PDB2 from pdb1l@pdb121_link
ERROR at line 1:
ORA-17628: Oracle error 17630 returned by remote Oracle server
ORA-17630: Mismatch in the remote file protocol version client server
Do you have any idea was getting wrong?
I think the TNS setup is the crucial point. When I tried the test blindly I hit the same error as you do.
Can you please verify that your TNS setup is done correctly and that you could connect from both environments on the command prompt with:
$ sqlplus “hugo/oracle@pdb1”
It’s is also important to follow the “clone user” approach. Not 100% sure anymore but I believe with the out-of-the-box SYSTEM user I saw the error as well. But not 100% anymore …
Bug 18633374 : COPYING ACROSS REMOTE SERVERS: ASMCMD-8016, ORA-17628, ORA-17630, ORA-06512
thanks – but fixed in 126.96.36.199 onwards – and included in 188.8.131.52 DBBP170718 and onwards as well.
Downloaded latest Hands on Lab but I’m running into this error when running the command preupgrade.jar “file name too long”. Deleted virtual box image and started with fresh image but still running into same error.
sorry for that – this is credited to the old VBox image on OTN. Roy will take care and exchange it as soon as possible (but may take a few days).