Share via


sp_reinitpullsubscription (Transact-SQL)

ディストリビューション エージェントの次回実行時に再初期化するように、トランザクション プル サブスクリプションまたは匿名サブスクリプションにマークを付けます。このストアド プロシージャは、サブスクライバ側でプル サブスクリプション データベースについて実行されます。

トピック リンク アイコンTransact-SQL 構文表記規則

構文

sp_reinitpullsubscription [ @publisher = ] 'publisher'
        , [ @publisher_db = ] 'publisher_db'
        , [ @publication = ] 'publication'

引数

  • [ @publisher=] 'publisher'
    パブリッシャの名前です。publishersysname であり、既定値はありません。
  • [ @publisher_db=] 'publisher_db'
    パブリッシャ データベースの名前です。publisher_dbsysname であり、既定値はありません。
  • [ @publication=] 'publication'
    パブリケーションの名前です。publicationsysname であり、既定値は all です。これは、すべてのサブスクリプションに再初期化のマークを付けることを指定します。

解説

sp_reinitpullsubscription は、トランザクション レプリケーションで使用します。

sp_reinitpullsubscription は、ピアツーピア トランザクション レプリケーションではサポートされていません。

sp_reinitpullsubscription をサブスクライバから呼び出して、ディストリビューション エージェントの次回実行時にサブスクリプションを再初期化できます。

@immediate_sync の値を false に設定して作成されたパブリケーションへのサブスクリプションは、サブスクライバから再初期化することはできません。

サブスクライバで sp_reinitpullsubscription を、またはパブリッシャで sp_reinitsubscription を実行することにより、プル サブスクリプションを再初期化できます。

権限

sp_reinitpullsubscription を実行できるのは、固定サーバー ロール sysadmin または固定データベース ロール db_owner のメンバだけです。

戻り値

成功した場合は 0 を、失敗した場合は 1 をそれぞれ返します。

使用例

-- 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'AdvWorksProductTran';

USE [AdventureWorksReplica]

-- Execute at the Subscriber to reinitialize the pull subscription. 
EXEC sp_reinitpullsubscription 
    @publisher = $(PubServer),
    @publisher_db = @publicationDB,
    @publication = @publication;
GO

-- Start the Distribution Agent.

参照

関連項目

システム ストアド プロシージャ (Transact-SQL)

その他の技術情報

サブスクリプションを再初期化する方法 (レプリケーション Transact-SQL プログラミング)
サブスクリプションの再初期化

ヘルプおよび情報

SQL Server 2005 の参考資料の入手