Oracle restart and listener configuration

Preamble

When installing Oracle Grid Infrastructure for a Standalone Server you have the taste of Oracle Real Application Cluster (RAC) without it… The management of RAC components is a bit more complex but you have the added value of ASM and Oracle restart.

Changing port or name of listener processes is not straightforward as it was before with a normal Oracle home and flat files. Moreover by working the old way you may reach crazy situation where a listener called LISTENER is started and/or your listeners are not listening on correct ports.

Testing has been done on Oracle Enterprise Linux 5 with Oracle 11.2.0.2.0. In the following server name is server1 (with non routable IP 192.168.56.101) and instance names are +ASM and rac1 with respective listeners on 1531 and 1541 ports. Each Oracle home has been installed with a dedicated Unix account: oracrs for grid Infrastructure and orarac for database instance.

Oracle restart configuration

Oracle restart components are managed like if you were on a RAC cluster. Start by first deleting the default listener (LISTENER) listening on default 1521 port:

[oracrs@server1 /]$ srvctl remove listener -l LISTENER -f

Configure listener.ora and endpoints_listener.ora files like the following:

[oracrs@server1 /]$ cat $TNS_ADMIN/listener.ora
LISTENER_ASM=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_ASM))))
 
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_ASM=ON
[oracrs@server1 /]$ cat $TNS_ADMIN/endpoints_listener.ora
LISTENER_ASM=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=server1.domain.com)(PORT=1531)(IP=FIRST))))
[orarac@server1 /]$ cat $TNS_ADMIN/listener.ora
LISTENER_RAC1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_RAC1))))
 
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_RAC1=ON
[orarac@server1 /]$ cat $TNS_ADMIN/endpoints_listener.ora
LISTENER_RAC1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=server1.domain.com)(PORT=1541)(IP=FIRST))))

Then add the two resources to Oracle restart:

[oracrs@server1 /]$ srvctl add listener -l LISTENER_ASM -o /ora_crs/software -p 1531
[oracrs@server1 /]$ srvctl add listener -l LISTENER_RAC1 -o /ora_rac/software -p 1541

Then you can check that all has been done with something like:

[oracrs@server1 /]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       server1
ora.LISTENER_ASM.lsnr
               ONLINE  ONLINE       server1
ora.LISTENER_RAC1.lsnr
               ONLINE  ONLINE       server1
ora.asm
               ONLINE  ONLINE       server1                  Started
ora.ons
               OFFLINE OFFLINE      server1
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       server1
ora.diskmon
      1        ONLINE  ONLINE       server1
ora.evmd
      1        ONLINE  ONLINE       server1
ora.rac1.db
      1        ONLINE  ONLINE       server1                  Open

To get more information on your listener:

[oracrs@server1 admin]$ srvctl config listener
Name: LISTENER_ASM
Home: /ora_crs/software
End points: TCP:1531
Name: LISTENER_RAC1
Home: /ora_rac/software
End points: TCP:1541
[oracrs@server1 /]$ srvctl config listener -l LISTENER_ASM
Name: LISTENER_ASM
Home: /ora_crs/software
End points: TCP:1531

Then on ASM instance issue the following:

SQL> ALTER SYSTEM SET local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=server1.domain.com)(PORT=1531))))' scope=both;
 
SYSTEM altered.
 
SQL> show parameter lis
 
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
listener_networks                    string
local_listener                       string      (DESCRIPTION=(ADDRESS_LIST=(AD
                                                 DRESS=(PROTOCOL=TCP)(HOST=serv
                                                 er1.domain.com)(PORT=1531))))
remote_listener                      string

On your database instance you would issue similarly:

SQL> ALTER SYSTEM SET local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=server1.domain.com)(PORT=1541))))' scope=both;
 
SYSTEM altered.

Testing

You can test it at Oracle level with:

[oracrs@server1 /]$ lsnrctl status listener_asm
 
LSNRCTL FOR Linux: Version 11.2.0.2.0 - Production ON 24-MAY-2011 12:46:34
 
Copyright (c) 1991, 2010, Oracle.  ALL rights reserved.
 
Connecting TO (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_ASM)))
STATUS OF the LISTENER
------------------------
Alias                     LISTENER_ASM
Version                   TNSLSNR FOR Linux: Version 11.2.0.2.0 - Production
START DATE                24-MAY-2011 09:33:32
Uptime                    0 days 3 hr. 13 MIN. 2 sec
Trace LEVEL               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter FILE   /ora_crs/software/network/admin/listener.ora
Listener LOG FILE         /ora_crs/software/LOG/diag/tnslsnr/server1/listener_asm/alert/LOG.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_ASM)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.101)(PORT=1531)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) FOR this service...
The command completed successfully
[orarac@server1 admin]$ lsnrctl status LISTENER_RAC1
 
LSNRCTL FOR Linux: Version 11.2.0.2.0 - Production ON 24-MAY-2011 14:12:02
 
Copyright (c) 1991, 2010, Oracle.  ALL rights reserved.
 
Connecting TO (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_RAC1)))
STATUS OF the LISTENER
------------------------
Alias                     LISTENER_RAC1
Version                   TNSLSNR FOR Linux: Version 11.2.0.2.0 - Production
START DATE                24-MAY-2011 14:11:36
Uptime                    0 days 0 hr. 0 MIN. 26 sec
Trace LEVEL               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter FILE   /ora_rac/software/network/admin/listener.ora
Listener LOG FILE         /ora_rac/software/LOG/diag/tnslsnr/server1/listener_rac1/alert/LOG.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_RAC1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.101)(PORT=1541)))
Services Summary...
Service "rac1.world" has 1 instance(s).
  Instance "rac1", status READY, has 1 handler(s) FOR this service...
The command completed successfully

Then at the end it is difficult to understand if database listener has to be configured within Grid Infrastructure Oracle home or with database Oracle home. Both are working fine and I personally rate it more logic to configure with database Oracle home to have listener running with same patch level as your database (Grid Infrastructure and database Oracle homes can be patch independently).

References

  • HOW TO RECONFIGURE ORACLE RESTART AFTER SERVER RENAME [ID 986740.1]
  • 11.2 Scan and Node TNS Listener Setup Examples [ID 1070607.1]

About Post Author

Share the knowledge!

4 thoughts on “Oracle restart and listener configuration

  1. Ravi Aleti says:

    Nice one Yannick, with this help I am able to enjoy Oracle restart and got rid off traditional scripting.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>