Skip to content

Latest commit

 

History

History
79 lines (54 loc) · 2.96 KB

File metadata and controls

79 lines (54 loc) · 2.96 KB
title sp_posttracertoken (Transact-SQL)
description sp_posttracertoken posts a tracer token into the transaction log at the Publisher.
author markingmyname
ms.author maghan
ms.reviewer randolphwest
ms.date 06/23/2025
ms.service sql
ms.subservice replication
ms.topic reference
f1_keywords
posttracerttoken
posttracerttoken_TSQL
sp_posttracertoken
sp_posttracertoken_TSQL
helpviewer_keywords
sp_posttracertoken
dev_langs
TSQL

sp_posttracertoken (Transact-SQL)

[!INCLUDE SQL Server]

This procedure posts a tracer token into the transaction log at the Publisher and begins the process of tracking latency statistics.

Information is recorded:

  • when the tracer token is written to the transaction log;
  • when the Log Reader Agent picks it up; and
  • when the Distribution Agent applies it.

This stored procedure is executed at the Publisher on the publication database. For more information, see Measure Latency and Validate Connections for Transactional Replication.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

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

Arguments

[ @publication = ] N'publication'

The name of the publication for which latency is being measured. @publication is sysname, with no default.

[ @tracer_token_id = ] tracer_token_id OUTPUT

The ID of the tracer token inserted. @tracer_token_id is an OUTPUT parameter of type int. This value can be used to execute sp_helptracertokenhistory or sp_deletetracertokenhistory without first executing sp_helptracertokens.

[ @publisher = ] N'publisher'

Specifies a non-[!INCLUDE ssNoVersion] Publisher. @publisher is sysname, with a default of NULL. This parameter shouldn't be specified for a [!INCLUDE ssNoVersion] Publisher.

Return code values

0 (success) or 1 (failure).

Remarks

sp_posttracertoken is used in transactional replication.

Examples

:::code language="sql" source="../replication/codesnippet/tsql/sp-posttracertoken-trans_1.sql":::

Permissions

Only members of the sysadmin fixed server role or the db_owner fixed database role can execute sp_posttracertoken.

Related content