sp_delete_log_shipping_primary_database (Transact-SQL)sp_delete_log_shipping_primary_database (Transact-SQL)

适用对象:是SQL Server 否Azure SQL 数据库 否Azure Synapse Analytics (SQL DW) 否并行数据仓库 APPLIES TO: yesSQL Server noAzure SQL Database noAzure Synapse Analytics (SQL DW) noParallel Data Warehouse

此存储过程删除主数据库的日志传送,包括备份作业、本地历史记录以及远程历史记录。This stored procedure removes log shipping of primary database including backup job as well as local and remote history. 仅在使用sp_delete_log_shipping_primary_secondary删除辅助数据库后,才使用此存储过程。Only use this stored procedure after you have removed the secondary databases using sp_delete_log_shipping_primary_secondary.

主题链接图标 Transact-SQL 语法约定Topic link icon Transact-SQL Syntax Conventions

语法Syntax

  
sp_delete_log_shipping_primary_database  
[ @database = ] 'database'  

参数Arguments

[ @database = ] 'database'日志传送主数据库的名称。[ @database = ] 'database' Is the name of the log shipping primary database. 数据库sysname,无默认值,且不能为 NULL。database is sysname, with no default, and cannot be NULL.

返回代码值Return Code Values

0(成功)或 1(失败)0 (success) or 1 (failure)

结果集Result Sets

无。None.

备注Remarks

必须从主服务器上的master数据库运行sp_delete_log_shipping_primary_databasesp_delete_log_shipping_primary_database must be run from the master database on the primary server. 此存储过程执行以下操作:This stored procedure does the following:

  1. 为指定的主数据库删除备份作业。Deletes the backup job for the specified primary database.

  2. 删除主服务器上log_shipping_monitor_primary中的本地监视记录。Removes the local monitor record in log_shipping_monitor_primary on the primary server.

  3. 删除log_shipping_monitor_history_detaillog_shipping_monitor_error_detail中的相应条目。Removes corresponding entries in log_shipping_monitor_history_detail and log_shipping_monitor_error_detail.

  4. 如果监视服务器不同于主服务器,则会在监视服务器log_shipping_monitor_primary上删除监视记录。If the monitor server is different from the primary server, removes the monitor record in log_shipping_monitor_primary on the monitor server.

  5. 删除监视服务器log_shipping_monitor_history_detaillog_shipping_monitor_error_detail中的相应条目。Removes corresponding entries in log_shipping_monitor_history_detail and log_shipping_monitor_error_detail on the monitor server.

  6. 删除此主数据库log_shipping_primary_databases中的条目。Removes the entry in log_shipping_primary_databases for this primary database.

  7. 调用监视服务器上sp_delete_log_shipping_alert_jobCalls sp_delete_log_shipping_alert_job on the monitor server.

权限Permissions

只有sysadmin固定服务器角色的成员才能运行此过程。Only members of the sysadmin fixed server role can run this procedure.

示例Examples

此示例演示如何使用sp_delete_log_shipping_primary_database删除主数据库AdventureWorks2012This example illustrates using sp_delete_log_shipping_primary_database to delete the primary database AdventureWorks2012.

EXEC master.dbo.sp_delete_log_shipping_primary_database @database = N'AdventureWorks2012';  
GO  

另请参阅See Also

关于日志传送 (SQL Server) About Log Shipping (SQL Server)
系统存储过程 (Transact-SQL)System Stored Procedures (Transact-SQL)