TransSynchronizationAgent-Klasse

Stellt die Funktionalität des Replikationsverteilungs-Agents bereit.

Vererbungshierarchie

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

Namespace:  Microsoft.SqlServer.Replication
Assembly:  Microsoft.SqlServer.Replication (in Microsoft.SqlServer.Replication.dll)

Syntax

'Declaration
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
<ComVisibleAttribute(True)> _
<GuidAttribute("adeda98a-bdfc-4029-b6fb-991d6b468395")> _
<PermissionSetAttribute(SecurityAction.Demand, Name := "FullTrust")> _
Public Class TransSynchronizationAgent _
    Inherits MarshalByRefObject _
    Implements IDisposable, ITransSynchronizationAgent
'Usage
Dim instance As TransSynchronizationAgent
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)]
[ComVisibleAttribute(true)]
[GuidAttribute("adeda98a-bdfc-4029-b6fb-991d6b468395")]
[PermissionSetAttribute(SecurityAction.Demand, Name = "FullTrust")]
public class TransSynchronizationAgent : MarshalByRefObject, 
    IDisposable, ITransSynchronizationAgent
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)]
[ComVisibleAttribute(true)]
[GuidAttribute(L"adeda98a-bdfc-4029-b6fb-991d6b468395")]
[PermissionSetAttribute(SecurityAction::Demand, Name = L"FullTrust")]
public ref class TransSynchronizationAgent : public MarshalByRefObject, 
    IDisposable, ITransSynchronizationAgent
[<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)>]
[<ComVisibleAttribute(true)>]
[<GuidAttribute("adeda98a-bdfc-4029-b6fb-991d6b468395")>]
[<PermissionSetAttribute(SecurityAction.Demand, Name = "FullTrust")>]
type TransSynchronizationAgent =  
    class
        inherit MarshalByRefObject
        interface IDisposable
        interface ITransSynchronizationAgent
    end
public class TransSynchronizationAgent extends MarshalByRefObject implements IDisposable, ITransSynchronizationAgent

Der TransSynchronizationAgent-Typ macht folgende Elemente verfügbar.

Konstruktoren

  Name Beschreibung
Öffentliche Methode TransSynchronizationAgent Erstellt eine Instanz der TransSynchronizationAgent-Klasse.

Zum Anfang

Eigenschaften

  Name Beschreibung
