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
執行緒安全性
這個型別的任何公用 static (在 Visual Basic 中為 Shared) 成員都是執行緒安全的。並不是所有的執行個體成員都保證可以用於所有的執行緒。
請參閱
參考
Microsoft.SqlServer.Replication 命名空間