sp_posttracertoken(Transact-SQL)

이 프로시저는 추적 프로그램 토큰을 게시자의 트랜잭션 로그에 게시하고 대기 시간 통계 추적 프로세스를 시작합니다. 추적 프로그램 토큰이 트랜잭션 로그에 기록될 때, 기록된 토큰을 로그 판독기 에이전트에서 선택할 때, 선택된 토큰을 배포 에이전트에서 적용할 때 각각 정보가 기록됩니다. 이 저장 프로시저는 게시 데이터베이스의 게시자에서 실행됩니다. 자세한 내용은 트랜잭션 복제에 대한 대기 시간 측정 및 연결 유효성 검사를 참조하십시오.

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

구문

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

인수

  • [ @publication= ] 'publication'
    대기 시간을 측정할 게시의 이름입니다. publicationsysname이며 기본값은 없습니다.
  • [ @publisher= ] 'publisher'
    비-Microsoft SQL Server 게시자를 지정합니다. publishersysname이며 기본값은 NULL입니다. SQL Server 게시자에 대해서는 지정하지 마십시오.

반환 코드 값

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

주의

sp_posttracertoken은 트랜잭션 복제에 사용됩니다.

사용 권한

sysadmin 고정 서버 역할 또는 db_owner 고정 데이터베이스 역할의 멤버만이 sp_posttracertoken을 실행할 수 있습니다.

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

USE [AdventureWorks]

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

참고 항목

관련 자료

How to: Measure Latency and Validate Connections for Transactional Replication (Replication Transact-SQL Programming)

도움말 및 정보

SQL Server 2005 지원 받기