Öffentliche Eigenschaft AltSnapshotFolder Ruft den alternativen Momentaufnahmeordner für das Abonnement ab oder legt diesen fest.
Öffentliche Eigenschaft ComErrorCollection Ruft eine Auflistung der Fehler ab, die vom Replikations-Agent generiert wurden.
Öffentliche Eigenschaft Distributor Ruft den Namen der Instanz von Microsoft SQL Server ab, die für das Abonnement als Verteiler fungiert, oder legt diesen fest.
Öffentliche Eigenschaft DistributorAddress Ruft die Netzwerkadresse ab, die verwendet wird, um eine Verbindung mit dem Verteiler herzustellen, wenn die DistributorNetwork-Eigenschaft angegeben wird, oder legt diese fest.
Öffentliche Eigenschaft DistributorEncryptedPassword Infrastruktur
Öffentliche Eigenschaft DistributorLogin Ruft den Anmeldenamen ab, der beim Herstellen einer Verbindung mit dem Verteiler mithilfe der SQL Server-Authentifizierung verwendet wird, oder legt diesen fest.
Öffentliche Eigenschaft DistributorNetwork Ruft die Clientnetzwerkbibliothek ab, die beim Herstellen einer Verbindung mit dem Verteiler verwendet wird, oder legt diese fest.
Öffentliche Eigenschaft DistributorPassword Legt das Kennwort fest, das beim Herstellen einer Verbindung mit dem Verteiler mithilfe der SQL Server-Authentifizierung verwendet wird.
Öffentliche Eigenschaft DistributorSecurityMode Ruft den Sicherheitsmodus ab, der beim Herstellen einer Verbindung mit dem Verteiler verwendet wird, oder legt diesen fest.
Öffentliche Eigenschaft DtsPackageFileName Ruft den Namen und den Pfad eines Microsoft SQL Server 2000-DTS-Pakets (Data Transformation Services) ab, das verwendet wird, um Befehlsrowsets zu transformieren, bevor sie auf einen Abonnenten angewendet werden, oder legt diese Informationen fest.
Öffentliche Eigenschaft DtsPackagePassword Ruft das Besitzerkennwort ab, das verwendet wird, um auf das von der DtsPackageFileName-Eigenschaft angegebene Microsoft SQL Server 2000-DTS-Paket (Data Transformation Services) Paket zuzugreifen, oder legt dieses fest.
Öffentliche Eigenschaft FileTransferType Ruft ab, wie dem Abonnenten die ersten Momentaufnahmedateien übergeben werden, oder legt die Vorgehensweise fest.
Öffentliche Eigenschaft HostName Infrastruktur
Öffentliche Eigenschaft LastUpdatedTime Ruft den Zeitstempel der letzten Synchronisierung des Abonnements durch diesen Replikations-Agent ab.
Öffentliche Eigenschaft LoginTimeout Ruft die maximale Anzahl von Sekunden ab, die auf das Herstellen von Verbindungen gewartet werden soll, oder legt diese fest.
Öffentliche Eigenschaft MaxDeliveredTransactions Ruft die maximale Anzahl von Transaktionen ab, die während einer einzelnen Ausführung des Agents auf den Abonnenten angewendet werden, oder legt diese fest.
Öffentliche Eigenschaft Output Ruft den Dateinamen und den Pfad der Agentausgabedatei ab oder legt diese Angaben fest.
Öffentliche Eigenschaft OutputVerboseLevel Ruft ab oder legt fest, wie viele Informationen vom Verteilungs-Agent in der Agentausgabedatei protokolliert werden.
Öffentliche Eigenschaft ProfileName Ruft den Namen des Profils ab, das vom Agent verwendet wird, oder legt diesen fest.
Öffentliche Eigenschaft Publication Ruft den Namen der Veröffentlichung ab oder legt diesen fest.
Öffentliche Eigenschaft Publisher Ruft den Namen der Microsoft SQL Server-Instanz ab, die für das Abonnement als Verleger auftritt, oder legt diesen fest.
Öffentliche Eigenschaft PublisherDatabase Ruft den Namen der Veröffentlichungsdatenbank ab oder legt ihn fest.
Öffentliche Eigenschaft QueryTimeout Ruft die Anzahl von Sekunden ab, innerhalb derer interne Abfragen abgeschlossen sein müssen, oder legt diese fest.
Öffentliche Eigenschaft SecureDistributorEncryptedPassword Infrastruktur
Öffentliche Eigenschaft SecureSubscriberEncryptedPassword Infrastruktur
Öffentliche Eigenschaft SkipErrors Ruft eine Liste der Fehlernummern ab, die von diesem Agent ausgelassen werden sollen, oder legt diese fest. Die Einträge in der Liste sind durch Doppelpunkte getrennt.
Öffentliche Eigenschaft Subscriber Ruft den Namen der Instanz von Microsoft SQL Server ab, die als Abonnent auftritt, oder legt diesen fest.
Öffentliche Eigenschaft SubscriberDatabase Ruft den Namen der Abonnementdatenbank ab oder legt ihn fest.
Öffentliche Eigenschaft SubscriberDatabasePath Infrastruktur
Öffentliche Eigenschaft SubscriberDataSourceType Ruft den Typ der Datenquelle ab, die als Abonnent verwendet wird, oder legt diesen fest.
Öffentliche Eigenschaft SubscriberEncryptedPassword Infrastruktur
Öffentliche Eigenschaft SubscriberLogin Ruft den Anmeldenamen ab, der beim Herstellen einer Verbindung mit dem Abonnenten mithilfe der SQL Server-Authentifizierung verwendet wird, oder legt diesen fest.
Öffentliche Eigenschaft SubscriberPassword Legt das Kennwort fest, das beim Herstellen einer Verbindung mit dem Abonnenten mithilfe der SQL Server-Authentifizierung verwendet wird.
Öffentliche Eigenschaft SubscriberSecurityMode Ruft den Sicherheitsmodus ab, der beim Herstellen einer Verbindung mit dem Verleger verwendet wird, oder legt diesen fest.
Öffentliche Eigenschaft SubscriptionType Ruft ab oder legt fest, ob das Abonnement ein Push- oder Pullabonnement ist.
Öffentliche Eigenschaft UndeliveredCommands Infrastruktur
Öffentliche Eigenschaft UndeliveredTransactions Infrastruktur
Öffentliche Eigenschaft UseInProcLoader Ruft ab oder legt fest, ob beim Anwenden von Momentaufnahmedateien beim Abonnenten der BULK INSERT-Befehl verwendet werden soll.
Öffentliche Eigenschaft WorkingDirectory Ruft das Arbeitsverzeichnis ab, von dem aus bei Verwendung von FTP (File Transfer Protocol) auf Momentaufnahmedateien zugegriffen wird, oder legt dieses fest.

Zum Anfang

Methoden

  Name Beschreibung
Öffentliche Methode Abort Infrastruktur
Öffentliche Methode CreateObjRef (Geerbt von MarshalByRefObject.)
Öffentliche Methode Dispose() () () () Infrastruktur
Geschützte Methode Dispose(Boolean)
Öffentliche Methode Equals (Geerbt von Object.)
Geschützte Methode Finalize Infrastruktur (Überschreibt Object. . :: . .Finalize() () () ().)
Öffentliche Methode GetHashCode (Geerbt von Object.)
Öffentliche Methode GetLifetimeService (Geerbt von MarshalByRefObject.)
Öffentliche Methode GetType (Geerbt von Object.)
Öffentliche Methode InitializeLifetimeService (Geerbt von MarshalByRefObject.)
Öffentliche Methode IsSnapshotRequired Stellt eine Verbindung mit dem Verteiler und dem Abonnenten her, um zu bestimmen, ob während der nächsten Agent-Synchronisierung eine neue Momentaufnahme angewendet wird.
Geschützte Methode MemberwiseClone() () () () (Geerbt von Object.)
Geschützte Methode MemberwiseClone(Boolean) (Geerbt von MarshalByRefObject.)
Öffentliche Methode Synchronize Startet den Verteilungs-Agent, um das Abonnement zu synchronisieren.
Öffentliche Methode ToString (Geerbt von Object.)

Zum Anfang

Ereignisse

  Name Beschreibung
Öffentliches Ereignis ComStatus Infrastruktur
Öffentliches Ereignis Status Tritt auf, wenn der Verteilungs-Agent Synchronisierungsstatusinformationen zurückgibt.

Zum Anfang

Hinweise

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

Beispiele

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 = "AdventureWorks2008R2Replica";
            string publicationDbName = "AdventureWorks2008R2";

            // 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 = "AdventureWorks2008R2Replica"
Dim publicationDbName As String = "AdventureWorks2008R2"

' 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

Threadsicherheit

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.