TransSubscription 클래스

정의

트랜잭션 또는 스냅샷 게시에 대한 밀어넣기 구독을 나타냅니다.

public ref class TransSubscription sealed : Microsoft::SqlServer::Replication::Subscription
public sealed class TransSubscription : Microsoft.SqlServer.Replication.Subscription
type TransSubscription = class
    inherit Subscription
Public NotInheritable Class TransSubscription
Inherits Subscription
상속

예제

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

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

           // Create the objects that we need.
           TransPublication publication;
           TransSubscription subscription;

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

               // Ensure that the publication exists and that 
               // it supports push subscriptions.
               publication = new TransPublication();
               publication.Name = publicationName;
               publication.DatabaseName = publicationDbName;
               publication.ConnectionContext = conn;

               if (publication.IsExistingObject)
               {
                   if ((publication.Attributes & PublicationAttributes.AllowPush) == 0)
                   {
                       publication.Attributes |= PublicationAttributes.AllowPush;
                   }

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

                   // Specify the Windows login credentials for the Distribution Agent job.
                   subscription.SynchronizationAgentProcessSecurity.Login = winLogin;
                   subscription.SynchronizationAgentProcessSecurity.Password = winPassword;

                   // By default, subscriptions to transactional publications are synchronized 
                   // continuously, but in this case we only want to synchronize on demand.
                   subscription.AgentSchedule.FrequencyType = ScheduleFrequencyType.OnDemand;

                   // Create the push subscription.
                   subscription.Create();
               }
               else
               {
                   // Do something here if the publication does not exist.
                   throw new ApplicationException(String.Format(
                       "The publication '{0}' does not exist on {1}.",
                       publicationName, publisherName));
               }
           }
           catch (Exception ex)
           {
               // Implement the appropriate error handling here.
               throw new ApplicationException(String.Format(
                   "The subscription to {0} could not be created.", publicationName), ex);
           }
           finally
           {
               conn.Disconnect();
           }
' Define the Publisher, publication, and databases.
Dim publicationName As String = "AdvWorksProductTran"
Dim publisherName As String = publisherInstance
Dim subscriberName As String = subscriberInstance
Dim subscriptionDbName As String = "AdventureWorks2012Replica"
Dim publicationDbName As String = "AdventureWorks2012"

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

' Create the objects that we need.
Dim publication As TransPublication
Dim subscription As TransSubscription

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

    ' Ensure that the publication exists and that 
    ' it supports push subscriptions.
    publication = New TransPublication()
    publication.Name = publicationName
    publication.DatabaseName = publicationDbName
    publication.ConnectionContext = conn

    If publication.IsExistingObject Then
        If (publication.Attributes And PublicationAttributes.AllowPush) = 0 Then
            publication.Attributes = publication.Attributes _
            Or PublicationAttributes.AllowPush
        End If

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

        ' Specify the Windows login credentials for the Distribution Agent job.
        subscription.SynchronizationAgentProcessSecurity.Login = winLogin
        subscription.SynchronizationAgentProcessSecurity.Password = winPassword

        ' By default, subscriptions to transactional publications are synchronized 
        ' continuously, but in this case we only want to synchronize on demand.
        subscription.AgentSchedule.FrequencyType = ScheduleFrequencyType.OnDemand

        ' Create the push subscription.
        subscription.Create()
    Else
        ' Do something here if the publication does not exist.
        Throw New ApplicationException(String.Format( _
         "The publication '{0}' does not exist on {1}.", _
         publicationName, publisherName))
    End If

Catch ex As Exception
    ' Implement the appropriate error handling here.
    Throw New ApplicationException(String.Format( _
        "The subscription to {0} could not be created.", publicationName), ex)
Finally
    conn.Disconnect()
End Try

설명

원격 배포자를 사용하여 게시자를 구성할 때 를 비롯한 SynchronizationAgentProcessSecurity모든 매개 변수에 제공된 값은 일반 텍스트로 배포자로 전송됩니다. Create 메서드를 호출하기 전에 게시자와 해당 원격 배포자 간 연결을 암호화해야 합니다. 자세한 내용은 sp_reinitsubscription(Transact-SQL)를 참조하세요.

구독이 SQL Server 이외 게시자에 ConnectionContext 속하는 경우 속성은 Publisher 대신 배포자로 설정되고, DatabaseName 속성은 게시 데이터베이스 대신 배포 데이터베이스로 설정되고PublisherName, 속성은 SQL Server 않은 게시자의 이름으로 설정됩니다.

스레드 보안

이 형식의 모든 공용 정적(Shared Microsoft Visual Basic의 경우) 멤버는 다중 스레드 작업에 안전합니다. 인스턴스 구성원은 스레드로부터의 안전성이 보장되지 않습니다.

