422 Chapter9•ManagingReplication The distribution database plays a vital role in replication, therefore for better performance it is recommended to have it in a separate database server instance. This will reduce publisher loading however; by separating distributor databases, overall network traffic will increase. The snapshot agent bulk copies data from publisher to the distributor. When scheduling the snapshot agent, try to schedule it when the CPU is idle and during low production periods. You have the option of scheduling replication for continuous instead; to improve the performance try to schedule it at a regular intervals. Though you have the option of replication, text,ntext, varchar(max), nvarchar(max), FileStream, and image data types, it is recommended to avoid replicating these data fields because these data types require more storage space. As specified before, pull subscription will move the processing to subscriber from distributor. Sometimes, you may use articles with filtered rows. In that case, it will be better to include indexes for those fields to improve the performance. Monitoring In case replication failed, you need to take prompt actions as it would lead to critical issues. To avoid these issues, you need to monitor your replication. To monitor replication, there are three options with SQL Server 2008. Replication Monitor Replication monitor is separated monitoring, which can run directly by executing sqlmonitor.exe in \Program Files\Microsoft SQL Server\100\Tools\Binn folder. New & Noteworthy… Replication Monitor Features In Replication Monitor grids, you can select which columns to view, sort by multiple columns, and filter rows in the grid based on column values Continued ManagingReplication•Chapter9 423 Follow Exercise 9.6 to launch Replication Monitor. EXERCISE 9.6 la u n C h i n g re P l i C a t i o n Mo n i t o 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 enable conflict resolution. 3. Navigate to Replication node in Object Explorer of the SQL Server Management Studio. 4. Right-click the Replication node and select Launch Replication Monitor. 5. Expand the server node and you will see the available Publishers in the current server as shown in Figure 9.13. to improve the usability of replication monitor. Right-click a grid, and then select Choose Columns to Show, Sort, Filter, or Clear Filter. Filter set- tings are specific to each grid. Column selection and sorting are applied to all grids of the same type, such as the publications grid for each Publisher. The Common Jobs tab for the Publisher node has been renamed to Agents. The Agents tab now provides a centralized location to view information about all the agents and jobs that are associated with publi- cations at the selected Publisher. Agents and jobs that are associated with publications include the following: The Snapshot Agent, which is used by all publications. The Log Reader Agent, which is used by all transactional publications. The Queue Reader Agent, which is used by transactional publications that are enabled for queued updating subscriptions. Maintenance jobs, which are used by all publications. 424 Chapter9•ManagingReplication 6. You can right-click the My Publishers and add any other Publishers. 7. If you click the Publisher server, in the right-hand side you will see all the Publishers and other information relevant to the Publisher. 8. If you select the Subscription Watch List tab, you will see all information about Subscribers. You can view subscription information, which is grouped by the replication type. 9. The next tab is the Agent tab, where you will get information about Snapshot, Log reader, and Queue reader agents. 10. In the left-hand side, under the publisher there are subscribers. Click any subscriber you want to monitor. 11. You will see three tabs: All Subscription, Agents, and Warning. In case of a Transactional Replication, you will see an additional tab called Tracer Tokens. Tracer tokens and Warning are discussed later in the chapter. 12. You can use the Replication monitor to find the performance of the subscribers, which depends on the Latency. Excellent, Good, Fair, Poor, and Critical (Transactional Replication only) are the values available for the performance, as shown in Figure 9.14. Figure 9.13 Replication Monitor Figure 9.14 Performance Monitoring from Replication Monitor ManagingReplication•Chapter9 425 Tracer Tokens Tracer tokens are to measure the latencies in transaction replication. Tracer tokens measure how much time has elapsed between the following actions: A transaction being committed at the Publisher and the corresponding command being inserted in the distribution database at the Distributor A command being inserted in the distribution database and the corresponding transaction being committed at a Subscriber Basically Tracer Tokens can be used to find out which Subscribers are take the most time to receive a change from the Publisher. Also Tracer Tokens can be used to find out which Subscribers expected to receive the tracer token, and which, if any, have not received it. EXERCISE 9.7 Cr e a t i n g tr a C e r to k e n s 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 enable conflict resolution. 3. Navigate to Replication node in Object Explorer of the SQL Server Management Studio. 4. Right-click the Replication node and select Launch Replication Monitor. 5. Expand the server node and you will see the available publishers in the current server; select a transactional publication in which you want to create a tracer token. 6. From the right-hand side select the Tracer Token Tab as shown in Figure 9.15. 426 Chapter9•ManagingReplication 7. Click the Insert Tracer button; you will get a record for each subscriber with the latency time for Publisher to Distributor and Distributor to Subscriber. 8. You can create several tracer tokens and view them by selecting relevant time stamp from the Time inserted drop-down menu. Alerts Alerts are needs to make proactive decisions. In replication you can create alerts and can be directed to relevant operators by using relevant medium, email, pager, and so on. EXERCISE 9.8 Cr e a t i n g al e r t s 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 enable conflict resolution. 3. Navigate to Replication node in Object Explorer of the SQL Server Management Studio. 4. Right-click the Replication node and select Launch Replication Monitor. 5. Expand the server node; you will see the available publishers in the current server. Select any publication in which you want to create an alert. Figure 9.15 Replication Monitor Tracer Tokens . n Mo n i t o 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. e r to k e n s 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. n g al e r t s 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