Port used needs to be killed

Hi,

We are using oracle 10g in a Solaris box. The same box has Informatica also installed. But it runs on port 6001. But whenever the server is restarted the Oracle database picks up the port 6001 and does not allow Informatica to be started. But I am have no clue of which Oracle process is using this port. I had confirmed that Oracle is using that particular port, by shutting down and starting up the database.

Please help.

lsof -i tcp:6001

and see which oracle process is taking it. If lsof is not installed, another way is i vaguely remembers its something like ptree , some command that starts with p****, check the sun manuals

pfiles is the command you're thinking of under Solaris

# pfiles PID | grep INET
        sockname: AF_INET xxx.xxx.xxx.xxx  port: xxxx

Try something like this if you don't have lsof (or just install lsof....)

#!/bin/bash

# use this where lsof (for lsof -i tcp:<port>) isn't available

AWK="/usr/bin/awk"
ECHO="/bin/echo"
PARGS="/usr/bin/pargs"
PFILES="/usr/bin/pfiles"
PS="/usr/bin/ps"
SED="/usr/bin/sed"

${PS} -ef | ${SED} '1d' | while read PS_LINE; do
   PS_PID=$( ${ECHO} "${PS_LINE}" | ${AWK} '{print $2}' )
   PS_PROC=$( ${PARGS} ${PS_PID} | ${SED} -n '1p' | ${SED} 's/^[0-9][0-9]*:[    ]*\(.*\)$/\1/' )
   PORT_USAGE=$( ${PFILES} ${PS_PID} | ${AWK} '/AF_INET/ { printf( "\t%s(%s)\n", $3, $5 ) }' )
   if [ "${PORT_USAGE}" != "" ]; then
      ${ECHO} "${PS_PROC} [PID: ${PS_PID}]"
      ${ECHO} "${PORT_USAGE}"
   fi
done

exit 0

Cheers
ZB