The following steps should be performed when we are ready to do the switch.
Startup the Source database in read-only mode.
[oracle@sn1-r720-e03-17 dbs]$ srvctl start database -db dbtest39 -startoption "read only"
Execute the following script on the Source to capture the Source metadata in an XML file.
[oracle@sn1-r720-e03-17 dbs]$ sqlplus / as sysdba
SQL> BEGIN
2 DBMS_PDB.DESCRIBE(pdb_descr_file => '/home/oracle/dbtest39_18.xml');
3 END;
4 /
PL/SQL procedure successfully completed.
At this point, we will take a snapshot of the protection group covering the Source volumes using the following CLI command.
$ SUFFIX=after-read-only
$ ssh -l ${FA_USER} ${FA_IP} purepgroup snap --suffix $SUFFIX oracle-dbtest39-pg
Copy the snapshot to new volumes
$ ssh -l ${FA_USER} ${FA_IP} purevol copy oracle-dbtest39-pg.after-reado-nly.oracle-rt-dbtest39-data oracle-rt-dbtest39-plug-data
$ ssh -l ${FA_USER} ${FA_IP} purevol copy oracle-dbtest39-pg.after-reado-nly.oracle-rt-dbtest39-fra oracle-rt-dbtest39-plug-fra
Attach these volumes to Target host.
$ ssh -l ${FA_USER} ${FA_IP} purevol connect --host sn1-r720-e03-15 oracle-rt-dbtest39-plug-data
$ ssh -l ${FA_USER} ${FA_IP} purevol connect --host sn1-r720-e03-15 oracle-rt-dbtest39-plug-fra
Rescan scsi bus on the Target host
[root@sn1-r720-e03-15 ~]# rescan-scsi-bus.sh -a
Update /etc/multipath.conf with multipath aliases for the new volumes
multipath {
wwid 3624a93703401ece8c2054b8200013174
alias oracle-rt-dbtest38-plug-39-data
}
multipath {
wwid 3624a93703401ece8c2054b8200013175
alias oracle-rt-dbtest38-plug-39-fra
}
Restart multipath service
[root@sn1-r720-e03-15 ~]# service multipathd restart
Rescan ASMLib. The new volumes should get discovered and new disks should appear under /dev/oracleasm/disks/.
[root@sn1-r720-e03-15 ~]# oracleasm scandisks
[root@sn1-r720-e03-15 ~]# oracleasm listdisks
DATA01
DATA_39
FRA01
FRA_39
Log in to ASMCMD on the Target host. Mount the new disk groups that we migrated from Source.
ASMCMD> mount DATA_39
ASMCMD> mount FRA_39
ASMCMD> lsdg
State Type Rebal Sector L. Sector Block AU Total_MB Free_MB Req_mir_fr_MB Usable_file_MB OffL_disks Vtg_files Name
MOUNTED EXTERN N 512 512 4096 1048576 2097152 2097053 0 2097053 0 N DATA/
MOUNTED EXTERN N 512 512 4096 1048576 2097152 2093942 0 2093942 0 N DATA_39/
MOUNTED EXTERN N 512 512 4096 1048576 2097152 2092112 0 2092112 0 N FRA/
MOUNTED EXTERN N 512 512 4096 1048576 2097152 2096433 0 2096433 0 N FRA_39/
Transfer the XML file dbtest39_18.xml to the Target host and execute the following procedure on the Target. It should output YES as shown below.
[oracle@sn1-r720-e03-15 dbs]$ sqlplus / as sysdba
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
2 compatible CONSTANT VARCHAR2(3) := CASE DBMS_PDB.CHECK_PLUG_COMPATIBILITY( pdb_descr_file => '/home/oracle/dbtest39_18.xml',
pdb_name => 'dbtest39')
3 WHEN TRUE THEN 'YES'
4 ELSE 'NO'
5 END;
6 BEGIN
7 DBMS_OUTPUT.PUT_LINE(compatible);
8 END;
9 /
YES
PL/SQL procedure successfully completed.
If the previous command outputs YES, that means the Source is compatible with the Target. We can then go ahead with the next step to create the Pluggable database from the Source metadata spec. Notice that we are using the NOCOPY keyword as the new disk groups have already been mounted on the Target ASM and no files need to be copied.
SQL> CREATE PLUGGABLE DATABASE dbtest39 USING '/home/oracle/dbtest39_18.xml' NOCOPY;
Pluggable database created.
We can run show pdbs command to see the pluggable database in this container. A new PDB - DBTEST39 that we just migrated appears in the list in MOUNTED state.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
4 DBTST39B READ WRITE NO
5 DBTST39C READ WRITE NO
6 DBTEST39 MOUNTED
Next, we need to convert the dictionary of the newly added PDB from non-CDB to PDB before we can open it. Make PDB DBTEST39 as the current container.
SQL> alter session set container=DBTEST39;
Now we can run the Oracle provided script noncdb_to_pdb.sql located in $ORACLE_HOME/rdbms/admin.
SQL> @$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql;
On successful completion of the script, we can go ahead and open the migrated pluggable database - DBTEST39.
SQL> alter pluggable database DBTEST39 open;
Pluggable database altered.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
6 DBTEST39 READ WRITE NO
In case there are errors while opening the pluggable database, the details can be found by querying the view - pdb_plug_in_violations.