Connecting to a CDB Oracle Database isn't much different compared to what we did previously with non-CDB Oracle instances. In this video we will identify how we can connect to the CDB Instance the root container and what happens when we open a SQL*Plus connection using a SYSDBA user and relying on the ORACLE_SID environment variable
- [Narrator] Once you have configured your Oracle database as a CDB, or container database, connecting to it is similar to what you knew from previous Oracle versions, such as Oracle 11G. Let's show this by opening a terminal window. First of all, the Oracle SID parameter, which you have used previously to connect to your Oracle instance, still remains and has a similar effect. For example, in my environment, which is a simple Oracle VM, installed locally on my MAC, I can see by looking at the Oracle pmon process that the Oracle instance I have created has an SID of ORCL.
Setting the Oracle SID environment variable to ORCL and connecting as SYSBDA still works as the way it was in previous Oracle versions. However, now that you know about the multi-tenant architecture of Oracle 12c, you might ask yourself, to which container exactly did I just connect? Well, let's check it out. We have a couple of ways of showing the container to which we have connected. First is by running the show con_name command, short for container name.
We can see that we are connected to the root container or CDB dollar sign, root. This means that we have connected directly to the CDB and not any of the palatable databases that are contained inside it. Connecting to the root container directly is usually done when there is a need to perform certain Oracle administration tasks, such as creating new PDB's. We can also see the container ID to which we are connected to by running the show con_id command.
The root container always have a container ID of one. It's the first container in the CDB database. When connecting to a CDB instance, we can specify the container name as part of the Oracle connection string. Let's quit SQL Plus and type the following command sqlplus sys/oracle, which means I'm authenticating with the SYS DBA users, specifying it's password at localhost, that's because I'm connecting to an Oracle database, running on my own virtual machine.
We also need to specify the listener port name, 1521, in my case, /orcl, which is the Oracle instance name. And in an Oracle 12c multi-tenant architecture, this leads to a connection to the root container of the CDB. I'm also going to specify as sysdba because this is a sysdba connection. Show con_name will show us that I've connected to the root container of our CDB database.
When we'll connect to other containers, later on we will specify the container PDB name instead of ORCL. You will see plenty of examples about that later on in our chapter.
- Pluggable databases (PDB)
- Enabling the new multitenant container database (CDB) architecture
- Connecting to the CDB
- Creating a new PDB
- Unplugging and cloning a PDB
- Backing up and restoring a PDB using RMAN
- Using the new In-Memory Column Store
- Using improved default column values
- Enabling and using extended 32K VARCHARs
- Exploring improved Top-N queries
- Using Oracle temporary undo
- New database partitioning features
- Using adaptive execution plans
- Restoring a table to a specific point in time using RMAN