Dela via


How to: Create a Snapshot for a Merge Publication with Parameterized Filters (SQL Server Management Studio)

Generate snapshots for partitions on the Data Partitions page of the Publication Properties - <Publication> dialog box. For more information about accessing this dialog box, see How to: View and Modify Publication and Article Properties (SQL Server Management Studio). You can allow Subscribers to initiate snapshot generation and delivery and/or generate snapshots.

Note

If the filtering for one or more articles in the publication yields non-overlapping partitions that are unique for each subscription, metadata is cleaned up whenever the Merge Agent runs. This means that the partitioned snapshot expires more quickly. When using this option, you should consider allowing Subscribers to initiate snapshot generation and delivery. For more information about filtering options, see the "Setting 'partition options'" section of Snapshots for Merge Publications with Parameterized Filters.

Before generating snapshots for one or more partitions, you must:

  1. Create a merge publication with the New Publication Wizard, and specify one or more parameterized row filters on the Add Filter page of the wizard. For more information, see How to: Define and Modify a Parameterized Row Filter for a Merge Article (SQL Server Management Studio).

  2. Generate a schema snapshot for the publication. By default, a schema snapshot is generated when you complete the New Publication Wizard; you can also generate a schema snapshot from Microsoft SQL Server Management Studio.

To generate a schema snapshot

  1. Connect to the Publisher in Management Studio, and then expand the server node.

  2. Expand the Replication folder, and then expand the Publications folder.

  3. Right-click the publication for which you want to create a snapshot, and then click View Snapshot Agent Status.

  4. In the View Snapshot Agent Status - <Publication> dialog box, click Start.

    When the Snapshot Agent finishes generating the snapshot, a message will be displayed, such as "[100%] A snapshot of 17 article(s) was generated."

To allow Subscribers to initiate snapshot generation and delivery

  1. On the Data Partitions page of the Publication Properties - <Publication> dialog box, select Automatically define a partition and generate a snapshot if needed when a new Subscriber tries to synchronize.

  2. Click OK.

To generate and refresh snapshots

  1. On the Data Partitions page of the Publication Properties - <Publication> dialog box, click Add.

  2. Enter a value for the HOST_NAME() and/or SUSER_SNAME() value associated with the partition for which you want to create a snapshot.

  3. Optionally specify a schedule for refreshing snapshots:

    1. Select Schedule the Snapshot Agent for this partition to run at the following time(s)

    2. Accept the default schedule for refreshing snapshots, or click Change to specify a different schedule.

  4. Click OK, which returns you to the Publication Properties - <Publication> dialog box.

  5. Select the partition in the property grid, and then click Generate the selected snapshots now.

  6. Click OK.