--- title: "sp_delete_log_shipping_secondary_primary (Transact-SQL) | Microsoft Docs" ms.custom: "" ms.date: "06/10/2016" ms.prod: sql ms.prod_service: "database-engine" ms.reviewer: "" ms.technology: system-objects ms.topic: "language-reference" f1_keywords: - "sp_delete_log_shipping_secondary_primary_TSQL" - "sp_delete_log_shipping_secondary_primary" dev_langs: - "TSQL" helpviewer_keywords: - "sp_delete_log_shipping_secondary_primary" ms.assetid: 507fc744-73d9-4cb7-8d2a-bcff88841c6a author: MashaMSFT ms.author: mathoma --- # sp_delete_log_shipping_secondary_primary (Transact-SQL) [!INCLUDE[tsql-appliesto-ss2008-xxxx-xxxx-xxx-md](../../includes/tsql-appliesto-ss2008-xxxx-xxxx-xxx-md.md)] This stored procedure removes the information about the specified primary server from the secondary server, and removes the copy job and restore job from the secondary. ![Topic link icon](../../database-engine/configure-windows/media/topic-link.gif "Topic link icon") [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md) ## Syntax ``` sp_delete_log_shipping_secondary_primary [ @primary_server = ] 'primary_server' [ @primary_database = ] 'primary_database' ``` ## Arguments `[ @primary_server = ] 'primary_server'` The name of the primary instance of the [!INCLUDE[msCoName](../../includes/msconame-md.md)] [!INCLUDE[ssDEnoversion](../../includes/ssdenoversion-md.md)] in the log shipping configuration. *primary_server* is **sysname** and cannot be NULL. `[ @primary_database = ] 'primary_database'` Is the name of the database on the primary server. *primary_database* is **sysname**, with no default. ## Return Code Values 0 (success) or 1 (failure) ## Result Sets None. ## Remarks **sp_delete_log_shipping_secondary_primary** must be run from the **master** database on the secondary server. This stored procedure does the following: 1. Deletes the copy and restore jobs for the secondary ID. 2. Deletes the entry in **log_shipping_secondary**. 3. Calls **sp_delete_log_shipping_alert_job** on the monitor server. ## Permissions Only members of the **sysadmin** fixed server role can run this procedure. ## See Also [About Log Shipping (SQL Server)](../../database-engine/log-shipping/about-log-shipping-sql-server.md) [System Stored Procedures (Transact-SQL)](../../relational-databases/system-stored-procedures/system-stored-procedures-transact-sql.md)