1) Merge all PDBs of cdb1 into cdb2
2) Drop cdb1
[oracle@myorasrv ~]$ . oraenv
ORACLE_SID = [cbd1] ? cdb1
[oracle@myorasrv ~]$ sqlplus / as sysdba
SQL> select name,open_mode from v$pdbs;
NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
PDB1_1 READ WRITE
SQL> alter pluggable database pdb1_1 close immediate;
Pluggable database altered.
SQL> alter pluggable database pdb1_1 unplug into 'xmlPDB1_1.xml';
Pluggable database altered.
SQL> col PDB_NAME for a20
SQL> select pdb_name,status from cdb_PDBS
2 where pdb_name='PDB1_1';
PDB_NAME STATUS
-------------------- ---------
PDB1_1 UNPLUGGED
SQL> drop pluggable database pdb1_1 keep datafiles;
Pluggable database dropped.
SQL> exit
[oracle@myorasrv CDB]$ . oraenv
ORACLE_SID = [cdb1] ? cdb2
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1 is /u01/app/oracle
[oracle@myorasrv CDB]$ sqlplus / as sysdba
SQL> !cat compat.sql
set serveroutput on
DECLARE
compat BOOLEAN := FALSE;
BEGIN
compat := DBMS_PDB.CHECK_PLUG_COMPATIBILITY(
pdb_descr_file => '/u01/app/oracle/product/12.1.0/dbhome_1/dbs/xmlPDB1_1.xml', pdb_name => 'pdb1_1');
if compat then
DBMS_OUTPUT.PUT_LINE('Is pluggable compatible? YES');
else DBMS_OUTPUT.PUT_LINE('Is pluggable compatible? NO');
end if;
end;
/
SQL> @compat.sql
Is pluggable compatible? YES
PL/SQL procedure successfully completed.
SQL> create pluggable database pdb1_1 using 'xmlPDB1_1.xml' nocopy;
Pluggable database created.
SQL> alter pluggable database pdb1_1 open;
Pluggable database altered.
SQL> select name,open_mode from v$pdbs;
NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
PDB2_1 READ ONLY
PDB2_2 READ WRITE
PDB_ORCL2 READ WRITE
PDB1_1 READ WRITE
SQL> exit
[oracle@myorasrv CDB]$ . oraenv
ORACLE_SID = [cdb2] ? cdb1
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1 is /u01/app/oracle
[oracle@myorasrv CDB]$ sqlplus / as sysdba
SQL> shutdown immediate
SQL> startup mount restrict;
SQL> drop database;
Database dropped.
2) Drop cdb1
[oracle@myorasrv ~]$ . oraenv
ORACLE_SID = [cbd1] ? cdb1
[oracle@myorasrv ~]$ sqlplus / as sysdba
SQL> select name,open_mode from v$pdbs;
NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
PDB1_1 READ WRITE
SQL> alter pluggable database pdb1_1 close immediate;
Pluggable database altered.
SQL> alter pluggable database pdb1_1 unplug into 'xmlPDB1_1.xml';
Pluggable database altered.
SQL> col PDB_NAME for a20
SQL> select pdb_name,status from cdb_PDBS
2 where pdb_name='PDB1_1';
PDB_NAME STATUS
-------------------- ---------
PDB1_1 UNPLUGGED
SQL> drop pluggable database pdb1_1 keep datafiles;
Pluggable database dropped.
SQL> exit
[oracle@myorasrv CDB]$ . oraenv
ORACLE_SID = [cdb1] ? cdb2
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1 is /u01/app/oracle
[oracle@myorasrv CDB]$ sqlplus / as sysdba
SQL> !cat compat.sql
set serveroutput on
DECLARE
compat BOOLEAN := FALSE;
BEGIN
compat := DBMS_PDB.CHECK_PLUG_COMPATIBILITY(
pdb_descr_file => '/u01/app/oracle/product/12.1.0/dbhome_1/dbs/xmlPDB1_1.xml', pdb_name => 'pdb1_1');
if compat then
DBMS_OUTPUT.PUT_LINE('Is pluggable compatible? YES');
else DBMS_OUTPUT.PUT_LINE('Is pluggable compatible? NO');
end if;
end;
/
SQL> @compat.sql
Is pluggable compatible? YES
PL/SQL procedure successfully completed.
SQL> create pluggable database pdb1_1 using 'xmlPDB1_1.xml' nocopy;
Pluggable database created.
SQL> alter pluggable database pdb1_1 open;
Pluggable database altered.
SQL> select name,open_mode from v$pdbs;
NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
PDB2_1 READ ONLY
PDB2_2 READ WRITE
PDB_ORCL2 READ WRITE
PDB1_1 READ WRITE
SQL> exit
[oracle@myorasrv CDB]$ . oraenv
ORACLE_SID = [cdb2] ? cdb1
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1 is /u01/app/oracle
[oracle@myorasrv CDB]$ sqlplus / as sysdba
SQL> shutdown immediate
SQL> startup mount restrict;
SQL> drop database;
Database dropped.
No comments:
Post a Comment