Aracılığıyla paylaş


sp_posttracertoken (Transact-SQL)

Bu yordam deftere naklettiği bir izleme belirteci harekete Yayımcı tarafında oturum ve gecikme süresi istatistiklerini izleme işlemini başlatır.Kaydedilmiş bilgiler, izleme belirteci işlem günlüğü için Günlük Okuyucu Aracısı tarafından toplanmış, ve Dağıtım Aracısı tarafından uygulandığında yazılır.Bu saklı yordam, yayın veritabanı üzerinde yayımcı adresindeki yürütülür.Daha fazla bilgi için bkz: Gecikme ölçmek ve işlem çoğaltma bağlantıları doğrulama.

Konu bağlantısı simgesiTransact-sql sözdizimi kuralları

Sözdizimi

sp_posttracertoken [ @publication = ] 'publication' 
    [ , [ @tracer_token_id = ] tracer_token_id OUTPUT
    [ , [ @publisher = ] 'publisher' 

Bağımsız değişkenler

  • [ @ yayın=] 'publication'
    Is the name of the publication for which latency is being measured.publication is sysname, with no default.

  • [ @tracer_token_id= ] tracer_token_idOUTPUT
    Is the ID of the tracer token inserted.tracer_token_id is int with a default of NULL, and it is an OUTPUT parameter.Bu değer yürütmek için kullanılan sp_helptracertokenhistory (Transact-SQL) veya sp_deletetracertokenhistory (Transact-SQL) ilk yürütme olmadan sp_helptracertokens (Transact-SQL).

  • [ @publisher= ] 'publisher'
    Specifies a non-Microsoft SQL Server Publisher.publisher is sysname, with a default of NULL and should not be specified for a SQL Server Publisher.

Dönüş Kodu Değerleri

0 (başarılı) veya 1 (başarısız)

Açıklamalar

sp_posttracertoken 'deki işlem çoğaltma kullanılır.

Örnek

DECLARE @publication AS sysname;
DECLARE @tokenID AS int;
SET @publication = N'AdvWorksProductTran'; 

USE [AdventureWorks2008R2]

-- 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

İzinler

Yalnızca üyeleri sysadmin sabit sunucu rolü veya db_owner sabit veritabanı rolü olabilir yürütmek sp_posttracertoken.