Thursday, September 10, 2015

emctl is not working in oracle 12c and How to manually configure EM Express

From oracle 12c, there is no command like “emctl start dbconsole” because, in 12c there is no DBCONSOLE ( no middle-tier for EM). In replace Oracle has introduced EM Express.

What is EM Express and its Architecture?

Oracle Enterprise Manager Database Express, also referred to as EM Express, is a web-based tool for managing Oracle Database 12c. Built inside the database server, it offers support for basic administrative tasks such as storage and user management, and provides comprehensive solutions for performance diagnostics and tuning.. 
EM Express is designed to be lightweight and to incur minimal overhead on the database server. In order to achieve this goal, EM Express is built inside the Oracle Database and only uses internal infrastructure components. . such as XDB and SQL*Net. It does not require any separate middle-tier components.

Since EM Express is built inside the database, the database has to be open in order to use EM Express, and EM Express cannot perform actions outside the database.

EM Express does not have background tasks or processes that periodically collect information. Instead, it utilizes data that is already collected by the database. Data is requested only when the user interacts with the UI and all UI processing is done in the browser, thus minimizing load on the database server.

By default EM Express will install by DBCA while you will create a database in oracle 12C, you just need invoke it via

https://full-database-hostname:portnumber/em/

for this you need to know the port number. 


How can I find the HTTP/HTTPS port for EM Express

from SQL*Plus:
SQL> select dbms_xdb.getHttpPort() from dual; ---http port

GETHTTPPORT
-----------
       5500

SQL> select dbms_xdb_config.getHttpsPort() from dual;--https

GETHTTPSPORT
------------
        5500


Privilige for EM express

EM_EXPRESS_BASIC or EM_EXPRESS_ALL role

SQL> grant EM_EXPRESS_BASIC to scott ;
  


By default EM Express is installed by DBCA when you will create a database but still you can configure your OWN. Please see in below.



Manually configure the EM Express in Oracle 12c


  1. Configure and start the Oracle Listener.
  2) Assign local_listener parameter value ( If listener is         running     on a nonstandard port. for example, not 1521)
The local_listener entry references a TNSNAMES entry that points to the correct listener.
So you can set it like : 

SQL> alter system set local_listener = orcl ; --(orcl is the tnsnames)

or 
 
SQL> alter system set local_listener = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=host_name)(PORT=1526)) (CONNECT_DATA=(SERVICE_NAME=service_name)(SERVER=DEDICATED)))' ;


  1. Enable the TCP dispatcher by adding the following entry to the init.ora file for the database you want to manage using EM Express:
dispatchers="(PROTOCOL=TCP)(SERVICE=ORCLXDB)" ---here ORCL is the SID name .
SQL> alter system set dispatchers="(PROTOCOL=TCP)(SERVICE=ORCLXDB)" ;


  1. Then Restart the database so that the changes made can take effect.

  1. Set the HTTPS/HTTP port for EM Express
Connect with SYS then,
      For a Non-Container Database : 

      SQL> exec DBMS_XDB_CONFIG.SETHTTPSPORT(5500);

      For Container Database: 
      SQL> alter session set container=CDB$ROOT;
      SQL> exec DBMS_XDB_CONFIG.SETHTTPSPORT(5507);
        For PDB (plug-gable Database)
        SQL> alter session set container=PDB1;
        SQL> exec DBMS_XDB_CONFIG.SETHTTPSPORT(5508);
6) Use the following command to confirm that the port has registered with the listener:
cmd> lsnrctl status | grep -i 5507 ---(port number)
7) For accessing to EM express

https://full_database-hostname:portnumber/em/

For example:
https://myserver.test.com:5500/em/

Cheers...Halim