ReplicationServer.AgentCheckupInterval Property
Gets or sets the interval for the Distribution Agent to perform a checkup.
Namespace: Microsoft.SqlServer.Replication
Assembly: Microsoft.SqlServer.Rmo (in microsoft.sqlserver.rmo.dll)
Syntax
'Declaration
Public Property AgentCheckupInterval As Integer
public int AgentCheckupInterval { get; set; }
public:
property int AgentCheckupInterval {
int get ();
void set (int value);
}
/** @property */
public int get_AgentCheckupInterval ()
/** @property */
public void set_AgentCheckupInterval (int value)
public function get AgentCheckupInterval () : int
public function set AgentCheckupInterval (value : int)
Property Value
An Int32 value that specifies the interval for the distribution to perform a checkup.
Exceptions
Exception type | Condition |
---|---|
ApplicationException | When the server is not a Distributor. |
Remarks
Use IsDistributor to check whether or not the current server is a Distributor before you use AgentCheckupInterval.
This property is available with SQL Server 7.0, SQL Server 2000, and SQL Server 2005.
The AgentCheckupInterval property can be retrieved by the public fixed database role.
The AgentCheckupInterval property can be set by the sysadmin fixed server role only. Getting the AgentCheckupInterval property is equivalent to executing the sp_helpdistributor_properties (Transact-SQL) stored procedure.
This namespace, class, or member is supported only in version 2.0 of the .NET Framework.
Example
// Set the Distributor and distribution database names.
string distributionDbName = "distribution";
string distributorName = publisherInstance;
ReplicationServer distributor;
DistributionDatabase distributionDb;
// Create a connection to the Distributor using Windows Authentication.
ServerConnection conn = new ServerConnection(distributorName);
try
{
// Open the connection.
conn.Connect();
distributor = new ReplicationServer(conn);
// Load Distributor properties, if it is installed.
if (distributor.LoadProperties())
{
// Password supplied at runtime.
distributor.ChangeDistributorPassword(password);
distributor.AgentCheckupInterval = 5;
// Save changes to the Distributor properties.
distributor.CommitPropertyChanges();
}
else
{
throw new ApplicationException(
String.Format("{0} is not a Distributor.", publisherInstance));
}
// Create an object for the distribution database
// using the open Distributor connection.
distributionDb = new DistributionDatabase(distributionDbName, conn);
// Change distribution database properties.
if (distributionDb.LoadProperties())
{
// Change maximum retention period to 48 hours and history retention
// period to 24 hours.
distributionDb.MaxDistributionRetention = 48;
distributionDb.HistoryRetention = 24;
// Save changes to the distribution database properties.
distributionDb.CommitPropertyChanges();
}
else
{
// Do something here if the distribution database does not exist.
}
}
catch (Exception ex)
{
// Implement the appropriate error handling here.
throw new ApplicationException("An error occured when changing Distributor " +
" or distribution database properties.", ex);
}
finally
{
conn.Disconnect();
}
' Set the Distributor and distribution database names.
Dim distributionDbName As String = "distribution"
Dim distributorName As String = publisherInstance
Dim distributor As ReplicationServer
Dim distributionDb As DistributionDatabase
' Create a connection to the Distributor using Windows Authentication.
Dim conn As ServerConnection = New ServerConnection(distributorName)
Try
' Open the connection.
conn.Connect()
distributor = New ReplicationServer(conn)
' Load Distributor properties, if it is installed.
If distributor.LoadProperties() Then
' Password supplied at runtime.
distributor.ChangeDistributorPassword(password)
distributor.AgentCheckupInterval = 5
' Save changes to the Distributor properties.
distributor.CommitPropertyChanges()
Else
Throw New ApplicationException( _
String.Format("{0} is not a Distributor.", publisherInstance))
End If
' Create an object for the distribution database
' using the open Distributor connection.
distributionDb = New DistributionDatabase(distributionDbName, conn)
' Change distribution database properties.
If distributionDb.LoadProperties() Then
' Change maximum retention period to 48 hours and history retention
' period to 24 hours.
distributionDb.MaxDistributionRetention = 48
distributionDb.HistoryRetention = 24
' Save changes to the distribution database properties.
distributionDb.CommitPropertyChanges()
Else
' Do something here if the distribution database does not exist.
End If
Catch ex As Exception
' Implement the appropriate error handling here.
Throw New ApplicationException("An error occured when changing Distributor " + _
" or distribution database properties.", ex)
Finally
conn.Disconnect()
End Try
Thread Safety
Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Platforms
Development Platforms
For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.
Target Platforms
For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.
See Also
Reference
ReplicationServer Class
ReplicationServer Members
Microsoft.SqlServer.Replication Namespace
Other Resources
How to: View and Modify Publisher and Distributor Properties (RMO Programming)