MergeSynchronizationAgent 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
Replication 병합 에이전트의 기능을 제공합니다.
public ref class MergeSynchronizationAgent : MarshalByRefObject, IDisposable, Microsoft::SqlServer::Replication::IMergeSynchronizationAgent
[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("ee5ee47e-6d29-448f-b2d2-f8e632db336a")]
public class MergeSynchronizationAgent : MarshalByRefObject, IDisposable, Microsoft.SqlServer.Replication.IMergeSynchronizationAgent
[<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("ee5ee47e-6d29-448f-b2d2-f8e632db336a")>]
type MergeSynchronizationAgent = class
inherit MarshalByRefObject
interface IDisposable
interface IMergeSynchronizationAgent
Public Class MergeSynchronizationAgent
Inherits MarshalByRefObject
Implements IDisposable, IMergeSynchronizationAgent
- 상속
-
MergeSynchronizationAgent
- 특성
- 구현
예제
다음 예에서는, Synchronize 이 메서드가 해당 속성에서 SynchronizationAgent 접근되는 클래스 인스턴스 MergeSynchronizationAgent 에서 호출되어 푸시 구독을 동기화합니다.
// Define the server, publication, and database names.
string subscriberName = subscriberInstance;
string publisherName = publisherInstance;
string publicationName = "AdvWorksSalesOrdersMerge";
string subscriptionDbName = "AdventureWorks2012Replica";
string publicationDbName = "AdventureWorks2012";
// Create a connection to the Publisher.
ServerConnection conn = new ServerConnection(publisherName);
MergeSubscription subscription;
try
{
// Connect to the Publisher
conn.Connect();
// Define the subscription.
subscription = new MergeSubscription();
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 Merge 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 = "AdvWorksSalesOrdersMerge"
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 MergeSubscription
Try
' Connect to the Publisher
conn.Connect()
' Define the subscription.
subscription = New MergeSubscription()
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 Merge Agent for the subscription.
' Log agent messages to an output file.
subscription.SynchronizationAgent.Output = "mergeagent.log"
subscription.SynchronizationAgent.OutputVerboseLevel = 2
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
다음 예에서는 클래스의 MergeSynchronizationAgent 인스턴스를 사용하여 병합 구독을 동기화합니다. 풀 구독은 에 대한 값을 falseCreateSyncAgentByDefault사용하여 생성되었기 때문에 추가 속성이 제공되어야 합니다.
// Define the server, publication, and database names.
string subscriberName = subscriberInstance;
string publisherName = publisherInstance;
string distributorName = distributorInstance;
string publicationName = "AdvWorksSalesOrdersMerge";
string subscriptionDbName = "AdventureWorks2012Replica";
string publicationDbName = "AdventureWorks2012";
string hostname = @"adventure-works\garrett1";
string webSyncUrl = "https://" + publisherInstance + "/SalesOrders/replisapi.dll";
// Create a connection to the Subscriber.
ServerConnection conn = new ServerConnection(subscriberName);
MergePullSubscription subscription;
MergeSynchronizationAgent agent;
try
{
// Connect to the Subscriber.
conn.Connect();
// Define the pull subscription.
subscription = new MergePullSubscription();
subscription.ConnectionContext = conn;
subscription.DatabaseName = subscriptionDbName;
subscription.PublisherName = publisherName;
subscription.PublicationDBName = publicationDbName;
subscription.PublicationName = publicationName;
// If the pull subscription exists, then start the synchronization.
if (subscription.LoadProperties())
{
// Get the agent for the subscription.
agent = subscription.SynchronizationAgent;
// Check that we have enough metadata to start the agent.
if (agent.PublisherSecurityMode == null)
{
// Set the required properties that could not be returned
// from the MSsubscription_properties table.
agent.PublisherSecurityMode = SecurityMode.Integrated;
agent.DistributorSecurityMode = SecurityMode.Integrated;
agent.Distributor = publisherName;
agent.HostName = hostname;
// Set optional Web synchronization properties.
agent.UseWebSynchronization = true;
agent.InternetUrl = webSyncUrl;
agent.InternetSecurityMode = SecurityMode.Standard;
agent.InternetLogin = winLogin;
agent.InternetPassword = winPassword;
}
// Enable agent output to the console.
agent.OutputVerboseLevel = 1;
agent.Output = "";
// Synchronously start the Merge Agent for the subscription.
agent.Synchronize();
}
else
{
// Do something here if the pull subscription does not exist.
throw new ApplicationException(String.Format(
"A 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. Verify that the subscription has " +
"been defined correctly.", 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 = "AdvWorksSalesOrdersMerge"
Dim subscriptionDbName As String = "AdventureWorks2012Replica"
Dim publicationDbName As String = "AdventureWorks2012"
Dim hostname As String = "adventure-works\garrett1"
Dim webSyncUrl As String = "https://" + publisherInstance + "/SalesOrders/replisapi.dll"
' Create a connection to the Subscriber.
Dim conn As ServerConnection = New ServerConnection(subscriberName)
Dim subscription As MergePullSubscription
Dim agent As MergeSynchronizationAgent
Try
' Connect to the Subscriber.
conn.Connect()
' Define the pull subscription.
subscription = New MergePullSubscription()
subscription.ConnectionContext = conn
subscription.DatabaseName = subscriptionDbName
subscription.PublisherName = publisherName
subscription.PublicationDBName = publicationDbName
subscription.PublicationName = publicationName
' If the pull subscription exists, then start the synchronization.
If subscription.LoadProperties() Then
' Get the agent for the subscription.
agent = subscription.SynchronizationAgent
' Check that we have enough metadata to start the agent.
If agent.PublisherSecurityMode = Nothing Then
' Set the required properties that could not be returned
' from the MSsubscription_properties table.
agent.PublisherSecurityMode = SecurityMode.Integrated
agent.Distributor = publisherInstance
agent.DistributorSecurityMode = SecurityMode.Integrated
agent.HostName = hostname
' Set optional Web synchronization properties.
agent.UseWebSynchronization = True
agent.InternetUrl = webSyncUrl
agent.InternetSecurityMode = SecurityMode.Standard
agent.InternetLogin = winLogin
agent.InternetPassword = winPassword
End If
' Enable agent logging to the console.
agent.OutputVerboseLevel = 1
agent.Output = ""
' Synchronously start the Merge Agent for the subscription.
agent.Synchronize()
Else
' Do something here if the pull subscription does not exist.
Throw New ApplicationException(String.Format( _
"A 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. Verify that the subscription has " + _
"been defined correctly.", ex)
Finally
conn.Disconnect()
End Try
설명
이 클래스는 MergeSynchronizationAgent 다음과 같은 복제 작업을 수행할 수 있는 기능을 지원합니다:
구독을 동기화하세요.
동기화 시 업로드 단계만 실행하는지, 다운로드 단계만 실행하는지, 또는 두 단계 모두 실행하는지 지정하세요.
구독이 예상 데이터를 가지고 있는지 검증하세요.
구독의 초기 스냅샷을 적용할 수 있는 다른 스냅샷 폴더를 지정하세요.
생성자
| Name | Description |
|---|---|
| MergeSynchronizationAgent() |
MergeSynchronizationAgent 클래스의 인스턴스를 만듭니다. |
속성
| Name | Description |
|---|---|
| AlternateSynchronizationPartnerCollection |
구독을 위해 대체 동기화 파트너를 얻습니다. |
| AltSnapshotFolder |
구독의 대체 스냅샷 폴더를 받거나 설정합니다. |
| ComErrorCollection |
복제 에이전트가 생성한 오류 모음을 받습니다. |
| Distributor |
구독의 배포자 역할을 하는 Microsoft SQL Server 인스턴스의 이름을 받거나 설정합니다. |
| DistributorAddress |
속성이 DistributorNetwork 지정될 때 분배기와 연결하는 데 사용되는 네트워크 주소를 받거나 설정합니다. |
| DistributorEncryptedPassword |
배포자의 암호화된 비밀번호를 받거나 설정합니다. |
| DistributorLogin |
SQL Server 인증을 사용해 배포자에 연결할 때 사용하는 로그인 이름을 얻거나 설정합니다. |
| DistributorNetwork |
배포자에 연결할 때 사용하는 클라이언트 Net-Library을 받거나 설정합니다. |
| DistributorPassword |
SQL Server 인증을 사용해 배포자에 연결할 때 사용하는 비밀번호를 설정합니다. |
| DistributorSecurityMode |
디스트리뷰터에 연결할 때 사용하는 보안 모드를 획득하거나 설정합니다. |
| DownloadGenerationsPerBatch |
Publisher에서 Subscriber로 변경 사항을 다운로드하면서 한 번에 처리할 세대 수를 받거나 설정합니다. 생성은 아티클당 변경 내용의 논리적 그룹으로 정의됩니다. |
| DynamicSnapshotLocation |
이 Subscriber의 파티션된 스냅샷 위치를 얻거나 설정합니다. |
| ExchangeType |
동기화 중 데이터 교환 방식을 받거나 설정합니다. |
| FileTransferType |
초기 스냅샷 파일을 구독자에게 어떻게 전송하는지 설정합니다. |
| HostName |
HOST_NAME 함수를 사용하는 매개변수화된 필터를 평가할 때 병합 에이전트가 사용하는 값을 얻거나 설정합니다. |
| InputMessageFile |
입력 메시지 파일을 받거나 설정합니다. |
| InternetLogin |
인터넷 인증을 통해 Publisher에 연결할 때 웹 동기화에 사용되는 로그인 이름을 받거나 설정합니다. |
| InternetPassword |
인터넷 인증을 사용해 Publisher에 연결할 때 웹 동기화에 사용되는 속성의 InternetLogin 비밀번호를 설정합니다. |
| InternetProxyLogin |
웹 프록시 서버를 통해 웹 서버에 연결할 때 사용할 로그인 이름을 받거나 설정합니다. |
| InternetProxyPassword |
웹 프록시 서버를 통해 웹 서버에 연결할 때 사용하는 로그인 비밀번호를 설정합니다. |
| InternetProxyServer |
웹 서버에 연결할 때 웹 동기화에 사용되는 인터넷 프록시 서버의 이름을 얻거나 설정합니다. |
| InternetSecurityMode |
웹 동기화 중 웹 서버에 연결할 때 사용되는 HTTP 인증 방식을 획득하거나 설정합니다. |
| InternetTimeout |
웹 서버에 연결할 때 HTTP 타임아웃을 받거나 설정합니다. |
| InternetUrl |
웹 동기화를 위해 설정된 웹 서비스의 URL을 받거나 설정합니다. |
| LastUpdatedTime |
복제 에이전트가 구독을 동기화한 마지막 시점의 타임스탬프를 받습니다. |
| LoginTimeout |
연결이 확립될 때까지 기다리는 최대 초수를 얻거나 설정합니다. |
| MetadataRetentionCleanup |
메타데이터를 정리할지 설정하거나 설정하세요. |
| Output |
에이전트 출력 파일을 받거나 설정합니다. |
| OutputMessageFile |
입력 메시지 파일을 받거나 설정합니다. |
| OutputVerboseLevel |
에이전트 출력 파일에 기록되는 정보의 세부 수준을 받거나 설정합니다. |
| ProfileName |
에이전트가 사용하는 프로필 이름을 얻거나 설정합니다. |
| Publication |
출판물의 이름을 얻거나 정하는 역할. |
| Publisher |
구독의 Publisher인 Microsoft SQL Server 인스턴스의 이름을 받거나 설정합니다. |
| PublisherAddress |
속성이 PublisherNetwork 지정되었을 때 Publisher에 연결하는 데 사용되는 네트워크 주소를 받거나 설정합니다. |
| PublisherChanges |
마지막 동기화 시 구독자에게 적용된 Publisher 변경 사항 총수를 얻습니다. |
| PublisherConflicts |
마지막 동기화 시 Publisher에서 발생한 총 충돌 수를 얻습니다. |
| PublisherDatabase |
출판 데이터베이스의 이름을 얻거나 설정합니다. |
| PublisherEncryptedPassword |
퍼블리셔의 암호화된 비밀번호를 받거나 설정합니다. |
| PublisherFailoverPartner |
퍼블리케이션 데이터베이스와 데이터베이스 미러링 세션에 참여하는 SQL Server의 페일오버 파트너 인스턴스를 획득하거나 설정합니다. |
| PublisherLogin |
SQL Server 인증을 사용해 Publisher에 연결할 때 사용하는 로그인 이름을 얻거나 설정합니다. |
| PublisherNetwork |
Publisher에 연결할 때 사용하는 클라이언트 Net-Library을 받거나 설정합니다. |
| PublisherPassword |
SQL Server 인증을 사용해 Publisher에 연결할 때 사용하는 비밀번호를 설정합니다. |
| PublisherSecurityMode |
Publisher에 연결할 때 사용하는 보안 모드를 설정하거나 획득합니다. |
| QueryTimeout |
내부 쿼리가 완료될 수 있는 초를 받거나 설정합니다. |
| SecureDistributorEncryptedPassword |
보안 배포자 암호화된 비밀번호를 받거나 설정합니다. |
| SecurePublisherEncryptedPassword |
보안 퍼블리셔 암호화된 비밀번호를 받거나 설정합니다. |
| SecureSubscriberEncryptedPassword |
보안 구독자 암호화 비밀번호를 받거나 설정합니다. |
| Subscriber |
구독자인 Microsoft SQL Server 인스턴스의 이름을 받거나 설정합니다. |
| SubscriberChanges |
마지막 동기화 시 Publisher에서 적용된 전체 구독자 변경 수를 가져옵니다. |
| SubscriberConflicts |
마지막 동기화 시 Publisher에서 발생한 총 충돌 수를 얻습니다. |
| SubscriberDatabase |
구독 데이터베이스의 이름을 얻거나 설정합니다. |
| SubscriberDatabasePath |
구독자 데이터베이스 경로를 받거나 설정합니다. |
| SubscriberDataSourceType |
구독자로 사용되는 데이터 소스의 유형을 획득하거나 설정합니다. |
| SubscriberEncryptedPassword |
가입자의 암호화된 비밀번호를 받거나 설정합니다. |
| SubscriberLogin |
SQL Server 인증을 사용해 가입자와 연결할 때 사용하는 로그인 이름을 받거나 설정합니다. |
| SubscriberPassword |
SQL Server 인증을 사용하여 가입자와 연결할 때 사용하는 비밀번호를 설정합니다. |
| SubscriberSecurityMode |
가입자와 연결할 때 사용하는 보안 모드를 받거나 설정합니다. |
| SubscriptionType |
구독이 푸시 구독인지 풀 구독인지 받거나 설정합니다. |
| SyncToAlternate |
동기화가 다른 동기화 파트너와 연결되는지 또는 설정합니다. |
| UploadGenerationsPerBatch |
구독자에서 Publisher로 변경 사항을 업로드하는 동안 한 번에 처리할 생성 수를 받거나 설정합니다. 생성은 아티클당 변경 내용의 논리적 그룹으로 정의됩니다. |
| UseInteractiveResolver |
조정 중에 인터랙티브 리졸버가 사용되는지 여부에 대해 얻거나 설정합니다. |
| UseWebSynchronization |
웹 동기화가 사용되는지 받거나 설정합니다. |
| Validate |
동기화 종료 시 가입자 데이터에 대한 데이터 검증이 수행되는지 또는 설정합니다. |
| WorkingDirectory |
FTP를 사용할 때 스냅샷 파일에 접근할 작업 디렉터리를 얻거나 설정합니다. |
메서드
| Name | Description |
|---|---|
| Abort() |
동기화를 중단합니다. |
| ClearAllTraceFlags() |
동기화 에이전트가 사용하는 모든 트레이스 플래그를 제거합니다. |
| ClearTraceFlag(Int32) |
추적 플래그가 해제됩니다. |
| Dispose() |
이 자원을 사용하는 MergeSynchronizationAgent관리되지 않은 자원을 해제합니다. |
| Dispose(Boolean) |
클래스에서 MergeSynchronizationAgent 사용하는 관리되지 않은 자원을 해제하고, 선택적으로 관리되는 자원을 해제합니다. |
| EnableTraceFlag(Int32) |
국기 추적을 가능하게 합니다. |
| Finalize() |
에이전트를 최종 확정합니다. |
| IsSnapshotRequired() |
Publisher 또는 Distributor와 Subscriber에 연결하여 다음 에이전트 동기화 시 새로운 스냅샷이 적용될지 여부를 결정합니다. |
| ProcessMessagesAtPublisher() |
퍼블리셔에서 메시지를 처리합니다. |
| ProcessMessagesAtSubscriber() |
가입자 쪽에서 메시지를 처리합니다. |
| Synchronize() |
구독을 동기화하기 위해 병합 에이전트를 시작합니다. |
이벤트
| Name | Description |
|---|---|
| ComStatus |
병합 에이전트가 동기화 상태 정보를 반환할 때 발생합니다. |
| Status |
병합 에이전트가 동기화 상태 정보를 반환할 때 발생합니다. |
적용 대상
스레드 보안
이 유형의 공개 정적(Visual Basic에서 공유됨) 멤버는 스레드 안전입니다. 모든 인스턴스 멤버는 스레드로부터 안전하게 보호되지 않습니다.