Managing Multitenant Architecture
Managing Multitenant Architecture
This domain tests the container database model: how root, seed and pluggable databases relate, how users and objects are scoped, and how PDBs are created, cloned, unplugged, opened and governed.
Core rules
- A CDB contains CDB$ROOT, PDB$SEED (read-only template, never opened read-write), optional application root and application PDBs, and ordinary PDBs.
- Common users exist in root and every container and carry the prefix set by COMMON_USER_PREFIX (C## by default). A user created in root without that prefix becomes local to CDB$ROOT and cannot log into a PDB.
- Grants made with CONTAINER=ALL apply across containers. Privileges granted inside one PDB do not propagate anywhere else, including upward.
- Query across containers from root with SELECT ... FROM CONTAINERS(scott.emp) or CONTAINERS(scott.emp, 'PDB1').
- Unplugging writes a manifest XML describing the PDB; plugging validates COMPATIBLE, character set and installed options, and the PDB receives a new GUID.
- Cloning options include CREATE PLUGGABLE DATABASE ... FROM (local), remote clone over a database link (the source may stay open), proxy PDBs pointing at a remote PDB, and snapshot copy PDBs backed by a snapshot carousel for space efficiency.
- PDB states are MOUNT, READ ONLY, READ WRITE and MIGRATE; SAVE STATE preserves the open mode across instance restarts. Resource Manager allocates CPU via shares, and MAX_PDBS caps the number of PDBs.
Worked example
A DBA connected to CDB$ROOT runs CREATE USER app_admin IDENTIFIED BY ... and then fails to connect as app_admin to PDB1 with ORA-01017. Reasoning: the missing C## prefix made app_admin a local user of CDB$ROOT only, so it does not exist in PDB1. Fix by creating the user with the prefix and CONTAINER=ALL, or by creating app_admin locally inside PDB1.
Traps that cost marks
- Assuming root grants propagate; they need CONTAINER=ALL.
- Dropping a PDB without INCLUDING DATAFILES, then wondering why data files remain.
- Opening a PDB without first putting it in MOUNT state, or attempting to modify PDB$SEED.