RAC LISTENERS -learnomate

Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
  • User AvatarANKUSH THAVALI
  • 24 May, 2022
  • 0 Comments
  • 6 Mins Read

RAC LISTENERS -learnomate

Listeners in RAC

       The listener.ora file is the configuration file for a listener. It can include the protocol addresses it is accepting connection requests on, a list of the database and other services it is listening for, and control parameters used by the listener.

You can modify the configuration of the listeners used by Oracle Clusterware and Oracle RAC with Server Control Utility (SRVCTL) commands, or by using NETCA. Manual editing of the listener.ora file is not required.

Each listener is configured with one or more protocol addresses that specify its listening endpoints. The listener agent dynamically updates endpoints with the listener. Starting with Oracle Database 11g Release 2, the listener.ora file now only contains an IPC key and the following information:

(ADDRESS = (PROTOCOL=TCP)(HOST=)(PORT=1521))

The listener.ora file is the same on every node for an Oracle RAC database. Listening endpoints, such as the port numbers, are dynamically registered with the listener.

Before you install Oracle RAC, during the Oracle Grid Infrastructure installation, NETCA creates and starts a default listener in the Grid home called LISTENER. The listener is configured with default protocol listening addresses. The listener is configured to respond to connection requests that are directed to one protocol address specified during installation.

During the Oracle RAC installation, the Oracle RAC database uses the listener in the Grid home, and configures service information about the Oracle RAC database. The database services automatically register their information with the listener, such as the service name, instance names, and load information. Dynamic service registration eliminates the need for static configuration of database services.

RAC LISTENERS COMMANDS
 srvctl config listener
To change default LISTENER port,user,home
srvctl modify listener -1 LISTENER -p TCP:1545
srvctl modify listener -l LISTENER -u root
srvctl modify listener -1 LISTENER -o /u01/app/oracle/product/19.0.0.0/dbhome_1
oracle$
cd $ORACLE_HOME/network/admin
Cat listener.ora
lsnrctl status LINTENER_prim
lsnrctl start LISTENER_prim
alter system set local_listener ='(DESCRIPTION= (ADDRESS_LIST= (ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.81)(PORT=1522))))' scope=BOTH SID='prim1';
alter system set local_listener ='(DESCRIPTION= (ADDRESS_LIST= (ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.82)(PORT=1522))))' scope=BOTH 
SID='prim2';
alter system register;
Show parameter local
Show parameter listener
root$
crsctl stat res -t
>>>>verify that LISTENER_prim not registered with the cluster
DEMO

