Share via


sp_posttracertoken (Transact-SQL)

Mit dieser Prozedur wird ein Überwachungstoken in das Transaktionsprotokoll am Verleger platziert, und der Prozess der Nachverfolgung von Statistiken über Wartezeiten wird gestartet. Informationen werden erfasst, wenn das Überwachungstoken in das Transaktionsprotokoll geschrieben wird, wenn es vom Protokolllese-Agent aufgenommen wird und vom Verteilungs-Agent angewendet wird. Diese gespeicherte Prozedur wird beim Verleger mit der Publikationsdatenbank ausgeführt. Weitere Informationen finden Sie unter Messen der Wartezeit und Überprüfen der Verbindungen bei der Transaktionsreplikation.

Themenlink (Symbol)Transact-SQL-Syntaxkonventionen

Syntax

sp_posttracertoken [ @publication = ] 'publication' 
    [ , [ @tracer_token_id = ] tracer_token_id OUTPUT
    [ , [ @publisher = ] 'publisher' 

Argumente

  • [ @publication= ] 'publication'
    Der Name der Publikation, für die die Wartezeit ermittelt wird. publication ist vom Datentyp sysname und hat keinen Standardwert.
  • [ @publisher= ] 'publisher'
    Gibt einen Nicht-Microsoft SQL Server-Verleger an. publisher ist vom Datentyp sysname, hat den Standardwert NULL und sollte für einen SQL Server-Verleger nicht angegeben werden.

Rückgabecodewerte

0 (Erfolg) oder 1 (Fehler)

Hinweise

sp_posttracertoken wird für die Transaktionsreplikation verwendet.

Berechtigungen

Nur Mitglieder der festen Serverrolle sysadmin oder der festen Datenbankrolle db_owner können sp_posttracertoken ausführen.

Beispiel

DECLARE @publication AS sysname;
DECLARE @tokenID AS int;
SET @publication = N'AdvWorksProductTran'; 

USE [AdventureWorks]

-- Insert a new tracer token in the publication database.
EXEC sys.sp_posttracertoken 
  @publication = @publication,
  @tracer_token_id = @tokenID OUTPUT;
SELECT 'The ID of the new tracer token is ''' + 
    CONVERT(varchar,@tokenID) + '''.'
GO

-- Wait 10 seconds for the token to make it to the Subscriber.
WAITFOR DELAY '00:00:10';
GO

-- Get latency information for the last inserted token.
DECLARE @publication AS sysname;
DECLARE @tokenID AS int;
SET @publication = N'AdvWorksProductTran'; 

CREATE TABLE #tokens (tracer_id int, publisher_commit datetime)

-- Return tracer token information to a temp table.
INSERT #tokens (tracer_id, publisher_commit)
EXEC sys.sp_helptracertokens @publication = @publication;
SET @tokenID = (SELECT TOP 1 tracer_id FROM #tokens
ORDER BY publisher_commit DESC)
DROP TABLE #tokens

-- Get history for the tracer token.
EXEC sys.sp_helptracertokenhistory 
  @publication = @publication, 
  @tracer_id = @tokenID;
GO

Siehe auch

Andere Ressourcen

How to: Measure Latency and Validate Connections for Transactional Replication (Replication Transact-SQL Programming)

Hilfe und Informationen

Informationsquellen für SQL Server 2005