TransSynchronizationAgent 클래스

정의

복제 배포 에이전트의 기능을 제공합니다.

public ref class TransSynchronizationAgent : MarshalByRefObject, IDisposable, Microsoft::SqlServer::Replication::ITransSynchronizationAgent
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComSourceInterfaces(typeof(Microsoft.SqlServer.Replication.IComStatusEvent))]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Runtime.InteropServices.Guid("adeda98a-bdfc-4029-b6fb-991d6b468395")]
public class TransSynchronizationAgent : MarshalByRefObject, IDisposable, Microsoft.SqlServer.Replication.ITransSynchronizationAgent
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComSourceInterfaces(typeof(Microsoft.SqlServer.Replication.IComStatusEvent))>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Runtime.InteropServices.Guid("adeda98a-bdfc-4029-b6fb-991d6b468395")>]
type TransSynchronizationAgent = class
    inherit MarshalByRefObject
    interface IDisposable
    interface ITransSynchronizationAgent
Public Class TransSynchronizationAgent
Inherits MarshalByRefObject
Implements IDisposable, ITransSynchronizationAgent
상속
TransSynchronizationAgent
특성
구현

예제

다음 예에서는, Synchronize 이 메서드가 해당 속성에서 TransSynchronizationAgent 접근되는 클래스 인스턴스 SynchronizationAgent 에서 호출되어 푸시 구독을 동기화합니다.

// Define the server, publication, and database names.
string subscriberName = subscriberInstance;
string publisherName = publisherInstance;
string publicationName = "AdvWorksProductTran";
string subscriptionDbName = "AdventureWorks2012Replica";
string publicationDbName = "AdventureWorks2012";

// Create a connection to the Publisher.
ServerConnection conn = new ServerConnection(publisherName);

TransSubscription subscription;

try
{
    // Connect to the Publisher.
    conn.Connect();

    // Define the push subscription.
    subscription = new TransSubscription();
    subscription.ConnectionContext = conn;
    subscription.DatabaseName = publicationDbName;
    subscription.PublicationName = publicationName;
    subscription.SubscriptionDBName = subscriptionDbName;
    subscription.SubscriberName = subscriberName;

    // If the push subscription exists, start the synchronization.
    if (subscription.LoadProperties())
    {
        // Check that we have enough metadata to start the agent.
        if (subscription.SubscriberSecurity != null)
        {
            // Synchronously start the Distribution Agent for the subscription.
            subscription.SynchronizationAgent.Synchronize();
        }
        else
        {
            throw new ApplicationException("There is insufficent metadata to " +
                "synchronize the subscription. Recreate the subscription with " +
                "the agent job or supply the required agent properties at run time.");
        }
    }
    else
    {
        // Do something here if the push subscription does not exist.
        throw new ApplicationException(String.Format(
            "The subscription to '{0}' does not exist on {1}",
            publicationName, subscriberName));
    }
}
catch (Exception ex)
{
    // Implement appropriate error handling here.
    throw new ApplicationException("The subscription could not be synchronized.", ex);
}
finally
{
    conn.Disconnect();
}
' Define the server, publication, and database names.
Dim subscriberName As String = subscriberInstance
Dim publisherName As String = publisherInstance
Dim publicationName As String = "AdvWorksProductTran"
Dim subscriptionDbName As String = "AdventureWorks2012Replica"
Dim publicationDbName As String = "AdventureWorks2012"

' Create a connection to the Publisher.
Dim conn As ServerConnection = New ServerConnection(publisherName)

Dim subscription As TransSubscription

Try
    ' Connect to the Publisher.
    conn.Connect()

    ' Define the push subscription.
    subscription = New TransSubscription()
    subscription.ConnectionContext = conn
    subscription.DatabaseName = publicationDbName
    subscription.PublicationName = publicationName
    subscription.SubscriptionDBName = subscriptionDbName
    subscription.SubscriberName = subscriberName

    ' If the push subscription exists, start the synchronization.
    If subscription.LoadProperties() Then
        ' Check that we have enough metadata to start the agent.
        If Not subscription.SubscriberSecurity Is Nothing Then

            ' Synchronously start the Distribution Agent for the subscription.
            subscription.SynchronizationAgent.Synchronize()
        Else
            Throw New ApplicationException("There is insufficent metadata to " + _
             "synchronize the subscription. Recreate the subscription with " + _
             "the agent job or supply the required agent properties at run time.")
        End If
    Else
        ' Do something here if the push subscription does not exist.
        Throw New ApplicationException(String.Format( _
         "The subscription to '{0}' does not exist on {1}", _
         publicationName, subscriberName))
    End If
Catch ex As Exception
    ' Implement appropriate error handling here.
    Throw New ApplicationException("The subscription could not be synchronized.", ex)
Finally
    conn.Disconnect()
End Try

설명

이 클래스는 TransSynchronizationAgent 트랜잭션 또는 스냅샷 출판물에 대한 구독을 프로그래밍적으로 동기화하는 기능을 지원합니다.

생성자

Name Description
TransSynchronizationAgent()

TransSynchronizationAgent 클래스의 인스턴스를 만듭니다.

속성

Name Description
AltSnapshotFolder

구독의 대체 스냅샷 폴더를 받거나 설정합니다.

ComErrorCollection

복제 에이전트가 생성하는 오류 모음을 받습니다.

Distributor

구독의 배포자 역할을 하는 Microsoft SQL Server 인스턴스의 이름을 받거나 설정합니다.

DistributorAddress

속성이 DistributorNetwork 지정될 때 배포기에 연결하는 데 사용되는 네트워크 주소를 획득하거나 설정합니다.

DistributorEncryptedPassword

