Showing posts with label notification. Show all posts
Showing posts with label notification. Show all posts

Monday, March 19, 2012

Monitoring service broker queues through a .NET process

Is there a way for a .NET application to receive a notification when a service broker queue has been updated with a new message? I tried using SqlDependency on an SB queue but I got an "invalid" error in my notification handler.

Such a notification would be much better than having to poll the queue every N seconds.

Thanks

Issue a WAITFOR(RECEIVE.. ) on the queue with no timeout? Make sure you set the CommandTimeout on the SqlCommand to infinite.|||I will try that. Thanks very much

Wednesday, March 7, 2012

Monitor SQL Server status through Notification Services

Hello,

I am new to Notification Services. My question is can notification services be used to monitor the status of sql server 2005 (stopped/started) and databases (online/offline).

Thanks

I probably wouldn't use NS for this. Use the Microsoft Operations Manager with the SQL Server MOM pack. The MOM pack is available at http://www.microsoft.com/downloads/details.aspx?familyid=79F151C7-4D98-4C2B-BF72-EC2B4AE69191&displaylang=en.

Or, you can use SQL Trace and event notifications to receive notifications of SQL Server events. See the Montioring Events section of SQL Server Books Online for more information. See http://msdn2.microsoft.com/en-us/library/ms190378.aspx.

-Diane Larsen
SQL Server User Education

monitor sql backups

I currently receive a notification if my sql backup fails through sql agent.
However, there is always an outside chance that the sql agent is not working
either in which case I have no notification if my backups fail.
Perhaps one can easily write a command prompt code to monitor the dates on a
folder and send out an email if the dates for the backup files are not
current. I dont
know how to write such a code. If anyone uses this or any other method to
monitor their backups, please email the code at scott-williams@.hotmail.comProbably an easiest and safest thing to do is to configure the job to send
the notification when it completes, even if it failed or was successful. The
n
you will need to read the message and verify that the job was successful.
In this scenario, if you do not receive an e-mail you will know that
something is wrong, and maybe not the SQL Server Agent, but the e-mail
software or something else.
The monitor that you propose will have the same limitation as your original
problem as it will also relay on e-mail, which could fail.
Ben Nevarez, MCDBA, OCP
Database Administrator
"Scott" wrote:

> I currently receive a notification if my sql backup fails through sql agen
t.
> However, there is always an outside chance that the sql agent is not worki
ng
> either in which case I have no notification if my backups fail.
> Perhaps one can easily write a command prompt code to monitor the dates on
a
> folder and send out an email if the dates for the backup files are not
> current. I dont
> know how to write such a code. If anyone uses this or any other method to
> monitor their backups, please email the code at scott-williams@.hotmail.com|||Probably an easiest and safest thing to do is to configure the job to send
the notification when it completes, even if it failed or was successful. The
n
you will need to read the message and verify that the job was successful.
In this scenario, if you do not receive an e-mail you will know that
something is wrong, and maybe not the SQL Server Agent, but the e-mail
software or something else.
The monitor that you propose will have the same limitation as your original
problem as it will also relay on e-mail, which could fail.
Ben Nevarez, MCDBA, OCP
Database Administrator
"Scott" wrote:

> I currently receive a notification if my sql backup fails through sql agen
t.
> However, there is always an outside chance that the sql agent is not worki
ng
> either in which case I have no notification if my backups fail.
> Perhaps one can easily write a command prompt code to monitor the dates on
a
> folder and send out an email if the dates for the backup files are not
> current. I dont
> know how to write such a code. If anyone uses this or any other method to
> monitor their backups, please email the code at scott-williams@.hotmail.com|||You might want to invest in a product from www.sqlsentry.net then. It will
do all your monitoring and more.
Andrew J. Kelly SQL MVP
"Scott" <Scott@.discussions.microsoft.com> wrote in message
news:7BBD606A-379C-4AF4-91C8-453DBB2F7F20@.microsoft.com...
>I currently receive a notification if my sql backup fails through sql
>agent.
> However, there is always an outside chance that the sql agent is not
> working
> either in which case I have no notification if my backups fail.
> Perhaps one can easily write a command prompt code to monitor the dates on
> a
> folder and send out an email if the dates for the backup files are not
> current. I dont
> know how to write such a code. If anyone uses this or any other method to
> monitor their backups, please email the code at scott-williams@.hotmail.com

monitor sql backups

