Cloning an on-premise PDB to the Oracle Cloud is basically done in three steps. 1. Select your PDB – 2. Start Clone Menu – 3. Verify new PDB. In the basic clone menu, Oracle uses some default settings in the background, for example the source datafiles will be packed in a compressed file which is located in /tmp directory of the source server. When your /tmp directory is too small, the clone process fails. Why this directory is used? I don’t know. But it could be a problem when you clone bigger databases. Maybe we can edit the clone procedure, but this is a task for me for a day when it’s raining outside… All cloning steps are well monitored, in case of an error you see a detailed error message so you can go on from the step where the error occurred.
To clone a PDB, there are some prerequisites which has to be fulfilled like same characterset, endianess and options. Don’t worry, if your source database has a wrong characterset, the clone procedure will be stopped.
The source PDB
My source PDB is a small database called CRM02 located in a Trivadis Datacenter – the container database is called TVD12CDB. I want to clone the local PDB to the Cloud database TVDHIPER.
Start the Clone Procedure
In the menu Oracle Database – Cloning select “Clone to Oracle Cloud”.
Source and Destination Information
Enter the source and destination information like credentials, passwords etc. As destination Database Host Credentials select the SSH credential.This credebtial will be used to copy the files to the new server. In the right top corner you have the buttons Advanced and Clone. Clone starts the process with default settings immediately, if you select Advanced you can set destination directory, scheduler the execution etc. I select Clone.
The Process starts immediately
This is the main menu where all the steps are monitored. You see all the details which are executed in the background. It’s an excellent overview.
I one of the firsts steps, Oracle creates the PDB XML manifest and puts all datafiles in a compressed tar.gz file. As I said in one the first lines in this blog post, the directory is /tmp…
oracle@training:/tmp/CRM02_Backup_1440681629182/ [TVD12CDB] lr total 1104050 -rw-r----- 1 oracle dba 6168 Aug 27 15:20 CRM02.xml -rw-r----- 1 oracle dba 283123712 Aug 27 15:20 system01TVD12CDB.dbf -rw-r----- 1 oracle dba 665853952 Aug 27 15:20 sysaux01TVD12CDB.dbf -rw-r----- 1 oracle dba 10493952 Aug 27 15:20 crm02_idx_01TVD12CDB.dbf -rw-r----- 1 oracle dba 10493952 Aug 27 15:20 crm02_data_01TVD12CDB.dbf -rw-r----- 1 oracle dba 156151447 Aug 27 15:22 data-transfer-tmp.tar.gz
The tar.gz file will be transferred to the new target and after the transfer it’s deleted. But you have to clean up the datafiles manually.
What happens on Target Server
The tar.file will be extracted in a new folder and then the database will be plugged in. Here is the tar.gz file on target server. After the successful plug-in, the files will be deleted at this location. Oracle uses OMF – Oracle Managed Files, the extracted files are then located in this directory structure.
oracle@TrivadisHiPerf:/u02/app/oracle/oradata/CRM02_CL/ [TVDHIPER] ll total 25608 drwxr-xr-x 2 oracle oinstall 4096 Aug 27 13:22 . drwxr-x--- 4 oracle oinstall 4096 Aug 27 13:20 .. -rw------- 1 oracle oinstall 26214400 Aug 27 13:23 .data-transfer-tmp.tar.gz.NoyLiJ
If the plug-in action fails, you can see that immediately in EM12c. During my clone process, an error occured when Oracle wants to apply a patch to the new PDB.
In this case, the plugged in PDB has a wrong state. Oracle was not able to apply the datapatch because the pluggable database was not in UPGRADE state.
As workaround I logged in as SYSDBA into the target database in the Oracle cloud and changed the mode manually.
SQL> ALTER SESSION SET CONTAINER=CRM02_CL; Session altered. SQL> SHUTDOWN IMMEDIATE Pluggable Database closed. SQL> STARTUP UPGRADE Pluggable Database opened. SQL>
Then I restarted the procedure from the position where the error occurred.
Welcome to the cloned PDB
After some minutes, all steps are done, no errors. the pluggable database is now cloned and up and running. The task has status succeeded.
EM12c target discovery is not required, the new pluggable database CRM02_CL will be added automatically as new target.
First I wanted to try to clone a PDB from cloud database to cloud database, but this is not implemented at the moment. So I tried out to clone an on-premise database to the cloud. I have tested the basic functionality with a small database and it works fine. There are some issues like why does Oracle write files to /tmp or why has the plugged-in PDB the wrong state to apply the patches. But in general when you fulfill all the prerequisites to clone a PDB like character set etc. as you have to to on conventional way too, it runs. One of my next tests will be how it works when the source PDB version is not 18.104.22.168, when it’s a 22.214.171.124 PDB. But I assume it works as designed, there will be a message in PDB_PLUG_IN_VIOLATIONS view and the I have to solve it manually. Or do you think Oracle will upgrade my PDB automatically? We will see… 🙂