Finding client side port in Oracle

select machine||':'||port from gv\$active_session_history where machine like '%app01%' and inst_id = 1" | sort -u
MACHINE||':'||PORT             hostname.domain:34218
MACHINE||':'||PORT             hostname.domain:34252
MACHINE||':'||PORT             hostname.domain:34312
MACHINE||':'||PORT             hostname.domain:34313
MACHINE||':'||PORT             hostname.domain:34314
MACHINE||':'||PORT             hostname.domain:34317
MACHINE||':'||PORT             hostname.domain:34319
MACHINE||':'||PORT             hostname.domain:34326
MACHINE||':'||PORT             hostname.domain:34328
MACHINE||':'||PORT             hostname.domain:34331
MACHINE||':'||PORT             hostname.domain:34332
MACHINE||':'||PORT             hostname.domain:34334
MACHINE||':'||PORT             hostname.domain:34336
MACHINE||':'||PORT             hostname.domain:34338
MACHINE||':'||PORT             hostname.domain:34340
MACHINE||':'||PORT             hostname.domain:34342
MACHINE||':'||PORT             hostname.domain:34344
MACHINE||':'||PORT             hostname.domain:34346
MACHINE||':'||PORT             hostname.domain:34348
MACHINE||':'||PORT             hostname.domain:34350
MACHINE||':'||PORT             hostname.domain:34352
MACHINE||':'||PORT             hostname.domain:34354
MACHINE||':'||PORT             hostname.domain:34357

You can then use this to find the thread with this port open on the client server, and:

Issue an strace against the thread
Gather a thread dump to determine its state

Get the file descriptor on the client server associated with this socket…

[[email protected] ~]# netstat -aenp | grep 34342
tcp        0      0       ESTABLISHED 20062      608150577  452/java
[[email protected] ~]# ls -lrt /proc/452/fd | grep 608150577
lrwx------. 1 sa-oms-eomadmin domain users 64 Nov 13 09:05 986 -> socket:[608150577]
[[email protected] ~]# strace -f -p 452 2>&1 | grep '(986'
[pid  1989] sendto(986, "\0\0\0N\6 \0\0\0\0\3^4\2\200`\1\23\0\0\1\1\r\0\0\0\0\4\177\377\377\377"..., 78, 0, NULL, 0 <unfinished ...>
[pid  1989] recvfrom(986,  <unfinished ...>