Класс SnapshotGenerationAgent

Provides the functionality of the Replication Snapshot Agent.

Иерархия наследования

System.Object
  System.MarshalByRefObject
    Microsoft.SqlServer.Replication.AgentCore
      Microsoft.SqlServer.Replication.SnapshotGenerationAgent

Пространство имен:  Microsoft.SqlServer.Replication
Сборка:  Microsoft.SqlServer.Replication (в Microsoft.SqlServer.Replication.dll)

Синтаксис

'Декларация
<ComVisibleAttribute(True)> _
<GuidAttribute("80016755-0016-4129-A778-1461AD058C86")> _
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
Public NotInheritable Class SnapshotGenerationAgent _
    Inherits AgentCore _
    Implements ISnapshotGenerationAgent
'Применение
Dim instance As SnapshotGenerationAgent
[ComVisibleAttribute(true)]
[GuidAttribute("80016755-0016-4129-A778-1461AD058C86")]
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)]
public sealed class SnapshotGenerationAgent : AgentCore, 
    ISnapshotGenerationAgent
[ComVisibleAttribute(true)]
[GuidAttribute(L"80016755-0016-4129-A778-1461AD058C86")]
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)]
public ref class SnapshotGenerationAgent sealed : public AgentCore, 
    ISnapshotGenerationAgent
[<SealedAttribute>]
[<ComVisibleAttribute(true)>]
[<GuidAttribute("80016755-0016-4129-A778-1461AD058C86")>]
[<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)>]
type SnapshotGenerationAgent =  
    class 
        inherit AgentCore 
        interface ISnapshotGenerationAgent 
    end
public final class SnapshotGenerationAgent extends AgentCore implements ISnapshotGenerationAgent

Тип SnapshotGenerationAgent обеспечивает доступ к следующим элементам.

Конструкторы

  Имя Описание
Открытый метод SnapshotGenerationAgent Creates an instance of the SnapshotGenerationAgent class.

В начало

Свойства

  Имя Описание
