How To Setup 19c Oracle Cloud Database Express On The Same Port For CDB and PDB

How To Setup 19c Oracle Cloud Database Express On The Same Port For CDB and PDB

December 6, 2019 Off By dianarobete

Last week we configured the EM Express, or better said Oracle Cloud Database Express (this is the official name in 19c) and you’ve learned how to connect to the CDB and the PDB using the tool.

Do you like the fact that the PDB/CDB are using different ports for connecting to Oracle Cloud Database Express?

Wouldn’t it be nice to use only one port and have access to the PDB and the CDB as well? Imagine if you have 10 PDBs within a CDB, and each one has a different port! What a nightmare… You would need to track the ports in a separate spreadsheet in order to remember them.

Let’s figure out today how we can use one port only for all the PDBs within a CDB, including the root container.

For those of you that do not know what a PDB (pluggable database) and a CDB (container database) is, check out one of my oldest post here for the terminologies.

This is what my current setup is:

Oracle 19c on Windows
CDB name: TESTDB
PDB name: TESTDBPDB

Oracle Cloud Database Express site for the CDB: https://desktop-kdo21sg:5500/em/login
Oracle Cloud Database Express site for the PDB: https://desktop-kdo21sg:5502/em/login

Notice I am using two different ports above to connect to the PDB and CDB.

If you need help setting this up, check out last week’s post.

What my goal is: use a single URL for the Oracle Cloud Database Express to connect to the PDB or CDB: https://desktop-kdo21sg:5500/em/login

Step 1 Check if the use of Global Port for Oracle Cloud Database Express is enabled in the CDB

In order to check the the setting, you can use the following function: dbms_xdb_config.ISGLOBALPORTENABLED, which returns TRUE if enabled, and FALSE if it’s not enabled.

connect to the root container and issue the following:

sqlplus / as sysdba

declare
l_value boolean;
begin
l_value :=dbms_xdb_config.ISGLOBALPORTENABLED;
if l_value then
dbms_output.put_line ('Enabled');
else
dbms_output.put_line ('Not Enabled');
end if;
end;
/

Step 2 Enable Global Port in the CDB:

If the Global Port is not enabled, then you must enable it in the CDB. This operation takes place only in the CDB.

exec dbms_xdb_config.SetGlobalPortEnabled(TRUE);

Step 3 Verify if the https port is set in the other PDBs.

In the previous blog post I set the https port for the PDB to 5502. If you have done the same thing, then you must reset the port to 0 (un-set it).

select dbms_xdb_config.gethttpsport() from dual;

The above command returned 5502 for me.

To reset:

exec DBMS_XDB_CONFIG.SETHTTPSPORT(0);
select dbms_xdb_config.gethttpsport() from dual;

Step 4 Verify you can connect to the CDB and PDB using the same port 5500

Using the URL: https://desktop-kdo21sg:5500/em/login

You will notice on the next screenshot that we are connected to the root container.

Connecting to the PDB:

You will notice on the next screenshot that we are connected to the PDB.

It worked!

Your homework for this week is to setup your CDB/PDB to use the same port! You can also create another PDB, and see if you can connect to that one as well using the same port.

If you enjoyed this article, and would like to learn more about databases, please sign up to my weekly email, and you will receive

The Ultimate 3 Step Guide To Find The Root Cause Of The Slow Running SQL!