TransSynchronizationAgent 클래스

Provides the functionality of the Replication Distribution Agent.

System.Object
  System.MarshalByRefObject
    Microsoft.SqlServer.Replication.TransSynchronizationAgent

네임스페이스:  Microsoft.SqlServer.Replication
어셈블리:  Microsoft.SqlServer.Replication(Microsoft.SqlServer.Replication.dll)

[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)]
[GuidAttribute("adeda98a-bdfc-4029-b6fb-991d6b468395")]
[ComVisibleAttribute(true)]
[PermissionSetAttribute(SecurityAction.Demand, Name = "FullTrust")]
public class TransSynchronizationAgent : MarshalByRefObject, 
	IDisposable, ITransSynchronizationAgent

TransSynchronizationAgent 유형에서 다음 멤버를 표시합니다.

  이름설명
공용 메서드TransSynchronizationAgentCreates an instance of the TransSynchronizationAgent class.
맨 위로 이동

  이름설명
공용 속성AltSnapshotFolderGets or sets the alternate snapshot folder for the subscription.
공용 속성ComErrorCollectionGets a collection of errors that are generated by the replication agent.
공용 속성DistributorGets or sets the name of the instance of Microsoft SQL Server that is acting as the distributor for the subscription.
공용 속성DistributorAddressGets or sets the network address that is used to connect to the distributor when the DistributorNetwork property is specified.
공용 속성DistributorEncryptedPassword인프라입니다. Gets or sets the encrypted password that is used when connecting to the distributor by using SQL Server Authentication.
공용 속성DistributorLoginGets or sets the login name that is used when connecting to the distributor by using SQL Server Authentication.
공용 속성DistributorNetworkGets or sets the client Net-Library that is used when connecting to the distributor.
공용 속성DistributorPasswordGets or sets the password that is used when connecting to the Distributor by using SQL Server Authentication.
공용 속성DistributorSecurityModeGets or sets the security mode that is used when connecting to the distributor.
공용 속성DtsPackageFileNameGets or sets the name and path of a Microsoft SQL Server 2000 Data Transformation Services (DTS) package that is used to transform command rowsets before they are applied to a Subscriber.
공용 속성DtsPackagePasswordGets or sets the owner password that used to access the Microsoft SQL Server 2000 Data Transformation Services (DTS) package specified by the DtsPackageFileName property.
공용 속성FileTransferTypeGets or sets how the initial snapshot files are transferred to the Subscriber.
공용 속성HostName인프라입니다. Gets or sets the host name used.
공용 속성LastUpdatedTimeGets the timestamp of the last time that replication agent synchronized the subscription.
공용 속성LoginTimeoutGets or sets the maximum number of seconds to wait for connections to be established.
공용 속성MaxDeliveredTransactionsGets or sets the maximum number of transactions that are applied to the Subscriber during a single agent execution.
공용 속성OutputGets or sets the file name and path of the agent output file.
공용 속성OutputVerboseLevelGets or sets the amount of information that is logged by the Distribution Agent in the agent output file.
공용 속성ProfileNameGets or sets the name of the profile that is used by the agent.
공용 속성PublicationGets or sets the name of the publication.
공용 속성PublisherGets or sets the name of the instance of Microsoft SQL Server that is the Publisher for the subscription.
공용 속성PublisherDatabaseGets or sets the name of the publication database.
공용 속성QueryTimeoutGets or sets the number of seconds that are allowed for internal queries to complete.
공용 속성SecureDistributorEncryptedPassword인프라입니다. Gets or sets the secure encrypted password for the distributor.
공용 속성SecureSubscriberEncryptedPassword인프라입니다. Gets or sets the secure encrypted password for the subscriber.
공용 속성SkipErrorsGets or sets a colon-separated list of the error numbers that are to be skipped by this agent.
공용 속성SubscriberGets or sets the name of the instance of Microsoft SQL Server that is the subscriber.
공용 속성SubscriberDatabaseGets or sets the name of the subscription database.
공용 속성SubscriberDatabasePath인프라입니다. Get or sets the database path for the subscriber.
공용 속성SubscriberDataSourceTypeGets or sets the type of data source that is used as the subscriber.
공용 속성SubscriberEncryptedPassword인프라입니다. Gets or sets the encrypted password for the subscriber.
공용 속성SubscriberLoginGets or sets the login name that is used when connecting to the subscriber by using SQL Server Authentication.
공용 속성SubscriberPasswordGets or sets the password that is used when connecting to the subscriber by using SQL Server Authentication.
공용 속성SubscriberSecurityModeGets or sets the security mode that is used when connecting to the publisher.
공용 속성SubscriptionTypeGets or sets whether the subscription is a push or pull subscription.
공용 속성UndeliveredCommands인프라입니다. Gets the number of undelivered commands.
공용 속성UndeliveredTransactions인프라입니다. Gets the number of undelivered transactions.
공용 속성UseInProcLoaderGets or sets a value that indicates whether to use the BULK INSERT command when applying snapshot files at the subscriber.
공용 속성WorkingDirectoryGets or sets the working directory from which snapshot files are accessed when File Transfer Protocol (FTP) is used.
맨 위로 이동

  이름설명
공용 메서드Abort인프라입니다. Aborts the TransSynchronizationAgent operation.
공용 메서드CreateObjRef보안에 중요합니다. (MarshalByRefObject에서 상속됨)
공용 메서드Dispose()인프라입니다. Releases all resources used by the current instance of the TransSynchronizationAgent class.
보호된 메서드Dispose(Boolean)Releases all resources used by the TransSynchronizationAgent class.
공용 메서드Equals (Object에서 상속됨)
보호된 메서드Finalize인프라입니다. Finalizes the TransSynchronizationAgent. (Object.Finalize()을(를) 재정의함)
공용 메서드GetHashCode (Object에서 상속됨)
공용 메서드GetLifetimeService보안에 중요합니다. (MarshalByRefObject에서 상속됨)
공용 메서드GetType (Object에서 상속됨)
공용 메서드InitializeLifetimeService보안에 중요합니다. (MarshalByRefObject에서 상속됨)
공용 메서드IsSnapshotRequiredConnects to the Distributor and the Subscriber to determine whether a new snapshot will be applied during the next agent synchronization.
보호된 메서드MemberwiseClone() (Object에서 상속됨)
보호된 메서드MemberwiseClone(Boolean) (MarshalByRefObject에서 상속됨)
공용 메서드SynchronizeStarts the Distribution Agent to synchronize the subscription.
공용 메서드ToString (Object에서 상속됨)
맨 위로 이동

  이름설명
공용 이벤트ComStatus인프라입니다. Occurs when the Distribution Agent returns synchronization Com status information.
공용 이벤트StatusOccurs when the Distribution Agent returns synchronization status information.
맨 위로 이동

The TransSynchronizationAgent class supports the ability to programmatically synchronize subscriptions to transactional or snapshot publications.

In the following example, the Synchronize method is called on the instance of the TransSynchronizationAgent class that is accessed from the SynchronizationAgent property to synchronize the push subscription.

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

The TransSynchronizationAgent class does not support multithreaded apartments. You can specify a single-threaded apartment by declaring the [STAThread] attribute on the method that is the main entry point for the application. This is the default for Microsoft Windows-based applications that are created by using Microsoft Visual Studio.

커뮤니티 추가 항목

추가
표시: