Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: probe database using OEM event or job

RE: probe database using OEM event or job

From: Reardon, Bruce (CALBBAY) <Bruce.Reardon_at_comalco.riotinto.com.au>
Date: Tue, 30 Sep 2003 16:54:29 -0800
Message-ID: <F001.005D18B3.20030930165429@fatcity.com>


Hi,
Can you just use the built in OEM event "Database UpDown" - though perhaps this only comes with the Diagnostics Pack for OEM.

As for a user defined test - You could just do something like "select user from dual" and hope it comes back if it can't connect - I haven't tried this. However, I think you'll find that user defined tests use the agent which connects via BEQ rather than via the listener so this won't help that much.

In the diagnostics pack you also have a listener SQLNet up down event

You could also write all this in a batch / perl / windows script / whatever language.

Have a look at Metalink notes to see all the events that are predefined: Note:69563.1 Subject: Overview of all the Event TCL files used by Enterprise Manager Note:69592.1 Subject: Quick reference of the events available in Enterprise Manager

The following forum has good info on user defined events:

	From: Christian Lang 31-Oct-00 15:03 
	Subject: User Defined SQL Test 

As for the sleep command - get it as its the easiest way (and part of resource kit) However, there are some (obscure) ways to emulate this functionality, eg:

44. How to pause in a batch for a preset number of seconds?


You can use the MS-DOS CHOICE.COM command for the purpose as the example below demonstrates
  @echo off
  echo Testing a delay, starting at ...
  echo.| time | find /v "new"
  choice /c:. /t:.,5 /n Pausing for five seconds   echo ending at ...
  echo.| time | find /v "new"
The choice command was introduced with MS-DOS 6. If you have an earlier MS-DOS version you can use my similar CHOOSE.EXE from ftp://garbo.uwasa.fi/pc/ts/tsutlf16.zip.

   For pauses longer than 99 seconds see the item #64. For better understanding the CHOICE parameter values, see the end of item #40.

Tom Lavedas points out that if one uses
  type nul | choice /c:. /t:.,5 /n Pausing for five seconds "The piping of the output from the TYPE command into CHOICE acts to defeat keyboard entry for the wait period."

Also see the later item "How can I write a "SLEEP" command to pause for a certain time?" for more on this question.


64. How can I write a "SLEEP" command to pause for a certain time?


If the delay you want is no more than 99 seconds the answer is fairly simple. All you need is the CHOICE command with appropriate options. For example the following batch pauses for ten seconds. You can, if you wish, break the wait by pressing the key b.   @echo off
  choice /cb /t:b,10 /n > nul
  rem ^ ^ "use b as the a break the wait key" For longer waits a loop is needed. The following batch sets a ten minute wait. Remove the line "echo %count_%" if you do not wish any progress report output.
  @echo off
  set count_=.
  set target_=...........
  :_loop
  echo %count_%
  choice /cb /t:b,60 /n > nul
  set count_=.%count_%
  if not "%count_%"=="%target_%" goto _loop   :_end
As so many items, parts of this one owe to the insights of Tom Lavedas, and parts are totally my own (un)doing.


For this and other useful (?) batch tricks see: Resources NT batch specific

news:alt.msdos.batch.nt
http://groups.google.com/groups?oi=djq&as_ugroup=alt.msdos.batch.nt

UltraTech knowledge base
http://www.ultratech-llc.com/Personal/Files/?File=ResKit.TXT

JSI Windows NT/2000 Tips, Tricks, Registry Hacks and more... http://www.jsiinc.com/Reghack.htm#Tip%20Index

NT/Win2k scripting - good on bat differences between NT and DOS http://www.seanet.com/~shardy/ntscript.html

Resources batch general:

Batfiles: The DOS batch file programming handbook and tutorial - good examples and hints / tricks
http://home7.inet.tele.dk/batfiles/  

DOS Batch Language: A personal view by Ted Davis - good intro for beginners http://131.151.112.77/~batch/batchtoc.htm

news:alt.msdos.batch
http://groups.google.com/groups?oi=djq&as_ugroup=alt.msdos.batch

Multilingual Batch Programs
http://gearbox.maem.umr.edu/~batch/multilingual.html

Programs by Prof. Timo Salmi - THE author of the alt.msdos.batch FAQ http://garbo.uwasa.fi/pc/ts.html and then search for tsbat67.zip 184193 Mar 8 11:16
A collection of useful batch files and tricks, T.Salmi

HTH,
Bruce Reardon

-----Original Message-----
Sent: Wednesday, 1 October 2003 9:54 AM
To: Multiple recipients of list ORACLE-L

On unix you could do:

while true; do tnsping ALIAS > out || mail tanel_at_integrid.info < out; sleep 300; done;

(obviously you have to replace ALIAS and e-mail address there)
It will send you the tnsping output if it happens to fail. (you'll get a failure message after every 300 seconds though).

On windows, you could play around with %ERRORLEVEL% and goto cycles... You have to download sleep command though, Windows does not have such extraordinarily complicated scientific tool in standard package.

Tanel.

Can someone help me with this?
Running Oracle 9.2.0.3 under win2000

I have an application server that occasionally looses connectivity with the listener on the database server although other application servers have no problems connecting. I get error 'Fatal NI connect error 12535' I would like to setup an OEM event (user defined?) or user defined job that must run from the application server having the problem which will test the connection to the listener on the database server (could be like a tnsping XXX) and if it is unsuccessful, notify me via email, pager, etc. has anyone done this?
Can it be done with a TCL script? Any samples appreciated?

John Baylis
Database Administrator
Canadian Forest Products Ltd.
Vancouver B.C. Canada
(604) 697-6476 (Office)
(604) 313-6054 (Cell)

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Reardon, Bruce (CALBBAY)
  INET: Bruce.Reardon_at_comalco.riotinto.com.au

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L

(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).
Received on Tue Sep 30 2003 - 19:54:29 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US