sp_delete_log_shipping_primary

Transact-SQL Reference

Transact-SQL Reference

sp_delete_log_shipping_primary

Deletes the primary server from the log_shipping_primaries table.

Syntax

sp_delete_log_shipping_primary     [ @primary_server_name = ] 'primary_server_name' ,
    [ @primary_database_name = ] 'primary_database_name' ,
    { [ @delete_secondaries = ] delete_secondaries }

Arguments

[@primary_server_name =] 'primary_server_name'

Is the name of the primary server. primary_server_name is sysname.

[@primary_database_name =] 'primary_database_name'

Is the name of the secondary server. primary_database_name is sysname.

[@delete_secondaries =] delete_secondaries

Specifies that the delete action is also applied to log_shipping_secondaries table. delete_secondaries is bit, with a default of zero (0).

Return Code Values

0 (success) or 1 (failure)

Remarks

This stored procedure only removes the primary and secondary server from the monitor. Log shipping still has to be removed from the primary and secondary servers.

sp_delete_log_shipping_primary deletes a log shipping primary table. If there are corresponding rows in the log_shipping_databases table, delete_secondaries must be set to one (1) or the stored procedure will fail.

Permissions

Only members of the sysadmin fixed server role can execute sp_delete_log_shipping_primaries.

Examples

This example deletes the source database "pubs" from the server "source". There are no corresponding rows in log_shipping_secondaries table.

EXEC   sp_delete_log_shipping_primary @primary_server_name = N'source', @primary_database_name = N'pubs'