Unplug and Plug Pluggable Database
We can unplug the pluggable database from existing CDB and Plug it in a different CDB or in the same CDB, depending upon the required. While plugging you can
oracle configurationintermediate
by OracleDba
14 views
We can unplug the pluggable database from existing CDB and Plug it in a different CDB or in the same CDB, depending upon the required. While plugging you can
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDBCDB READ WRITE NO
4 PDBCDB2 READ WRITE NO
SQL>
SQL> alter session set container=PDBCDB2;
Session altered.
SQL> select file_name from dba_data_files;
FILE_NAME
--------------------------------------------------------------------------------
/data/app/oracle/oradata/CDB/pdbcdb2/system01.dbf
/data/app/oracle/oradata/CDB/pdbcdb2/sysaux01.dbf
/data/app/oracle/oradata/CDB/pdbcdb2/undotbs01.dbf
/data/app/oracle/oradata/CDB/pdbcdb2/users01.dbf
/data/app/oracle/oradata/CDB/pdbcdb2/users02.dbf
/data/app/oracle/oradata/CDB/pdbcdb2/tbs_perm_pdb.dat
/data/app/oracle/oradata/CDB/pdbcdb2/bigtbs01.dbf
SQL> shutdown immediate;
Pluggable Database closed.
[oracle@localhost orcl_plug]$ sqlplus sys/oracle@prim as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Sun Jun 20 19:44:31 2021
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> alter pluggable database PDBCD2 unplug into '/data/orcl_plug.xml';
Pluggable database altered.
SQL> select pdb_name, status from dba_pdbs;
PDB_NAME STATUS
------------------------------ ----------
PDBCDB NORMAL
PDB$SEED NORMAL
PDBCDB2 UNPLUGGED123456789101112131415161718
SQL> drop pluggable database PDBCDB2;
Pluggable database dropped.
[oracle@localhost orcl_plug]$ sqlplus sys/oracle@prim as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Sun Jun 20 19:44:31 2021
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> create pluggable database PDBCDB3 using '/data/orcl_plug.xml' FILE_NAME_CONVERT=('/data/app/oracle/oradata/CDB/PDBCDB2','/data/app/oracle/oradata/CDB/pdbcdb3');
Pluggable database created.12345678910111213141516171819202122232425
SQL> alter pluggable database PDBCDB3 open;
Pluggable database altered.
SQL> select name, open_mode, total_size from v$pdbs;
NAME OPEN_MODE TOTAL_SIZE
------------------------------ ---------- ----------
PDB$SEED READ ONLY 771751936
PDBCDB READ WRITE 978321408
PDBCDB3 READ WRITE 978321408
SQL> drop pluggable database pdb_db2 keep datafiles;
Pluggable database dropped.
SQL> select name, open_mode from v$pdbs;
NAME OPEN_MODE
--------------- ----------
PDB$SEED READ ONLY
PDB1 READ WRITE
PDB2 READ WRITE
PDB3 READ WRITE
PDB_DB2_NEW READ WRITE123456789101112131415161718192021
SET SERVEROUTPUT ON
DECLARE
compatible CONSTANT VARCHAR2(3) :=
CASE DBMS_PDB.CHECK_PLUG_COMPATIBILITY(
pdb_descr_file => '/u01/pdb_clone/pdb_db2.xml',
pdb_name => 'pdb_db2')
WHEN TRUE THEN 'YES'
ELSE 'NO'
END;
BEGIN
DBMS_OUTPUT.PUT_LINE(compatible);
END;
/
PL/SQL procedure successfully completed.
YES
SQL> create pluggable database pdb_db2 using '/u01/pdb_clone/pdb_db2.xml' NOCOPY TEMPFILE REUSE;
Pluggable database created.Please to add comments
No comments yet. Be the first to comment!