생성자

TransSubscription()

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

TransSubscription(String, String, String, String, ServerConnection)

지정된 게시, 데이터베이스, 구독자 및 구독자 데이터베이스와 Microsoft SQL Server 인스턴스에 대한 지정된 연결을 사용하여 클래스의 새 TransSubscription 인스턴스를 만듭니다.

속성

AgentJobId

구독을 동기화하는 데 사용되는 에이전트 작업의 ID를 가져옵니다.

(다음에서 상속됨 Subscription)
AgentOffload

동기화 에이전트가 에이전트 작업이 만들어진 컴퓨터가 아닌 다른 컴퓨터에서 실행되는지 여부를 가져오거나 설정합니다. 이 속성은 Microsoft SQL Server 2005 이상을 실행하는 배포자에 대해 더 이상 지원되지 않습니다.

(다음에서 상속됨 Subscription)
AgentOffloadServer

원격 에이전트 활성화를 사용하는 경우 에이전트가 실행되는 원격 컴퓨터의 이름을 가져오거나 설정합니다.

(다음에서 상속됨 Subscription)
AgentSchedule

구독을 동기화하는 데 사용되는 에이전트 작업의 일정을 가져옵니다.

(다음에서 상속됨 Subscription)
BackupInformation

백업에서 구독을 초기화하는 데 필요한 정보를 가져오거나 설정합니다.

CachePropertyChanges

복제 속성에 대한 변경 내용을 캐시할지 아니면 즉시 적용할지를 가져오거나 설정합니다.

(다음에서 상속됨 ReplicationObject)
ConnectionContext

Microsoft SQL Server 인스턴스에 대한 연결을 가져오거나 설정합니다.

(다음에서 상속됨 ReplicationObject)
CreateSyncAgentByDefault

구독을 동기화하는 데 사용되는 에이전트 작업이 기본적으로 만들어지는지 여부를 가져오거나 설정합니다.

(다음에서 상속됨 Subscription)
DatabaseName

게시 데이터베이스의 이름을 가져오거나 설정합니다.

(다음에서 상속됨 Subscription)
DtsPackageLocation

Microsoft SQL Server 2000 DTS(데이터 변환 서비스) 패키지의 위치를 가져오거나 설정합니다.

DtsPackageName

구독자에 적용되는 Microsoft SQL Server 2000 DTS(데이터 변환 서비스) 패키지의 이름을 가져오거나 설정합니다.

DtsPackagePassword

Microsoft SQL Server 2000 DTS(데이터 변환 서비스) 패키지를 실행하는 데 사용되는 암호를 설정합니다.

EnabledForSynchronizationManager

Microsoft Windows 동기화 관리자를 사용하여 구독을 동기화할 수 있는지 여부를 지정합니다.

(다음에서 상속됨 Subscription)
FullSubscription

구독이 전체인지 여부를 나타내는 값을 가져옵니다.

IsExistingObject

서버에 개체가 있는지 여부를 가져옵니다.

(다음에서 상속됨 ReplicationObject)
LoopBackDetection

배포 에이전트가 구독자에서 발생한 트랜잭션을 다시 구독자에게 보내는지 여부를 가져오거나 설정합니다.

MemoryOptimized

트랜잭션 또는 스냅샷 게시에 대한 밀어넣기 구독을 나타냅니다.

Name

기존 구독에 할당된 이름을 가져옵니다.

(다음에서 상속됨 Subscription)
PublicationName

구독에서 구독하는 게시의 이름을 가져오거나 설정합니다.

(다음에서 상속됨 Subscription)
PublisherName

구독이 SQL Server 이외 게시자에 속하는 경우 게시자의 이름을 가져오거나 설정합니다.

SecureDtsPackagePassword

Microsoft SQL Server 2000 DTS(데이터 변환 서비스) 패키지를 실행하는 데 사용되는 암호를 개체로 SecureString 설정합니다.

SqlServerName

이 개체가 연결된 Microsoft SQL Server 인스턴스의 이름을 가져옵니다.

(다음에서 상속됨 ReplicationObject)
Status

구독 상태를 가져옵니다.

(다음에서 상속됨 Subscription)
SubscriberCatalog

SQL Server 이외 구독자에 대해 OLE DB 공급자에 연결할 때 사용되는 카탈로그를 가져오거나 설정합니다.

SubscriberDatasource

SQL Server 이외 구독자에 대한 OLE DB 공급자가 이해한 데이터 원본의 이름입니다.

SubscriberDatasourceType

SQL Server 구독자가 아닌 데이터 원본의 형식을 식별합니다.

SubscriberLocation

SQL Server 이외 구독자에 대한 OLE DB 공급자가 이해한 데이터베이스의 위치입니다.

