Thursday, 12 November 2020

 

How to Configuring Oracle Listener in ASM Auto Start and Stop

(Add & Remove with Modify)12CR1

Start Listener from Oracle User

 

[oracle@oda12 ~]$ lsnrctl start HMDB_LSN

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 06-OCT-2020 23:02:01

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

Starting /u01/app/oracle/product/12.1.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.1.0.2.0 - Production

System parameter file is /u01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora

Log messages written to /u01/app/oracle/diag/tnslsnr/oda12/hmdb_lsn/alert/log.xml

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oda12.oracle.com)(PORT=1525)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oda12.oracle.com)(PORT=1525)))

STATUS of the LISTENER

------------------------

Alias                     HMDB_LSN

Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production

Start Date                06-OCT-2020 23:02:01

Uptime                    0 days 0 hr. 0 min. 0 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora

Listener Log File         /u01/app/oracle/diag/tnslsnr/oda12/hmdb_lsn/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oda12.oracle.com)(PORT=1525)))

Services Summary...

Service "HMDB" has 1 instance(s).

  Instance "HMDB", status UNKNOWN, has 1 handler(s) for this service...

The command completed successfully

Important Note:

No Need to create and start listener on database side like above example. When you will Configure Database Listener in ASM so ASM automatically create listener in ASM resource for database.

                                                     Add Listener

1- Check Existing Listener Status from Grid User

[grid@oda12 ~]$ srvctl status listener

Listener LISTENER is enabled

Listener LISTENER is running on node(s): oda12

2- Add New Create Listener as a part of ASM Services/Cluster from Grid User

[grid@oda12 ~]$  srvctl add listener -listener  HMDB_LSN

PRCN-2061 : Failed to add listener ora.HMDB_LSN.lsnr

PRCN-2065 : Ports 1525 are not available on the nodes given

PRCN-2067 : Port 1525 is not available on nodes: oda12.oracle.com

Note:

It`s mean your database Non-ASM Listener is already running on database side that`s why this error is occurring.

[grid@oda12 ~]$ srvctl add listener -l HMDB_LSN  -p 1525

Note:

You will define -p switch for deferent port if you are not going to default port.

3- Check Listeners Configuration from grid user

[grid@oda12 ~]$ srvctl config listener

Name: HMDB_LSN

Type: Database Listener

Home: /u01/app/grid/product/12.1.0/home

End points: TCP:1525

Listener is enabled.

Name: LISTENER

Type: Database Listener

Home: /u01/app/grid/product/12.1.0/home

End points: TCP:1521

Listener is enabled.

4- Check new listener status as a local resource from grid user

[grid@oda12 ~]$ crsctl stat res -init -t

--------------------------------------------------------------------------------

Name           Target  State        Server                   State details

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

ora.CRS.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.DATA.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.FRA.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.HMDB_LSN.lsnr

               OFFLINE OFFLINE      oda12                    STABLE

ora.LISTENER.lsnr

               ONLINE  ONLINE       oda12                    STABLE

ora.asm

               ONLINE  ONLINE       oda12                    Started,STABLE

ora.ons

               OFFLINE OFFLINE      oda12                    STABLE

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.cssd

      1        ONLINE  ONLINE       oda12                    STABLE

ora.diskmon

      1        OFFLINE OFFLINE                               STABLE

ora.evmd

      1        ONLINE  ONLINE       oda12                    STABLE

ora.hmdb.db

      1        ONLINE  ONLINE       oda12                    Open,STABLE

ora.orcl.db

      1        ONLINE  ONLINE       oda12                    Open,STABLE

--------------------------------------------------------------------------------

5- Start new listener from grid user

[grid@oda12 ~]$ srvctl start listener -l hmdb_lsn

6- Check again new listener status as a local resource from grid user

[grid@oda12 ~]$ crsctl stat res -init -t

--------------------------------------------------------------------------------

Name           Target  State        Server                   State details

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

ora.CRS.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.DATA.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.FRA.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.HMDB_LSN.lsnr

               ONLINE  ONLINE       oda12                    STABLE

ora.LISTENER.lsnr

               ONLINE  ONLINE       oda12                    STABLE

ora.asm

               ONLINE  ONLINE       oda12                    Started,STABLE

ora.ons

               OFFLINE OFFLINE      oda12                    STABLE

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.cssd

      1        ONLINE  ONLINE       oda12                    STABLE

ora.diskmon

      1        OFFLINE OFFLINE                               STABLE

ora.evmd

      1        ONLINE  ONLINE       oda12                    STABLE

ora.hmdb.db

      1        ONLINE  ONLINE       oda12                    Open,STABLE

ora.orcl.db

      1        ONLINE  ONLINE       oda12                    Open,STABLE

