Unplug the PDBs from On-Premises and Plug Them into a Database in the Cloud

Close and unplug the pluggable databases (PDBs) that are on-premises, connect to the cloud, use SSH to copy the PDB manifest files to your database in the cloud, plug the PDBs into the DB node, then open read/write permissions.

Connect to the On-Premises Database

Connect to the on-premises database and change the pluggable databases (PDBs) to read/write mode.

  1. Select the PDBs using SQL*Plus.
    SQL> select name, open_mode, from v$pdbs;
  2. Close the PDBs.
    SQL> alter pluggable database pdb_db_name close immediate;

Unplug the PDB From the Source Database

Unplug the pluggable database (PDB) and save the generated PDB manifest file. The file contains information about the names and the full paths of the tablespaces and data files of the unplugged PDB.

The unplugging operation makes changes in the PDB data files to record that the PDB was properly and successfully unplugged. You must preserve the data files for the subsequent plugging operation.

  • Unplug the PDB and save the file by specifying the path and name of the data files.
    ALTER PLUGGABLE DATABASE pdb_db_name UNPLUG INTO '/opt/oracle/oradata/$ORACLE_SID/pdb_db_name.pdb';

Copy the PDB File to the DB Node on VM Through Tunneling

Create a tunnel to the VM DB system through the bastion host and copy the pluggable database (PDB) data manifest file to the DB system in the cloud.

  • Tunnel through the VM DB System and copy the PDB file.
    Include the path of your public key and the local path of the PDB file that you saved earlier.
    scp -i path of the public key -0 "ProxyCommand=ssh -i path of the public key -W %h:%p opc@BastionHostIP"/opt/oracle/oradata/$ORACLE_SID/pdb_db_name.pdb opc@IPaddressofdbNode:~/tmp

Plug the PDB into the CDB in the Cloud

Connect to the DB node and check if your database is in read/write mode, then attach the PDB from your instance.

  1. Connect to the DB node and verify that your database is in read/write mode.
    ssh -i path of the public key opc@db_node_IP_address
    $ sqlplus / as sysdba
    SQL > select log_mode,open_mode , database_role from v$database;
  2. Copy the PDB file from the /tmp directory to the respective ORA-Data folder (/u01/app/oracle/oradata/Oracle-SID).
    ssh -i path of the public key opc@db_node_IP_address
    $ sqlplus / as sysdba
    SQL > select log_mode,open_mode , database_role from v$database;
  3. Copy the PDB file from the /tmp directory to the respective ORA-Data folder (/u01/app/oracle/oradata/SID).
    cp /tmp/pdb_db_name.pdb /u01/app/oracle/oradata/SID/pdb_db_name.pdb
  4. Attach the PDB from your PDB manifest file using your file path.
    SQL > create pluggable database pdb_db_name using '/u01/app/oracle/oradata/SID/pdb_db_name.pdb'
  5. Verify that all of the PDBs are plugged in.
    SQL > select name, open_mode from v$pdbs;
  6. Change all of the PDBs to read/write mode.
    SQL> Alter pluggable datase all open;

Validate the Migration

Perform a final check to verify that all of the PDBs migrated into the VM DB System.

  • Verify that the PDBs are visible and that they have read/write permissions.
    SQL> select name, open_mode from v$pdbs;