About Me

My photo
Bangalore, India
I am an Oracle Certified Professional working in SAP Labs. Everything written on my blog has been tested on my local environment, Please test before implementing or running in production. You can contact me at amit.rath0708@gmail.com.
Showing posts with label listener. Show all posts
Showing posts with label listener. Show all posts

Monday, September 1, 2014

Oracle Error starting listener: "Failed to start service, error 0"

Today I faced Below error when I was trying to start listener in my Windows machine :-

C:\Users\NewAdmin>lsnrctl start

LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 01-SEP-2014 21:40:10

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

Starting tnslsnr: please wait...

Failed to start service, error 0.

I checked the log in G:\app\NewAdmin\cfgtoollogs\netca also I got below message :-

[AWT-EventQueue-0] [ 2014-09-01 20:37:08.704 IST ] [WindowsSystem.dorunRemoteExecCmd:2078]  _WS_: remote command executed, but didn't return zero.
[AWT-EventQueue-0] [ 2014-09-01 20:37:08.704 IST ] [GETCRSHOMEUtil.getCRS_HOME:147]  cmdTool.execute() failed.
[AWT-EventQueue-0] [ 2014-09-01 20:37:08.706 IST ] [HAUtils.isHASConfigured:364]  Ignoring exception in isHASConfigured: PRCT-1400 : getcrshome execution failed. Detailed error:
localnode
[AWT-EventQueue-0] [ 2014-09-01 20:37:08.707 IST ] [HAUtils.isHASConfigured:365]  oracle.cluster.deployment.ClusterwareInfo.getConfiguredCRSHome(ClusterwareInfo.java:425)
oracle.sysman.assistants.util.hasi.HAUtils.getCRSHome(HAUtils.java:592)
oracle.sysman.assistants.util.hasi.HAUtils.getHASHome(HAUtils.java:652)
oracle.sysman.assistants.util.hasi.HAUtils.isHASConfigured(HAUtils.java:360)
oracle.net.ca.ConfigureListener.getLsnrsRegWithHA(ConfigureListener.java:557)
oracle.net.ca.ConfigureListener.getListeners(ConfigureListener.java:774)
oracle.net.ca.NetCA.prepareNextPage(NetCA.java:1220)
oracle.net.ca.NetCA.wizardValidatePage(NetCA.java:1036)
oracle.ewt.wizard.WizardPage.processWizardValidateEvent(Unknown Source)
oracle.ewt.wizard.WizardPage.validatePage(Unknown Source)
oracle.ewt.wizard.BaseWizard.validateSelectedPage(Unknown Source)
oracle.ewt.wizard.BaseWizard.doFinish(Unknown Source)
oracle.ewt.wizard.BaseWizard$Action.actionPerformed(Unknown Source)
oracle.ewt.button.PushButton.processActionEvent(Unknown Source)
oracle.ewt.button.PushButton.processEventImpl(Unknown Source)
oracle.ewt.lwAWT.LWComponent.redispatchEvent(Unknown Source)
oracle.ewt.lwAWT.LWComponent.processEvent(Unknown Source)
oracle.ewt.button.PushButton.activate(Unknown Source)
oracle.ewt.lwAWT.AbstractButton.processMouseReleased(Unknown Source)
oracle.ewt.lwAWT.AbstractButton.processMouseEvent(Unknown Source)
java.awt.Component.processEvent(Component.java:5282)
java.awt.Container.processEvent(Container.java:1966)
oracle.ewt.lwAWT.LWComponent.processEventImpl(Unknown Source)
oracle.ewt.button.PushButton.processEventImpl(Unknown Source)
oracle.ewt.lwAWT.LWComponent.redispatchEvent(Unknown Source)
oracle.ewt.lwAWT.LWComponent.processEvent(Unknown Source)
java.awt.Component.dispatchEventImpl(Component.java:3984)
java.awt.Container.dispatchEventImpl(Container.java:2024)
java.awt.Component.dispatchEvent(Component.java:3819)
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
java.awt.Container.dispatchEventImpl(Container.java:2010)
java.awt.Window.dispatchEventImpl(Window.java:1791)
java.awt.Component.dispatchEvent(Component.java:3819)
java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:153)
java.awt.Dialog$1.run(Dialog.java:535)
java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
[AWT-EventQueue-0] [ 2014-09-01 20:37:08.708 IST ] [ConfigureListener.getLsnrsRegWithHA:568]  HAS is installed but *NOT* Configured !!
[AWT-EventQueue-0] [ 2014-09-01 20:37:08.708 IST ] [ConfigureListener.getLsnrsRegWithCRS:650]  NOT a Cluster !!
[AWT-EventQueue-0] [ 2014-09-01 20:37:08.709 IST ] [ConfigureListener.getScanLsnrNames:693]  NOT a Cluster !!

