How to: Manage Partitions for a Merge Publication with Parameterized Filters (RMO Programming)
To better manage a publication with parameterized filters, you can programmatically create new Subscriber partitions, enumerate the existing Subscriber partitions, and delete Subscriber partitions by using Replication Management Objects (RMO). For information about how to create Subscriber partitions, see How to: Create a Snapshot for a Merge Publication with Parameterized Filters (RMO Programming). The following information about existing partitions can be obtained:
- The value and filtering function upon which the partition is based.
- The name of the job that generates a parameterized snapshot for the Subscriber.
- The last time that a parameterized snapshot job ran.
[!참고] When a publication has parameterized filters that yield subscriptions with nonoverlapping partitions, and if a particular subscription is lost and needs to be re-created, you must do the following: remove the partition that was subscribed to, re-create the subscription, and then re-create the partition. For more information, see 매개 변수가 있는 행 필터. Replication generates creation scripts for existing Subscriber partitions when a publication creation script is generated. For more information, see 복제 스크립팅.
To view information on existing partitions
Create a connection to the Publisher by using the ServerConnection class.
Create an instance of the MergePublication class. Set the Name and DatabaseName properties for the publication, and set the ConnectionContext property to the ServerConnection created in step 1.
Call the LoadProperties method to get the properties of the object. If this method returns false, either the publication properties in step 2 were defined incorrectly or the publication does not exist.
Call the EnumMergePartitions method, and pass the result to an array of MergePartition objects.
For each MergePartition object in the array, get any properties of interest.
To delete existing partitions
Create a connection to the Publisher by using the ServerConnection class.
Create an instance of the MergePublication class. Set the Name and DatabaseName properties for the publication, and set the ConnectionContext property to the ServerConnection created in step 1.
Call the LoadProperties method to get the properties of the object. If this method returns false, either the publication properties in step 2 were defined incorrectly or the publication does not exist.
Call the EnumMergePartitions method, and pass the result to an array of MergePartition objects.
For each MergePartition object in the array, determine whether the partition should be deleted. This decision is usually based on the value of the DynamicFilterLogin property or the DynamicFilterHostName property.
Call the RemoveMergePartition method on the MergePublication object from step 2. Pass the MergePartition object from step 5.
Repeat step 6 for each partition that is deleted.
참고 항목
관련 자료
매개 변수가 있는 행 필터
매개 변수가 있는 필터를 사용하는 병합 게시의 스냅숏