I currently receive a notification if my sql backup fails through sql agent.
However, there is always an outside chance that the sql agent is not working
either in which case I have no notification if my backups fail.
Perhaps one can easily write a command prompt code to monitor the dates on a
folder and send out an email if the dates for the backup files are not
current. I dont
know how to write such a code. If anyone uses this or any other method to
monitor their backups, please email the code at scott-williams@.hotmail.comProbably an easiest and safest thing to do is to configure the job to send
the notification when it completes, even if it failed or was successful. Then
you will need to read the message and verify that the job was successful.
In this scenario, if you do not receive an e-mail you will know that
something is wrong, and maybe not the SQL Server Agent, but the e-mail
software or something else.
The monitor that you propose will have the same limitation as your original
problem as it will also relay on e-mail, which could fail.
Ben Nevarez, MCDBA, OCP
Database Administrator
"Scott" wrote:
> I currently receive a notification if my sql backup fails through sql agent.
> However, there is always an outside chance that the sql agent is not working
> either in which case I have no notification if my backups fail.
> Perhaps one can easily write a command prompt code to monitor the dates on a
> folder and send out an email if the dates for the backup files are not
> current. I dont
> know how to write such a code. If anyone uses this or any other method to
> monitor their backups, please email the code at scott-williams@.hotmail.com|||Probably an easiest and safest thing to do is to configure the job to send
the notification when it completes, even if it failed or was successful. Then
you will need to read the message and verify that the job was successful.
In this scenario, if you do not receive an e-mail you will know that
something is wrong, and maybe not the SQL Server Agent, but the e-mail
software or something else.
The monitor that you propose will have the same limitation as your original
problem as it will also relay on e-mail, which could fail.
Ben Nevarez, MCDBA, OCP
Database Administrator
"Scott" wrote:
> I currently receive a notification if my sql backup fails through sql agent.
> However, there is always an outside chance that the sql agent is not working
> either in which case I have no notification if my backups fail.
> Perhaps one can easily write a command prompt code to monitor the dates on a
> folder and send out an email if the dates for the backup files are not
> current. I dont
> know how to write such a code. If anyone uses this or any other method to
> monitor their backups, please email the code at scott-williams@.hotmail.com|||You might want to invest in a product from www.sqlsentry.net then. It will
do all your monitoring and more.
--
Andrew J. Kelly SQL MVP
"Scott" <Scott@.discussions.microsoft.com> wrote in message
news:7BBD606A-379C-4AF4-91C8-453DBB2F7F20@.microsoft.com...
>I currently receive a notification if my sql backup fails through sql
>agent.
> However, there is always an outside chance that the sql agent is not
> working
> either in which case I have no notification if my backups fail.
> Perhaps one can easily write a command prompt code to monitor the dates on
> a
> folder and send out an email if the dates for the backup files are not
> current. I dont
> know how to write such a code. If anyone uses this or any other method to
> monitor their backups, please email the code at scott-williams@.hotmail.com

Saturday, February 25, 2012

monitor backup jobs on MSDE

We have several backup jobs on MSDE.
How do I monitor these jobs and get notified when a job fails. What are the
different notification possibilites with MSDE./*
Was not able to have the normal way (using SQL Agent notification system) to
work with MSDE but it works great on SQL Server. I suggest you switch to
Windows scheduler and batch driven maintenance tasks. SQLExpress will not
come with SQL Agent service. If you want to have schedules you will have to
use Windows SCHTASKS or AT command.
Create a script with your backup command, then a batch file to execute it
using OSQL or SQLCMD, a net send command can be embeded into the batch file.
Create a Windows task to execute the batch file.
Example of a batch file that would be called by the Winmdows Scheduler
OSQL -b -h-1 -s~ -w8000 -E -SCHC-6X9VQ31-XP -dmaster
-i"YourScriptFileNameAndLocation" -o"ALogFileNameAndLocationToStoreErrors"
if errorlevel == 1 goto errhand
goto end
:errhand
net send chc-6x9vq31-xp "The database back up failed ..."
:end
*/
USE msdb
-- Create a message to store in the sysmessages table
exec sp_addmessage @.msgnum = 55001 ,
@.severity = 1 ,
@.msgtext = 'Error 55001 has occurred. The database back up failed ...'
-- Because the message must be logged for the net send to fire
exec sp_altermessage 55001, 'WITH_LOG', 'true'
-- define an operator and how it is going to get notified
exec sp_add_operator @.name = 'Your Name'
, @.enabled = 1
, @.netsend_address = 'chc-6x9vq31-xp'
-- create and alert for the message.
EXEC sp_add_alert @.name = 'Test Alert', @.message_id = 55001, @.enabled = 1
-- define the notofocation procedure
-- in facts it joins the operator to an alert and how to join it
exec sp_add_notification @.alert_name = 'Test Alert' ,
@.operator_name = 'Your Name' ,
@.notification_method = 4
-- this will do the netsend
raiserror(55001,1,1)
"inquisite" wrote:

> We have several backup jobs on MSDE.
> How do I monitor these jobs and get notified when a job fails. What are th
e
> different notification possibilites with MSDE.
>

monitor backup jobs on MSDE

