You are on page 1of 6

from client side

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

]$sqlplus sys/sales@to_sales as sysdba


sql>show user;
SYS

Note: whether u r from local server or remote server


it we want to connect sys user u must supply sysdba
privilege then u can connect otherwise u cannot connect.

One listener is listening one service.


iii)
-------------------------------------------------------
Note:
one listener can handle min load
if load is increasing we need more than one listener.

multiple users ---> listener ---------> database server

here listener may perform tasks slowly

How to resolve the above issue?


----------------------------------------------------------
eg: L1 <-------------> service (prd)

eg: L1
L2 <---------------? service (prd)
L3
i) More than one listener can handle same service
here service name is sales.

To decreaset the network and increasing the


performance.

serverside
-------------
]$cd $ORACLE_HOME/network/admin
admin]$vi listener.ora
------------------------------------------------
#.........This is first listenr .............

listenersales1=
port=1522

sid_list_listener1=
sid=sales

#....................second lsitener ...........


listenersales2= port=1523

sid_list_listener2=
sid=sales

:wq
------------------------------------------------
admin]$lsnrctl stop listenersales

amdin]$lsnrctl start listenersales1


started
admin]$lsnrctl start listenersales2

started

server
L1 L2

North side they will access L1 listener


South side they will access L2 listener
serverside
------------

]$sqlplus scott/tiger@192.168.100.2:1522/sales

sql>show user
scott

]$]$sqlplus scott/tiger@192.168.100.2:1523/sales

sql>show user
scott

or
admin]$vi tnsnames.ora
-----------------------------------
TOL1_SALES

port =1522
SERVICE_NAME = sales
TOL2_SALES
port = 1523

SERVICE_NAME= sales
--------------------------------------
]$sqlplus scott/tiger@TOL1_SALES

sql>
]$sqlplus scott/tiger@TOL2_SALES
sql>

Why we configure multiple listeners for the same service?


Reasons:
i) To minimize the load balance.
ii) Failover situation
means one listener is failed other or remaining
listeners can continue listen initial connection
requests from the clients.

Example for failover:


----------------------
admin]$vi tnsnames.ora
-------------------------------------------

TO_SALES=
(DESCRIPTION =
(connect_time_failover=30)
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.2) (PORT = 1522))

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.2) (PORT = 1523))

(CONNECT_DATA =
(SERVICE_NAME = sales)
)
)
It will request for first listener for 30 seconds
if it fails it request another listener.

client side
---------
]$tnsping to_sales

]$sqlplus scott/tiger@to_sales
sql>show user
scott
Server side
-------------

admin]$cd $ORACLE_HOME/network
network]$cd log
log]$vi listenersales1.ora
-------------------------------------------
u can see the listener status
---------------------------------------------

here we will stop first listener

]$cd $ORACLE_HOME/network/admin
admin]$lsnrctl stop listenersales1

log]$vi listenersales1.log

if u stop listener no problem because.


connection is already established.

sql>exit (logoff)
then u connect then u will get an error.

Example for load balancing:


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

admin]$vi tnsnames.ora
----------------------------------------------------

TO_SALES
(DESCRIPTION
(LOAD_BALANCE=ON)
rest of the things are same
-----------------------------------------------------

serverside
-----------

admin]$lsnrctl start listenersales1


admin]$lsnrctl start listenersales2

serverside
--------------

]$tnsping to_sales

OK (10 msec)

You might also like