0

I have over 900 Oracle strings in the following format:

sqlplus (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=c)(PORT=a))(CONNECT_DATA=(SID=b)))

Can I create a batch file to test all 900 together using DOS? I do not want to test each manually. Getting the version will be helpful too. Appreciate your help.

eckes
  • 9,711
  • 1
  • 55
  • 69

1 Answers1

0

You can read a file line by line (source) and use it as a argument like this:

for /f "tokens=*" %%a in (alias.txt) do call :processline %%a

:processline
tnsping %*
goto :eof

:eof

You might need to use the trick from Checking if the output is OK to check if connection is ok or not.

I would prefer tnsping over sqlplus, so you do not have to worry about username, password and actual command to execute.

Community
  • 1
  • 1
eckes
  • 9,711
  • 1
  • 55
  • 69