Microsoft® SQL Server® 2012 Bible

(Ben Green) #1

736


Part V: Enterprise Data Management


If you highlight a table and then click the Article Properties drop-down box, you
can confi gure options for how the table replicates to the subscriber. For example,
you can replicate user triggers, include foreign key dependencies, and determine
what happens if a table with the same name already exists on the subscriber. The
options are as follows:
■ Drop the subscriber table.

■ (^) Do nothing.
■ Keep the table, but delete all of its data.
■ (^) Keep the table, but delete all the data that meets your fi ltering criteria (covered
in the next step).



  1. After you select the objects you want to replicate, click Next. The Filter Table Rows
    dialog appears. From here, you can confi gure fi ltering criteria that sends only a
    subset of the rows to the subscriber. For example, if you were replicating a table
    with a state column, you may decide that the subscriber should have only rows
    from California. To enable that, you would click the Add button, select the table in
    the drop-down box in the Select Table to Filter Option, click the State column in
    the Complete the Filter Statement section, and then add the state value. In code, it
    might look like this:
    SELECT FROM [dbo].[SalesStaff] WHERE [State]='CA'


This would ensure that the subscriber receives only data and changes from sales
staff when the value of State is CA.


  1. After you enabled your fi lters, click Next. The next dialog is Snapshot Agent, which
    controls two snapshot options:
    ■ Create a snapshot immediately, and keep the snapshot available to initialize
    subscriptions.
    ■ Schedule the Snapshot Agent to run at the following times.
    The fi rst option generates the snapshot immediately; every replicated change that
    occurs in the publication is not only replicated to the subscriber, but also added to
    the snapshot fi les. This is a great option when you must deploy a lot of snapshots
    frequently, but it does add a constant load to your publisher. The second option
    to schedule the snapshot agent generates a snapshot on a schedule, so the snap-
    shot fi les are updated each time you run the snapshot agent. Changes not in the
    snapshot must be stored in the distribution agent, which may mean extra storage
    requirements on the distributor. For most DBAs/developers, it is not a good practice
    to enable these options.

  2. Click Next to confi gure Agent Security. This option enables you to select the secu-
    rity context you want your replication agents to run under. By default, SQL Server
    runs the replication agents under the same account under which the SQL Server
    agent account runs.


c28.indd 736c28.indd 736 7/31/2012 9:51:12 AM7/31/2012 9:51:12 AM


http://www.it-ebooks.info
Free download pdf