Normally failure of oracle utility commands occurs from improper environmental parameters or configuration problems. This procedure shows the steps in resolving oracle error ORA-12541 during execution of EMCA repository creation.
Initial Error:
[oracle@mylinux1 ~]$ emca -repos create
STARTED EMCA at Apr 7, 2014 4:31:20 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: ORCL
Listener port number: 1521
Password for SYS user:
Password for SYSMAN user:
Do you wish to continue? [yes(Y)/no(N)]: Y
Apr 7, 2014 4:31:36 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /opt/app/oracle/cfgtoollogs/emca/ORCL/emca_2014_04_07_16_31_19.log.
Apr 7, 2014 4:31:36 PM oracle.sysman.emcp.ParamsManager checkListenerStatusForDBControl
WARNING: ORA-12541: TNS:no listener
Apr 7, 2014 4:31:36 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 1521 provided is incorrect. Provide the correct port.
2) Listener is not up. Start the Listener.
3) Database service ORCL 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 /opt/app/oracle/cfgtoollogs/emca/ORCL/emca_2014_04_07_16_31_19.log for more details.
Could not complete the configuration. Refer to the log file at /opt/app/oracle/cfgtoollogs/emca/ORCL/emca_2014_04_07_16_31_19.log for more details.
[oracle@mylinux1 ~]$
Solution:
1. Validate listener port is 1521 with command “netstat -tulpn|grep 1521”:
[oracle@mylinux1 ~]$ netstat -tulpn|grep 1521
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 192.168.1.120:1521 0.0.0.0:* LISTEN 10883/tnslsnr
udp 0 0 :::15212 :::* 1831/ora_p025_ORCL
[oracle@mylinux1 ~]$
NOTE: Oracle is listening on port 1521 with process 10883/tnslsnr. If the oracle listener is not on port 1521, open the file listener.ora to determine the correct port.
2. Validate that the Listener is up with command “ps -ef|grep tns”:
[oracle@mylinux1 ~]$ ps -ef|grep tns
root 90 2 0 Apr01 ? 00:00:00 [netns]
oracle 10883 1 0 Apr01 ? 00:03:54 /opt/app/oracle/ORCL_db/bin/tnslsnr LISTENER -inherit
oracle 21669 20714 0 16:45 pts/0 00:00:00 grep tns
[oracle@mylinux1 ~]$
NOTE: The listener is up with process id of 10883. If the listener is not running, start the listener with command: “lsnrctl start”
3. Verify that the Database service ORCL is registered with listener by using the command “tnsping ORCL”:
[oracle@mylinux1 ~]$ tnsping ORCL
TNS Ping Utility for Linux: Version 11.2.0.3.0 – Production on 07-Apr-2014 16:47:16
Copyright (c) 1997, 2011, Oracle. All rights reserved.
Used parameter files:
/opt/app/oracle/ORCL_db/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.120)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORCL) (SID = ORCL)))
OK (200 msec)
[oracle@mylinux1 ~]$
NOTE: The ORCL service is register with the listener. If it is not, edit the file listener.ora to add the service.
4. Verify that ORACLE_HOSTNAME is set with command “echo $ORACLE_HOSTNAME”:
[oracle@mylinux1 ~]$ echo $ORACLE_HOSTNAME
[oracle@mylinux1 ~]$
NOTE: the ORACLE_HOSTNAME variable is not set, set the ORACLE_HOSTNAME variable with the command “export ORACLE_HOSTNAME=mylinux1” NOTE: place this variable in your bash startup profile.
[oracle@mylinux1 ~]$ export ORACLE_HOSTNAME=mylinux1
[oracle@mylinux1 ~]$ echo $ORACLE_HOSTNAME
mylinux1
[oracle@mylinux1 ~]$
5. Same as step 4 but using virtual hostname.
6. Verify that the file /etc/hosts contains the hostname of current system with command “cat /etc/hosts”
[oracle@mylinux1 ~]$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 mylinux1 mylinux1.mydomain.com
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 mylinux1 mylinux1.mydomain.com
192.168.1.120 mylinux1 mylinux1.mydomain.com
[oracle@mylinux1 ~]$
NOTE: The hostname is in the /etc/hosts file. But if it is not edit the file /etc/hosts.
7. Re-execute the EMCA command for successful completion:
[oracle@mylinux1 ~]$ emca -repos create
STARTED EMCA at Apr 7, 2014 4:59:36 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: ORCL
Listener port number: 1521
Password for SYS user:
Password for SYSMAN user:
Do you wish to continue? [yes(Y)/no(N)]: Y
Apr 7, 2014 5:00:12 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /opt/app/oracle/cfgtoollogs/emca/ORCL/emca_2014_04_07_16_59_35.log.
Apr 7, 2014 5:00:13 PM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) …
Apr 7, 2014 5:14:27 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Enterprise Manager configuration completed successfully
FINISHED EMCA at Apr 7, 2014 5:14:27 PM
[oracle@mylinux1 ~]$
Larry Catt, OCP