In this article we will Plug Single Instance PDB to RAC CDB.
Single Instance CDB Name | Single Instance PDB Name | RAC Instance CDB | RAC Instance Name | RAC Node |
globdb | pdb1 | CDB1 | RAC1 | Node1 |
RAC2 | Node2 |
Step 1 : Check status of Globdb and CDB1
[oracle@rac2 ~]$ srvctl status database -d globdb Instance globdb is running on node rac2 [oracle@rac2 ~]$ [oracle@rac2 ~]$ srvctl status database -d cdb1 Instance cdb11 is running on node rac1 Instance cdb12 is running on node rac2 [oracle@rac2 ~]$
Step 2 : Check details of globdb :
[oracle@rac2 ~]$ export ORACLE_SID=globdb [oracle@rac2 ~]$ sqlplus / as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Fri Mar 30 18:38:29 2018 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Advanced Analytics and Real Application Testing options SQL> select name,open_mode from v$database; NAME OPEN_MODE --------- -------------------- GLOBDB READ WRITE SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PDB1 READ WRITE NO 4 PDB2 READ WRITE NO SQL> alter session set container=pdb1; Session altered. SQL> select name from v$datafile; NAME -------------------------------------------------------------------------------- +DATA/GLOBDB/DATAFILE/undotbs1.340.972147791 +DATA/GLOBDB/68A14F55F99E0927E053B601A8C0B73F/DATAFILE/system.351.972150863 +DATA/GLOBDB/68A14F55F99E0927E053B601A8C0B73F/DATAFILE/sysaux.350.972150863 +DATA/GLOBDB/68A14F55F99E0927E053B601A8C0B73F/DATAFILE/users.353.972150981 SQL>
Step 3 : Close pluggable database before unplugging it :
SQL> alter pluggable database pdb1 close immediate; Pluggable database altered.
Step 4 : Unplug pluggable database to xml file .
SQL> alter pluggable database pdb1 unplug into '/u01/app/oracle/pdb1.xml'; Pluggable database altered. SQL>
Step 5 : Drop pluggable database and keep datafiles :
SQL> drop pluggable database pdb1 keep datafiles; Pluggable database dropped. SQL> select pdb_id,pdb_name,dbid from cdb_pdbs where pdb_name='PDB1'; no rows selected
Step 6 : Transfer xml file to RAC1 node.
[oracle@rac2 oracle]$ scp pdb1.xml rac1:/u01/app/oracle/ pdb1.xml 100% 5373 5.3KB/s 00:00
Step 7 : Connect to CDB1 and check compatibility of pdb1 :
SQL> set serveroutput on; SQL> declare 2 chk boolean := FALSE; 3 begin 4 chk :=DBMS_PDB.CHECK_PLUG_COMPATIBILITY(pdb_descr_file=>'/u01/app/oracle/pdb1.xml',pdb_name=>'PDB1'); 5 if chk then 6 DBMS_OUTPUT.PUT_LINE('YES'); 7 else DBMS_OUTPUT.PUT_LINE('NO'); 8 end if; 9 end; 10 / YES PL/SQL procedure successfully completed. SQL>
Step 8 : Check if any violation of pdb1 from PDB_PLUG_IN_VIOLATIONS :
SQL> select name,cause,type,message,status from PDB_PLUG_IN_VIOLATIONS where name='PDB1'; NAME CAUSE TYPE MESSAGE STATUS ---------- ---------- --------- ----------------------------------- --------- PDB1 OPTION WARNING Database option RAC mismatch: PDB PENDING installed version NULL. CDB installed version 12.1.0.2.0. PDB1 Parameter WARNING CDB parameter memory_target PENDING mismatch: Previous 680M Current 500M SQL>
We can ignore this as these are just warnings .
Step 9 : Create pluggable database using xml file in CDB1 :
[oracle@rac1 ~]$ sqlplus / as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Sat Mar 31 10:06:24 2018 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Advanced Analytics and Real Application Testing options SQL> select name,open_mode from v$database; NAME OPEN_MODE --------- -------------------- CDB1 READ WRITE SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 DB1 MOUNTED 4 DB2 MOUNTED SQL> Create pluggable database pdb1 using '/u01/app/oracle/pdb1.xml' copy ; Pluggable database created. SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 DB1 MOUNTED 4 DB2 MOUNTED 5 PDB1 MOUNTED
Step 10 : Check alertcdb1.log , you will see output like following :
[oracle@rac1 ~]$ tail -500f /u01/app/oracle/diag/rdbms/cdb1/cdb11/trace/alert_cdb11.log Create pluggable database pdb1 using '/u01/app/oracle/pdb1.xml' copy Sat Mar 31 10:13:28 2018 **************************************************************** Pluggable Database PDB1 with pdb id - 5 is created as UNUSABLE. If any errors are encountered before the pdb is marked as NEW, then the pdb must be dropped **************************************************************** This instance was first to open pluggable database PDB1 (container=5) Sat Mar 31 10:13:49 2018 Database Characterset for PDB1 is WE8MSWIN1252 Sat Mar 31 10:14:51 2018 Deleting old file#8 from file$ Deleting old file#9 from file$ Deleting old file#10 from file$ Adding new file#19 to file$(old file#8) Adding new file#20 to file$(old file#9) Adding new file#21 to file$(old file#10) Successfully created internal service pdb1 at open Sat Mar 31 10:15:03 2018 ALTER SYSTEM: Flushing buffer cache inst=1 container=5 local **************************************************************** Post plug operations are now complete. Pluggable database PDB1 with pdb id - 5 is now marked as NEW. **************************************************************** Completed: Create pluggable database pdb1 using '/u01/app/oracle/pdb1.xml' copy alter pluggable database pdb1 open
Step 11 : Open pluggable database :
SQL> alter pluggable database pdb1 open; Pluggable database altered. SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 DB1 MOUNTED 4 DB2 MOUNTED 5 PDB1 READ WRITE NO
Step 12 : Open pdb1 in RAC2 :
[oracle@rac1 ~]$ ssh rac2 Last login: Fri Mar 30 16:39:15 2018 from 192.168.1.2 [oracle@rac2 ~]$ [oracle@rac2 ~]$ export ORACLE_SID=cdb12 [oracle@rac2 ~]$ sqlplus / as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Sat Mar 31 10:18:43 2018 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Advanced Analytics and Real Application Testing options SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 DB1 MOUNTED 4 DB2 MOUNTED 5 PDB1 MOUNTED SQL> alter pluggable database pdb1 open; Pluggable database altered.
Stay tuned for More articles on Oracle RAC
Thank you for giving your valuable time to read the above information.
If you want to be updated with all our articles send us the Invitation or Follow us:
Telegram Channel : https://t.me/helporacle
Skant Gupta’s LinkedIn: www.linkedin.com/in/skantali/
Joel Perez’s LinkedIn: Joel Perez’s Profile
LinkedIn Group: Oracle Cloud DBAAS
Facebook Page: OracleHelp