Skip to content

Latest commit

 

History

History
79 lines (54 loc) · 2.96 KB

sp-posttracertoken-transact-sql.md

File metadata and controls

79 lines (54 loc) · 2.96 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
sp_posttracertoken (Transact-SQL)
sp_posttracertoken posts a tracer token into the transaction log at the Publisher.
markingmyname
maghan
randolphwest
08/21/2024
sql
replication
reference
posttracerttoken
posttracerttoken_TSQL
sp_posttracertoken
sp_posttracertoken_TSQL
sp_posttracertoken
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