Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSprocesslogshippingmonitorerror

  No additional text.


Syntax
create procedure sys.sp_MSprocesslogshippingmonitorerror
(
    @mode tinyint -- 1 = add, 2 = delete
    ,@agent_id uniqueidentifier
    ,@agent_type tinyint  -- 0 = backup, 1 = copy, 2 = restore
    ,@session_id int = NULL -- should not be null when adding
    ,@sequence_number int = NULL  -- should not be null when adding
    ,@monitor_server sysname
    ,@monitor_server_security_mode bit = 1
    ,@database sysname = NULL -- needed for add
    ,@log_time datetime = NULL
    ,@log_time_utc datetime = NULL
    ,@message nvarchar(4000) = NULL
    ,@source nvarchar(4000) = NULL
    ,@help_url nvarchar(4000) = NULL
)
as
begin
    set nocount on
    declare @retcode int
                ,@linkcmd nvarchar(512)

    
    -- validate @mode
    
    if (@mode not in (1,2))
        return 1
    if (@mode = 1)
    begin
        
        -- Add an entry in the log_shipping_monitor_error_detail
        
        insert into msdb.dbo.log_shipping_monitor_error_detail (
                agent_id
                ,agent_type
                ,session_id
                ,database_name
                ,sequence_number
                ,log_time
                ,log_time_utc
                ,message
                ,source
                ,help_url)
        values (
                @agent_id
                ,@agent_type
                ,@session_id
                ,@database
                ,@sequence_number
                ,@log_time
                ,@log_time_utc
                ,@message
                ,@source
                ,@help_url)
        if (@@error != 0)
            return 1
    end
    else if (@mode = 2)
    begin
        
        -- clean up log_shipping_monitor_error_detail
        
        delete msdb.dbo.log_shipping_monitor_error_detail
        where agent_id = @agent_id and agent_type = @agent_type
    end
    
    -- Do we need have remote monitor
    
    if (upper(@monitor_server) != upper(@@servername))
    begin
        if (@monitor_server_security_mode = 0) and (suser_name() != SUSER_SNAME(0x01))
        begin
            
            -- Process remote monitor using proxy
            
            exec @retcode = msdb.sys.sp_MSproxylogshippingmonitorerror
                    @mode = @mode
                    ,@agent_id = @agent_id
                    ,@agent_type = @agent_type
                    ,@session_id = @session_id
                    ,@sequence_number = @sequence_number
                    ,@monitor_server = @monitor_server
                    ,@database = @database
                    ,@log_time = @log_time
                    ,@log_time_utc = @log_time_utc
                    ,@message = @message
                    ,@message = @message
                    ,@source = @source
                    ,@help_url = @help_url
        end
        else
        begin
            
            -- integrated -do not use proxy
            
            select @linkcmd = quotename(sys.fn_MSgetlogshippingmoniterlinkname(upper(@monitor_server))) + N'.msdb.sys.sp_processlogshippingmonitorerror'
            begin try
                exec @retcode = @linkcmd
                    @mode = @mode
                    ,@agent_id = @agent_id
                    ,@agent_type = @agent_type
                    ,@session_id = @session_id
                    ,@sequence_number = @sequence_number
                    ,@monitor_server = @monitor_server
                    ,@monitor_server_security_mode = 1
                    ,@database = @database
                    ,@log_time = @log_time
                    ,@log_time_utc = @log_time_utc
                    ,@message = @message
                    ,@source = @source
                    ,@help_url = @help_url
            end try
            begin catch
                select @retcode = 1
            end catch
        end
        if (@retcode != 0 or @@error != 0)
            return 1
    end
    
    -- all done
    
    return 0
end

 
Last revision 2008RTM
See also

  sp_MSadd_log_shipping_error_detail (Procedure)
sp_processlogshippingmonitorerror (Procedure)
       



News

  Query a named instance
Sybase+ASE+silent+install
SQL 2008 R2
Deprecated procedures in SQL2008
Reporting Services item-level role definitions
Create all your missing indexes
Converting datetime field
Start MSSQL Server Profiler at time
Replicating MSSQL Server views
Exploring Microsoft Sharepoint
The OLE DB provider "SQLNCLI10" for linked server indicates.
Mobile solar charger
Oracle to SQL Server replication
Cannot insert the value NULL into column
Undocumented Microsoft SQL Server 2008
VMware
Zoekmachine optimalisatie
SQL Servers hidden objects
FckEditor
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
PHP
sIFR; de combinatie tussen HTML en Flash