[AWT-EventQueue-0] [ 2014-09-01 20:37:08.710 IST ] [ConfigureListener.getListeners:811]  Returning SI lsnrs = LISTENER

By checking the above its seems port was free but still it's not able to read the listener related files.

LSNRCTL status was giving me below message :-

C:\Users\NewAdmin>lsnrctl status

LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 01-SEP-2014 21:40:00

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=amit-PC)(PORT=9001)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   64-bit Windows Error: 61: Unknown error
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC9001)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener

   64-bit Windows Error: 2: No such file or directory

It seems LSNRCTL command was not able to read the listener related files from already set environment variables(ORACLE_HOME and PATH).

I checked the environment variables , In User level settings ORACLE_HOME and PATH variables was properly defined but in System level Settings ORACLE_HOME was set to another location. I changed it as its in USER level setting and then tried to start the listener and it started successfully. PFB output :-

C:\Users\NewAdmin>lsnrctl status

LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 01-SEP-2014 21:51:22

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=amit-PC)(PORT=9001)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Production
Start Date                01-SEP-2014 21:51:09
Uptime                    0 days 0 hr. 0 min. 15 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   G:\app\NewAdmin\product\11.1.0\db_1\network\admin\listener.ora
Listener Log File         g:\app\newadmin\diag\tnslsnr\amit-PC\listener\alert\log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=amit-PC)(PORT=9001)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
  Instance "CLRExtProc", status UNKNOWN, has 2 handler(s) for this service...
The command completed successfully

I hope this article helped you.

Regards,
Amit Rath

Monday, December 2, 2013

Difference between Static listener and Dynamic listener registrations

Database can be registered in two ways with a listener :-

1. Static Registration :- A static registration of database to a listener is used when we want to remotely start our database. Static registration is like hardcoding a instance details in listener.ora file. In a static registration an instance is registered with the listener whether its up or not. When a client request comes listener opens a dedicated connection , and server later find out that instance is not up then it gives error message as "Oracle not available". 

2. Dynamic Registration :- In Dynamic registration , registration is performed by PMON process. Once a Database instance starts, its PMON process registers instance details with associated listener. Dynamic registration does not require any manual configuration in the listener.ora file where as Static configuration does.From Oracle 8i dynamic configuration introduced. 

PFB listener.ora file having static configuration :-

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = AMIT)
      (ORACLE_HOME = /oracle_home/oracle/ora11g/product)
    )
    (SID_DESC =
      (SID_NAME = TEST)
      (ORACLE_HOME = /oracle_home/oracle/ora11g/product)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.11.1.10)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

ADR_BASE_LISTENER = /oracle_home/oracle

PFB listener.ora file having dynamic configuration :-

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.11.1.10)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

ADR_BASE_LISTENER = /oracle_home/oracle
As we can see dynamic configuration is much easier as compared to static configuration.

PFB listener status details when using Dynamic regitration :-

bash-3.2$ lsnrctl status

LSNRCTL for IBM/AIX RISC System/6000: Version 11.2.0.1.0 - Production on 02-DEC-2013 10:51:59

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=amit)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for IBM/AIX RISC System/6000: Version 11.2.0.1.0 - Production
Start Date                01-DEC-2013 16:19:04
Uptime                    10 days 18 hr. 32 min. 56 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      ON
Listener Parameter File   /oracle_home/oracle/ora11g/product/network/admin/listener.ora
Listener Log File         /oracle_home/oracle/diag/tnslsnr/new/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=amit)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "amit" has 1 instance(s).
  Instance "amit", status READY, has 1 handler(s) for this service...
Service "amitXDB" has 1 instance(s).
  Instance "amit", status READY, has 1 handler(s) for this service...
The command completed successfully

Above status as "READY" resembles that listener has checked instance details and found its status as up or running to handle client request.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=amit)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for IBM/AIX RISC System/6000: Version 11.2.0.1.0 - Production
Start Date                01-DEC-2013 16:42:04
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      ON
Listener Parameter File   /oracle_home/oracle/ora11g/product/network/admin/listener.ora
Listener Log File         /oracle_home/oracle/diag/tnslsnr/new/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=amit)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

