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
  • 10,103
  • 1
  • 59
  • 71
  • Could you install cygwin? Should you use the cmmand prompt only? – 0xdb Oct 04 '16 at 20:22
  • By "DOS" you are actually talking about the Windows command prompt `cmd`, I guess... – aschipfl Oct 04 '16 at 20:30
  • There is no current Oracle client that runs on DOS. They all require at least Windows to run. So, no you can't do that in DOS - but you _can_ do it in the Windows command line. –  Oct 04 '16 at 21:23

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
  • 10,103
  • 1
  • 59
  • 71