--------------------------------------------------------------------------------

7- Check listener tnsping from Oracle User

[oracle@oda12 ~]$ tnsping HMDB_LSN

TNS Ping Utility for Linux: Version 12.1.0.2.0 - Production on 07-OCT-2020 19:30:34

Copyright (c) 1997, 2014, Oracle.  All rights reserved.

Used parameter files:

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oda12.oracle.com)(PORT = 1525)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = hmdb)))

OK (10 msec)

[oracle@oda12 ~]$ tnsping HMDB_LSN

TNS Ping Utility for Linux: Version 12.1.0.2.0 - Production on 07-OCT-2020 19:30:37

Copyright (c) 1997, 2014, Oracle.  All rights reserved.

Used parameter files:

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oda12.oracle.com)(PORT = 1525)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = hmdb)))

OK (10 msec)

[oracle@oda12 ~]$

8- Check listener status from Grid User

[grid@oda12 ~]$ srvctl status listener -l HMDB_LSN

Listener HMDB_LSN is enabled

Listener HMDB_LSN is running on node(s): oda12

Listener Modification

Note:

I am producing error in listener like I will change listener port with default port value and then I will modify.

1- Check listener status from Grid User

[grid@oda12 ~]$ crsctl stat res -init -t

--------------------------------------------------------------------------------

Name           Target  State        Server                   State details

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

ora.CRS.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.DATA.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.FRA.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.HMDB_LSN.lsnr

               ONLINE  INTERMEDIATE oda12                    Not All Endpoints Re

                                                             gistered,STABLE

ora.LISTENER.lsnr

               ONLINE  ONLINE       oda12                    STABLE

ora.asm

               ONLINE  ONLINE       oda12                    Started,STABLE

ora.ons

               OFFLINE OFFLINE      oda12                    STABLE

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.cssd

      1        ONLINE  ONLINE       oda12                    STABLE

ora.diskmon

      1        OFFLINE OFFLINE                               STABLE

ora.evmd

      1        ONLINE  ONLINE       oda12                    STABLE

ora.hmdb.db

      1        ONLINE  ONLINE       oda12                    Open,STABLE

ora.orcl.db

      1        ONLINE  ONLINE       oda12                    Open,STABLE

--------------------------------------------------------------------------------

Show Error:

--------------------------------------------------------------------------------------

Name                                  Target   State         Server  State details

--------------------------------------------------------------------------------------

ora.HMDB_LSN.lsnr   ONLINE   INTERMEDIATE  oda12   Not All Endpoints Registered,STABLE 

--------------------------------------------------------------------------------------

Error is above mention let’s start our work

2- Check listener configuration from Grid User

[grid@oda12 ~]$ srvctl config listener -l HMDB_LSN

Name: HMDB_LSN

Type: Database Listener

Home: /u01/app/grid/product/12.1.0/home

End points: TCP:1521

Listener is enabled.

Note:

You can see there this is port issue which is create by self.

3- Modify listener from grid user

[grid@oda12 ~]$ srvctl modify listener -l hmdb_lsn -p 1525

4- Check modification listener configuration from Grid User

[grid@oda12 ~]$ srvctl config listener -l HMDB_LSN

Name: HMDB_LSN

Type: Database Listener

Home: /u01/app/grid/product/12.1.0/home

End points: TCP:1525

Listener is enabled.

5- Reboot Server Machine or all Services from Root User

[root@oda12 ~]$ reboot

6- Check Listener Status After Solution Applied from Grid User

[grid@oda12 ~]$  crsctl stat res -t

--------------------------------------------------------------------------------

Name           Target  State        Server                   State details

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

ora.CRS.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.DATA.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.FRA.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.HMDB_LSN.lsnr

               ONLINE  ONLINE       oda12                    STABLE

ora.LISTENER.lsnr

               ONLINE  ONLINE       oda12                    STABLE

ora.asm

               ONLINE  ONLINE       oda12                    Started,STABLE

ora.ons

               OFFLINE OFFLINE      oda12                    STABLE

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.cssd

      1        ONLINE  ONLINE       oda12                    STABLE

ora.diskmon

      1        OFFLINE OFFLINE                               STABLE

ora.evmd

      1        ONLINE  ONLINE       oda12                    STABLE

ora.hmdb.db

      1        ONLINE  ONLINE       oda12                    Open,STABLE

ora.orcl.db

      1        ONLINE  ONLINE       oda12                    Open,STABLE

--------------------------------------------------------------------------------

7- Listener Status from Grid User

[grid@oda12 ~]$ srvctl status listener -l HMDB_LSN

Listener HMDB_LSN is enabled

Listener HMDB_LSN is running on node(s): oda12

