In this article I will show you how you can manually configure a HTTPS port for Oracle Enterprise Manager. Using these steps, you can set https port for any container whether it’s root container or a pluggable container of the Oracle Database.
In the newer versions of Oracle database, specially which are based on multi-tenant architecture, the oracle engine differentiates between login from a CDB and a PDB through the port number which we use in the URL of the oracle enterprise manager.
Why configure HTTPS port for Oracle Enterprise Manager?
If you are one of those curious kids, then you must be wondering “what is the need of manually configuring a port for Oracle Enterprise Manager?”
There are two main reasons for configuring a port for Oracle Enterprise Manager. These are –
To access the Oracle EM
As Oracle Enterprise manager is a web-based database management tool thus we need a proper URL to access it. That URL is made up of two main components, which are – Domain name and Port Number.
You can click here to read how to find out the domain name and the default port number of the database.
Using default port number for Oracle Enterprise Manager is never recommended. As default port numbers are easier to exploit by hackers. Therefore, it’s always advisable to change the default port number of your OEM Express.
How to Configure the Port Number for Oracle Enterprise Manager.
Manually configuring the https port number for Oracle Enterprise Manager is a 3 step process. These steps are –
- Switch the Container
- Open the Database
- Set the Port Number
But before I start explaining these steps, let me tell you about the Oracle Database setup that I am using for this demonstration.
My Setup for The Demonstration –
For the demonstration I am using Oracle Database 19c which has one root container database CDB$ROOT and one pluggable database ORCLPDB.
Additionally, I will be configuring the port number for my pluggable database orclpdb.
Though I am using Oracle 19c, but the process will be same for Oracle 12c or 18c. Moreover it will be same for any Oracle Database version which is based on multi-tenant architecture.
You can click here to learn how to install Oracle Database 19c.
Let’s come back to the process of configuring the port number for Oracle Enterprise Manager.
Step 1: Switch the Container
You need to connect with the container for which you want to set the https port.
In order to do that you first need to connect with the database.
sqlplus / as sysdba
This statement will connect you with your database using the sys user. And we know that in multi-tenant architecture of the Oracle, by default, we are always connected with the database through the root container.
Which means on execution of the above command you will be connected with your database through the root container CDB$ROOT.
You can verify that like this –
Consequently, this command will show you the container name with which you are connected with your database.
Nevertheless, as I mentioned earlier that I want to set the https port for my pluggable database orclpdb. Thus, I need to switch my container from CDB$ROOT to orclpdb.
ALTER SESSION SET CONTAINER = orclpdb;
This ALTER SESSION DDL will switch the container to orclpdb. That’s all you have to do to switch the containers.
You can replace “orclpdb” with the name of your desired container database. It could be a root container or pluggable container.
Step 2: Open the Database
We need to make sure that database is open for read and write operation in order to perform any action.
You can query the v$pdbs view and verify its open mode. Like this –
COLUMN name FORMAT a10; SELECT name, open_mode FROM v$pdbs;
Consequently, this select statement will show you whether your database with which you are currently connected is open or not.
If it is open, then the open mode will be “Read Write”. Otherwise it will be “Mounted”. Nevertheless, if your database is already open, then please skip this step.
But in case your database is closed or its open mode is “mounted” then you will have to open it. And for that you have to run an ALTER DDL statement. Like this –
ALTER PLUGGABLE DATABASE open;
This statement will open your database.
Step 3: Set the Port Number
Now we have done all the necessary settings. That means we are ready to move ahead and set the https port for the enterprise manager.
And for that we will have to execute a stored procedure. That stored procedure is “sethttpsport”.
This procedure is also created inside the “dbms_xdb_config” package of the Oracle Database library similar to “gethttpsport” function.
The “sethttpsport” procedure takes only one integer type argument and sets that argument as a https port for the database to which you are presently connected.
You need to make sure of two things while specifying this argument –
- This argument should be of number data type. No character, no string and no varchar.
- Second, this argument must always be a valid port number.
Whatever port number you are specifying here must be free otherwise you will get an error.
Click Here to learn more about PL/SQL Stored Procedure.
Now that you have got an idea about what “sethttpsport” procedure is, let’s move ahead and use it to set a port number for our database orclpdb.
EXEC dbms_xdb_config.sethttpsport (5510);
Here I have specified 5510 as the argument for sethttpsport procedure. Furthermore this procedure on execution will set the said number as the https port for my pluggable database orclpdb.
Once you are done then you can use that port number to connect with your Oracle Enterprise Manager Database Express.
In my case the URL for accessing the Oracle EM was
Since we have configured the port for HTTPS protocol thus make sure to specify https in the url not the HTTP.
I have used the sys user to login to my oracle enterprise manager. Therefore the user name will be “sys”. In addition, I have set ‘Oracle’ as the password for my sys user during the installation. This could be different in your case.
So that is the process of manually configuring the https port number for your database. You can use this process and set the port number for any database whether it is root container or a pluggable. Or whether it’s pre-defined or user defined database.
Moreover You can watch the video and see the live demonstration of this process.
In conclusion that’s how we manually configure the HTTPS port for the Oracle Enterprise Manager. Hope you enjoyed Reading. But if you still have doubts then feel free to drop me a message on my Facebook Page.
Please do subscribe to the YouTube channel. Also share this blog on your social media.
Thanks and have a great day.