Oracle Apps DBA

My photo
More than 5+ Years of IT Experience in administering Enterprise wide Multi Vendor UNIX Servers, Oracle Databases (8i to 11gR2), Middle-tiers, Applications and Clusters. I am a Sun Certified System Administrator (SCSA) for Solaris 10, oracle 10g database certified associate(OCA), Oracle 10g Database certified professional (OCP) and Oracle E-Business suite R12 certified professionl(OCP)

Oracle Database and Applications

Sunday, 30 June 2013

Create Oracle 12c Database using DBCA - 12c Container Database & pluggable Database

In this article I am going to test new options introduced in Oracle Database 12cR1. Oracle introduced 2 new  type of databases  in this release "Container Database" and "Pluggable Database". This is one of the major new change introduced from this release. I believe for this feature only Oracle has changed the naming convention of its release from letter "g" to "c" as this feature is completely compatible with the concept what we call as a "CLOUD".

Here I am going to demonstrate the following points:

  •  Container Database & pluggable Database
  •  Using DBCA to create container database
  •  Using DBCA to create pluggable database
  •  Managing pluggable database
Container Database & Plug gable Database:

 - Container database is the root database to which all pluggable database belongs. Here Oracle used same concept as of Solaris Zones. There will be two types of zones in solaris Global zone and non-global zone. Global zone is the main OS and all OS created on top of thsi global zone is known as non-global zone.

Same concept here, CDB is the main database like global zone to which all pluggable databases can attached like non global zone.

Note:

- Pluggable database can be created only in a container database.
- In 12c DBA there are much new options introduced with completely new interface.

Using DBCA to create container database:

- Set proper display variable and execute dbca.




- Select check box "create as Container Database" and also provide a name pluggable database.















Creation of container database "CDB" and Pluggable database "PDB1" completed.

Now i will create another pluggable database in CDB using DBCA.

Using DBCA to create container database:

- set proper display variable and execute dbca


- Select "Manage Pluggable Databses"


- Select "Create a Pluggable Database" 


- Select a container database in which you want to create a pluggable database. Here i have selected "CDB"



- Here you can sepecify other location for creating PDB2 datafiles.








Creation of pluggable datbase "PDB2" completed successfully.

Managing Pluggable database:

Check the status of pluggable database:



ora12c@linux1 ~]$ echo $ORACLE_SID
CDB

[ora12c@linux1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Sun Jun 30 08:13:42 2013

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
and Real Application Testing options

SQL> SELECT NAME,OPEN_MODE FROM V$PDBS;

NAME                           OPEN_MODE
------------------------------ ----------
PDB$SEED                       READ ONLY
PDB1                           READ WRITE
PDB2                           READ WRITE

SQL> 



Connecting to a pluggable database:

- connecting to PDB1 & PDB2


[ora12c@linux1 ~]$ sqlplus  system@PDB1

SQL*Plus: Release 12.1.0.1.0 Production on Sun Jun 30 08:18:49 2013

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Enter password: 
Last Successful login time: Sun Jun 30 2013 06:44:22 -04:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, Automatic Storage Management, Oracle Label Security, OLAP,
Advanced Analytics and Real Application Testing options

SQL> SELECT NAME,OPEN_MODE FROM V$PDBS;

NAME                           OPEN_MODE
------------------------------ ----------
PDB1                           READ WRITE

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
+DBDATA/CDB/DATAFILE/undotbs1.259.819429793
+DBDATA/CDB/E05B13C778DA75D3E0430100007F792D/DATAFILE/system.273.819430191
+DBDATA/CDB/E05B13C778DA75D3E0430100007F792D/DATAFILE/sysaux.274.819430191
+DBDATA/CDB/E05B13C778DA75D3E0430100007F792D/DATAFILE/users.276.819430235

SQL> connect system@PDB2
Enter password: 
Connected.
SQL> SELECT NAME,OPEN_MODE FROM V$PDBS;

NAME                           OPEN_MODE
------------------------------ ----------
PDB2                           READ WRITE

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
+DBDATA/CDB/DATAFILE/undotbs1.259.819429793
+DBDATA/CDB/E05D8F42221C2D78E0430100007F4DDF/DATAFILE/system.277.819440853
+DBDATA/CDB/E05D8F42221C2D78E0430100007F4DDF/DATAFILE/sysaux.278.819440861
+DBDATA/CDB/E05D8F42221C2D78E0430100007F4DDF/DATAFILE/users.280.819440897

SQL> 


Open and close pluggable database:


[ora12c@linux1 ~]$ echo $ORACLE_SID
CDB
[ora12c@linux1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Sun Jun 30 08:13:42 2013

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
and Real Application Testing options

SQL> SELECT NAME,OPEN_MODE FROM V$PDBS;

NAME                           OPEN_MODE
------------------------------ ----------
PDB$SEED                       READ ONLY
PDB1                           READ WRITE
PDB2                           READ WRITE

SQL> alter pluggable database pdb1 close;

Pluggable database altered.

SQL> SELECT NAME,OPEN_MODE FROM V$PDBS;

NAME                           OPEN_MODE
------------------------------ ----------
PDB$SEED                       READ ONLY
PDB1                           MOUNTED
PDB2                           READ WRITE

SQL> alter pluggable database pdb1 open;

Pluggable database altered.

SQL> SELECT NAME,OPEN_MODE FROM V$PDBS;

NAME                           OPEN_MODE
------------------------------ ----------
PDB$SEED                       READ ONLY
PDB1                           READ WRITE
PDB2                           READ WRITE

SQL> alter pluggable database all close;

Pluggable database altered.

SQL> SELECT NAME,OPEN_MODE FROM V$PDBS;

NAME                           OPEN_MODE
------------------------------ ----------
PDB$SEED                       READ ONLY
PDB1                           MOUNTED
PDB2                           MOUNTED


SQL> alter pluggable database all open;

Pluggable database altered.

SQL> SELECT NAME,OPEN_MODE FROM V$PDBS;

NAME                           OPEN_MODE
------------------------------ ----------
PDB$SEED                       READ ONLY
PDB1                           READ WRITE
PDB2                           READ WRITE

SQL> 

 
Hope this article gives you an overview of Multitanent database feature.

Thanks for reading.

regards,
 X A H E E R

1 comment:

Anonymous said...

Thanks Sir,
by www.oracle786.com