Where am I at: CDB vs. PDB? – 12 edition

All right, how many of us use the V$INSTANCE view to verify the instance name and current status of the database after we connect?  In Oracle Database 12c, we can still find this information from V$INSTANCE.  Breath a sigh of relief, for the moment!  What if I connect to a container database and then issue an ALTER SESSION command to move into a different container, i.e. as PDB?  Will I get the name of the PDB that I move into from the V$INSTANCE view or do I need to look somewhere else?  Lets take a look.

Connect to the container database as usual and use the V$INSTANCE view to see where I’m at.

[oracle@oel6 dbhome_1]$ sqlplus / as sysdba
SQL> select instance_name, version, status, con_id from v$instance;
INSTANCE_NAME     VERSION           STATUS       CON_ID
----------------- ----------------- ------------ ----------
ora12cb                  12.1.0.1.0       OPEN          0

Lets move into a PDB.  I have quite a few PDBs created, lets just use PDB1.

SQL> alter session set container=PDB1;
Session altered.

Did I actually move containers?  How can I tell?  Instead of selecting INSTANCE_NAME from V$INSTANCE; we have two new SHOW commands that will provide us the information we are looking for.  These command are quite simple (SHOW CON_ID & SHOW CON_NAME).

SQL> show con_id
CON_ID
------------------------------
3
SQL> show con_name
CON_NAME
------------------------------
PDB1

Now that we are confident that we are in PDB1, lets take a look at the V$INSTANCE view again.  What you will notice is that V$INSTANCE provides us with information relative to the container database (CDB).  It only makes sense that the V$INSTANCE would return CDB information. So, how do we identify items related to the pluggable database (PDB) without the SHOW commands?

Lets take a look at a view that is similar to V$INSTANCE.  Enter the V$PDBS view!  

SQL> desc v$pdbs;
Name Null? Type
----------------------- -------- ----------------------------
CON_ID NUMBER
DBID NUMBER
CON_UID NUMBER
GUID RAW(16)
NAME VARCHAR2(30)
OPEN_MODE VARCHAR2(10)
RESTRICTED VARCHAR2(3)
OPEN_TIME TIMESTAMP(3)
CREATE_SCN NUMBER
TOTAL_SIZE NUMBER

This view provides similar information as V$INSTANCE does; yet is only specific to PDBs.  If we wanted to find out the container_id, name, open_mode and size of the PDB we are currently connected to, we can use this query:

SQL> select con_id, name, open_mode, total_size from v$pdbs;
CON_ID     NAME                           OPEN_MODE  TOTAL_SIZE
---------- ------------------------------ ---------- ----------
3 PDB1 READ WRITE 393216000

What is interesting to point out, is that since we used an ALTER SESSION statement to switch to PDB1, the V$PDBS view only lists the PDB we are currently working in.  If we want to get a complete list of PDBs within the container database, we need to go back to the root container database and run the same SQL statement.

SQL> alter session set container=CDB$ROOT;
Session altered.
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT

SQL> select con_id, name, open_mode, total_size from v$pdbs;
CON_ID     NAME                           OPEN_MODE  TOTAL_SIZE
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY 283115520
3 PDB1 READ WRITE 393216000
4 PDBTEST MOUNTED 0
5 PDB2 READ ONLY 393216000

I hope that everyone now understands how to find information related to PDBs from SQL*Plus.  

Enjoy!

twitter: @curtisbl294

blog: http://dbasolved.com

Please follow and like:
Comments
  • March 2: More than 400 Italian civilians die on a cargo prepare when it stalls in a tunnel and asphyxiates them with fumes. March 25: Seventy-six Allied pilots escape from the German POW camp Stalag Luft III, outside of Berlin, by way of an expertly engineered underground tunnel. March 15: Responding to Hungary’s latest flirtation with the Allies, German troops stage alongside the border, forewarning an invasion. As many as six million workers in northern Italy strike in protest of deportations of Italians to German slave labor camps. Headlining conflict news in 1944 had been the Allied assaults on Italy and Japan, and the presence of a Hitler relative within the U.S. The Marianas see motion for the first time throughout the war, because the Allies launch a series of air attacks against the Japanese on the islands of Guam, Saipan, Tinian, and Rota. See also Little Christmas. After just a little time for mingling, we’ll begin velocity relationship!

    There are plenty of foreign courting apps free on the market for expats. High on the agenda there shall be issues associated with debt sustainability for low- and middle-revenue international locations; mobilizing finance for infrastructure – physical, digital, energy infrastructure world wide; and likewise dealing, obviously, with the main geopolitical issues of the day, from Ukraine to the Middle East. William and his mom traveled to America for a lecture tour, they usually stayed voluntarily there in the beginning of the battle. Navy: Unknown to most Americans however watched very fastidiously by the FBI, William Patrick Hitler, the nephew of Adolf Hitler, lived with his mother in New York City in the course of the warfare. Dating many European and American males do not share real courting and nonetheless want free households, they begin searching for a girl who will change into a loyal good friend, spouse, and mom sites their kids. Our online courting software permits including new sites to current database and sharing all users, making your multiple websites unique in design. We sites know english irritating it apps be when someone does not know what they want!

    Despite widespread English fluency and obvious similarities, Europe is wealthy in cultural nuances. Where are all the enticing women in Europe situated? The immigrants primarily belong to South Asia, Far East, Europe and Middle East. The Nazis homicide 336 Italian civilians to avenge a partisan attack that claimed the lives of 33 members of the SS who have been marching by means of a slim street in Rome. March 3: The Allies reveal that the U.S., Britain, and Soviet Union will share equally within the warfare spoils of the Italian navy. Enjoying overwhelming superiority in men and guns — together with 24,000 artillery pieces — the Soviet Union forces have been unstoppable. Allies in the end prevail in Burma marketing campaign: The fate of the China-Burma-India region was decided by the British 14th Army’s profitable Burma marketing campaign (supported by U.S.-led Chinese Nationalist forces) from mid-1944, following its victories at Imphal and Kohima. In 1943 and 1944, he led a protracted-range penetration brigade, the famed “Chindits,” in opposition to the Japanese in Burma. The INA allied itself with the Japanese through the conflict.

    The freight cars had turn into the one technique of transportation in a country the place all available assets are being dedicated to the conflict effort. March 4: The Japanese authorities order schoolchildren as young as 12 to mobilize for the conflict effort. Both the Japanese and the British Royal Air Force suffered vital losses in March 1944. Read about these and other World War II events in the next section. March 31: Within the worst RAF losses of the warfare, 95 bombers are misplaced in one night in an unsuccessful raid of Nuremberg, Nazi Germany. March 30-April 2: The Japanese suffer major tools and provide losses when U.S. A detailed timeline of events and headlines of main news stories are included. Belgian ladies are known for being direct communicators who categorical their opinions overtly without hesitation. Caveman and girls living situations charmdate scam had been dependent on seasons and were frequently roam in search of food and shelter. The audience here leans in the direction of these looking for greater than only a casual fling. If you’re searching for a woman who can stand on her personal two feet, a Spanish girl is the proper selection. You’ll be able to ship winks to ladies without spending a dime and add them to your favorites checklist.

Leave a Reply

Your email address will not be published. Required fields are marked *

Enquire now

Give us a call or fill in the form below and we will contact you. We endeavor to answer all inquiries within 24 hours on business days.