DistributionDatabase クラス

定義

ディストリビューターの配布データベースを表しています。

public ref class DistributionDatabase sealed : Microsoft::SqlServer::Replication::ReplicationObject
public sealed class DistributionDatabase : Microsoft.SqlServer.Replication.ReplicationObject
type DistributionDatabase = class
    inherit ReplicationObject
Public NotInheritable Class DistributionDatabase
Inherits ReplicationObject
継承
DistributionDatabase

// 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

注釈

スレッド セーフ

このタイプの公開静的(Microsoft Visual BasicShared)メンバーはマルチスレッド操作に安全です。 インスタンス メンバーがスレッド セーフであるとは限りません。

コンストラクター

名前 説明
DistributionDatabase()

DistributionDatabase クラスの新しいインスタンスを作成します。

DistributionDatabase(String, ServerConnection)

指定されたデータベース名とディストリビュータへの接続を持つ DistributionDatabase クラスの新しいインスタンスを作成します。

プロパティ

名前 説明
CachePropertyChanges

レプリケーションプロパティの変更をキャッシュするか、即座に適用するかを取得または設定します。

(継承元 ReplicationObject)
ConnectionContext

Microsoft SQL Serverのインスタンスへの接続を取得または設定します。

(継承元 ReplicationObject)
DataFile

配布データベースのデータファイル名を取得するか設定します。

DataFileSize

配布データベースのプライマリデータベースファイルのサイズを取得するか設定します。

DataFolder

配布データベースのデータファイルを含むディレクトリへのパスを取得したり設定したりします。

DistributionCleanupTaskName

ディストリビューション内のレプリケーションテーブルのクリーンアップを担当するSQL Server エージェントジョブの名前を取得します。

DistributorSecurity

ディストリビューターに接続して配布データベースを作成する際に使われるセキュリティコンテキストを取得します。

HistoryCleanupTaskName

レプリケーション履歴テーブルのクリーンアップを担当するSQL Server エージェントジョブの名前を取得します。

HistoryRetention

レプリケーションエージェントの履歴データを保持する時間(数時間)を取得したり設定したりします。

IsExistingObject

オブジェクトがサーバー上に存在するかどうかを把握します。

(継承元 ReplicationObject)
LogFile

データベースのトランザクションログレコードを格納するファイル名を取得するか設定します。

LogFileSize

データベースのトランザクションログレコードを格納するファイルのサイズを取得または設定します。

LogFolder

データベースのトランザクションログレコードを格納するファイルがあるディレクトリへのパスを取得するか設定します。

MaxDistributionRetention

トランザクションが配布データベースから削除される前に、最大保持期間(数時間)を取得したり設定したりします。

MinDistributionRetention

トランザクションが配布データベースから削除される前の最小保持期間(数時間単位)を取得したり設定したりします。

Name

配布データベースの名前を取得するか設定します。

QueueReaderAgentExists

このディストリビューションデータベースのためにキューリーダーエージェントジョブが作成されているかどうかを取得または設定します。

QueueReaderAgentName

この配布データベースのために作成されたキューリーダーエージェントのジョブ名を取得したり設定したりします。

QueueReaderAgentProcessSecurity

Queue Reader Agentジョブを実行するためのエージェントプロセスのセキュリティコンテキストを取得します。

SqlServerName

このオブジェクトが接続されているMicrosoft SQL Serverインスタンスの名前を取得します。

(継承元 ReplicationObject)
UserData

ユーザーが自分のデータをオブジェクトにアタッチできるオブジェクトプロパティを取得したり設定したりします。

(継承元 ReplicationObject)

メソッド

名前 説明
CheckValidCreation()

有効な複製の作成を確認します。

(継承元 ReplicationObject)
CheckValidDefinition(Boolean)

定義が有効かどうかを示します。

(継承元 ReplicationObject)
CleanUpAnonymousSubscription(Int32, PublicationType)

ディストリビューターの匿名サブスクリプションのメタデータを削除します。

CommitPropertyChanges()

キャッシュされたプロパティ変更文をすべてMicrosoft SQL Serverのインスタンスに送信します。

(継承元 ReplicationObject)
Create()

配布データベースを作成します。

CreateQueueReaderAgent()

配布データベース上でキューリーダーエージェントジョブを作成します。

Decouple()

参照されたレプリケーションオブジェクトをサーバーから切り離します。

(継承元 ReplicationObject)
GetChangeCommand(StringBuilder, String, String)

レプリケーションからの変更コマンドを返します。

(継承元 ReplicationObject)
GetCreateCommand(StringBuilder, Boolean, ScriptOptions)

レプリケーションからcreateコマンドを返します。

(継承元 ReplicationObject)
GetDropCommand(StringBuilder, Boolean)

レプリケーションからドロップコマンドを返します。

(継承元 ReplicationObject)
InternalRefresh(Boolean)

レプリケーションから内部リフレッシュを開始します。

(継承元 ReplicationObject)
Load()

サーバーから既存のオブジェクトのプロパティを読み込みます。

(継承元 ReplicationObject)
LoadProperties()

サーバーから既存のオブジェクトのプロパティを読み込みます。

(継承元 ReplicationObject)
Refresh()

オブジェクトのプロパティをリロードします。

(継承元 ReplicationObject)
RegisterBusinessLogicHandler(BusinessLogicHandler)

ディストリビューターでビジネスロジックハンドラアセンブリを登録します。

Remove()

配布データベースを削除します。

Script(ScriptOptions)

オブジェクトが表現する配布データベースを作成または削除するための Transact-SQL スクリプトを生成します。

UnregisterBusinessLogicHandler(BusinessLogicHandler)

ディストリビューターからビジネスロジックハンドラの登録を解除します。

適用対象

こちらもご覧ください