We have several backup jobs on MSDE.
How do I monitor these jobs and get notified when a job fails. What are the
different notification possibilites with MSDE./*
Was not able to have the normal way (using SQL Agent notification system) to
work with MSDE but it works great on SQL Server. I suggest you switch to
Windows scheduler and batch driven maintenance tasks. SQLExpress will not
come with SQL Agent service. If you want to have schedules you will have to
use Windows SCHTASKS or AT command.
Create a script with your backup command, then a batch file to execute it
using OSQL or SQLCMD, a net send command can be embeded into the batch file.
Create a Windows task to execute the batch file.
Example of a batch file that would be called by the Winmdows Scheduler
OSQL -b -h-1 -s~ -w8000 -E -SCHC-6X9VQ31-XP -dmaster
-i"YourScriptFileNameAndLocation" -o"ALogFileNameAndLocationToStoreErrors"
if errorlevel == 1 goto errhand
goto end
:errhand
net send chc-6x9vq31-xp "The database back up failed ..."
:end
*/
USE msdb
-- Create a message to store in the sysmessages table
exec sp_addmessage @.msgnum = 55001 ,
@.severity = 1 ,
@.msgtext = 'Error 55001 has occurred. The database back up failed ...'
-- Because the message must be logged for the net send to fire
exec sp_altermessage 55001, 'WITH_LOG', 'true'
-- define an operator and how it is going to get notified
exec sp_add_operator @.name = 'Your Name'
, @.enabled = 1
, @.netsend_address = 'chc-6x9vq31-xp'
-- create and alert for the message.
EXEC sp_add_alert @.name = 'Test Alert', @.message_id = 55001, @.enabled = 1
-- define the notofocation procedure
-- in facts it joins the operator to an alert and how to join it
exec sp_add_notification @.alert_name = 'Test Alert' ,
@.operator_name = 'Your Name' ,
@.notification_method = 4
-- this will do the netsend
raiserror(55001,1,1)
"inquisite" wrote:
> We have several backup jobs on MSDE.
> How do I monitor these jobs and get notified when a job fails. What are the
> different notification possibilites with MSDE.
>

monitor backup jobs on MSDE

We have several backup jobs on MSDE.
How do I monitor these jobs and get notified when a job fails. What are the
different notification possibilites with MSDE.
/*
Was not able to have the normal way (using SQL Agent notification system) to
work with MSDE but it works great on SQL Server. I suggest you switch to
Windows scheduler and batch driven maintenance tasks. SQLExpress will not
come with SQL Agent service. If you want to have schedules you will have to
use Windows SCHTASKS or AT command.
Create a script with your backup command, then a batch file to execute it
using OSQL or SQLCMD, a net send command can be embeded into the batch file.
Create a Windows task to execute the batch file.
Example of a batch file that would be called by the Winmdows Scheduler
OSQL -b -h-1 -s~ -w8000 -E -SCHC-6X9VQ31-XP -dmaster
-i"YourScriptFileNameAndLocation" -o"ALogFileNameAndLocationToStoreErrors"
if errorlevel == 1 goto errhand
goto end
:errhand
net send chc-6x9vq31-xp "The database back up failed ..."
:end
*/
USE msdb
-- Create a message to store in the sysmessages table
exec sp_addmessage @.msgnum = 55001 ,
@.severity = 1 ,
@.msgtext = 'Error 55001 has occurred. The database back up failed ...'
-- Because the message must be logged for the net send to fire
exec sp_altermessage 55001, 'WITH_LOG', 'true'
-- define an operator and how it is going to get notified
exec sp_add_operator @.name = 'Your Name'
, @.enabled = 1
, @.netsend_address = 'chc-6x9vq31-xp'
-- create and alert for the message.
EXEC sp_add_alert @.name = 'Test Alert', @.message_id = 55001, @.enabled = 1
-- define the notofocation procedure
-- in facts it joins the operator to an alert and how to join it
exec sp_add_notification @.alert_name = 'Test Alert' ,
@.operator_name = 'Your Name' ,
@.notification_method = 4
-- this will do the netsend
raiserror(55001,1,1)
"inquisite" wrote:

> We have several backup jobs on MSDE.
> How do I monitor these jobs and get notified when a job fails. What are the
> different notification possibilites with MSDE.
>

monitor backup jobs on MSDE

We have several backup jobs on MSDE.
How do I monitor these jobs and get notified when a job fails. What are the
different notification possibilites with MSDE.
inquisite wrote:
> We have several backup jobs on MSDE.
> How do I monitor these jobs and get notified when a job fails. What
> are the different notification possibilites with MSDE.
please do not multipost... if you really need it, do Xpost instead...
answered in .msde
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.9.1 - DbaMgr ver 0.55.1
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply

monitor backup jobs

We have several backup jobs on MSDE.
How do I monitor these jobs and get notified when a job fails. What are the
different notification possibilites with MSDE.
hi,
inquisite wrote:
> We have several backup jobs on MSDE.
> How do I monitor these jobs and get notified when a job fails. What
> are the different notification possibilites with MSDE.
MSDE does not support SQLMail, so you have to resort on NetSend ... but...
:D
at http://sqldev.net/xp/xpsmtp.htm you can find a well known extended stored
procedure that is able to send mails via SMPT and you can take advantage of
that...
have a look at http://www.karaszi.com/sqlserver/info_no_mapi.asp , SQL
Server MVP Tibor Karaszi web site, for some info about how to set such a
process, in the section "Job notifications from SQL Server Agent"
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.9.1 - DbaMgr ver 0.55.1
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply