gebeurtenis
31 mrt, 23 - 2 apr, 23
De grootste SQL-, Fabric- en Power BI-leerevenement. 31 maart – 2 april. Gebruik code FABINSIDER om $ 400 te besparen.
Zorg dat u zich vandaag nog registreertDeze browser wordt niet meer ondersteund.
Upgrade naar Microsoft Edge om te profiteren van de nieuwste functies, beveiligingsupdates en technische ondersteuning.
Applies to:
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:
This stored procedure is executed at the Publisher on the publication database. For more information, see Measure Latency and Validate Connections for Transactional Replication.
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-SQL Server Publisher. @publisher is sysname, with a default of NULL
. This parameter shouldn't be specified for a SQL Server Publisher.
0
(success) or 1
(failure).
sp_posttracertoken
is used in transactional replication.
DECLARE @publication AS sysname;
DECLARE @tokenID AS int;
SET @publication = N'AdvWorksProductTran';
USE [AdventureWorks2022]
-- Insert a new tracer token in the publication database.
EXEC sys.sp_posttracertoken
@publication = @publication,
@tracer_token_id = @tokenID OUTPUT;
SELECT 'The ID of the new tracer token is ''' +
CONVERT(varchar,@tokenID) + '''.'
GO
-- Wait 10 seconds for the token to make it to the Subscriber.
WAITFOR DELAY '00:00:10';
GO
-- Get latency information for the last inserted token.
DECLARE @publication AS sysname;
DECLARE @tokenID AS int;
SET @publication = N'AdvWorksProductTran';
CREATE TABLE #tokens (tracer_id int, publisher_commit datetime)
-- Return tracer token information to a temp table.
INSERT #tokens (tracer_id, publisher_commit)
EXEC sys.sp_helptracertokens @publication = @publication;
SET @tokenID = (SELECT TOP 1 tracer_id FROM #tokens
ORDER BY publisher_commit DESC)
DROP TABLE #tokens
-- Get history for the tracer token.
EXEC sys.sp_helptracertokenhistory
@publication = @publication,
@tracer_id = @tokenID;
GO
Only members of the sysadmin fixed server role or the db_owner fixed database role can execute sp_posttracertoken
.
gebeurtenis
31 mrt, 23 - 2 apr, 23
De grootste SQL-, Fabric- en Power BI-leerevenement. 31 maart – 2 april. Gebruik code FABINSIDER om $ 400 te besparen.
Zorg dat u zich vandaag nog registreert