Overview
Connecting to a CDB is only available to common users. Other users must connect using a service name associated with a PDB.
References
Reading Notes
" 42.2 Connecting to a PDB with SQL*Plus " says:
You can use the following techniques to connect to a PDB with the SQL*Plus CONNECT command:
- Local connection with operating system authentication
- Database connection using easy connect
- Database connection using a net service name
Procedure
BEQUEATH Connection
Via BEQUEATH:
sqlplus / as sysdba
ALTER SESSION SET container = vegemite;
Connection via Service
Find active services in a CDB:
set pages 1000
col network_name for a25
col name for a25
col pdb for a8
set lines 70
select name, network_name, pdb from cdb_services;
Sample output is:
NAME NETWORK_NAME PDB ------------------------- ------------------------- -------- SYS$BACKGROUND CDB$ROOT SYS$USERS CDB$ROOT jarXDB jarXDB CDB$ROOT jar.yaocm.id.au jar.yaocm.id.au CDB$ROOT vegemite.yaocm.id.au vegemite.yaocm.id.au VEGEMITE
Find Current Container
Find current container:
select sys_context('USERENV', 'CON_NAME') from dual;
Sample output:
SYS_CONTEXT('USERENV','CON_NAME') --------------------------------- CDB$ROOT