Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_help_log_shipping_secondary_database

  No additional text.


Syntax
create procedure sys.sp_help_log_shipping_secondary_database
(
    @secondary_database sysname = NULL
    ,@secondary_id uniqueidentifier = NULL
)
as
begin
    set nocount on
    declare @retcode int

    
    -- security check
    
    exec @retcode = sys.sp_MSlogshippingsysadmincheck
    if (@retcode != 0 or @@error != 0)
        return 1
    
    -- must be invoked from master db
    
    if (db_name() != N'master')
    begin
        raiserror(5001, 16,-1)
        return 1
    end
    
    -- validate input
    
    if (@secondary_database is null and @secondary_id is null)
    begin
        raiserror(14524, 16, 1, N'@secondary_database', N'@secondary_id')
        return 1
    end
    
    -- do the resultset join
    
    select
        s.secondary_id
        ,s.primary_server
        ,s.primary_database
        ,s.backup_source_directory
        ,s.backup_destination_directory
        ,s.file_retention_period
        ,s.copy_job_id
        ,s.restore_job_id
        ,'monitor_server' = case when (s.user_specified_monitor = 1) then s.monitor_server else cast(NULL as sysname) end
        ,'monitor_server_security_mode' = case when (s.user_specified_monitor = 1) then s.monitor_server_security_mode else cast(NULL as bit) end
        ,sd.secondary_database
        ,sd.restore_delay
        ,sd.restore_all
        ,sd.restore_mode
        ,sd.disconnect_users
        ,sd.block_size
        ,sd.buffer_count
        ,sd.max_transfer_size
        ,sm.restore_threshold
        ,sm.threshold_alert
        ,sm.threshold_alert_enabled
        ,sm.last_copied_file
        ,sm.last_copied_date
        ,sm.last_copied_date_utc
        ,sm.last_restored_file
        ,sm.last_restored_date
        ,sm.last_restored_date_utc
        ,sm.history_retention_period
        ,sm.last_restored_latency
    from ((msdb.dbo.log_shipping_secondary as s join msdb.dbo.log_shipping_secondary_databases as sd
            on s.secondary_id = sd.secondary_id)
        join msdb.dbo.log_shipping_monitor_secondary as sm
            on sd.secondary_id = sm.secondary_id
                    and sd.secondary_database = sm.secondary_database
                    and s.primary_server = sm.primary_server
                    and s.primary_database = sm.primary_database)
    where (@secondary_database is null or sd.secondary_database = @secondary_database)
        and (@secondary_id is null or s.secondary_id = @secondary_id)
    
    -- all done
    
    return 0
end

 
Last revision 2008RTM
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