Skip to content

Latest commit

 

History

History
93 lines (63 loc) · 3.79 KB

sp-deletetracertokenhistory-transact-sql.md

File metadata and controls

93 lines (63 loc) · 3.79 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
sp_deletetracertokenhistory (Transact-SQL)
Removes tracer token records from the MStracer_tokens and MStracer_history system tables.
markingmyname
maghan
randolphwest
01/23/2024
sql
replication
reference
sp_deletetracertokenhistory
sp_deletetracertokenhistory_TSQL
sp_deletetracertokenhistory
TSQL

sp_deletetracertokenhistory (Transact-SQL)

[!INCLUDE SQL Server SQL MI]

Removes tracer token records from the MStracer_tokens (Transact-SQL) and MStracer_history (Transact-SQL) system tables. This stored procedure is executed at the Publisher on the publication database or at the Distributor on the distribution database.

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

Syntax

sp_deletetracertokenhistory
    [ @publication = ] N'publication'
    [ , [ @tracer_id = ] tracer_id ]
    [ , [ @cutoff_date = ] cutoff_date ]
    [ , [ @publisher = ] N'publisher' ]
    [ , [ @publisher_db = ] N'publisher_db' ]
[ ; ]

Arguments

[ @publication = ] N'publication'

The name of the publication in which the tracer token was inserted. @publication is sysname, with no default. This parameter is required.

[ @tracer_id = ] tracer_id

The ID of the tracer token to delete. @tracer_id is int, with a default of NULL. If NULL, all tracer tokens belonging to the publication are deleted.

[ @cutoff_date = ] cutoff_date

Tracer tokens inserted into the publication before this date are deleted. @cutoff_date is datetime, with a default of NULL.

[ @publisher = ] N'publisher'

The name of the Publisher. @publisher is sysname, with a default of NULL.

Note

This parameter should only be specified for non-[!INCLUDE ssNoVersion] Publishers or when executing the stored procedure from distributor.

[ @publisher_db = ] N'publisher_db'

The name of the publication database. @publisher_db is sysname, with a default of NULL. This parameter is ignored if the stored procedure is executed at the Publisher.

Note

This parameter should be specified when executing the stored procedure from distributor.

Return code values

0 (success) or 1 (failure).

Remarks

sp_deletetracertokenhistory is used in transactional replication.

An error occurs if you specify both parameters @tracer_id and @cutoff_date.

If you don't execute sp_deletetracertokenhistory to delete tracer token metadata, the information is deleted when the regularly scheduled history cleanup occurs.

Tracer token IDs can be determined by executing sp_helptracertokens (Transact-SQL) or by querying the MStracer_tokens (Transact-SQL) system table.

Permissions

Only the following personnel have the authority to execute sp_deletetracertokenhistory:

  • Members of the replmonitor roles, in the distribution database.
  • Members of the sysadmin fixed server role.
  • Members of the db_owner fixed database role, in the publication database.
  • The db_owner of the fixed database.

Related content