Get Oracle Listeners config

A simple command to get Oracle Listeners configuration, in SAP environments.
Will work also on non-SAP Oracle instance, simply by substituting the find path.

For Linux hosts:

find /oracle/???/1*/network/admin/listener.ora ! -name . -prune -type f \
-exec echo \; -exec echo  -e '\033[0;31m' {} '\033[0m' \; \
-exec echo -n '   Listener name: ' \; -exec sh -c 'grep SID_LIST_ $0 |cut -d " " -f 1 |sed "s/SID_LIST_//" ' {} \; \
-exec echo -n '   Listener port: ' \; -exec sh -c 'grep PORT $0 |cut -d "=" -f 2 |sed "s/)//" |sed "s/ //" ' {} \; \
-exec echo -n '   DB hostname:   ' \; -exec sh -c 'grep HOST $0 |cut -d "=" -f 2 |sed "s/)//" |sed "s/ //" ' {} \;

 

For AIX/Solaris hosts:

find /oracle/???/1*/network/admin/listener.ora ! -name . -prune -type f \
-exec echo \; -exec echo '\033[0;31m' {} '\033[0m' \; \
-exec echo '   Listener name: \c' \; -exec sh -c 'grep SID_LIST_ $0 |cut -d " " -f 1 |sed "s/SID_LIST_//" ' {} \; \
-exec echo '   Listener port: \c' \; -exec sh -c 'grep PORT $0 |cut -d "=" -f 2 |sed "s/)//" |sed "s/ //" ' {} \; \
-exec echo '   DB hostname:   \c' \; -exec sh -c 'grep HOST $0 |cut -d "=" -f 2 |sed "s/)//" |sed "s/ //" ' {} \;

 

Output example:
Oracle Listener parameter extractor example