sp_reinitpullsubscription (Transact-SQL)
適用対象: SQL Server Azure SQL Managed Instance
次にディストリビューション エージェントを実行する際に、トランザクション プルまたは匿名サブスクリプションに再初期化のマークを付けます。 このストアド プロシージャは、サブスクライバー側でプル サブスクリプション データベースについて実行されます。
構文
sp_reinitpullsubscription [ @publisher = ] 'publisher'
, [ @publisher_db = ] 'publisher_db'
, [ @publication = ] 'publication'
引数
[ @publisher = ] 'publisher'
パブリッシャーの名前を指定します。 publisher は sysname で、既定値はありません。
[ @publisher_db = ] 'publisher_db'
パブリッシャー データベースの名前を指定します。 publisher_db は sysname で、既定値はありません。
[ @publication = ] 'publication'
パブリケーションの名前を指定します。 publication は sysname で、既定値は all で、すべてのサブスクリプションに再初期化のマークが付けられます。
リターン コードの値
0 (成功) または 1 (失敗)
解説
sp_reinitpullsubscription はトランザクション レプリケーションで使用されます。
sp_reinitpullsubscription は、ピアツーピア トランザクション レプリケーションではサポートされていません。
sp_reinitpullsubscriptionサブスクライバーから呼び出して、ディストリビューション エージェントの次の実行時にサブスクリプションを再初期化できます。
@immediate_syncの値が false で作成されたパブリケーションのサブスクリプションは、サブスクライバーから再初期化できません。
プル サブスクリプションを再初期化するには、サブスクライバーで sp_reinitpullsubscription を実行するか、パブリッシャーで sp_reinitsubscription します。
例
-- 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'AdventureWorks2022';
SET @publication = N'AdvWorksProductTran';
USE [AdventureWorks2022Replica]
-- Execute at the Subscriber to reinitialize the pull subscription.
EXEC sp_reinitpullsubscription
@publisher = $(PubServer),
@publisher_db = @publicationDB,
@publication = @publication;
GO
-- Start the Distribution Agent.
アクセス許可
sysadmin固定サーバー ロールまたはdb_owner固定データベース ロールのメンバーのみが、sp_reinitpullsubscriptionを実行できます。
参照
サブスクリプションの再初期化
サブスクリプションの再初期化
システム ストアド プロシージャ (Transact-SQL)