Here is a brute force way to test the file. I sort the file with a unique flag, then grep out the stuff that isn't a connect string. I then loop through the connect strings and do a tnsping on each one.
You can also run the sort grep thing by itself and just get a list of connect strings. You can also chop up the file to find the server name and check to see if each server it in your /etc/hosts file or if you can ping each server.
Code:#!/usr/bin/bash export CONNSTRINGS=`sort -u $TNS_ADMIN/tnsnames.ora | grep -v "^ " | grep -v "^#" | grep -v "^(" | grep -v "^)" | sed "s/ =//g" | grep -v "^$"` echo "${CONNSTRINGS}" | while read line do tnsping $line done exit 0




Reply With Quote