Открытое свойство AbortPolicy Gets or sets how running replication agent threads are terminated when an unanticipated shutdown occurs. (Производный от AgentCore.)
Открытое свойство BcpBatchSize Gets or set the number of rows to send to the Distributor in a bulk copy operation.
Открытое свойство ComErrorCollection Gets information on errors that occur during agent execution. (Производный от AgentCore.)
Открытое свойство Distributor Gets or sets the name of the instance of SQL Server acting as the Distributor for the publication.
Открытое свойство DistributorDeadlockPriority Gets or sets the priority of the Snapshot Agent connection to the Distributor when a deadlock occurs.
Открытое свойство DistributorEncryptedPassword Инфраструктура. Gets or sets the encrypted password for the distributor.
Открытое свойство DistributorEncryptionLevel Gets of sets the level of Secure Sockets Layer (SSL) encryption used by the Snapshot Agent when connecting to the Distributor.
Открытое свойство DistributorLogin Gets or sets the login name used when connecting locally to the Distributor using SQL Server Authentication.
Открытое свойство DistributorNetworkLibrary Инфраструктура. Gets or sets the Network library used when connecting locally to the Distributor using SQL Server Authentication.
Открытое свойство DistributorPassword Sets the password used when connecting locally to the Distributor using SQL Server Authentication.
Открытое свойство DistributorSecurityMode Gets or sets the security mode used when connecting locally to the Distributor.
Открытое свойство DynamicFilterHostName Gets or sets the value supplied to the HOST_NAME function used in a parameterized row filter.
Открытое свойство DynamicFilterLogin Gets or sets the value supplied to the SUSER_SNAME function used in a parameterized row filter.
Открытое свойство DynamicSnapshotLocation Gets or sets the location of the partitioned snapshot for a subscription to a merge publication that is defined based-on a parameterized row filter.
Открытое свойство FieldDelimiter Gets or sets the character or character sequence that marks the end of a field in the SQL Server bulk-copy data file.
Открытое свойство FlatExceptionCollection Инфраструктура. Gets the collection of exception objects accessed using the IEnumerable interface. (Производный от AgentCore.)
Открытое свойство HistoryVerboseLevel Gets or sets the amount of history logged during agent execution. (Производный от AgentCore.)
Открытое свойство HRBcpBlocks Инфраструктура. Gets or sets the HR bulk copy program blocks.
Открытое свойство HRBcpBlockSize Инфраструктура. Gets or sets the HR bulk copy program block size.
Открытое свойство HRBcpDynamicBlocks Инфраструктура. Gets or sets the HR bulk copy program dynamic blocks.
Открытое свойство LoginTimeout Get or sets the number of seconds before the login times out for connections made by the agent. (Производный от AgentCore.)
Открытое свойство MaxBcpThreads Gets or sets the number of bulk copy operations that can be performed in parallel.
Открытое свойство MaxNetworkOptimization Gets or sets whether out-of-partition deletes are sent to the Subscriber.
Открытое свойство OnetimeDynamicSnapshot Инфраструктура. Gets or sets the one time dynamic snapshot.
Открытое свойство Output Gets or sets the name and path of the agent output file. (Производный от AgentCore.)
Открытое свойство OutputVerboseLevel Gets or sets the level of detail of information written to the agent output file. (Производный от AgentCore.)
Открытое свойство PacketSize Инфраструктура. Gets or sets the packet size associated with the agent. (Производный от AgentCore.)
Открытое свойство ProfileName Gets or sets an agent profile to use when running the agent. (Производный от AgentCore.)
Открытое свойство Publication Gets or sets the name of the publication.
Открытое свойство Publisher Gets or sets the name of the instance of SQL Server that is the Publisher.
Открытое свойство PublisherDatabase Gets or sets the name of the publication database.
Открытое свойство PublisherDeadlockPriority Gets or sets the priority of the Snapshot Agent connection to the Publisher when a deadlock occurs.
Открытое свойство PublisherEncryptedPassword Инфраструктура. Gets or sets the encrypted password for the publisher.
Открытое свойство PublisherEncryptionLevel Gets of sets the level of Secure Sockets Layer (SSL) encryption used by the Snapshot Agent when connecting to the Distributor.
Открытое свойство PublisherFailoverPartner Gets or sets the failover partner instance of SQL Server participating in a database mirroring session with the publication database. (Производный от AgentCore.)
Открытое свойство PublisherLogin Gets or sets the login name used when connecting to the Publisher using SQL Server Authentication.
Открытое свойство PublisherNetworkLibrary Инфраструктура. Gets or sets the Network library used when connecting locally to the Publisher using SQL Server Authentication.
Открытое свойство PublisherPassword Sets the password used when connecting to the Publisher using SQL Server Authentication.
Открытое свойство PublisherSecurityMode Gets or sets the security mode used when connecting to the Publisher.
Открытое свойство QueryTimeout Gets or sets the number of seconds before a query times out. (Производный от AgentCore.)
Открытое свойство ReplicationType Gets or sets the type of publication.
Открытое свойство RowDelimiter Gets or sets the character or character sequence that marks the end of a row in the SQL Server bulk-copy data file.
Открытое свойство SecureDistributorEncryptedPassword Инфраструктура. Sets the encrypted password used when connecting locally to the Distributor using SQL Server Authentication.
Открытое свойство SecureDistributorPassword Sets the password (as a SecureString object) used when connecting locally to the Distributor using SQL Server Authentication.
Открытое свойство SecurePublisherEncryptedPassword Инфраструктура. Sets the encrypted password used when connecting to the Publisher using SQL Server Authentication.
Открытое свойство SecurePublisherPassword Sets the password (as a SecureString object) used when connecting to the Publisher using SQL Server Authentication.
Открытое свойство StartQueueTimeout Gets or sets the time that the Snapshot Agent waits when the maximum number of concurrent partitioned snapshot processes for a merge publication are already running.
Открытое свойство Supports70Subscribers Gets or sets whether the generated snapshot supports SQL Server 7.0 Subscribers.

В начало

Методы

  Имя Описание
