SetGlobalPortEnabled By Manish Sharma

Wondering why you need to set global port for Oracle Enterprise Manager? Let’s see. So far, one thing about Oracle Enterprise Manager database express which is very clear to us is that 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 enterprise manager.

However, the only problem with this new feature of Database Express is that it could cause confusion if not handled properly. Nevertheless, let me explain to you how –

Problem Statement –

Imagine you are a DBA who is handling a database which has 1 root container. And, that root container has 1024 pluggable databases.

You will need to know its respective port number in order to log into the Oracle EM using that root container. However, if we want to log into the Oracle EM using any one of those Pluggable databases then you need to use their respective https port number.

And here comes the problem. Keeping a tab on those pluggable databases and their respective HTTPS port number will become a hassle which nobody wants to have.

Solution –

Now think, what if we can log into the Oracle Enterprise Manager Database Express using the port number of the root container. Therefore, somehow if we could figure that out then we can use a single URL to log into all the root as well as pluggable databases.

So, the good news is that we can implement this solution. And, in this tutorial this is exactly what you are going to learn –

Set Global Port Enabled for Oracle Enterprise Manager–

We enable the global port for the Oracle EM using the setGlobalPortEnabled procedure. This procedure enables Oracle Enterprise Manager Database Express (EM Express) clients to use a single port (called a global port), for the session rather than using a port dedicated to the PDB.

Moreover, this procedure is also created inside the DBMS_XDB_CONFIG package just like all other procedure and functions that we have learnt in this series.

Also, this procedure takes only one argument. It could either be TRUE or FALSE.

Thereofre, if it is set to TRUE, then this procedure will enable the global port. And, if set to FALSE then global https port will be disabled.

What Will setGlobalPortEnabled Procedure Do?

On successful execution, this procedure makes the https port of the root container database a global https port. Meaning you can use the https port of your root container database to log into the oracle enterprise manager using whatever pluggable database you want. As long as that pluggable database is connected or created inside that particular root container.

How to Set Global Port for Oracle Enterprise Manager –

So, here is the process of enabling global port for your Oracle EM –

Step 1: Log onto your Oracle Database

First you need to log on to your Oracle Database through the Root container using the sys user –

SQLPLUS / as sysdba

The above statement will connect you to your database using the sys user. Besides, we know that in multi-tenant architecture by-default we are connected with the database through the root container. Therefore, after executing the above statement you must be connected to your database through the root container.

Furthermore, you can check this simply by writing the following command –

SHOW con_name;

This statement will show you the container name through which you are currently connected.

Suggested Reading – How To Connect With Oracle Database Using SQL Developer

Step 2: Execute the procedure –

In addition, once you have established a connection with your database next you have to execute the setGlobalPortEnabled procedure.

Since this procedure is created inside the DBMS_XDB_CONFIG package thus to execute it we need to use the dot notation. Where we first write the name of the package followed by the dot (.) and then the name of the procedure. Like this –

EXEC DBMS_XDB_CONFIG. setglobalportenabled (TRUE)

Moreover we must specify “TRUE” as the argument of the said procedure since we are configuring the global port for the Oracle Enterprise Manager. However in case, you want to disable the global port for your Oracle EM then you simply have to write “False” on the place of “TRUE” and execute the procedure.

Nonetheless, after executing the above command you will be able to log into the Oracle Enterprise Manager using whatever pluggable database you want.

Just make sure that, that pluggable database must be created and plugged into the root container using which you have executed the procedure.

How To Check If The Global Port Is Enabled or Not?

Furthermore to check if the global port is enabled or not you can take help of another procedure of the same package DBMS_XDB_CONFIG. And, that procedure is isGlobalPortEnabled.

Therefore, you can write or copy this anonymous PL/SQL block.

    gPort boolean;
    gPort := DBMS_XDB_config.isglobalportenabled;
    if gPort THEN
        DBMS_OUTPUT.PUT_LINE('Global Port is Enabled');
        DBMS_OUTPUT.PUT_LINE('Global Port is Not Enabled');
    END IF;

Click Here to Read More About PL/SQL Blocks

Conditions of setGlobalPortEnabled procedure — 

In order to set the global port for your Oracle Enterprise Manager, you need to take care of two conditions. These are –

  1. Global port must be enabled not only for the root container but also for all the pluggable databases, which are configured into that root container.

Consequently, by default the global port is disabled only for the root container but for the pluggable container its always enabled. Therefore, you only need to enable it for the root container.

  1. Additionally, you need to make sure that the pluggable database is open for all read write operations in order to log into the Oracle Enterprise Manager through a pluggable database.

But unfortunately by default all the pluggable databases are mounted. Meaning they are not open for read write operations.

Login to your Oracle Enterpriser Manager –

Therefore, once you have successfully followed the above procedure then you must be able to log into your Oracle Enterprise Manager Database Express using any Pluggable database of your root container.

Besides that you can use your sys or system user for login. For example, if you decide to log into your Oracle EM using the sys user then your login Credentials will be –

Username – sys
Password – Your Password 
Container Name – name of the pluggable database container 

Moreover, if you want to log in into your Oracle EM using the no-admin user like HR, SH or whatever user you have created then I suggest you follow this guide –

How to Login into The Oracle EM Using Non-Admin User By Manish Sharma

That’s it for this tutorial. Furthermore, for live demonstration feel free to watch this video –

Also, if you still have any doubts then drop a message on my Facebook. Thanks, and have a great day!