How to connect to a PDB using Oracle EM Express

This post is more like a reminder to myself on how to do this (I have a bad memory…)

By default EM Express is configured for a non-CDB or for a CDB depending on what you selected during a 12C installation and the default URL is https://hostname:5500/em

You can confirm this by looking at the database name (ora12cr1) that is displayed on the top left corner.

em_exp_cdb

To be able to connect to a PDB using EM Express, we need to configure another port using the DBMS_XDB_CONFIG.SETHTTPSPORT() procedure. To complete this setup, first we have to connect to the PDB and make sure it’s open and then we have to configure the https port for the PDB.

C:\Users\gbalda>sqlplus

SQL*Plus: Release 12.1.0.1.0 Production on Thu Aug 1 21:14:17 2013

Copyright (c) 1982, 2013, Oracle. All rights reserved.

Enter user-name: sys as sysdba
Enter password:
Last Successful login time: Thu Aug 01 2013 21:08:44 -05:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> show user
USER is "SYS"
SQL> alter session set container = ora12cpdb1
 2 ;

Session altered.

SQL> select name, open_mode from v$pdbs;

NAME OPEN_MODE
------------------------------ ----------
ORA12CPDB1 MOUNTED

SQL> alter pluggable database open read write;

Pluggable database altered.

SQL> select name, open_mode from v$pdbs;

NAME OPEN_MODE
------------------------------ ----------
ORA12CPDB1 READ WRITE
SQL> select dbms_xdb_config.gethttpsport from dual;

GETHTTPSPORT
------------
SQL> exec dbms_xdb_config.sethttpsport(5501);

PL/SQL procedure successfully completed.

Now the URL for the PDB is going to be https://hostname:5501/em and you can confirm it’s the PDB once you connect and look at the name displayed (ora12cpdb1) on the top left corner.

em_exp_pdb

The same process can be repeated for other PDBs on your system.


7 Comments on “How to connect to a PDB using Oracle EM Express”

  1. […] Much like having to activate a PDB before being able to connect to it, EM GUI per PDB has to activated independently.  I found all the information I needed in this great post.    […]

  2. simple pero completa explicación, muchas gracias.

  3. Mark Risman says:

    Lifesaver, thanks. This got me past this problem:

    SQL> alter session set container=MYPDB;
    Session altered.

    SQL> select dbms_xdb_config.gethttpsport() from dual;
    select dbms_xdb_config.gethttpsport() from dual
    *
    ERROR at line 1:
    ORA-00904: “DBMS_XDB_CONFIG”.”GETHTTPSPORT”: invalid identifier

    SQL> exec DBMS_XDB_CONFIG.SETHTTPSPORT(5502);
    BEGIN DBMS_XDB_CONFIG.SETHTTPSPORT(5502); END;
    *
    ERROR at line 1:
    ORA-06550: line 1, column 7:
    PLS-00201: identifier ‘DBMS_XDB_CONFIG.SETHTTPSPORT’ must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored

    *beats head against wall*

    Then, based on your post:

    SQL> select name, open_mode from v$pdbs;
    NAME OPEN_MODE
    —————————— ———-
    RISPDB MOUNTED

    SQL> alter pluggable database open read write;
    Pluggable database altered.

    SQL> select dbms_xdb_config.gethttpsport() from dual;
    DBMS_XDB_CONFIG.GETHTTPSPORT()
    ——————————

    SQL> exec DBMS_XDB_CONFIG.SETHTTPSPORT(5502);
    PL/SQL procedure successfully completed.


Leave a comment