Estrazione configurazione Listener Oracle

Un semplice comando per ricavare la configurazione delle istanze di Oracle Listener, in ambienti SAP.
Funziona anche per istanze Oracle non-SAP, semplicemente sostituendo il path di ricerca di find.

Per host Linux:

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/ //" ' {} \;

 

Per host AIX/Solaris:

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/ //" ' {} \;

 

Esempio di output:
Oracle Listener parameter extractor example