Открытый метод Abort Aborts the process of the current instance. (Производный от AgentCore.)
Открытый метод CreateObjRef Важный элемент безопасности. (Производный от MarshalByRefObject.)
Открытый метод Equals (Производный от Object.)
Открытый метод GenerateSnapshot Starts the Snapshot Agent to generate the snapshot.
Открытый метод GetHashCode (Производный от Object.)
Открытый метод GetLifetimeService Важный элемент безопасности. (Производный от MarshalByRefObject.)
Открытый метод GetType (Производный от Object.)
Открытый метод InitializeLifetimeService Важный элемент безопасности. (Производный от MarshalByRefObject.)
Открытый метод ResetParametersToDefault Resets the value of the parameters to default. (Производный от AgentCore.)
Открытый метод ToString (Производный от Object.)

В начало

События

  Имя Описание
Открытое событие ComStatus Инфраструктура. Occurs when a running agent returns synchronization Com status information. (Производный от AgentCore.)
Открытое событие Status Occurs when a running agent returns status information. (Производный от AgentCore.)

В начало

Явные реализации интерфейса

  Имя Описание
Явная реализация интерфейсаЗакрытый метод ISnapshotGenerationAgent.ResetParametersToDefault Resets the parameters to its default value.

В начало

Замечания

The SnapshotGenerationAgent class provides direct, programmatic access to the Snapshot Agent.

The SnapshotGenerationAgent class supports the ability to do the following replication tasks:

  • Generate the initial snapshot

  • Generate a partitioned snapshot for a subscription defined based-on a parameterized filter.

Примеры

This example generates a standard snapshot for a transactional publication.

           // Set the Publisher, publication database, and publication names.
            string publicationName = "AdvWorksProductTran";
            string publicationDbName = "AdventureWorks2012";
            string publisherName = publisherInstance;
            string distributorName = publisherInstance;

            SnapshotGenerationAgent agent;

            try
            {
                // Set the required properties for Snapshot Agent.
                agent = new SnapshotGenerationAgent();
                agent.Distributor = distributorName;
                agent.DistributorSecurityMode = SecurityMode.Integrated;
                agent.Publisher = publisherName;
                agent.PublisherSecurityMode = SecurityMode.Integrated;
                agent.Publication = publicationName;
                agent.PublisherDatabase = publicationDbName;
                agent.ReplicationType = ReplicationType.Transactional;

                // Start the agent synchronously.
                agent.GenerateSnapshot();

            }
            catch (Exception ex)
            {
                // Implement custom application error handling here.
                throw new ApplicationException(String.Format(
                    "A snapshot could not be generated for the {0} publication."
                    , publicationName), ex);
            }
' Set the Publisher, publication database, and publication names.
Dim publicationName As String = "AdvWorksProductTran"
Dim publicationDbName As String = "AdventureWorks2012"
Dim publisherName As String = publisherInstance
Dim distributorName As String = publisherInstance

Dim agent As SnapshotGenerationAgent

Try
    ' Set the required properties for Snapshot Agent.
    agent = New SnapshotGenerationAgent()
    agent.Distributor = distributorName
    agent.DistributorSecurityMode = SecurityMode.Integrated
    agent.Publisher = publisherName
    agent.PublisherSecurityMode = SecurityMode.Integrated
    agent.Publication = publicationName
    agent.PublisherDatabase = publicationDbName
    agent.ReplicationType = ReplicationType.Transactional

    ' Start the agent synchronously.
    agent.GenerateSnapshot()

Catch ex As Exception
    ' Implement custom application error handling here.
    Throw New ApplicationException(String.Format( _
     "A snapshot could not be generated for the {0} publication." _
     , publicationName), ex)
End Try

This example generates a standard snapshot for a merge publication.

// Set the Publisher, publication database, and publication names.
string publicationName = "AdvWorksSalesOrdersMerge";
string publicationDbName = "AdventureWorks2012";
string publisherName = publisherInstance;
string distributorName = publisherInstance;

SnapshotGenerationAgent agent;

try
{
    // Set the required properties for Snapshot Agent.
    agent = new SnapshotGenerationAgent();
    agent.Distributor = distributorName;
    agent.DistributorSecurityMode = SecurityMode.Integrated;
    agent.Publisher = publisherName;
    agent.PublisherSecurityMode = SecurityMode.Integrated;
    agent.Publication = publicationName;
    agent.PublisherDatabase = publicationDbName;
    agent.ReplicationType = ReplicationType.Merge;

    // Start the agent synchronously.
    agent.GenerateSnapshot();

}
catch (Exception ex)
{
    // Implement custom application error handling here.
    throw new ApplicationException(String.Format(
        "A snapshot could not be generated for the {0} publication."
        , publicationName), ex);
}
' Set the Publisher, publication database, and publication names.
Dim publicationName As String = "AdvWorksSalesOrdersMerge"
Dim publicationDbName As String = "AdventureWorks2012"
Dim publisherName As String = publisherInstance
Dim distributorName As String = publisherInstance

