Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_delete_log_shipping_secondary_database_internal

  No additional text.


Syntax
create procedure sys.sp_delete_log_shipping_secondary_database_internal
(
    @secondary_database sysname -- cannot be NULL
    ,@ignoreremotemonitor bit = 0
    ,@overwrite bit = 0
)
as
begin
    set nocount on
    declare @retcode int
                ,@secondary_id uniqueidentifier
                ,@primary_server sysname
                ,@primary_database sysname
                ,@monitor_server sysname
                ,@monitor_server_security_mode int

    
    -- Does it exist
    
    select @secondary_id = sd.secondary_id
            ,@primary_server = s.primary_server
            ,@primary_database = s.primary_database
            ,@monitor_server = s.monitor_server
            ,@monitor_server_security_mode = s.monitor_server_security_mode
    from msdb.dbo.log_shipping_secondary_databases as sd join msdb.dbo.log_shipping_secondary as s
        on sd.secondary_id = s.secondary_id
    where sd.secondary_database = @secondary_database
    if (@secondary_id is null)
    begin
        return 0
    end
    
    -- remove monitor metadata for the secondary and remote monitor
    
    exec sp_MSprocesslogshippingmonitorsecondary @mode = 2
                ,@secondary_server = @@servername
                ,@secondary_database = @secondary_database
                ,@secondary_id = @secondary_id
                ,@primary_server = @primary_server
                ,@monitor_server = @monitor_server
                ,@monitor_server_security_mode = @monitor_server_security_mode
                ,@primary_database = @primary_database
                ,@ignoreremotemonitor = @ignoreremotemonitor
    
    -- remove entry from log_shipping_secondary_databases
    
    delete msdb.dbo.log_shipping_secondary_databases
    where secondary_database = @secondary_database
    
    -- unregister primary if needed
    -- during overwrite processing - skip this
    
    if (@overwrite = 0)
    begin
        if not exists (select * from msdb.dbo.log_shipping_secondary_databases
                            where secondary_id = @secondary_id
                                and secondary_database != @secondary_database)
        begin
            exec sys.sp_delete_log_shipping_secondary_primary
                                @primary_server = @primary_server
                                ,@primary_database = @primary_database
        end
    end
    
    -- all done
    
    return 0
end

 
Last revision 2008RTM
See also

  sp_add_log_shipping_secondary_database (Procedure)
sp_add_log_shipping_secondary_primary (Procedure)
sp_delete_log_shipping_secondary_database (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