How to Unplug and Plug a PDB in Different Hosts

  • by
The step 1, 2, 3 are same as How to Unplug and Plug a PDB in Same Host, so we skip those steps and directly go to step 4.

4. Zip and compress the entire PDB directory to a zip file.
[oracle@test1 ~]$ cd /u01/app/oracle/oradata/orcl/
[oracle@test1 orcl]$ tar -zcf /tmp/finance_pdb.gz.tar Finance_PDB/
[oracle@test1 orcl]$ ll /tmp
...
-rw-rw-r-- 1 oracle oracle 161246549 Oct 22 23:26 finance_pdb.gz.tar
...

Please note that, the transfer process is handled on OS level, not on DB level.

5. Copy the file from test1 to test2.
[oracle@test1 ~]$ scp /tmp/finance_pdb.gz.tar oracle@test2:/tmp/
oracle@test2's password:
finance_pdb.gz.tar                                100%  154MB  76.9MB/s   00:02

Check the result on the host test2.
[oracle@test2 ~]$ ll /tmp
total 157564
...
-rw-rw-r-- 1 oracle oracle 161246549 Oct 22 23:26 finance_pdb.gz.tar
...

6. Unzip and extract the file to the data location of CDB.
[oracle@test2 ~]$ cd /u01/app/oracle/oradata/orcl/
[oracle@test2 orcl]$ tar -zxf /tmp/finance_pdb.gz.tar
[oracle@test2 orcl]$ ll
...
drwxr-x--- 2 oracle oracle      4096 Oct 22 19:56 Finance_PDB
...

Now, the files are all ready for plugging into the CDB. You have to login the target CDB as sysdba first.

7. Create the PDB.
[oracle@test2 ~]$ sqlplus / as sysdba
...
SQL> create pluggable database finance_pdb using '/u01/app/oracle/oradata/orcl/Finance_PDB/Finance_PDB.xml' nocopy tempfile reuse;

Pluggable database created.

SQL> show pdbs;

    CON_ID CON_NAME   OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
...
 4 FINANCE_PDB   MOUNTED

8. Open the PDB.
SQL> alter pluggable database finance_pdb open;

Pluggable database altered.

SQL> show pdbs;

    CON_ID CON_NAME   OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
...
 4 FINANCE_PDB   READ WRITE NO
SQL>

Now, the PDB is serviceable.

Leave a Reply

Your email address will not be published. Required fields are marked *