Operating System - HP-UX
1820553 Members
3754 Online
109626 Solutions
New Discussion юеВ

Re: find an unused port for oracle ?

 
SOLVED
Go to solution
Stuart Abramson_2
Honored Contributor

find an unused port for oracle ?

Our DBA asked me for an unused port (in /etc/services) for Oracle to use (like for a listener.).

How do I find on a server, what port will be unused? I can look right now with "netstat -a", but that will only show me what is being used right now. I can also look with "lsof -i TCP:port#", but I have to scan every port. And, again, it only tells me right now.

Then I should write the port in /etc/services, shouldn't I? Does entering the port in /etc/services ENSURE that no other application, which may scan for a port to use, will use that port?
7 REPLIES 7
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: find an unused port for oracle ?

In a word, no. Etc/services only serves as a mapping function for names which us dumb humans use to number which them computers use. By convention, oracle listeners are usually configed in the 1520's range but that is only a convention. You really have to use netstat & lsof to find an available port. You should then make an entry in /etc/services for documentation purposes at the very least. By the way, it is perfectly okay to use the same port (e.g. 1521 on different hosts for listeners) so that just because 1521 is in use on host 'bugs' does not mean that you can't also use 1521 on host 'tweety'.
If it ain't broke, I can fix that.
Robert-Jan Goossens
Honored Contributor

Re: find an unused port for oracle ?

Hi Stuart,

Yes you can preserve ports in the /etc/services file, I use the 3000 range for applications. Take a look at next doc.

http://www4.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000024673233

Hope it helps,

Robert-Jan.
Graham Cameron_1
Honored Contributor

Re: find an unused port for oracle ?

I'm with A Clay Stevenson on this one.

You can put what you like in /etc/services for documentation but that doesn't reserve it, and oracle doesn't use that file.

Assuming you are the sysadmin it's up to you to allocate and manage ports.

If it helps, here we use 1527 for hp hosted databases, 1521 for those on Sun.

Why the difference? Don't ask me, I'm not the sysadmin!!

-- Graham
Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done.
Stuart Abramson_2
Honored Contributor

Re: find an unused port for oracle ?

So, if I:

...netstat -a | grep 1521

and it isn't being used right now, I should assign it to this oracle instance?
Umapathy S
Honored Contributor

Re: find an unused port for oracle ?


/etc/services are used for documentation as well as configuration files. Most of the applications avoid hardcoding the port number by either reading from a conf file or from /etc/services itself by the gethostby* list of routines.

HTH,
Umapathy
Arise Awake and Stop NOT till the goal is Reached!
doug mielke
Respected Contributor

Re: find an unused port for oracle ?

Thats exactly what I do for our DBA's. It's never been a problem, and 1521 sounds like a common Oracle port to use.
Steven E. Protter
Exalted Contributor

Re: find an unused port for oracle ?

Yes you should assign it.

I view /etc/services as a reservation file, though some services really need entries to work correctly.

Oracle does not need an /etc/servics entry to function correctly. Oracle simply refuses to comply with Unix convention and reserver ports by putting entries in /etc/services.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com