EMCA Fails with Error ORA-12541

APPLIES TO

Operating System - Red Hat Enterprise Linux Server 7.9
Oracle Database - Enterprise Edition - Version 11.2.0.4
Oracle Grid Infrastructure - Version 11.2.0.4

SYMPTOMS

Enterprise Manager Configuration Assistant (EMCA) fails with error:

[oracle@sj-node2 ~]$ emca -repos drop

STARTED EMCA at Aug 10, 2023 2:52:19 PM
EM Configuration Assistant, Version 11.2.0.3.0 Production
Copyright (c) 2003, 2011, Oracle. All rights reserved.

Enter the following information:
Database SID:
Database SID: coco
Listener port number: 1158
Password for SYS user:
Password for SYSMAN user:
Password for SYSMAN user:
----------------------------------------------------------------------
WARNING : While repository is dropped the database will be put in quiesce mode.
----------------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: y
Aug 10, 2023 2:52:46 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/coco/emca_2023_08_10_14_52_19.log.
Aug 10, 2023 2:52:46 PM oracle.sysman.emcp.ParamsManager checkListenerStatusForDBControl
WARNING: ORA-12541: TNS:no listener

Aug 10, 2023 2:52:46 PM oracle.sysman.emcp.EMConfig perform
SEVERE:

Database connection through listener failed. Fix the error and run EM Configuration Assistant again.

Some of the possible reasons may be:

1) Listener port 1158 provided is incorrect. Provide the correct port.
2) Listener is not up. Start the Listener.
3) Database service coco is not registered with listener. Register the database service.
4) Listener is up on physical host and ORACLE_HOSTNAME environment variable is set to virtual host. Unset ORACLE_HOSTNAME environment variable.
5) Listener is up on virtual host. Set environment variable ORACLE_HOSTNAME=<virtual host>.
6) /etc/hosts does not have correct entry for hostname.

Refer to the log file at /u01/app/oracle/cfgtoollogs/emca/coco/emca_2023_08_10_14_52_19.log for more details.
Could not complete the configuration. Refer to the log file at /u01/app/oracle/cfgtoollogs/emca/coco/emca_2023_08_10_14_52_19.log for more details.

The Listener is running.

[oracle@sj-node2 ~]$ lsnrctl status LI_COCO

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 10-AUG-2023 15:12:40

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=vip1)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LI_COCO
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 10-AUG-2023 12:14:56
Uptime 0 days 2 hr. 57 min. 43 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0.4/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/sj-node2/li_coco/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.3.248)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "coco" has 1 instance(s).
Instance "coco", status READY, has 1 handler(s) for this service...
Service "cocoXDB" has 1 instance(s).
Instance "coco", status READY, has 1 handler(s) for this service...
The command completed successfully

Check that the /etc/hosts file is correctly.

[root@sj-node2 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.3.249 sj-node1
192.168.3.250 sj-node2
100.100.100.249 sj-node1-hb
100.100.100.250 sj-node2-hb
192.168.3.54 fedora
192.168.3.248 vip1

CAUSE

EMCA Fails With Error "ORA-12541: TNS:no listener" and "Listener is not up. Start the Listener and run EM Configuration Assistant again" (Doc ID 975024.1)

There could be several causes for this error message such as:

  1. The listener is actually down.
  2. The listener is running on a different port to the one specified by the user in the input to the EMCA commands.
  3. The machine has multiple NICS/IP addresses, and the hostname used by EMCA does not match the hostname used by the listener
  4. Incorrectly configured hosts file

SOLUTION

set ORACLE_HOSTNAME environment variable.

set ORACLE_HOSTNAME=vip1