100% found this document useful (1 vote)
549 views

Learning-Practice - Oracle 12C PDF

1) The document discusses testing Oracle 12c container databases (CDBs) and pluggable databases (PDBs) using VirtualBox. 2) Key steps taken include creating multiple CDBs ("world", "ASCDB", "EUCDB") each containing several PDBs, and moving PDBs between CDBs by unplugging and plugging them. 3) Configuration of the listener, TNS entries, and checking parameters like local_listener are described. Connecting to PDBs using their TNS aliases is demonstrated.

Uploaded by

Praveen Bachu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
549 views

Learning-Practice - Oracle 12C PDF

1) The document discusses testing Oracle 12c container databases (CDBs) and pluggable databases (PDBs) using VirtualBox. 2) Key steps taken include creating multiple CDBs ("world", "ASCDB", "EUCDB") each containing several PDBs, and moving PDBs between CDBs by unplugging and plugging them. 3) Configuration of the listener, TNS entries, and checking parameters like local_listener are described. Connecting to PDBs using their TNS aliases is demonstrated.

Uploaded by

Praveen Bachu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Learning / Practise Oracle 12c

Introduction / Understanding Oracle 12C ..................................................................................................... 2


Building CDBs in one go ................................................................................................................................. 2
Virtual Box Configuration .............................................................................................................................. 2
My Idea for Testing CDBs & PDBs.................................................................................................................. 3
Confirming the Installation:........................................................................................................................... 3
Testing CDBs and PDBs .................................................................................................................................. 3
TNS Alias for PDB ........................................................................................................................................... 4
Connecting to Pluggable Database: .............................................................................................................. 4
Check Status of Pluggable Database ............................................................................................................. 5
local_listener ................................................................................................................................................. 6
Unplug and plug PDB: .................................................................................................................................... 6
Further Testing as explained on "oracle-base.com" and also my intentions................................................ 7

Introduction / Understanding Oracle 12C


Reading the Articles about Oracle 12C on oracle-base.com Website the Architecture of CDB and PDB was
clear and interesting. I think Oracle 12C has a lot to offer us.
The only picture or example unknowingly that came in my mind when I started reading about it there
was a "girl's hand bag" ! :-) I mean if the CDB Architecture confuses you or etc. then I think my example
could help you in some way.
Just imagine a CDB is like a girl's hand bag . We know girls do often change the hand bags unless like men
who carry the same wallet or bag round the year :-) Right? yes.
She would put the things in it that she needs. These things you can consider as PDBs. When she thinks of
to change her hand bag she will then take out all the necessary things from that bag and move it in to a
new hand bag.
So, the new hand bag is like a new CDB and the things that moved in to the new hand bag are like the
PDBs plugged or PDBs unplugged. She knows what is required in the new bag and what's not. Like that,
we unplug and plug the PDBs between CDBs that we want.
A hand bag is always there open for the things. So, a CDB is always there up and running and the PDBs
can be made up and running or shutdown. No effect on CDB.
It is said, " practice makes a man perfect" and when I finally got time to test it I started doing it.
I think the database parameter "local_listener" should be considered important or at least checked.

Building CDBs in one go


The Section "Database Configuration Assistant (DBCA)" from the below link shows us the option
"Advanced Mode". Navigating from this Mode makes our job easier to create a CDB with multiple PDBs
in one go. http://oracle-base.com/articles/12c/multitenant-create-and-configure-container-database12cr1.php#configure-a-cdb

Virtual Box Configuration


The simplest procedure I had:
Server : Oracle Linux 6.4 (4GB RAM)
3 Partitions (/u01,/u02 and /u03)
/u01 - Oracle Home, /u02 - Data and also /u3 for Data

My Idea for Testing CDBs & PDBs


Using GUI I installed 1st CDB with the option "Create and configure a database" and was named as
"world". This CDB had 3 PDBs called :
"INDPDB, DEPDB and USPDB " (IND->INDIA, DE->Germany and US->USA).
My idea was to create 2 more CDBs "ASCDB and EUCDB" (AS->ASIA and EU-> EUROPE). This way I tested
CDBs and PDBs following Naming Standards.
So I moved the respective PDBs (INDPDB and DEPDB) from the "world" CDB to Continent Names (Asia
and Europe i.e. ASCDB and EUCDB).

Confirming the Installation:


When I was finished with the installation I checked with :
1) Directories of CDBs and PDBs
(created a directory " 12c_data " to hold CDB related data files)
[oracle@ora-rac2 ]$ pwd
/u03/12c_data/world
[oracle@ora-rac2 world]$ ls
A directory with "DEPDB" was created by the Installer and data files of PDB were saved here.
It is interesting to compare the DBF Files in this "DEPDB" Directory and "WORLD" Directory.
2) LISTENER
$ lsnrctl status
$ lsnrctl service
3) ORATAB - to confirm the SID
$ more /etc/oratab