SubscriberName

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

(다음에서 상속됨 Subscription)
SubscriberProvider

비 SQL Server 구독자에 대한 OLE DB 공급자가 등록된 고유한 PROGID(프로그래밍 식별자)

SubscriberProviderString

OLE DB 공급자별 연결 문자열은 SQL Server 아닌 구독자의 데이터 원본에 연결하는 데 사용됩니다.

SubscriberSecurity

구독자에 연결하는 데 사용되는 보안 컨텍스트를 가져옵니다.

(다음에서 상속됨 Subscription)
SubscriberType

구독자에서 데이터 변경에 대한 업데이트 동작을 가져오거나 설정합니다.

SubscriptionDBName

복제된 데이터를 받는 구독자 데이터베이스의 이름을 가져오거나 설정합니다.

(다음에서 상속됨 Subscription)
SubscriptionLSN

구독의 로그 시퀀스 수를 가져오거나 설정합니다.

SubscriptionType

구독 등록이 밀어넣기 구독인지 아니면 끌어오기 구독인지를 가져옵니다.

(다음에서 상속됨 Subscription)
SynchronizationAgent

구독을 동기화하는 데 사용할 수 있는 TransSynchronizationAgent 클래스의 인스턴스를 가져옵니다.

SynchronizationAgentName

구독을 동기화하기 위해 만든 에이전트 작업의 이름을 가져오거나 설정합니다.

(다음에서 상속됨 Subscription)
SynchronizationAgentProcessSecurity

구독을 동기화하기 위해 동기화 에이전트 작업이 실행되는 Microsoft Windows 계정을 지정하는 데 사용되는 보안 컨텍스트를 가져옵니다.

(다음에서 상속됨 Subscription)
SyncType

구독이 초기화되는 방식을 가져오거나 설정합니다.

(다음에서 상속됨 Subscription)
UserData

사용자가 자신의 고유 데이터를 개체에 연결할 수 있도록 하는 개체 속성을 가져오거나 설정합니다.

(다음에서 상속됨 ReplicationObject)

메서드

CheckValidCreation()

유효한 복제 만들기를 확인합니다.

(다음에서 상속됨 ReplicationObject)
CheckValidDefinition(Boolean)

구독 정의가 유효한지 여부를 나타냅니다.

(다음에서 상속됨 Subscription)
CommitPropertyChanges()

캐시된 모든 속성 변경 문을 Microsoft SQL Server 인스턴스로 보냅니다.

(다음에서 상속됨 ReplicationObject)
Create()

게시자에서 구독 등록을 만듭니다.

(다음에서 상속됨 Subscription)
Decouple()

참조된 복제 개체를 서버에서 분리합니다.

(다음에서 상속됨 ReplicationObject)
DoUpdateMemoryOptimizedProperty(String)

트랜잭션 또는 스냅샷 게시에 대한 밀어넣기 구독을 나타냅니다.

GetChangeCommand(StringBuilder, String, String)

복제에서 변경 명령을 반환합니다.

(다음에서 상속됨 ReplicationObject)
GetCreateCommand(StringBuilder, Boolean, ScriptOptions)

복제에서 생성 명령을 반환합니다.

(다음에서 상속됨 ReplicationObject)
GetDropCommand(StringBuilder, Boolean)

복제에서 삭제 명령을 반환합니다.

(다음에서 상속됨 ReplicationObject)
InternalRefresh(Boolean)

복제에서 내부 새로 고침을 시작합니다.

(다음에서 상속됨 ReplicationObject)
Load()

서버에서 기존 개체의 속성을 로드합니다.

(다음에서 상속됨 ReplicationObject)
LoadProperties()

서버에서 기존 개체의 속성을 로드합니다.

(다음에서 상속됨 ReplicationObject)
Refresh()

개체의 속성을 다시 로드합니다.

(다음에서 상속됨 ReplicationObject)
Reinitialize()

다음에 배포 에이전트를 실행하여 구독을 동기화할 때 구독을 다시 초기화하도록 표시합니다.

Reinitialize(Boolean)

구독을 다시 초기화합니다.

Remove()

밀어넣기 구독의 경우 게시자에서 구독 등록을 삭제하고 구독자에서 복제 개체를 제거합니다.

(다음에서 상속됨 Subscription)
Script(ScriptOptions)

구독을 만들거나 삭제하는 데 사용할 수 있는 Transact-SQL 스크립트를 반환합니다.

(다음에서 상속됨 Subscription)
StopSynchronizationJob()

현재 구독을 동기화 중인 배포 에이전트 작업의 실행을 중지하려고 합니다.

SynchronizeWithJob()

구독을 동기화하는 에이전트 작업을 시작합니다.

적용 대상

추가 정보