sp_reinitpullsubscription (Transact-SQL)
適用対象: SQL ServerAzure 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)
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示