8- Stop listener from Grid User

[grid@oda12 ~]$ srvctl stop listener -l HMDB_LSN

9- Check again listener status from Grid User

[grid@oda12 ~]$ srvctl status listener -l HMDB_LSN

Listener HMDB_LSN is enabled

Listener HMDB_LSN is not running

10- Check again listener tnsping from Oracle User

[oracle@oda12 ~]$ tnsping HMDB_LSN

TNS Ping Utility for Linux: Version 12.1.0.2.0 - Production on 07-OCT-2020 19:45:31

Copyright (c) 1997, 2014, Oracle.  All rights reserved.

Used parameter files:

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oda12.oracle.com)(PORT = 1525)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = hmdb)))

TNS-12541: TNS:no listener

Note:

we can see it is working now.

11- start listener tnsping from Grid User

[grid@oda12 ~]$ srvctl start listener -l HMDB_LSN

12- Check again listener status from Grid User

[grid@oda12 ~]$ srvctl status listener -l HMDB_LSN

Listener HMDB_LSN is enabled

Listener HMDB_LSN is running on node(s): oda12

13- Check again listener tnsping from Oracle User

[oracle@oda12 ~]$ tnsping HMDB_LSN

TNS Ping Utility for Linux: Version 12.1.0.2.0 - Production on 07-OCT-2020 19:49:49

Copyright (c) 1997, 2014, Oracle.  All rights reserved.

Used parameter files:

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oda12.oracle.com)(PORT = 1525)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = hmdb)))

OK (0 msec)

Note:

Issue has been resolved. Now we can see that listener is proper working in ASM services/Cluster Services start and stop properly.

Remove Listener

1- Check and Identify listener from Grid User

[grid@oda12 ~]$ crsctl stat res -init -t

--------------------------------------------------------------------------------

Name           Target  State        Server                   State details

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

ora.CRS.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.DATA.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.FRA.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.HMDB_LSN.lsnr

               ONLINE  ONLINE       oda12                    STABLE

ora.LISTENER.lsnr

               ONLINE  ONLINE       oda12                    STABLE

ora.asm

               ONLINE  ONLINE       oda12                    Started,STABLE

ora.ons

               OFFLINE OFFLINE      oda12                    STABLE

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.cssd

      1        ONLINE  ONLINE       oda12                    STABLE

ora.diskmon

      1        OFFLINE OFFLINE                               STABLE

ora.evmd

      1        ONLINE  ONLINE       oda12                    STABLE

ora.hmdb.db

      1        ONLINE  ONLINE       oda12                    Open,STABLE

ora.orcl.db

      1        ONLINE  ONLINE       oda12                    Open,STABLE

--------------------------------------------------------------------------------

[grid@oda12 ~]$ srvctl status listener -l HMDB_LSN

Listener HMDB_LSN is enabled

Listener HMDB_LSN is running on node(s): oda12

2- Stop listener and check status from Grid User

[grid@oda12 ~]$ srvctl stop listener -l HMDB_LSN

[grid@oda12 ~]$ srvctl status listener -l HMDB_LSN

Listener HMDB_LSN is enabled

Listener HMDB_LSN is not running

3- Disable Listener Service and Check Status from Grid User

[grid@oda12 ~]$ srvctl disable listener -l HMDB_LSN

[grid@oda12 ~]$ srvctl status listener -l HMDB_LSN

Listener HMDB_LSN is disabled

Listener HMDB_LSN is not running

4- Remove Listener and Check Status from Grid User

[grid@oda12 ~]$ srvctl remove  listener -l HMDB_LSN

[grid@oda12 ~]$ srvctl status listener -l HMDB_LSN

PRCR-1001 : Resource ora.HMDB_LSN.lsnr does not exist

 [grid@oda12 ~]$ crsctl stat res -init -t

--------------------------------------------------------------------------------

Name           Target  State        Server                   State details

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

ora.CRS.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.DATA.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.FRA.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.LISTENER.lsnr

               ONLINE  ONLINE       oda12                    STABLE

ora.asm

               ONLINE  ONLINE       oda12                    Started,STABLE

ora.ons

               OFFLINE OFFLINE      oda12                    STABLE

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.cssd

      1        ONLINE  ONLINE       oda12                    STABLE

ora.diskmon

      1        OFFLINE OFFLINE                               STABLE

ora.evmd

      1        ONLINE  ONLINE       oda12                    STABLE

ora.hmdb.db

      1        ONLINE  ONLINE       oda12                    Open,STABLE

ora.orcl.db

      1        ONLINE  ONLINE       oda12                    Open,STABLE

--------------------------------------------------------------------------------

Completed.

Note: My Future Post Will Linked with this Post

No comments:

Post a Comment