TNSPING in CMD script

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
felipe
Posts: 1
Joined: 23 Apr 2013 03:15

TNSPING in CMD script

#1 Post by felipe » 23 Apr 2013 03:20

Hi,
I want to create a install script for windows. I shoud be very simple if TNSPING go $SID works ok, then run
sqlplus /nolog @do_all.sql

I made some install sript for DB in unix system i look like this :
#!/bin/bash
NLS_LANG=AMERICAN_AMERICA.EE8MSWIN1250
export NLS_LANG

SID=$1

if tnsping $SID 2>&1 > /dev/null; then
sqlplus /nolog @do_all.sql
else
echo "$SID not up"
fi

But i don;t know is there an option i dos to check result of command like tnsping ?

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: TNSPING in CMD script

#2 Post by foxidrive » 23 Apr 2013 04:04

You can replace the URL with an IP address.

Code: Select all

@echo off
set sid=www.google.com

ping %sid% >nul
If not errorlevel 1 (
sqlplus /nolog @do_all.sql
) else (
echo "%sid% not up"
)
pause

Post Reply