Advertisement

09.29.2008 at 02:36AM PDT, ID: 23770772 | Points: 500
[x]
Attachment Details

Need a Vbscript to execute sqlplus coomand line and then create an event in the window event log

Asked by Madman2501 in VB Script, Windows Batch Scripting, MSH/Monad PowerShell

Tags:

Hi

I have the need for a vbscript which will execute a command line tool called sqlplus (part of Oracle) currently this is done using batch script which is run manually. I have just installed Opsmgr and would like to use a vbscript which can run this check automatically. i would also like it to log and event if successfull and log a different event if fails.

can anyone help me my vbscripting is shocking, attached is the batch script  this call various other batch files one which logs to a file but this would not be needed if the event could be recored?

thanks




Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
set USR=%1
set PWD=%2
set ORACLE_SID=%3
set TNS_NAMES=%4
set SERVER=%5
 
rem  -- Create SQL Script ---
echo whenever sqlerror exit sql.sqlcode > %0.tmp
echo set echo off feed off pages 0      >> %0.tmp
echo connect %USR%/%PWD%@%TNS_NAMES%;        >> %0.tmp
echo select * from global_name;         >> %0.tmp
echo exit;                              >> %0.tmp
 
rem -- Test connect to database ---
X:\systems\IS_GROUP\System_Checks\SQL_Monitor\Logs\bin\sqlplus -s /nolog @%0.tmp >NUL:
 
 
if {%ERRORLEVEL%} == {0} (
   rem echo "Database %ORACLE_SID% on %SERVER% is available (UP)"
   call X:\systems\System_Checks\SQL_Monitor\Logs\logit.bat "Database %ORACLE_SID% on %SERVER% is available (UP)"
) else (
   rem echo "!!! Database %ORACLE_SID% is NOT available (DOWN) !!!"
   call X:\systems\System_Checks\SQL_Monitor\Logs\logit.bat "!!! Database %ORACLE_SID% is NOT available (DOWN) !!!"
)
 
 
rem -- Cleanup -- 
del %0.tmp
[+][-]09.30.2008 at 04:42AM PDT, ID: 22604396

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.30.2008 at 09:27AM PDT, ID: 22606972

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.30.2008 at 09:34AM PDT, ID: 22607055

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.30.2008 at 09:37AM PDT, ID: 22607085

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.30.2008 at 09:57AM PDT, ID: 22607280

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.01.2008 at 04:10AM PDT, ID: 22613017

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.01.2008 at 04:27AM PDT, ID: 22613112

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.01.2008 at 04:43AM PDT, ID: 22613216

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.01.2008 at 04:53AM PDT, ID: 22613279

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.01.2008 at 05:00AM PDT, ID: 22613312

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.01.2008 at 05:02AM PDT, ID: 22613325

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.01.2008 at 05:19AM PDT, ID: 22613437

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.01.2008 at 05:21AM PDT, ID: 22613453

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.01.2008 at 05:35AM PDT, ID: 22613540

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.01.2008 at 05:40AM PDT, ID: 22613583

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.01.2008 at 05:48AM PDT, ID: 22613632

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.01.2008 at 05:58AM PDT, ID: 22613696

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-44 - Hierarchy / EE_QW_2_20070628