sp_helptracertokens(Transact-SQL)

대기 시간을 확인할 수 있도록 게시에 삽입된 각 추적 프로그램 토큰당 하나의 행을 반환합니다. 이 저장 프로시저는 게시 데이터베이스의 게시자 또는 배포 데이터베이스의 배포자에서 실행됩니다.

항목 링크 아이콘 Transact-SQL 구문 표기 규칙

구문

sp_helptracertokens [ @publication = ] 'publication' 
    [ , [ @publisher = ] 'publisher' ] 
    [ , [ @publisher_db = ] 'publisher_db' ]

인수

  • [ @publication= ] 'publication'
    추적 프로그램 토큰이 삽입된 게시의 이름입니다. publication는 sysname이며 기본값은 없습니다.

  • [ @publisher= ] 'publisher'
    게시자의 이름입니다. publisher는 sysname이며 기본값은 NULL입니다.

    [!참고]

    이 매개 변수는 비-Microsoft SQL Server 게시자에 대해서만 지정해야 합니다.

  • [ @publisher_db= ] 'publisher_db'
    게시 데이터베이스의 이름입니다. publisher_db는 sysname이며 기본값은 NULL입니다. 이 매개 변수는 게시자에서 저장 프로시저가 실행될 경우 무시됩니다.

결과 집합

열 이름

데이터 형식

설명

tracer_id

int

추적 프로그램 토큰 레코드를 식별합니다.

publisher_commit

datetime

게시 데이터베이스의 게시자에서 토큰 레코드가 커밋된 날짜와 시간입니다.

반환 코드 값

0(성공) 또는 1(실패)

주의

sp_helptracertokens는 트랜잭션 복제에 사용됩니다.

sp_helptracertokenssp_helptracertokenhistory(Transact-SQL)를 실행할 때 추적 프로그램 토큰 ID를 얻기 위해 사용합니다.

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

USE [AdventureWorks2012]

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

사용 권한

게시 데이터베이스의 sysadmin 고정 서버 역할 또는 db_owner 고정 데이터베이스 역할이나 배포 데이터베이스의 db_owner 고정 데이터베이스 또는 replmonitor 역할의 멤버만 sp_helptracertokenhistory를 실행할 수 있습니다.

참고 항목

참조

sp_deletetracertokenhistory(Transact-SQL)

개념

트랜잭션 복제에 대한 대기 시간 측정 및 연결 유효성 검사