Testing CDBs and PDBs


Connect as SYS or SYSTEM (Use 'SYSTEM' If it has access to CDBs and PDBs)
$ SQLPLUS sys as sysdba

Check Available Services:


SQL > COLUMN name FORMAT A30
SQL> SELECT name, pdb FROM v$services ORDER BY name;
SQL> SHOW CON_NAME
The output was exactly as informed on "oracle-base.com". It was " CDB$ROOT "

TNS Alias for PDB


Connecting Pluggable Database using TNS alias. I made an entry in TNSNAMES.ORA File by checking with
the command :
$ lsnrctl service
I already have a TNS Alias for my CDB "world". I just copied all the lines of this "world" TNS Alias and then
renamed "world" with "DEPDB" and gave a Service Name "DEPDB"
$ lsnrctl reload
$ SQLPLUS sys/password@world as sysdba
SQL > show con_name
CDB$ROOT
SQL> exit

Connecting to Pluggable Database:


$ SQLPLUS sys/password@depdb as sysdba
SQL > show con_name
DEPDB
Shutdown Pluggable Database:
$ SQLPLUS sys/password@depdb as sysdba
SQL> shutdown immediate
Pluggable Database closed.
SQL> exit
$ SQLPLUS sys/password@world as sysdba
SQL > show con_name
CDB$ROOT
SQL > exit

Check Status of Pluggable Database


$ SQLPLUS sys/password@depdb as sysdba
SQL> select open_mode from v$database;
MOUNTED
SQL> startup
SQL > select open_mode from v$database;
READ WRITE
SQL> shutdown immediate
Pluggable Database close
2nd Pluggable Database INDPDB :
My Test Server has 4 GB of RAM so I shutdown the PDB "DEPDB" and create another PDB called
"INDPDB". We can create another Pluggable Database using DBCA as show here
http://oracle-base.com/articles/12c/multitenant-create-and-configure-pluggable-database-12cr1.php
Followed the above link to create another PDB and named it as "INDPDB".
TNS NAME for INDPDB:
The next step I performed was an entry in the TNSNAMES.ORA File for this new PDB. Finally reloaded
with the command:
$ lsnrctl reload
Connecting "INDPDB" using TNS Alias:
$ SQLPLUS sys/password@indpdb as sysdba
SQL > select open_mode from v$database;
READ WRITE
SQL> shutdown immediate
Pluggable Database close
3rd Pluggable Database USPDB :
I shut down this "INDPDB" PDB and created another PDB called "USPDB". The next step I performed was
an entry in the TNSNAMES.ORA File for this new PDB. Finally reloaded with the command:
$ lsnrctl reload

Connecting "USPDB" using TNS Alias:


$ SQLPLUS sys/bachu77@uspdb as sysdba
SQL> select open_mode from v$database;
READ WRITE
SQL> shutdown immediate
Pluggable Database close

Creating another CDB "EUCDB":


$ dbca
I followed the below link to create another CDB "EUCDB". I didn't use the "Advanced Mode" option.
http://oracle-base.com/articles/12c/multitenant-create-and-configure-container-database-12cr1.php
Clicked on " Database Configuration Assistant "
Care has to be taken during the Installation esp. when the Screen with "Listener Configuration" comes
up.

local_listener
After the installation I checked the parameter " local_listener ". If it has not a value I made sure it has a
value.
SQL> show parameter local_listener
SQL> alter system set local_listener ='(ADDRESS = (PROTOCOL=TCP) (HOST=hostname)
(PORT=port_number) )' scope=both;
http://edstevensdba.wordpress.com/2011/07/30/exploring-the-local_listener-parameter/
SQL> shutdown immediate

Unplug and plug PDB:


I followed the below 2 sections
o
o

Unplug a Pluggable Database (PDB) using the DBCA


Plugin a Pluggable Database (PDB) using the DBCA

Using the below link to unplug "DEPDB" from "World" CDB and plug "DEPDB" to the CDB "EUCDB".
http://oracle-base.com/articles/12c/multitenant-create-and-configure-pluggable-database-12cr1.php
When the screen "Unplug Pluggable Database" came up I gave the Path "/u03/12c_data/" in the
"Pluggable Database Archive Location" so that it saved in the location where I want and easy to
remember.
$ export ORACLE_SID=world
$ SQLPLUS sys as sysdba
SQL> startup
$ dbca
o

Unplug a Pluggable Database (PDB) using the DBCA

SQL> shutdown immediate


$ export ORACLE_SID=eucdb
$ dbca
o
o

Plugin a Pluggable Database (PDB) using the DBCA

Further Testing as explained on "oracle-base.com" and also my intentions


1) Creating Data Base Files in PDBs
2) Managing Users that is giving access to Users to a certain PDB and/or all the PDBs in CDBs
3) Data Guard Scenarios
4) RMAN Backup of PDBs etc.

You might also like