Hi guys!

I would like to create batch script for doing bunch of databases TNSPING with certain condition.

I have created one batch file aca.bat and put in there this:

tnsping test1.bb.com
tnsping test2.bb.com
tnsping test1.bb.com
.
.
.

then i have executed it from cmd prompt like this aca.bat >>tnsping.log

and in tnsping.log file i have different output reply for each of above databases


D:\DATA\sta8983\Desktop>tnsping test1.bb.com

TNS Ping Utility for 32-bit Windows: Version 10.1.0.2.0 - Production on 01-SEP-2011 11:20:39

Copyright (c) 1997, 2003, Oracle. All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=test.bb.com)(Port=1639))(CONNECT_DATA=(SERVICE_NAME=test1.bb.com)))
OK (300 msec)

D:\DATA\sta8983\Desktop>tnsping test2.bb.com

TNS Ping Utility for 32-bit Windows: Version 10.1.0.2.0 - Production on 01-SEP-2011 11:20:39

Copyright (c) 1997, 2003, Oracle. All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=server.bb.com)(Port=1837))(CONNECT_DATA=(SERVICE_NAME=test2.bb.com)))
TNS-12541: TNS:no listener

D:\DATA\sta8983\Desktop>tnsping test3.bb.com

TNS Ping Utility for 32-bit Windows: Version 10.1.0.2.0 - Production on 01-SEP-2011 11:20:39

Copyright (c) 1997, 2003, Oracle. All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=manage.bb.com)(Port=1740))(CONNECT_DATA=(SID=test3.bb.com)))
TNS-12545: Connect failed because target host or object does not exist

So my question is it possible to create batch job which would going to put in log every dataabse which tnsping didnt finished with message OK at the end? I need to create that kind of list.

Thank you!