connetct to CDB as a common user and verify that pdb_test is closed
SQL> select con_id,dbid,name,open_mode from v$pdbs; CON_ID DBID NAME OPEN_MODE---------- ---------- ------------------------------ ---------- 2 1258043702 PDB$SEED READ ONLY 3 3749525766 PDB1 READ ONLY 4 2192587015 P4 READ ONLY 5 255759235 PDB_TEST READ WRITESQL> alter pluggable database pdb_test close;SQL> alter pluggable database pdb_test unplug into '/tmp/xmlfile1.xml';SQL> select con_id,dbid,name,open_mode from v$pdbs; CON_ID DBID NAME OPEN_MODE---------- ---------- ------------------------------ ---------- 2 1258043702 PDB$SEED READ ONLY 3 3749525766 PDB1 READ ONLY 4 2192587015 P4 READ ONLY 5 255759235 PDB_TEST MOUNTED
A PDB must be dropped from the CDB before it can be plugged back into the same CDB
SQL> create pluggable database pdb_test using '/tmp/xmlfile1.xml' nocopy;create pluggable database pdb_test using '/tmp/xmlfile1.xml' nocopy*ERROR at line 1:ORA-65012: Pluggable database PDB_TEST already exists.SQL> drop pluggable database pdb_test;SQL> create pluggable database pdb_test using '/tmp/xmlfile1.xml' nocopy;SQL> select con_id,dbid,name,open_mode from v$pdbs; CON_ID DBID NAME OPEN_MODE---------- ---------- ------------------------------ ---------- 2 1258043702 PDB$SEED READ ONLY 3 3749525766 PDB1 READ ONLY 4 2192587015 P4 READ ONLY 5 255759235 PDB_TEST MOUNTEDSQL> alter pluggable database pdb_test open;SQL> select con_id,dbid,name,open_mode from v$pdbs; CON_ID DBID NAME OPEN_MODE---------- ---------- ------------------------------ ---------- 2 1258043702 PDB$SEED READ ONLY 3 3749525766 PDB1 READ ONLY 4 2192587015 P4 READ ONLY 5 255759235 PDB_TEST READ WRITESQL>