sp_helptracertokenhistory (języka Transact-SQL)

Zwraca szczegółowe opóźnienie informacji śledzenia określony tokenów, z jednym wierszem zwracane dla każdego subskrybenta.Ta procedura składowana jest wykonywany Wydawca baza danych publikacji lub dystrybutora do baza danych dystrybucji.

Ikona łącza do tematuKonwencje składni Transact-SQL

Składnia

sp_helptracertokenhistory [ @publication = ] 'publication' 
        , [ @tracer_id = ] tracer_id
    [ , [ @publisher = ] 'publisher' ]
    [ , [ @publisher_db = ] 'publisher_db' ]

Argumenty

  • [ @publication= ] 'publication'
    Is the name of the publication in which the tracer token was inserted.publication is sysname, with no default.

  • [ @tracer_id= ] tracer_id
    Is the ID of the tracer token in the MStracer_tokens (Transact-SQL) table for which history information is returned.tracer_id is int, with no default.

  • [ @publisher= ] 'publisher'
    The name of the Publisher.publisher is sysname, with a default of NULL.

    Ostrzeżenie

    This parameter should only be specified for non-Microsoft SQL Server Publishers.

  • [ @publisher_db= ] 'publisher_db'
    The name of the publication database.publisher_db is sysname, with a default value of NULL.Ten parametr jest ignorowany, jeśli procedura składowana jest wykonywany na Wydawca.

Zestaw wyników

Nazwa kolumny

Typ danych

Opis

distributor_latency

bigint

Liczba sekund między rekordu token śledzący zaangażowanych w Wydawca i rekord zaangażowanych w dystrybutora.

Subskrybent

sysname

Nazwa subskrybenta, który otrzymał token śledzący.

subscriber_db

sysname

Nazwa baza danych subskrypcja do wstawiony został rekord token śledzący.

subscriber_latency

bigint

Liczba sekund między rekord token śledzący, zaangażowanych w dystrybutora i rekord, są zobowiązane przez subskrybenta.

overall_latency

bigint

Liczba sekund między rekordu token śledzący zaangażowanych w Wydawca i rekord tokenu są zobowiązane przez subskrybenta.

Wartości kodów powrotnych

0 (sukces) lub 1 (błąd)

Uwagi

sp_helptracertokenhistory w replikacja transakcyjna.

Wykonanie sp_helptracertokens (języka Transact-SQL) Aby uzyskać listę śledzenia tokenów dla publikacja.

Wartość NULL zestaw wyników oznacza, że opóźnienie nie można obliczyć statystyki.Jest tak, ponieważ nie otrzymano token śledzący u dystrybutora lub jeden abonentów.

Przykład

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

Uprawnienia

Tylko członkowie sysadmin stałej roli serwera db_owner ustaloną rolę bazy danych w baza danych publikacja, lub db_owner stałej bazy danych lub replmonitor role baza danych dystrybucji można wykonać sp_helptracertokenhistory.