Dim agent As SnapshotGenerationAgent

Try
    ' Set the required properties for Snapshot Agent.
    agent = New SnapshotGenerationAgent()
    agent.Distributor = distributorName
    agent.DistributorSecurityMode = SecurityMode.Integrated
    agent.Publisher = publisherName
    agent.PublisherSecurityMode = SecurityMode.Integrated
    agent.Publication = publicationName
    agent.PublisherDatabase = publicationDbName
    agent.ReplicationType = ReplicationType.Merge

    ' Start the agent synchronously.
    agent.GenerateSnapshot()

Catch ex As Exception
    ' Implement custom application error handling here.
    Throw New ApplicationException(String.Format( _
     "A snapshot could not be generated for the {0} publication." _
     , publicationName), ex)
End Try

This example overloads the HOST_NAME function to generate a filtered data snapshot for a subscription to a merge publication that has a parameterized filter.

           // Set the Publisher, publication database, and publication names.
            string publicationName = "AdvWorksSalesOrdersMerge";
            string publicationDbName = "AdventureWorks2012";
            string publisherName = publisherInstance;
            string distributorName = publisherInstance;

            SnapshotGenerationAgent agent;

            try
            {
                // Set the required properties for Snapshot Agent.
                agent = new SnapshotGenerationAgent();
                agent.Distributor = distributorName;
                agent.DistributorSecurityMode = SecurityMode.Integrated;
                agent.Publisher = publisherName;
                agent.PublisherSecurityMode = SecurityMode.Integrated;
                agent.Publication = publicationName;
                agent.PublisherDatabase = publicationDbName;
                agent.ReplicationType = ReplicationType.Merge;

                // Specify the partition information to generate a 
                // filtered snapshot based on Hostname.
                agent.DynamicFilterHostName = hostname;

                // Start the agent synchronously.
                agent.GenerateSnapshot();
            }
            catch (Exception ex)
            {
                // Implement custom application error handling here.
                throw new ApplicationException(String.Format(
                    "A snapshot could not be generated for the {0} publication."
                    , publicationName), ex);
            }
' Set the Publisher, publication database, and publication names.
Dim publicationName As String = "AdvWorksSalesOrdersMerge"
Dim publicationDbName As String = "AdventureWorks2012"
Dim publisherName As String = publisherInstance
Dim distributorName As String = publisherInstance

Dim agent As SnapshotGenerationAgent

Try
    ' Set the required properties for Snapshot Agent.
    agent = New SnapshotGenerationAgent()
    agent.Distributor = distributorName
    agent.DistributorSecurityMode = SecurityMode.Integrated
    agent.Publisher = publisherName
    agent.PublisherSecurityMode = SecurityMode.Integrated
    agent.Publication = publicationName
    agent.PublisherDatabase = publicationDbName
    agent.ReplicationType = ReplicationType.Merge

    ' Specify the partition information to generate a 
    ' filtered snapshot based on Hostname.
    agent.DynamicFilterHostName = hostname

    ' Start the agent synchronously.
    agent.GenerateSnapshot()
Catch ex As Exception
    ' Implement custom application error handling here.
    Throw New ApplicationException(String.Format( _
     "A snapshot could not be generated for the {0} publication." _
     , publicationName), ex)
End Try

Безопасность многопоточности

Любые открытые статический (Shared в Visual Basic) элементы этого типа потокобезопасны. Потокобезопасность с элементами экземпляров не гарантируется.

См. также

Справочник

Пространство имен Microsoft.SqlServer.Replication

Другие ресурсы

Как создать исходный моментальный снимок (программирование объектов RMO)

Как создать моментальный снимок для публикации слиянием с параметризованными фильтрами (программирование объектов RMO)

Агент моментальных снимков репликации