How to create listener in oracle 10g



Download 15.84 Kb.
Date08.01.2017
Size15.84 Kb.
How to create listener in oracle 10g
Listener is a process which resides on server and accept client connections and manages the request.

Every time a client requests a network session with a server, a listener receives the actual request. If the client information matches the listener information, then the listener grants a connection to the server.

Listener.ora file which resides under $ORACLE_HOME/network/admin on linux/unix platforms is configured with listener name, SID, IP or hostname & port on which the database is running
My current setup

OS : Oracle Enterprise Linux 4.5 64bit

Database Version: Oracle 10g (10.2.0.1) 64bit

Database : 2 database

Instance name: ora10gdb & 10gdb02

ORACLE_HOME = /u01/app/oracle/product/10.2.0.1/db01


Setup your environment variable

[oracle@db10g ~]$ . oraenv

ORACLE_SID = [oracle] ? ora10gdb01

[oracle@db10g ~]$ echo $ORACLE_SID

ora10gdb01

[oracle@db10g ~]$ echo $ORACLE_HOME

/u01/app/oracle/product/10.2.0.1/db01
You can create listener service using network manager easily

[oracle@db10g ~]$netmgr



Expand local folder from above

Click on Listeners and click on the Add (+) button on the left

Give listener name and click on ok.

From the right hand side drop down menu select Listening Locations and click on Add Address button below

Under protocol select TCP/IP which is the default one, under hostname type in your servername or ip address and here we are running our database on port 1521 default port.

From the drop down select Database Services.

And click on Add Database

Specify the Global Database name if you have a different global database name. Specify the oracle home

And SID

Now click on file menu and click save network configuration

Exit the netmgr configuration wizard.
Now we will test our listener

To check our if our listener is currently running or not use the below command lsnrctl status


[oracle@db10g ~]$ lsnrctl status LISTENER
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 19-MAY-2014 16:35:10
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db10g.localdomain)(PORT=1521)))

TNS-12541: TNS:no listener

TNS-12560: TNS:protocol adapter error

TNS-00511: No listener

Linux Error: 111: Connection refused
So as per the above output our listener is down. So let go ahead and start our listener
[oracle@db10g ~]$ lsnrctl start LISTENER
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 19-MAY-2014 16:36:14
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /u01/app/oracle/product/10.2.0.1/db01/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - Production

System parameter file is /u01/app/oracle/product/10.2.0.1/db01/network/admin/listener.ora

Log messages written to /u01/app/oracle/product/10.2.0.1/db01/network/log/listener.log

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db10g.localdomain)(PORT=1521)))


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db10g.localdomain)(PORT=1521)))

STATUS of the LISTENER

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

Alias LISTENER

Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production

Start Date 19-MAY-2014 16:36:14

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/10.2.0.1/db01/network/admin/listener.ora

Listener Log File /u01/app/oracle/product/10.2.0.1/db01/network/log/listener.log

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db10g.localdomain)(PORT=1521)))

Services Summary...

Service "ora10gdb" has 1 instance(s).

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

The command completed successfully


So our listener service is started. Now let’s stop and listener service and add one more database to the same listener.
[oracle@db10g ~]$ lsnrctl stop LISTENER
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 19-MAY-2014 16:37:14
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db10g.localdomain)(PORT=1521)))

The command completed successfully


Now you have already added one database so open the existing listener as per the screenshot below

Select database services

Click on Add Database


Click on file and save the network configuration and exit the netmgr
So both our database is configured to accept client connection from the server side
[oracle@db10g ~]$ lsnrctl start LISTENER
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 19-MAY-2014 16:41:52
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /u01/app/oracle/product/10.2.0.1/db01/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - Production

System parameter file is /u01/app/oracle/product/10.2.0.1/db01/network/admin/listener.ora

Log messages written to /u01/app/oracle/product/10.2.0.1/db01/network/log/listener.log

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db10g.localdomain)(PORT=1521)))


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db10g.localdomain)(PORT=1521)))

STATUS of the LISTENER

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

Alias LISTENER

Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production

Start Date 19-MAY-2014 16:41:52

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/10.2.0.1/db01/network/admin/listener.ora

Listener Log File /u01/app/oracle/product/10.2.0.1/db01/network/log/listener.log

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db10g.localdomain)(PORT=1521)))

Services Summary...

Service "10gdb02" has 1 instance(s).

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

Service "ora10gdb" has 1 instance(s).

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

The command completed successfully


You can manually create the listener.ora file under $ORACLE_HOME/network/admin directory as per the below format
SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(ORACLE_HOME = /u01/app/oracle/product/10.2.0.1/db01)

(SID_NAME = ora10gdb)

)

(SID_DESC =



(ORACLE_HOME = /u01/app/oracle/product/10.2.0.1/db01)

(SID_NAME = 10gdb02)

)

)
LISTENER =



(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = db10g.localdomain)(PORT = 1521))



)


Share with your friends:


The database is protected by copyright ©ininet.org 2019
send message

    Main page