TransSubscription クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
トランザクション パブリケーションまたはスナップショット パブリケーションへのプッシュ サブスクリプションを表します。
public ref class TransSubscription sealed : Microsoft::SqlServer::Replication::Subscription
public sealed class TransSubscription : Microsoft.SqlServer.Replication.Subscription
type TransSubscription = class
inherit Subscription
Public NotInheritable Class TransSubscription
Inherits Subscription
- 継承
例
// Define the Publisher, publication, and databases.
string publicationName = "AdvWorksProductTran";
string publisherName = publisherInstance;
string subscriberName = subscriberInstance;
string subscriptionDbName = "AdventureWorks2012Replica";
string publicationDbName = "AdventureWorks2012";
//Create a connection to the Publisher.
ServerConnection conn = new ServerConnection(publisherName);
// Create the objects that we need.
TransPublication publication;
TransSubscription subscription;
try
{
// Connect to the Publisher.
conn.Connect();
// Ensure that the publication exists and that
// it supports push subscriptions.
publication = new TransPublication();
publication.Name = publicationName;
publication.DatabaseName = publicationDbName;
publication.ConnectionContext = conn;
if (publication.IsExistingObject)
{
if ((publication.Attributes & PublicationAttributes.AllowPush) == 0)
{
publication.Attributes |= PublicationAttributes.AllowPush;
}
// Define the push subscription.
subscription = new TransSubscription();
subscription.ConnectionContext = conn;
subscription.SubscriberName = subscriberName;
subscription.PublicationName = publicationName;
subscription.DatabaseName = publicationDbName;
subscription.SubscriptionDBName = subscriptionDbName;
// Specify the Windows login credentials for the Distribution Agent job.
subscription.SynchronizationAgentProcessSecurity.Login = winLogin;
subscription.SynchronizationAgentProcessSecurity.Password = winPassword;
// By default, subscriptions to transactional publications are synchronized
// continuously, but in this case we only want to synchronize on demand.
subscription.AgentSchedule.FrequencyType = ScheduleFrequencyType.OnDemand;
// Create the push subscription.
subscription.Create();
}
else
{
// Do something here if the publication does not exist.
throw new ApplicationException(String.Format(
"The publication '{0}' does not exist on {1}.",
publicationName, publisherName));
}
}
catch (Exception ex)
{
// Implement the appropriate error handling here.
throw new ApplicationException(String.Format(
"The subscription to {0} could not be created.", publicationName), ex);
}
finally
{
conn.Disconnect();
}
' Define the Publisher, publication, and databases.
Dim publicationName As String = "AdvWorksProductTran"
Dim publisherName As String = publisherInstance
Dim subscriberName As String = subscriberInstance
Dim subscriptionDbName As String = "AdventureWorks2012Replica"
Dim publicationDbName As String = "AdventureWorks2012"
'Create a connection to the Publisher.
Dim conn As ServerConnection = New ServerConnection(publisherName)
' Create the objects that we need.
Dim publication As TransPublication
Dim subscription As TransSubscription
Try
' Connect to the Publisher.
conn.Connect()
' Ensure that the publication exists and that
' it supports push subscriptions.
publication = New TransPublication()
publication.Name = publicationName
publication.DatabaseName = publicationDbName
publication.ConnectionContext = conn
If publication.IsExistingObject Then
If (publication.Attributes And PublicationAttributes.AllowPush) = 0 Then
publication.Attributes = publication.Attributes _
Or PublicationAttributes.AllowPush
End If
' Define the push subscription.
subscription = New TransSubscription()
subscription.ConnectionContext = conn
subscription.SubscriberName = subscriberName
subscription.PublicationName = publicationName
subscription.DatabaseName = publicationDbName
subscription.SubscriptionDBName = subscriptionDbName
' Specify the Windows login credentials for the Distribution Agent job.
subscription.SynchronizationAgentProcessSecurity.Login = winLogin
subscription.SynchronizationAgentProcessSecurity.Password = winPassword
' By default, subscriptions to transactional publications are synchronized
' continuously, but in this case we only want to synchronize on demand.
subscription.AgentSchedule.FrequencyType = ScheduleFrequencyType.OnDemand
' Create the push subscription.
subscription.Create()
Else
' Do something here if the publication does not exist.
Throw New ApplicationException(String.Format( _
"The publication '{0}' does not exist on {1}.", _
publicationName, publisherName))
End If
Catch ex As Exception
' Implement the appropriate error handling here.
Throw New ApplicationException(String.Format( _
"The subscription to {0} could not be created.", publicationName), ex)
Finally
conn.Disconnect()
End Try
注釈
リモート ディストリビューターを使用するパブリッシャーを構成する場合は、SynchronizationAgentProcessSecurity を含むすべてのパラメーターに指定された値がディストリビューターにプレーン テキストとして送信されます。 Create メソッドを呼び出す前に、パブリッシャーとリモート ディストリビューター間の接続を暗号化する必要があります。 詳細については、「 sp_reinitsubscription (Transact-SQL)」を参照してください。
サブスクリプションが SQL Server 以外のパブリッシャーに属している場合、 ConnectionContext プロパティは Publisher ではなくディストリビューターに設定され、 DatabaseName プロパティはパブリケーション データベースではなくディストリビューション データベースに設定されPublisherName、 プロパティは SQL Server 以外のパブリッシャーの名前に設定されます。
スレッド セーフ
この型の public static (Microsoft Visual Basic では Shared) のすべてのメンバーは、マルチスレッド操作で安全に使用できます。 インスタンス メンバーの場合は、スレッド セーフであるとは限りません。
コンストラクター
| TransSubscription() |
TransSubscription クラスの新しいインスタンスを作成します。 |
| TransSubscription(String, String, String, String, ServerConnection) |
指定したパブリケーション、データベース、サブスクライバー、およびサブスクライバー データベースと、指定した Microsoft SQL Server のインスタンスへの接続を使用して、 クラスの新しいTransSubscriptionインスタンスを作成します。 |
プロパティ
| AgentJobId |
サブスクリプションの同期に使用されるエージェント ジョブの ID を取得します。 (継承元 Subscription) |
| AgentOffload |
エージェント ジョブの作成時と異なるコンピューター上で同期エージェントを実行するかどうかを取得します。値の設定も可能です。 このプロパティは、Microsoft SQL Server 2005 以降を実行しているディストリビューターではサポートされなくなりました。 (継承元 Subscription) |
| AgentOffloadServer |
リモート エージェントのアクティブ化を使用するとき、エージェントが実行されるリモート コンピューターの名前を取得します。値の設定も可能です。 (継承元 Subscription) |
| AgentSchedule |
サブスクリプションの同期に使用されるエージェント ジョブのスケジュールを取得します。 (継承元 Subscription) |
| BackupInformation |
バックアップからサブスクリプションを初期化するために必要な情報を取得します。値の設定も可能です。 |
| CachePropertyChanges |
レプリケーション プロパティに加えられた変更をキャッシュするか、またはすぐに適用するかを取得します。値の設定も可能です。 (継承元 ReplicationObject) |
| ConnectionContext |
Microsoft SQL Server のインスタンスへの接続を取得または設定します。 (継承元 ReplicationObject) |
| CreateSyncAgentByDefault |
サブスクリプションの同期に使用されるエージェント ジョブが既定で作成されるかどうかを取得します。値の設定も可能です。 (継承元 Subscription) |
| DatabaseName |
パブリケーション データベースの名前を取得します。値の設定も可能です。 (継承元 Subscription) |
| DtsPackageLocation |
Microsoft SQL Server 2000 Data Transformation Services (DTS) パッケージの場所を取得または設定します。 |
| DtsPackageName |
サブスクライバーに適用される Microsoft SQL Server 2000 データ変換サービス (DTS) パッケージの名前を取得または設定します。 |
| DtsPackagePassword |
Microsoft SQL Server 2000 Data Transformation Services (DTS) パッケージの実行に使用するパスワードを設定します。 |
| EnabledForSynchronizationManager |
Microsoft Windows 同期マネージャーを使用してサブスクリプションを同期できるかどうかを指定します。 (継承元 Subscription) |
| FullSubscription |
サブスクリプションがいっぱいかどうかを示す値を取得します。 |
| IsExistingObject |
サーバーにオブジェクトが存在するかどうかを取得します。 (継承元 ReplicationObject) |
| LoopBackDetection |
ディストリビューション エージェントがサブスクライバーで発生したトランザクションをサブスクライバーに戻すかどうかを取得します。値の設定も可能です。 |
| MemoryOptimized |
トランザクション パブリケーションまたはスナップショット パブリケーションへのプッシュ サブスクリプションを表します。 |
| Name |
既存のサブスクリプションに割り当てられている名前を取得します。 (継承元 Subscription) |
| PublicationName |
サブスクリプションがサブスクライブするパブリケーションの名前を取得します。値の設定も可能です。 (継承元 Subscription) |
| PublisherName |
サブスクリプションが SQL Server 以外のパブリッシャーに属している場合のパブリッシャーの名前を取得または設定します。 |
| SecureDtsPackagePassword |
Microsoft SQL Server 2000 Data Transformation Services (DTS) パッケージの実行に使用するパスワードを (オブジェクトとしてSecureString) 設定します。 |
| SqlServerName |
このオブジェクトが接続されている Microsoft SQL Server インスタンスの名前を取得します。 (継承元 ReplicationObject) |
| Status |
サブスクリプションの状態を取得します。 (継承元 Subscription) |
| SubscriberCatalog |
SQL Server以外のサブスクライバーの OLE DB プロバイダーへの接続時に使用されるカタログを取得または設定します。 |
| SubscriberDatasource |
SQL Server以外のサブスクライバーの OLE DB プロバイダーによって認識されるデータ ソースの名前。 |
| SubscriberDatasourceType |
SQL Server以外のサブスクライバーであるデータ ソースの種類を識別します。 |
| SubscriberLocation |
非SQL Server サブスクライバーの OLE DB プロバイダーによって認識されるデータベースの場所。 |
| SubscriberName |
サブスクライバーとして動作している Microsoft SQL Server のインスタンスの名前を取得します。値の設定も可能です。 (継承元 Subscription) |
| SubscriberProvider |
非SQL Server サブスクライバーの OLE DB プロバイダーが登録されている一意のプログラム識別子 (PROGID) |
| SubscriberProviderString |
OLE DB プロバイダー固有の接続文字列は、SQL Server以外のサブスクライバーのデータ ソースに接続するために使用されます。 |
| SubscriberSecurity |
サブスクライバーへの接続に使用されるセキュリティ コンテキストを取得します。 (継承元 Subscription) |
| SubscriberType |
サブスクライバーでのデータ変更の更新動作を取得します。値の設定も可能です。 |
| SubscriptionDBName |
レプリケートされたデータを受信するサブスクライバーのデータベースの名前を取得します。値の設定も可能です。 (継承元 Subscription) |
| SubscriptionLSN |
サブスクリプションのログ シーケンス番号を取得または設定します。 |
| SubscriptionType |
プッシュ サブスクリプションまたはプル サブスクリプションに対して、サブスクリプションを登録するかどうかを取得します。 (継承元 Subscription) |
| SynchronizationAgent |
サブスクリプションの同期に使用できる TransSynchronizationAgent クラスのインスタンスを取得します。 |
| SynchronizationAgentName |
サブスクリプションの同期のために作成されるエージェント ジョブの名前を取得します。値の設定も可能です。 (継承元 Subscription) |
| SynchronizationAgentProcessSecurity |
サブスクリプションを同期するために同期エージェント ジョブを実行する Microsoft Windows アカウントを指定するために使用されるセキュリティ コンテキストを取得します。 (継承元 Subscription) |
| SyncType |
サブスクリプションを初期化する方法を取得します。値の設定も可能です。 (継承元 Subscription) |
| UserData |
ユーザーが独自のデータをオブジェクトにアタッチすることを許可するオブジェクト プロパティを取得します。値の設定も可能です。 (継承元 ReplicationObject) |
メソッド
| CheckValidCreation() |
有効なレプリケーションの作成を確認します。 (継承元 ReplicationObject) |
| CheckValidDefinition(Boolean) |
サブスクリプション定義が有効かどうかを示します。 (継承元 Subscription) |
| CommitPropertyChanges() |
キャッシュされたすべてのプロパティ変更ステートメントを Microsoft SQL Serverのインスタンスに送信します。 (継承元 ReplicationObject) |
| Create() |
パブリッシャー側でサブスクリプション登録を作成します。 (継承元 Subscription) |
| Decouple() |
参照先のレプリケーション オブジェクトをサーバーから切断します。 (継承元 ReplicationObject) |
| DoUpdateMemoryOptimizedProperty(String) |
トランザクション パブリケーションまたはスナップショット パブリケーションへのプッシュ サブスクリプションを表します。 |
| GetChangeCommand(StringBuilder, String, String) |
レプリケーションの変更コマンドを返します。 (継承元 ReplicationObject) |
| GetCreateCommand(StringBuilder, Boolean, ScriptOptions) |
レプリケーションの作成コマンドを返します。 (継承元 ReplicationObject) |
| GetDropCommand(StringBuilder, Boolean) |
レプリケーションの削除コマンドを返します。 (継承元 ReplicationObject) |
| InternalRefresh(Boolean) |
レプリケーションで内部更新を開始します。 (継承元 ReplicationObject) |
| Load() |
サーバーから既存のオブジェクトのプロパティを読み込みます。 (継承元 ReplicationObject) |
| LoadProperties() |
サーバーから既存のオブジェクトのプロパティを読み込みます。 (継承元 ReplicationObject) |
| Refresh() |
オブジェクトのプロパティを再度読み込みます。 (継承元 ReplicationObject) |
| Reinitialize() |
サブスクリプションを同期するために、次回ディストリビューション エージェントを実行するときに再初期化されるようにサブスクリプションをマークします。 |
| Reinitialize(Boolean) |
サブスクリプションを再初期化します。 |
| Remove() |
パブリッシャーでサブスクリプション登録を削除し、プッシュ サブスクリプション用のサブスクライバーでレプリケーション オブジェクトを削除します。 (継承元 Subscription) |
| Script(ScriptOptions) |
サブスクリプションの作成または削除に使用できる Transact-SQL スクリプトを返します。 (継承元 Subscription) |
| StopSynchronizationJob() |
現在サブスクリプションの同期を実行しているディストリビューション エージェント ジョブの停止を試みます。 |
| SynchronizeWithJob() |
エージェント ジョブを開始してサブスクリプションを同期します。 |