In Oracle Database 12c Release 1, the concept of multi-tenant environment has been introduced. The multi-tenant architecture enables an Oracle database to function as a multi-tenant container database (CDB) that includes zero, one, or many customer-created pluggable databases (PDBs).
A CDB includes the following components:
Root named CDB$ROOT, stores Oracle-supplied metadata and common users. An example of metadata is the source code for Oracle-supplied PL/SQL packages. A common user is a database user known in every container.
A PDB appears to users and applications as if it were a non-CDB. For example, a PDB can contain the data and code required to support a specific application (e.g., APEX).
Each of these components is called a container. Therefore, the root is a container, the seed is a container, and each PDB is a container.
In this tutorial we will show two different types of configurations of Enterprise Manager Express one for CDB and the second for PDBs only. Imagine yourself as a dba who has full access to non-CDB/CDB/PDB, OEM Express 12c will allow you to manage CDB and all PDB containers from one central console. On the other hand you would like to allow regular users to login to OEM Express 12c as well, but grant them access to their PDBs only.
In our demo environment we have the following containers created:
CDB: ZIONDB,
PDBs: PDB01_OEM12c, PDB02_SOA12c
1. Open a terminal window, execute the oraenv
command to set the environment variables and connect to the multi-tenant container database (in our example ZIONDB) Check if the database is a CDB database and it is open.
[oracle@zeus ~]$ . oraenv ORACLE_SID = [oracle] ? ZIONDB [oracle@zeus ~]$ sqlplus / as sysdba Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 64bit ... SQL> select name, cdb, con_id from v$database; NAME CDB CON_ID --------- --- ---------- ZIONDB YES 0 SQL> select instance_name, status, con_id from v$instance; INSTANCE_NAME STATUS CON_ID ---------------- ------------ ---------- ZIONDB OPEN 0
2. Verify that the DISPATCHERS
parameter in the initialization parameter file includes the PROTOCOL=TCP
attribute.
SQL> show parameter dispatchers NAME TYPE VALUE ------------------ ----------- ------------------------------ dispatchers string (PROTOCOL=TCP) (SERVICE=ZIONDBXDB) max_dispatchers integer
3. Execute the DBMS_XDB.setHTTPSPort
procedure to set the HTTPS port 5500 and the DBMS_XDB.setHTTPPort
procedure to set the HTTP port 5510 for EM Express
SQL> exec DBMS_XDB_CONFIG.SETHTTPSPORT(5500); SQL> exec DBMS_XDB_CONFIG.SETHTTPPORT(5510); PL/SQL procedure successfully completed.
5. Login to Database EM Express Home Page.
https://<IP:Hostname>:5500/em and http://<IP:Hostname>:5510/em
Note: Now we have the privileges to manage CDB and PDBs containers
We are configuring EM Express for PDB01_OEM12c container to run on ports: HTTPs 5501 and HTTP 5511.
1. Display all pluggable databases and their status
SQL> select NAME, OPEN_MODE from v$pdbs; NAME OPEN_MODE ------------------------------ ---------- PDB$SEED READ ONLY PDB01_OEM12C READ WRITE PDB02_SOA12C READ WRITE
2. Alter the session and set container as PDB01_OEM12C
SQL> alter session set container=PDB01_OEM12C; Session altered.
3. Execute the DBMS_XDB.setHTTPSPort
procedure to set the HTTPS port 5501 and the DBMS_XDB.setHTTPPort
procedure to set the HTTP port 5511 for EM Express
SQL> exec DBMS_XDB_CONFIG.SETHTTPSPORT(5501); SQL> exec DBMS_XDB_CONFIG.SETHTTPPORT(5511); PL/SQL procedure successfully completed.
5. Login to Database EM Express home page.
https://<IP:Hostname>:5501/em and http://<IP:Hostname>:5511/em
Note that you have privileges to managed only PDB PDB01_OEM12C
Repeat recent steps from 2 to 5 to configure EM Express for more PDBs.
Alter session to CDB or PDB container and execute the SQL statement that returns the port that is configured for EM Express
SQL> select DBMS_XDB_CONFIG.GETHTTPPORT() from dual; DBMS_XDB_CONFIG.GETHTTPPORT() ----------------------------- 5511 SQL> select DBMS_XDB_CONFIG.GETHTTPSPORT() from dual; DBMS_XDB_CONFIG.GETHTTPSPORT() ------------------------------ 5501
If returned port number is 0, it means that EM Express is not configured for that particular container.
Cheers!!