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

注釈

スレッド セーフ

この型の public static (Microsoft Visual Basic では Shared) のすべてのメンバーは、マルチスレッド操作で安全に使用できます。 インスタンス メンバーの場合は、スレッド セーフであるとは限りません。

コンストラクター

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

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

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)

レプリケーションの作成コマンドを返します。

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

レプリケーションの削除コマンドを返します。

(継承元 ReplicationObject)
InternalRefresh(Boolean)

レプリケーションで内部更新を開始します。

(継承元 ReplicationObject)
Load()

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

(継承元 ReplicationObject)
LoadProperties()

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

(継承元 ReplicationObject)
Refresh()

オブジェクトのプロパティを再度読み込みます。

(継承元 ReplicationObject)
RegisterBusinessLogicHandler(BusinessLogicHandler)

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

Remove()

ディストリビューション データベースを削除します。

Script(ScriptOptions)

オブジェクトが表すディストリビューション データベースを作成または削除するために使用できる Transact-SQL スクリプトを生成します。

UnregisterBusinessLogicHandler(BusinessLogicHandler)

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

適用対象

こちらもご覧ください