本頁是否能提供幫助?
您對此內容的意見反應十分重要。 請告訴我們您的想法。
其他意見反應?
剩餘 1500 個字元
匯出 (0) 列印
全部展開
Expand Minimize

sp_reinitmergepullsubscription (Transact-SQL)

將合併提取訂閱標示為在下次執行合併代理程式時重新初始化。這個預存程序執行於訂閱資料庫的訂閱者端。

主題連結圖示 Transact-SQL 語法慣例


sp_reinitmergepullsubscription [ [ @publisher = ] 'publisher' ]
    [ , [ @publisher_db = ] 'publisher_db' ]
    [ , [ @publication = ] 'publication' ]
    [ , [ @upload_first = ] 'upload_first'

[ @publisher = ] 'publisher'

這是發行者的名稱。publishersysname,預設值是 ALL。

[ @publisher_db = ] 'publisher_db'

這是發行者資料庫的名稱。publisher_dbsysname,預設值是 ALL。

[ @publication = ] 'publication'

這是發行集的名稱。publicationsysname,預設值是 ALL。

[ @upload_first = ] 'upload_first'

這是指在訂閱重新初始化之前,是否上載在訂閱者端的變更。upload_firstnvarchar(5),預設值是 FALSE。如果是 true,便會在訂閱重新初始化之前上載變更。如果是 false,就不會上載變更。

0 (成功) 或 1 (失敗)

sp_reinitmergepullsubscription 用於合併式複寫中。

如果您新增、卸除或變更參數化篩選,在重新初始化期間,便無法將訂閱者的暫止變更上載到發行者。如果您要上載暫止變更,請在變更篩選之前,同步處理所有訂閱。

只有系統管理員 (sysadmin) 固定伺服器角色或 db_owner 固定資料庫角色的成員,才能夠執行 sp_reinitmergepullsubscription

-- This script uses sqlcmd scripting variables. They are in the form
-- $(MyVariable). For information about how to use scripting variables  
-- on the command line and in SQL Server Management Studio, see the 
-- "Executing Replication Scripts" section in the topic
-- "Programming Replication Using System Stored Procedures".

DECLARE @publicationDB AS sysname;
DECLARE @publication AS sysname;
SET @publicationDB = N'AdventureWorks';
SET @publication = N'AdvWorksSalesOrdersMerge';

USE [AdventureWorksReplica]

-- Execute at the Subscriber to reinitialize the pull subscription. 
-- Pending changes at the Subscrber are lost.
EXEC sp_reinitmergepullsubscription 
    @publisher = $(PubServer),
    @publisher_db = @publicationDB,
    @publication = @publication,
    @upload_first = N'false';
GO

-- Start the Merge Agent.


-- This script uses sqlcmd scripting variables. They are in the form
-- $(MyVariable). For information about how to use scripting variables  
-- on the command line and in SQL Server Management Studio, see the 
-- "Executing Replication Scripts" section in the topic
-- "Programming Replication Using System Stored Procedures".

DECLARE @publicationDB AS sysname;
DECLARE @publication AS sysname;
SET @publicationDB = N'AdventureWorks';
SET @publication = N'AdvWorksSalesOrdersMerge';

USE [AdventureWorksReplica]

-- Execute at the Subscriber to reinitialize the pull subscription, 
-- and upload pending changes at the Subscriber. 
EXEC sp_reinitmergepullsubscription 
    @publisher = $(PubServer),
    @publisher_db = @publicationDB,
    @publication = @publication,
    @upload_first = N'true';
GO

-- Start the Merge Agent.


社群新增項目

新增
顯示:
© 2015 Microsoft