Chapter 13 · Multitenant Architecture: CDBs, PDBs, Services, Cloning, and Lifecycle
CDB Root, PDBs, Application Containers, Common vs Local Users, and Containers
Build Oracle's multitenant identity model around CDB$ROOT, PDB$SEED, user PDBs, application containers, CON_ID, and common/local principals—and make wrong-container DDL visibly fail before it reaches application data.
Learning outcomes
ServiceHub has two teams sharing one Oracle installation. One
administrator connects through the FREE service,
sees a successful login, and starts creating application users
and objects. The session is actually in CDB$ROOT,
not the application PDB. Oracle multitenant makes container
identity a first-class administrative boundary: before DDL,
grants, recovery, monitoring, or service work, you must know
which container owns the operation.
Define CDB$ROOT, PDB$SEED, regular PDBs, application roots/PDBs, and the role of a seed/template.
Read CON_NAME and CON_ID from the actual session and map them to container views.
Distinguish common users/roles from local users/roles and inspect COMMON and CON_ID metadata.
Explain why local application users and schema DDL belong in an application PDB rather than CDB$ROOT.
Reproduce the wrong-root local-user failure and repair it by switching or reconnecting to FREEPDB1.
Mandatory work targets Oracle AI Database Free 26ai, reviewed against RU 23.26.3, SQL Developer 26.2, and SQLcl 26.2.1. The August 2026 Licensing Information manual lists Oracle Multitenant as included in Free with a maximum of 16 PDBs, although the practical number can be lower because Free is capped at 2 foreground CPU cores, 2 GB RAM, and 12 GB user data. Free permits one installation per logical environment and receives no Oracle patches or Support service requests. The course baseline CDB is FREE and the default application PDB/service is FREEPDB1. Administrative PDB lifecycle commands require root/PDB-specific administrative privileges; application SQL remains in FREEPDB1 or an explicitly created disposable PDB.
1. A CDB is one database engine with multiple container namespaces
A container database (CDB) is the multitenant
database. CDB$ROOT is its root container and owns
CDB-level metadata and administration. PDB$SEED is
a read-only system-supplied template used to provision ordinary
pluggable databases (PDBs). A PDB is a portable
collection of schemas, schema objects, and nonschema objects
that appears to clients as a separate database.
Oracle AI Database 21c and later supports the multitenant
architecture rather than the old non-CDB deployment model. The
Free installation script creates CDB FREE and PDB
FREEPDB1.
SHOW CON_NAMESELECT SYS_CONTEXT('USERENV','CON_NAME') AS con_name, SYS_CONTEXT('USERENV','CON_ID') AS con_id, SYS_CONTEXT('USERENV','SESSION_USER') AS session_user, SYS_CONTEXT('USERENV','CURRENT_SCHEMA') AS current_schemaFROM dual;
A successful SQL connection proves authentication and service
resolution; the CON_NAME evidence proves where
database operations are scoped.
2. CON_ID is the container discriminator in multitenant metadata
Many dynamic performance and CDB_* views expose
CON_ID. Root is container 1; the seed is normally
container 2; user/application containers receive other IDs. Do
not hard-code application logic around a particular numeric
user-PDB ID—query the current mapping.
SELECT con_id, name, open_mode, restrictedFROM v$containersORDER BY con_id;SELECT con_id, name, open_mode, restricted, total_sizeFROM v$pdbsORDER BY con_id;SELECT pdb_id, pdb_name, status, con_uid, guidFROM dba_pdbsORDER BY pdb_id;
V$CONTAINERS/V$PDBS show runtime open
state. DBA_PDBS.STATUS describes lifecycle
integration state such as NEW or
NORMAL; it is not the same field as open mode.
3. Common and local identities have different reach
A local user exists only in one PDB and is the
normal identity for an application schema. A
common user has an identity across a CDB or
application container and can receive privileges commonly with
appropriate CONTAINER=ALL semantics. Common and
local roles follow a similar scope distinction.
By default, common user/role names use the prefix defined by
COMMON_USER_PREFIX (commonly C##). Do
not invent a common application account merely to make root DDL
succeed.
SELECT name, valueFROM v$parameterWHERE name='common_user_prefix';SELECT con_id, username, common, account_statusFROM cdb_usersWHERE username IN ('SYS','SYSTEM','PDBADMIN','SERVICEHUB_OWNER','SERVICEHUB_APP')ORDER BY username, con_id;
4. Deliberately wrong: create a local application user while in root
SHOW CON_NAME-- CDB$ROOTCREATE USER servicehub_ch13_localIDENTIFIED BY "DisposableOnly9";-- With the default common-user naming policy this fails with:-- ORA-65096: invalid common user or role name
The error is a protection signal. In root,
CREATE USER is interpreted in the common-user
administrative context. Renaming the account to
C##SERVICEHUB_APP would change the identity model
rather than repair the application design.
ALTER SESSION SET CONTAINER=FREEPDB1;SELECT SYS_CONTEXT('USERENV','CON_NAME') AS con_nameFROM dual;CREATE USER servicehub_ch13_localIDENTIFIED BY "DisposableOnly9"QUOTA 5M ON users;GRANT CREATE SESSION TO servicehub_ch13_local;SELECT username, commonFROM dba_usersWHERE username='SERVICEHUB_CH13_LOCAL';DROP USER servicehub_ch13_local CASCADE;
Run ALTER SESSION SET CONTAINER only as an
administrative/common identity with the necessary container
privileges. Application clients should reconnect through the PDB
service instead of switching containers.
5. Application containers add another hierarchy when one application is replicated across PDBs
An application container has an application root plus application PDBs. It can also have an optional application seed. Shared application metadata/data can be defined in the application root and synchronized into application PDBs through application install/patch/sync operations. This is useful for SaaS-style fleets, but it adds lifecycle/version coordination and is not needed for a single ServiceHub PDB.
| Container | Primary role | Application objects? |
|---|---|---|
CDB$ROOT |
CDB-level administration/common metadata | Do not place ordinary tenant schema here |
PDB$SEED |
Read-only template for standard PDB provisioning | No normal application workload |
| Regular PDB | Application/tenant schemas and local administration | Yes |
| Application root | Shared application definition for application PDBs | Application-common objects |
| Application PDB | Tenant/application instance within application container | Shared + local application data/objects |
6. Free licensing changes scale, not the identity model
The current 26ai licensing matrix includes Oracle Multitenant in Free and permits up to 16 PDBs. That does not turn 16 PDBs into 16 independent instances: they still share the one Free installation and its 2-core/2-GB limits, while all user data across the Free database remains subject to the 12-GB cap.
PDB count is not capacity. Size CPU, memory, sessions, storage, backup, patch orchestration, and noisy-neighbor controls across the whole CDB.
7. Reproducible mandatory lab: container identity card
-- Root connection, for example: sql / as sysdbaSELECT SYS_CONTEXT('USERENV','CON_NAME') AS con_name, SYS_CONTEXT('USERENV','CON_ID') AS con_idFROM dual;SELECT con_id,name,open_mode,restrictedFROM v$containersORDER BY con_id;ALTER SESSION SET CONTAINER=FREEPDB1;SELECT SYS_CONTEXT('USERENV','CON_NAME') AS con_name, SYS_CONTEXT('USERENV','CON_ID') AS con_idFROM dual;SELECT username,common,account_statusFROM dba_usersWHERE username IN ('SERVICEHUB_OWNER','SERVICEHUB_APP')ORDER BY username;
Expected evidence is a different CON_NAME/CON_ID
after the administrative switch. This proves container context;
it does not prove that a remote client will use the same service
or PDB.
8. Production judgment
Make container identity part of every DBA runbook. Root is for
CDB-level/common administration; local application schemas
belong in their PDB. Use local users/roles by default for
application isolation and common identities only when
cross-container administration genuinely requires them. Log
CON_ID/CON_NAME with privileged
automation.
No pack, restart, or COMPATIBLE change is required.
Lesson 2 adds the operational counterpart to identity: PDB open
state and Oracle Net services determine whether clients can
reach the intended container after instance startup.
Check your understanding
- What are CDB$ROOT and PDB$SEED used for?
- What does CON_ID identify?
- Why is creating C##SERVICEHUB_APP not the correct repair for ORA-65096?
- Does a successful connection prove the session is in FREEPDB1?
- How many PDBs does the current 26ai Free licensing matrix permit at most?
Review the answers
CDB$ROOT is the CDB administrative/root container; PDB$SEED is the read-only provisioning template for standard PDBs.
It identifies the container to which multitenant metadata/runtime data belongs.
It changes a local application identity into a common identity; the correct repair is to create the local user in the application PDB.
No. Verify the service mapping and SYS_CONTEXT/SHOW CON_NAME after connection.
Up to 16 PDBs, subject to Free resource and user-data limits.
Authoritative references
- Multitenant Administrator's Guide — CDB, PDB, application-container and container administration
- Support for Pluggable Databases — client/PDB multitenant model
- DBA_PDBS — PDB identity and lifecycle status
- Licensing Information — current PDB limits and Multitenant entitlement
- Licensing Restrictions for Free — Free CPU/RAM/storage/runtime restrictions