The multi-tenant architecture enables an Oracle database to function as a multitenant container database (CDB).
A CDB includes zero, one, or many customer-created pluggable databases (PDBs). A PDB is a portable collection of schemas,
schema objects, and non-schema objects that appears to an Oracle Net client as a non-CDB . All Oracle databases before Oracle
Database 12c were non-CDBs.
Every CDB has the following containers:
- Exactly one CDB root container (also called simply
the root
- The CDB root is a collection of schemas, schema objects, and non-schema objects to which all PDBs belong The root stores Oracle-supplied
metadata and common users. An example of metadata is the source code for Oracle-supplied PL/SQL . A common user is a database
user known in every container . The root container is named
CDB$ROOT .
- Exactly one system container
- The system container includes the root CDB and all PDBs in the CDB. Thus, the system container is the logical container for
the CDB itself.
- Zero or more application containers
- An application container consists of exactly one application root , and the PDBs plugged in to this root. Whereas the system
container contains the CDB root and
allthe PDBs within the CDB, an application container includes only the PDBs plugged into the application root. An application
root belongs to the CDB root and no other container.
- Zero or more user-created PDBs
- A PDB contains the data and code required for a specific set of features (see "PDBs"). For example, a PDB can support a specific
application, such as a human resources or sales application. No PDBs exist at creation of the CDB. You add PDBs based on your
business requirements.
A PDB belongs to exactly zero or one application container. If a PDB belongs to an application container, then it is an application
PDB . For example, the cust1_pdb and cust2_pdb application PDBs might belong to the saas_sales_ac application container, in
which case they belong to no other application containers. An application seed is an optional application PDB that acts as
a user-created PDB template, enabling you to create new application PDBs rapidly.
- Exactly one seed PDB
- The seed PDB is a system-supplied template that the CDB can use to create new PDBs. The seed PDB is named
PDB$SEED . You cannot add or modify objects in
PDB$SEED .
The follwoing is an example of how to create a Container database on Windows 2012 R2 Server. This can be used by StarTeam
Server.
- Create a new database using Database Configuration Assistant ( DBCA) and check the "Create as Container database" Option and
provide the name of the pluggable database. For This example, define the instance name as StarTeam and Pluggable database
name as st_plug.
- Go to Command Prompt
- export ORACLE_SID=starteam ( the pluggable database instance name)
- sqlplus / as sysdba
- SELECT name, pdb FROM v$services ORDER BY name and ensure that the container st_plug exists.
- alter session set container=st_plug;
- create user starteam identified by test container=current;
- Run the following statements
- grant unlimited tablespace to starteam;
- grant create session to starteam;
- grant create table to starteam;
- grant create view to starteam;
- grant create procedure to starteam;
- grant create sequence to starteam;
- grant create trigger to starteam;
- grant create type to starteam;
- grant create any context to starteam;
- grant drop any context to starteam;
- Create a Tnsnames.ora entry in the $OracleHome/Network/Admin/Tnsnames.ora file. Here is a sample entry
St_plug =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =
cmv-orapdb)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = st_plug )
)
)
REMEMBER: This feature requires the
StarTeam Administrator to create a database manually. The option "Create new
StarTeam Database" should be unchecked ( See the screen shot below) and use tnsnames option for using an already created database
( Seen the second screen shot below ) . The database should be created using the steps described above.