412 Chapter9•ManagingReplication a centralized employee master database, and for each location, relevant employee data will be replicated. To do this, you can use functions like HOST_NAME() or SUSER_NAME(). Dynamic filters are possible only with Merge Replication. Figure 9.6 Adding Filters 10. The next screen sets schedules for the snapshot; it is better if you can schedule the snapshot during off-peak hours of the database. 11. Next is the security setting, which will be discussed in detail later. 12. Finally you have to assign a name for the publication. Configuration of Subscriber(s) After the configuration of Publisher, the next task is to configure Subscriber to access data in the publications of Publisher. There can be one or more Subscribers to one Publisher. Exercise 9.3 will help you to create a Subscriber. ManagingReplication•Chapter9 413 EXERCISE 9.3 Co n f i g u r i n g su b s C r i b e r 1. Launch Open SQL Server Management Studio from Program Files| SQL Server 2008. 2. Supply the correct authentication for you to login to the SQL Server in which you are going to configure the subscriber. 3. Navigate to the Replication node in the SQL Server Management Studio. In the Replication node, select Local Subscription and right-click the node and select New Subscription… from the Context menu. 4. In the new subscription wizard, after the starting page you will see the image shown in Figure 9.7. In this you can select the Publisher from the drop-down menu, and it will list the databases and their publications. You have the option of selecting one Publisher from the list. Figure 9.7 Choosing Replication for Subscriber 5. Next you need to specify whether the subscription is Pull or Push. This simply defines when the agents should run. If it is a Push subscription, all agents will be run at the distributor. This option makes it easier to administer the synchronization of subscriptions 414 Chapter9•ManagingReplication centrally. Pull subscription will run the agents at the subscriber and will reduce the load. 6. At the next screen (Figure 9.8), you can configure more subscribers. Also you have the option of allocating the subscriber database. If the database does not exist, you can create a new database from this screen itself by selecting the <new database…> option. Figure 9.8 Choosing Replication for Subscriber 7. Security settings will be configured in the next screen. In this you need to supply user credentials to connect to Publisher and Subscriber, and the Windows account for the agent to run. 8. Scheduling will be done in the next page in which you have three options for scheduling: Run on demand only: This option will not create a schedule; instead it will need manual execution of the agent jobs when required. Run continuously: This will update the data subscriber continuously. In the case where you need near real-time data, you can configure the scheduling as Run continuously. ManagingReplication•Chapter9 415 <Define Schedule…>: This will allow you to define your own schedule. 9. Next is to define when you want to synchronize the subscriber database, whether immediately or at the first synchronization. It is better if you can select the first option when there are fewer loads in the publisher database server. 10. The next screen (Figure 9.9) gives you the option of assigning priorities for the conflicts. This option is available only with Merge Replication. If the Subscription Type is server then you can configure the priorities. 0 means lowest priority and 99.99 is the highest priority. Figure 9.9 Choosing Replication for Subscriber 11. The next couple of screens will give you the option of creating scripts of the subscriber(s) you created. 416 Chapter9•ManagingReplication Configuration of Peer-to-Peer Replication Most users are puzzled when they want to configure the Peer-to-Peer Replication since there is no replication type seen when you are selecting a replication type. EXERCISE 9.4 Co n f i g u r i n g Pe e r -to-Pe e r re P l i C a t i o n 1. To configure Peer-to-Peer Replication you need to configure Transactional Replication first. 2. Right-click the created Transactional Replication and select Properties. In the dialog select Subscription Options and set True for Allow peer-to-peer subscriptions as shown in Figure 9.10. After it is set to True, the Allow peer-to-peer subscriptions property cannot be reset to False. 3. If you right-click the Transactional Publisher you will see new option called Configure Peer-to-Peer Replication. After selecting this option you will be taken to another wizard. Figure 9.10 Setting Up Peer-to-Peer Replication . Launch Open SQL Server Management Studio from Program Files| SQL Server 2008. 2. Supply the correct authentication for you to login to the SQL Server in which you are going to configure the subscriber. 3 Navigate to the Replication node in the SQL Server Management Studio. In the Replication node, select Local Subscription and right-click the node and select New Subscription… from the Context. synchronize the subscriber database, whether immediately or at the first synchronization. It is better if you can select the first option when there are fewer loads in the publisher database server. 10.