Database Reference
In-Depth Information
Connecting to a CDB Using the SQL*Plus ALTE R S E S S I O N
Command
Once you've established a connection to a CDB, switching to the CDB$ROOT container is
accomplished by issuing the ALTER SESSION command. In the next section we will connect
to PDBs and further demonstrate how to switch between containers.
SQL> ALTER SESSION SET CONTAINER = CDB$ROOT;
Session altered.
SQL>
Ensure that each service name, listener, and CDB combination are unique on
a computer. When you run two or more CDBs on the same computer and you
have more than one PDB with the same service name using the same lis-
tener, an attempted connection that specifies this service name will connect
randomly to one of the PDBs with the non-unique service name. To prevent
this condition, either configure separate listeners for the CDB and PDBs that
conflict or use unique service names for all PDBs on the computer system.
Establishing Connections to a PDB
This section describes using SQL*Plus to access the PDBs in a CDB. You can connect to a
PDB by starting SQL*Plus with a connect string to the PDB, using the SQL*Plus CONNECT
command if you're already logged on, or you can switch to a PDB from the CDB$ROOT by
using the ALTER SESSION SET CONTAINER SQL statement.
Clients access a PDB through a database service that has the same name as the PDB
name. With the service name, you can access the PDB using the easy connect syntax or a
net service name configured in the tnsnames.ora file. When you create a new PDB using
the DBCA, it does create a new listener service handler, but it does not create a service
name in the local tnsnames.ora file, so you must create a new entry in tnsnames.ora if you
intend to use tnsnames to resolve connections. Oracle Net Services must be configured for
you to connect to the PDB using a net service name.
The SESSIONS initialization parameter limits the total number of sessions that may be
established in a CDB and its PDBs. If you reach the SESSIONS limit, you will not be able
to log on.
Connecting to a PDB Using SQL*Plus
In Exercise 12.2 you will establish connections to a DBA-created PDB. This exercise
assumes that you have created a CDB and PDBs on your local machine and that the
CDB has been started.
Search WWH ::




Custom Search