SQL Server 인증을 사용해 배포자에 연결할 때 사용하는 암호화된 비밀번호를 받거나 설정합니다.

DistributorLogin

SQL Server 인증을 사용해 배포자에 연결할 때 사용하는 로그인 이름을 얻거나 설정합니다.

DistributorNetwork

배포자와 연결할 때 사용하는 클라이언트 Net-Library을 받거나 설정합니다.

DistributorPassword

SQL Server 인증을 사용하여 배포자에 연결할 때 사용하는 비밀번호를 받거나 설정합니다.

DistributorSecurityMode

배전기와 연결할 때 사용하는 보안 모드를 받거나 설정합니다.

DtsPackageFileName

명령 행셋을 Subscriber에 적용하기 전에 변환하는 데 사용되는 Microsoft SQL Server 2000 Data Transformation Services(DTS) 패키지의 이름과 경로를 받거나 설정합니다.

DtsPackagePassword

속성에서 DtsPackageFileName 지정한 Microsoft SQL Server 2000 데이터 변환 서비스(DTS) 패키지에 접근하는 데 사용된 소유자 비밀번호를 획득하거나 설정합니다.

FileTransferType

초기 스냅샷 파일을 구독자에게 어떻게 전송하는지 설정합니다.

HostName

호스트 이름을 받거나 설정합니다.

LastUpdatedTime

복제 에이전트가 구독을 동기화한 마지막 시점의 타임스탬프를 받습니다.

LoginTimeout

연결이 확립될 때까지 기다리는 최대 초수를 얻거나 설정합니다.

MaxDeliveredTransactions

단일 에이전트 실행 중 구독자에게 적용되는 최대 트랜잭션 수를 받거나 설정합니다.

Output

에이전트 출력 파일의 파일 이름과 경로를 받거나 설정합니다.

OutputVerboseLevel

배포 에이전트가 에이전트 출력 파일에 기록하는 정보량을 받거나 설정합니다.

ProfileName

에이전트가 사용하는 프로필 이름을 얻거나 설정합니다.

Publication

출판물의 이름을 얻거나 정하는 역할.

Publisher

구독의 Publisher인 Microsoft SQL Server 인스턴스의 이름을 받거나 설정합니다.

PublisherDatabase

출판 데이터베이스의 이름을 얻거나 설정합니다.

QueryTimeout

내부 쿼리가 완료될 수 있는 초를 획득하거나 설정합니다.

SecureDistributorEncryptedPassword

배포자의 보안 암호화 비밀번호를 받거나 설정합니다.

SecureSubscriberEncryptedPassword

가입자를 위한 보안 암호화 비밀번호를 받거나 설정합니다.

SkipErrors

이 에이전트가 건너뛸 오류 번호의 콜론 구분된 목록을 받거나 설정합니다.

Subscriber

구독자인 Microsoft SQL Server 인스턴스의 이름을 얻거나 설정합니다.

SubscriberDatabase

구독 데이터베이스의 이름을 얻거나 설정합니다.

SubscriberDatabasePath

구독자의 데이터베이스 경로를 받거나 설정하세요.

SubscriberDataSourceType

구독자로 사용되는 데이터 소스 유형을 획득하거나 설정합니다.

SubscriberEncryptedPassword

가입자의 암호화된 비밀번호를 받거나 설정합니다.

SubscriberLogin

SQL Server 인증을 사용해 가입자와 연결할 때 사용하는 로그인 이름을 얻거나 설정합니다.

SubscriberPassword

SQL Server 인증을 사용하여 가입자와 연결할 때 사용하는 비밀번호를 받거나 설정합니다.

SubscriberSecurityMode

퍼블리셔에 연결할 때 사용하는 보안 모드를 획득하거나 설정합니다.

SubscriptionType

구독이 푸시 구독인지 풀 구독인지 받거나 설정합니다.

UndeliveredCommands

전달되지 않은 명령어 수를 받습니다.

UndeliveredTransactions

미배달 거래 건수를 받습니다.

UseInProcLoader

스냅샷 파일을 구독자에게 적용할 때 BULK INSERT 명령을 사용할지 여부를 나타내는 값을 받거나 설정합니다.

WorkingDirectory

파일 전송 프로토콜(FTP)을 사용할 때 스냅샷 파일에 접근할 작업 디렉터리를 받거나 설정합니다.

메서드

Name Description
Abort()

작전을 TransSynchronizationAgent 중단한다.

Dispose()

TransSynchronizationAgent 클래스의 현재 인스턴스에서 사용하는 모든 리소스를 해제합니다.

Dispose(Boolean)

클래스에서 사용하는 모든 리소스를 해제합니다 TransSynchronizationAgent .

Finalize()

TransSynchronizationAgent.

IsSnapshotRequired()

다음 에이전트 동기화 시 새로운 스냅샷이 적용될지 여부를 결정하기 위해 배포자와 가입자에게 연결됩니다.

Synchronize()

구독을 동기화하기 위해 배포 에이전트를 시작합니다.

이벤트

Name Description
ComStatus

배포 에이전트가 동기화 Com 상태 정보를 반환할 때 발생합니다.

Status

배포 에이전트가 동기화 상태 정보를 반환할 때 발생합니다.

적용 대상

스레드 보안

이 클래스는 TransSynchronizationAgent 멀티스레드 아파트를 지원하지 않습니다. 애플리케이션의 주요 진입점인 메서드에 속성을 선언 [STAThread] 하여 단일 스레드 아파트를 지정할 수 있습니다. 이는 Microsoft Visual Studio를 사용하여 생성된 Microsoft Windows 기반 애플리케이션의 기본 설정입니다.