Above status resembles that either Instance is not up, or its not been registered with listener.

PFB commands to register database instance with listerner if its not automatically registering with listener :-

bash-3.2$ sqlplus

SQL*Plus: Release 11.2.0.1.0 Production on Mon Dec 2 11:43:39 2013

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Enter user-name: /as sysdba

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> alter system register;

System altered.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
bash-3.2$ lsnrctl status

LSNRCTL for IBM/AIX RISC System/6000: Version 11.2.0.1.0 - Production on 02-DEC-2013 11:43:51

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=amit)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for IBM/AIX RISC System/6000: Version 11.2.0.1.0 - Production
Start Date                01-DEC-2013 16:44:04
Uptime                    0 days 0 hr. 1 min. 47 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      ON
Listener Parameter File   /oracle_home/oracle/ora11g/product/network/admin/listener.ora
Listener Log File         /oracle_home/oracle/diag/tnslsnr/new/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=amit)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "amit" has 1 instance(s).
  Instance "amit", status READY, has 1 handler(s) for this service...
Service "amitXDB" has 1 instance(s).
  Instance "amit", status READY, has 1 handler(s) for this service...
The command completed successfully

PFB listener status details when using static regitration also :-

bash-3.2$ lsnrctl status

LSNRCTL for IBM/AIX RISC System/6000: Version 11.2.0.1.0 - Production on 02-DEC-2013 11:50:28

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST= amit)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for IBM/AIX RISC System/6000: Version 11.2.0.1.0 - Production
Start Date                01-DEC-2013 18:10:27
Uptime                    0 days 02 hr. 40 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      ON
Listener Parameter File   /oracle/oracle/ora11g/product/network/admin/listener.ora
Listener Log File         /oracle/oracle/diag/tnslsnr/pacs3/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=amit)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "amit" has 2 instance(s).
  Instance "amit", status UNKNOWN, has 1 handler(s) for this service...
  Instance "amit", status READY, has 1 handler(s) for this service...
Service "amitXDB" has 1 instance(s).
  Instance "amit", status READY, has 1 handler(s) for this service...
The command completed successfully

Above status as "UNKNOWN" resembles that listener has not checked instance status details that whether its up or not, it has just registered the details of instance. So listener is not sure that whether instance can handle client request or not.

I hope this article helped you.

Regards,
Amit Rath

Wednesday, August 21, 2013

Local Listener vs Remote Listener in Oracle RAC

Concept of Local listener and Remote Listener comes with Oracle RAC database where a single database has multiple instances. PFB example to understand the concept of Local Listener and Remote Listener.

Consider a two node RAC database. It has following components :-

1. Two nodes named NODE1 and NODE2
2. Two listeners on both nodes named LISTENER1 on NODE1 and LISTENER2 on NODE2.
3. Two instances of database on both nodes named ORCL1 on NODE1 and ORCL2 on NODE2 and database name is ORCL

Now Listener1 is running on Node1 where database instance Orcl1 is present. Listener1 is considered as Local Listener for Orcl1 instance as its present on the same node where Orcl1 is running and Listener2 is considered as Remote Listener for Orcl1 instance as its running on different node as the database instance Orcl1.

Similarly, Listener2 is considered as Local Listener for Orcl2 instance as its present on the same node where Orcl2 is running and Listener1 is considered as Remote Listener for Orcl2 instance as its running on different node as the database instance Orcl2.

Purpose of Remote Listener is to connect all instances with all listeners so the instances can propogate their load balance advisories to all listeners. Listener uses the advisories to decide which instance should service client request. If listener get to know from advisories that its local instance is least loaded and should service client request then listener passes client request to local instance. If local instance is over loaded then listener can use TNS redirect to redirect client request to a less loaded instance means remote instance. This Phenomenon is also called as Server Side Load balancing.

PFB steps to configure Local and Remote listener configuration for both instances :-

Node1 :-

orcl1.local_listener=(address of listener_host1)
orcl1.remote_listener=(addresses of both listener_host1 and listener_host2)

Node2 :-

orcl2.local_listener=(address of listener_host2)
orcl2.remote_listener=(addresses of both listener_host1 and listener_host2)

Without Configuration of Remote Listener, each listener will only know about its local instance only and it don't have any knowledge about the load of remote instance. Listener will direct the Client request to local instance only whatever may be the load on local instance. Without this configuration we only left with Client Side Load Balancing.

I hope this article helped you.

Regards,
Amit Rath