Thursday, 20 August 2015

Plugging a Non-CDB into a CDB in Oracle Database 12C

Hello DBAs. Here we are going to learn how to plug a (Non Container Database) Non-CDB into a CDB(Container Database) database.

Step 1: You need to check if your database is CDB or Non-CDB.
             a) Connect to root container(CDB) and execute the query:             
           


           b) SQL query to check if your DB is in PDB list.

                       
           If your database is not in this output , it means you need to plugin the database into this container database.

Step 2: Start the database "test" in Open Read Only mode and connect to Non-CDB database. Here I have "test" database.























Step 3: Create description file for new PDB.

exec dbms_pdb.describe (PDB_DESCR_FILE=>'<path_of_dir>/ncdb12c.xml');















Step 4: Shutdown the Non-CDB database.

Step 5: Connect to target CDB.






























Step 6: Run this PL/SQL code on sql prompt as sysdba in container database.
------------------------------------------------------------------------------------
DECLARE
   compatible BOOLEAN := FALSE;
    BEGIN
       compatible := DBMS_PDB.CHECK_PLUG_COMPATIBILITY(
            pdb_descr_file => '/u01/app/oracle/product/12.1.0/dbhome_1/dbs/test.xml');
       if compatible then
            DBMS_OUTPUT.PUT_LINE('Is pluggable PDB compatible? YES');
       else
            DBMS_OUTPUT.PUT_LINE('Is pluggable PDB compatible? NO');
       end if;
   END;
/
-------------------------------------------------------------------------------------
Step 7: If the output of the above code is NO, check PDB_PLUG_IN_VIOLATIONS view.





















































Note : You can ignore warning message and if there is error you need to fix them before proceeding further.

Step 8: Now plugin the non-cdb database into CDB.

 Here, test database has OMF files , so I need to convert it into normal file name. If you have normal file name convention you can use following command:







Step 9: Check the status for newly added PDB.














Step 10: Connect to newly added PDB and run the script given below:














Step 11: Now the newly plugged database must be in CDB.






I hope it will help you a lot. Please leave your query in comment section.

All the best !!!



Thursday, 15 January 2015

How to create disk partition in Linux/Unix ?


Hi Friends today I am going to tell you "How to create disk partition in Linux/Unix operating system?"

Note: Since I am an Oracle Database Administrator so this blog is for those guys who work on Linux/Unix on his/her Laptop/PC to learn oracle database . So  Please contact your System Administrator before implement it on server.

Let's start:

Step1: To verify the added disk:

#fdisk  -l

It will show list of disks added to your linux OS. Suppose newly added disk is :

/dev/sdb

Step2: To create partition of disk.

          1. #fdisk   /dev/sdb

                Hit 'm' to see help of options.

          2. Hit 'n' to create new disk.
          3. Hit 'p' for primary partition or 'e' for extended partition.
          4. Enter partition number '1'.
          5. Hit Enter. (Default Cylinder 1)
          6. Enter value in sizeM(500M) or as cylinder number or hit enter to accept default.
          7. Hit 'w' to save the partition.




Step 3: This partition will come in action after reboot but you can do it without rebooting  the system.

#partprobe /dev/sdb

Step 4: To mount the disk.

       1. mkdir  <new mount point folder like /u02 >
       2. mkfs   -t  ext3   <new partition name as /dev/sdb1 > 
        3.  mount   -t   ext3   /dev/sdb1  /u02
Note : Replace data in angular bracket including angular brackets with its value.

Step 5: To make this mount permanent.

      Add this line in '/etc/fstab' as :
       
                 <Partiton Name>     <Mount Point>        ext3         defaults       0  0
     Ex :          /dev/sdb1             /u02                          ext3         defaults      0   0
     
      Save and exit from file.
   
      Step 6: To make system to read this file without reboot.
       # mount   -a