sp_add_log_shipping_primary_secondary (Transact-SQL)sp_add_log_shipping_primary_secondary (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 adds an entry for a secondary database on the primary server.

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

语法Syntax

  
sp_add_log_shipping_primary_secondary  
[ @primary_database = ] 'primary_database',  
[ @secondary_server = ] 'secondary_server',   
[ @secondary_database = ] 'secondary_database'  

参数Arguments

[ @primary_database = ] 'primary_database'主服务器上的数据库的名称。[ @primary_database = ] 'primary_database' Is the name of the database on the primary server. primary_database sysname,无默认值。primary_database is sysname, with no default.

[ @secondary_server = ] 'secondary_server',辅助服务器的名称。[ @secondary_server = ] 'secondary_server', Is the name of the secondary server. secondary_server sysname,无默认值。secondary_server is sysname, with no default.

[ @secondary_database = ] 'secondary_database'辅助数据库的名称。[ @secondary_database = ] 'secondary_database' Is the name of the secondary database. secondary_database sysname,无默认值。secondary_database is sysname, with no default.

返回代码值Return Code Values

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

结果集Result Sets

None

备注Remarks

必须从主服务器上的master数据库运行sp_add_log_shipping_primary_secondarysp_add_log_shipping_primary_secondary must be run from the master database on the primary server.

权限Permissions

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

示例Examples

此示例演示如何使用sp_add_log_shipping_primary_secondary将辅助数据库LogShipAdventureWorks的条目添加到辅助服务器 FLATIRON。This example illustrates using sp_add_log_shipping_primary_secondary to add an entry for the secondary database LogShipAdventureWorks to the secondary server FLATIRON.

EXEC master.dbo.sp_add_log_shipping_primary_secondary   
@primary_database = N'AdventureWorks'   
, @secondary_server = N'flatiron'   
, @secondary_database = N'LogShipAdventureWorks' ;  
GO  

另请参阅See Also

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