Som Bhattacharyya
Som Bhattacharyya

Reputation: 4112

How to stop oracle listening on port 1521(TNS)

There is a oracle xe edition installed on a machine. My requirement is to stop oracle from listening on the 1521 port. This port is used by the TNS system. Also i need to do this from a vb.net program

Upvotes: 0

Views: 2979

Answers (2)

Rene
Rene

Reputation: 10541

Find the file called listener.ora (Oracle_HOME\network\admin\listener.ora). This file has the parameters for your listener. Change the port number. Save the changes. Restart your listener.

To connect properly to your database you may need to change the port number in your tnsnames.ora accordingly.

Upvotes: 1

Patrick Hofman
Patrick Hofman

Reputation: 157048

What you can do is call lsnrctl, the utility from Oracle that manages the listeners.

You can call it with Process.Start:

Dim startInfo As New ProcessStartInfo
startInfo.FileName = "lsnrctl"
startInfo.Arguments = "stop"
startInfo.Verb = "runas"
Process.Start(startInfo)

You set the Verb to runas to make it run as administrator.

In order to make this work, you should have the Oracle bin folder in your PATH. Note that calling this will make your Oracle installation unavailable from the outside since the listeners control the access to Oracle databases.

Upvotes: 2

Related Questions