Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Log Shipping monitor scheduled job


Log Shipping monitor scheduled job

Author
Message
blacklabellover2003
blacklabellover2003
SSC Rookie
SSC Rookie (41 reputation)SSC Rookie (41 reputation)SSC Rookie (41 reputation)SSC Rookie (41 reputation)SSC Rookie (41 reputation)SSC Rookie (41 reputation)SSC Rookie (41 reputation)SSC Rookie (41 reputation)

Group: General Forum Members
Points: 41 Visits: 155
HI all,

We have a scheduled task that I believe is redundant (due to us having 3rd party monitoring software) and that, as a job in its own right, is causing alerts to fire when it fails.

Can anyone confirm/refute what I believe the script does? I believe one sproc basically checks whether log shipping is still in synch, and if not, fires another that generates an error in the SQL log. As we are using the monitoring tool we therefore have double the number of alerts needed.

The idea is to disable/delete this job if found redundant.

Thanks,


BLL


CREATE PROCEDURE sp_log_shipping_monitor_backup AS
BEGIN
DECLARE @primary_id sysname
DECLARE @primary_server_name sysname
DECLARE @primary_database_name sysname
DECLARE @maintenance_plan_id UNIQUEIDENTIFIER
DECLARE @backup_threshold INT
DECLARE @threshold_alert INT
DECLARE @threshold_alert_enabled BIT
DECLARE @last_backup_filename sysname
DECLARE @last_updated DATETIME
DECLARE @planned_outage_start_time INT
DECLARE @planned_outage_end_time INT
DECLARE @planned_outage_weekday_mask INT
DECLARE @sync_status INT
DECLARE @backup_delta INT
DECLARE @delta_string NVARCHAR (10)
DECLARE @dt DATETIME

SELECT @dt = GETDATE ()

SET NOCOUNT ON

DECLARE bmlsp_cur CURSOR FOR
SELECT primary_id,
primary_server_name,
primary_database_name,
    maintenance_plan_id,
backup_threshold,
threshold_alert,
threshold_alert_enabled,
last_backup_filename,
last_updated,
planned_outage_start_time,
planned_outage_end_time,
planned_outage_weekday_mask
FROM msdb.dbo.log_shipping_primaries
FOR READ ONLY

OPEN bmlsp_cur
loop:
FETCH NEXT FROM bmlsp_cur
INTO @primary_id,
@primary_server_name,
    @primary_database_name,
    @maintenance_plan_id,
@backup_threshold,
    @threshold_alert,
    @threshold_alert_enabled,
    @last_backup_filename,
    @last_updated,
    @planned_outage_start_time,
@planned_outage_end_time,
    @planned_outage_weekday_mask

IF @@FETCH_STATUS <> 0 -- nothing more to fetch, finish the loop
GOTO _loop

EXECUTE @sync_status = sp_log_shipping_in_sync
@last_updated,
@dt,
    @backup_threshold,
   @planned_outage_start_time,
   @planned_outage_end_time,
@planned_outage_weekday_mask,
   @threshold_alert_enabled,
   @backup_delta OUTPUT

IF (@sync_status < 0)
BEGIN
SELECT @delta_string = CONVERT (NVARCHAR(10), @backup_delta)
RAISERROR (@threshold_alert, 16, 1, @primary_server_name, @primary_database_name, @delta_string)
END

GOTO loop
_loop:
CLOSE bmlsp_cur
DEALLOCATE bmlsp_cur
END

GO
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search