1.crsctl stop crs -f
2.ps -ef|grep smon or tns(All services will stop but LISTENER_prim will not stop.we need to manually stop database listener
3.crsctl start crs

How to register local listener to cluster?
lsnrctl status LISTENER_prim
lsnrctl stop LISTENER_prim
lsnrctl status LISTENER_prim
Fail Attemp:(default it will add to GI Home)
oracle$
srvctl add listener -l LISTENER_prim -p 1522
srvctl start listener -l LISTENER_prim

Grid Owner
grid$
srvctl add listener -l LISTENER_prim -p 1522
srvctl start listener -l LISTENER_prim
srvctl status listener -l LISTENER_prim
lsnrctl status LISTENER_prim
crsctl stat res -t
oracle$
ps -ef|grep tns
grid $
cd /u01/app/oracle/product/19C/dbhome/network/admin
>>>>>>>>>>Verify LISTENER_prim added now
Steps to add Listener to cluster

srvctl add listener -l LISTENER_prim -p 1522
srvctl start listener -l LISTENER_prim
srvctl status listener -l LISTENER_prim
lsnrctl status LISTENER_prim
lsnrctl stop LISTENER_prim
lsnrctl status LISTENER_prim

Oracle Owner -Access issue:
Oracle $
lsnrctl status LISTENER_prim
lsnrctl stop LISTENER_prim
srvctl config listener -l LISTENER_prim
Remove Again:
Grid $
lsnrctl stop LISTENER_prim
Lsnrctl stop LISTENER_prim
srvctl remove listener -l LISTENER_prim
cd
cat listener.ora
>>>>>remove manually LISTENER_prim entry
Wrong Atempt2:
grid $
Srvctl add listener -l LISTENER_prim -p 1522 -o grid home
Srvctl config listener -l LISTENER_prim
Srvctl status listener -l LISTENER_prim
srvctl start listener -l LISTENER_prim
Remove Again:
grid $
srvctl remove listener -l LISTENER_prim
Correct method to add DB local Listener to Cluster:
 oracle $
Srvctl add listener -l LISTENER_prim -p 1522 -o u01/app/oracle/product/19C/dbhome
srvctl config listener -l LISTENER_prim
Srvctl status listener -l LISTENER_prim
Srvctl start listener -l LISTENER_prim
srvctl status LISTENER_prim
Lsnrctl stop LISTENER_prim
Lsnrctl status LISTENER_prim
Lsnrctl start LISTENER_prim

crsctl stop crs -f
>>>>>will bring down local listener also along with the cluster listener
Crsctl start crs
>>>>> will bring up your local listener also along with the cluster listener
Verify:
oracle $
Cd $ORACLE_HOME/network/admin
Cat tnsnames.ora
sqlplus sys/pw@prim_SCAN as sysdba
Sqlplus sys/pw@prim_VIP as sysdba

The SCAN bundle
Grid $
Srvctl add scan -h
Adds SCAN VIP to the oracle Cluster
Usage:srvctl add scan -n

-n
-S //[if1[if2…]]
NET address spec for network
-h print usage

srvctl modify scan -scanname nodescan
Note:SCAN cal only operate on one network/in one subnet.

How to verify the ASM Listener and SCAN listener?
=================================
Grid $
cd $ORACLE_HOME/network/admin/
Cat listener.ora
Lsnrctl status LISTENER
lsnrctl status LISTENER_SCAN1
Lsnrctl status
>>>Default it will be pointing to GI Listener (LISTENER)
crsctl stat res -t
>>>>verify ora.LISTENER.lsnr and ora.LISTENER_SCAN1.lsnr services

Service Creation at cluster level
=========================

Srvctl add service -d prim -s Myservice -r prim1 -a prim2 -P BASIC
srvctl status service -d prim -s Myservice
srvctl start service -d prim -s Myservice
srvctl status service -d prim -s Myservice

Srvctl config service -d prim -s Myservice
Srvctl modify service -d prim -s Myservice -P NONE
Srvctl remove service -d prim -s Myservice

srvctl add service -d prim -service SRV_RMAN -preferred prim1,prim2
srvctl add service -db prim prim -service Myservice -oldinst prim1 -newinst prim2

Adding local LISTENER LISTENER_prim to the cluster

. oraenv
prim1

Srvctl add listener -l LISTENER_prim -p 1522 -o /u01/app/oracle/product/19C/dbhome

. oraenv
prim2

Srvctl add listener -l LISTENER_prim -p 1522 -o /u01/app/oracle/product/19C/dbhome

Verifying

srvctl config listener -l LISTENER_prim
Ps -ef|grep tns
[/php]

Creating new local listener on both nodes login as oracle
 . oraenv
prim1

env |grep ORA
ORACLE_SID=prim1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/19C/dbhome

cd $ORACLE_HOME/network/admin

vi listener.ora

LISTENER_prim =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.81)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = prim)
)
)
ADR_BASE_LISTENER_prim = /u01/app/oracle

. oraenv
prim2

env |grep ORA
ORACLE_SID=prim2
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/19C/dbhome

LISTENER_prim =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.82)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = prim)
)
)
ADR_BASE_LISTENER_prim = /u01/app/oracle

change default port from 1521 to 1522 on both nodes ================================ alter system set local_listener ='(DESCRIPTION= (ADDRESS_LIST= (ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.81)(PORT=1522))))’ scope=BOTH SID=’prim1′; alter system set local_listener ='(DESCRIPTION= (ADDRESS_LIST= (ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.82)(PORT=1522))))’ scope=BOTH SID=’prim2′; sqlplus / as sysdba SQL>show parameter local_listener NAME TYPE VALUE Local_listener string (ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.81) (PORT=1522)) lsnrctl status LISTENER_prim lsnrctl stop LISTENER_prim

How to find the SCAN information?

 Srvctl config SCAN  

How to find the Listener information?
 srvctl config listener  

How to find the network information?
 Srvctl config network  

Hope it Helps !