| 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 |
|
||||
| helpviewer_keywords |
|
||||
| dev_langs |
|
[!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
sp_posttracertoken
[ @publication = ] N'publication'
[ , [ @tracer_token_id = ] tracer_token_id OUTPUT ]
[ , [ @publisher = ] N'publisher' ]
[ ; ]
The name of the publication for which latency is being measured. @publication is sysname, with no default.
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.
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.
0 (success) or 1 (failure).
sp_posttracertoken is used in transactional replication.
:::code language="sql" source="../replication/codesnippet/tsql/sp-posttracertoken-trans_1.sql":::
Only members of the sysadmin fixed server role or the db_owner fixed database role can execute sp_posttracertoken.