tcpdump to see Oracle errors

Not all exceptions are created equally, and most you can ignore (the one below you can, in general). However, if you have to troubleshoot on JBOSS (or anywhere a Linux application connects to an Oracle database), what is below is a good “quicky” command the root user can run to quickly dump the Oracle exceptions being thrown back over the wire.

tcpdump -i eth1 tcp port 1521 -A -s1500 | awk '$1 ~ "ORA-" {i=1;split($1,t,"ORA-");while (i <= NF) {if (i == 1) {printf("%s","ORA-"t[2])}else {printf("%s ",$i)};i++}printf("\n")}'

…with the output below…

[[email protected] ~]# tcpdump -i eth1 tcp port 1521 -A -s1500 | awk '$1 ~ "ORA-" {i=1;split($1,t,"ORA-");while (i <= NF) {if (i == 1) {printf("%s","ORA-"t[2])}else {printf("%s ",$i)};i++}printf("\n")}'
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth1, link-type EN10MB (Ethernet), capture size 1500 bytes
ORA-01403:no data found
ORA-01403:no data found
ORA-01403:no data found
ORA-01403:no data found
ORA-01403:no data found
ORA-01403:no data found
ORA-01403:no data found
ORA-01403:no data found
ORA-01403:no data found

Just something to put in your toolkit.