H Identifying Listener Processes

Use the following set of commands to display information about all listener processes:

$!
$!  To identify and report on any active SQL*Net listener processes
$!  on this OpenVMS Server (used as part of 11g pre-installation 
$!  check activities)
$!
$ found_any = 0
$ say = "write sys$output"
$!
$ say " "
$ say " Collecting system information - please wait..."
$!
$!  First, get a list of all disk on this system
$!
$ pipe show dev d/mount > sys$scratch:lsnrchk_devices.tmp
$!
$ close/nolog flsnr
$ open/read flsnr sys$scratch:lsnrchk_devices.tmp
$!
$!  Skip the records we know we don't need
$!
$ read flsnr record
$ read flsnr record
$ read flsnr record
$!
$!  Loop on each disk we found
$!
$ loop:
$ read flsnr/end=done_it record
$ dev = f$element(0," ", record)
$!
$!  Look for any processes accessing tnslsnr.exe
$!
$ pipe show device/files 'dev' | search/nowarn -    
$ sys$input tnslsnr > sys$scratch:lsnr_chk1.tmp
$!  If we found something, check the process(es) returned
$!
$ if $status .eqs. "%X10000001"
$ then
$    close/nolog tmmp
$    open/read tmmp sys$scratch:lsnr_chk1.tmp
$loop1:
$    read/end=done_it_1 tmmp record
$    if record .nes. ""
$    then
$       record = f$edit(record,"COMPRESS,TRIM,UPCASE")
$! Skip tnslsnr.com records
$       if f$locate(".COM;",record) .ne. f$length(record) then goto loop1
$       proc = f$element(1," ",record)
$!
$!  The following check ensures we skip records that we don't want
$!  (for example, records that reflect that we have a installed image)
$!
$       if proc .nes. "" .and. f$locate(".EXE",proc) .eq. f$length(proc)
$       then
$          img = f$getjpi("''proc'","IMAGNAME")
$          lsnr_loc = f$extract(0,f$locate(".]",img),img)
$          lsnr_loc = f$extract(0,f$locate(".NETCONFIG]",lsnr_loc),lsnr_loc)
$          lsnr_loc = lsnr_loc  + ".NETWORK.ADMIN]"
$          prcnm = f$getjpi("''proc'","PRCNAM")
$!
$!  Display the result
$!
$          if found_any .eq. 0
$          then
$             say " "
$             say " The following listener(s) need to be checked :"
$             say " "
$             say " If they use the IPC Protocol with (key = EXTPROC) and/or "
$             say " the TCP Protocol with (Port = 1521) then they need to "
$             say " be shutdown when installing Oracle Database 11g"
$             say " "
$          endif
$          say "=============="
$          say "  Listener process name          : ''prcnm'"
$          say "  VMS pid                        : ''proc'
$          say "  Probable LISTENER.ORA location : ''lsnr_loc'"
$          found_any = found_any + 1
$       endif
$       goto loop1
$    endif
$ done_it_1:
$    close/nolog sys$scratch:lsnr_chk1.tmp
$ endif
$ goto loop
$!
$ done_it:
$ close/nolog flsnr
$!  Remove all work files
$!
$ delete/noconfirm sys$scratch:lsnrchk_devices.tmp;*
$ delete/noconfirm sys$scratch:lsnr_chk1.tmp;*
$!
$ if found_any .eq. 0
$ then
$    say " "
$    say "       No active SQL*Net Listeners detected on this node"
$    say " "
$ else
$    say "=============="
$    say " "
$ endif
$!
$ say " End of processing"
$ say " "
$ exit