DistributionDatabase.HistoryRetention DistributionDatabase.HistoryRetention DistributionDatabase.HistoryRetention Property

정의

복제 에이전트 기록 데이터가 보관되는 기간(시간)을 가져오거나 설정합니다. Gets or sets the length of time, in hours, replication agent history data is to be retained.

public:
 property int HistoryRetention { int get(); void set(int value); };
public int HistoryRetention { get; set; }
Public Property HistoryRetention As Integer
속성 값

Int32 값입니다. An Int32 value.

예제

// Set the server and database names
string distributionDbName = "distribution";
string publisherName = publisherInstance;
string publicationDbName = "AdventureWorks2012";

DistributionDatabase distributionDb;
ReplicationServer distributor;
DistributionPublisher publisher;
ReplicationDatabase publicationDb;

// Create a connection to the server using Windows Authentication.
ServerConnection conn = new ServerConnection(publisherName);

try
{
	// Connect to the server acting as the Distributor 
	// and local Publisher.
	conn.Connect();

	// Define the distribution database at the Distributor,
	// but do not create it now.
	distributionDb = new DistributionDatabase(distributionDbName, conn);
	distributionDb.MaxDistributionRetention = 96;
	distributionDb.HistoryRetention = 120;

	// Set the Distributor properties and install the Distributor.
	// This also creates the specified distribution database.
	distributor = new ReplicationServer(conn);
	distributor.InstallDistributor((string)null, distributionDb);

	// Set the Publisher properties and install the Publisher.
	publisher = new DistributionPublisher(publisherName, conn);
	publisher.DistributionDatabase = distributionDb.Name;
	publisher.WorkingDirectory = @"\\" + publisherName + @"\repldata";
	publisher.PublisherSecurity.WindowsAuthentication = true;
	publisher.Create();

	// Enable AdventureWorks2012 as a publication database.
	publicationDb = new ReplicationDatabase(publicationDbName, conn);

	publicationDb.EnabledTransPublishing = true;
	publicationDb.EnabledMergePublishing = true;
}
catch (Exception ex)
{
	// Implement appropriate error handling here.
	throw new ApplicationException("An error occured when installing distribution and publishing.", ex);
}
finally
{
	conn.Disconnect();
}
' Set the server and database names
Dim distributionDbName As String = "distribution"
Dim publisherName As String = publisherInstance
Dim publicationDbName As String = "AdventureWorks2012"

Dim distributionDb As DistributionDatabase
Dim distributor As ReplicationServer
Dim publisher As DistributionPublisher
Dim publicationDb As ReplicationDatabase

' Create a connection to the server using Windows Authentication.
Dim conn As ServerConnection = New ServerConnection(publisherName)

Try
    ' Connect to the server acting as the Distributor 
    ' and local Publisher.
    conn.Connect()

    ' Define the distribution database at the Distributor,
    ' but do not create it now.
    distributionDb = New DistributionDatabase(distributionDbName, conn)
    distributionDb.MaxDistributionRetention = 96
    distributionDb.HistoryRetention = 120

    ' Set the Distributor properties and install the Distributor.
    ' This also creates the specified distribution database.
    distributor = New ReplicationServer(conn)
    distributor.InstallDistributor((CType(Nothing, String)), distributionDb)

    ' Set the Publisher properties and install the Publisher.
    publisher = New DistributionPublisher(publisherName, conn)
    publisher.DistributionDatabase = distributionDb.Name
    publisher.WorkingDirectory = "\\" + publisherName + "\repldata"
    publisher.PublisherSecurity.WindowsAuthentication = True
    publisher.Create()

    ' Enable AdventureWorks2012 as a publication database.
    publicationDb = New ReplicationDatabase(publicationDbName, conn)

    publicationDb.EnabledTransPublishing = True
    publicationDb.EnabledMergePublishing = True

Catch ex As Exception
    ' Implement appropriate error handling here.
    Throw New ApplicationException("An error occured when installing distribution and publishing.", ex)

Finally
    conn.Disconnect()

End Try

설명

HistoryRetention 의 구성원만 속성을 검색할 수는 db_owner 또는 replmonitor 있는 사용자가 또는 배포 데이터베이스를 사용 하는 게시의 게시 액세스 목록 (PAL)의 사용자가 배포 데이터베이스의 고정된 데이터베이스 역할 에 대 한 SELECT는 MSdistributiondbs 배포 데이터베이스의 시스템 테이블입니다.The HistoryRetention property can only be retrieved by members of the db_owner or replmonitor fixed database role on the distribution database, by users in the publication access list (PAL) of a publication using the distribution database, or by users with SELECT permission on the MSdistributiondbs system table in the distribution database.

HistoryRetention 속성의 구성원으로 설정할 수 있습니다는 sysadmin 배포자에서 고정된 서버 역할입니다.The HistoryRetention property can only be set by members of the sysadmin fixed server role at the Distributor.

검색 된 HistoryRetention 속성은 실행 sp_helpdistributiondb합니다.Retrieving the HistoryRetention property is equivalent to executing sp_helpdistributiondb.

설정의 HistoryRetention 속성은 실행 sp_adddistributiondb 또는 sp_changedistributiondb합니다.Setting the HistoryRetention property is equivalent to executing sp_adddistributiondb or sp_changedistributiondb.

적용 대상

추가 정보