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 |
08/22/2024 |
sql |
replication |
reference |
|
|
|
[!INCLUDE SQL Server SQL MI]
Removes tracer token records from the MStracer_tokens and MStracer_history 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
sp_deletetracertokenhistory
[ @publication = ] N'publication'
[ , [ @tracer_id = ] tracer_id ]
[ , [ @cutoff_date = ] cutoff_date ]
[ , [ @publisher = ] N'publisher' ]
[ , [ @publisher_db = ] N'publisher_db' ]
[ ; ]
The name of the publication in which the tracer token was inserted. @publication is sysname, with no default. This parameter is required.
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.
Tracer tokens inserted into the publication before this date are deleted. @cutoff_date is datetime, with a default of NULL
.
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.
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.
0
(success) or 1
(failure).
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 or by querying the MStracer_tokens system table.
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.