Hi Everyone,
I need create the batch file to check sql server databases available during
the weekend.
I try to do run query use osql in batch file and the result write to a log
file. And check if the log file include "fail" string then email or page
someone, if not that means database is OK. Which batch command can implement
this check?
Any input much appreciates!
ChenYou can run a simple query (any simple query) accessing a table (such as
sysobjects or perhaps another smaller ) in that database.
Personally, I don't think it's a good idea to use a batch file for this
purpose because batch files are rather limited in their ability to handle
errors returned from a program. I'd use a real programming language, connect
to the SQL instance using ADO or ADO.NET, and walk through the returned error
messages to verify that there is indeed a problem with accessing the database.
Linchi
"Chen" wrote:
> Hi Everyone,
> I need create the batch file to check sql server databases available during
> the weekend.
> I try to do run query use osql in batch file and the result write to a log
> file. And check if the log file include "fail" string then email or page
> someone, if not that means database is OK. Which batch command can implement
> this check?
> Any input much appreciates!
> Chen|||For service availability monitoring better option is to go for tools like:-
NetIQ'a Diagnostic Mangager
or
BMC Patrol
Thanks
Hari
SQL Server MVP
"Chen" wrote:
> Hi Everyone,
> I need create the batch file to check sql server databases available during
> the weekend.
> I try to do run query use osql in batch file and the result write to a log
> file. And check if the log file include "fail" string then email or page
> someone, if not that means database is OK. Which batch command can implement
> this check?
> Any input much appreciates!
> Chen|||"Chen" <Chen@.discussions.microsoft.com> wrote in message
news:31D219AE-B65C-47AD-AAF2-BB80D73FBDE2@.microsoft.com...
> Hi Everyone,
> I need create the batch file to check sql server databases available
during
> the weekend.
> I try to do run query use osql in batch file and the result write to a log
> file. And check if the log file include "fail" string then email or page
> someone, if not that means database is OK. Which batch command can
implement
> this check?
We use Servers Alive product for this (and many other things.)
> Any input much appreciates!
> Chen
没有评论:
发表评论