Sqlpass The Magic Of Replication

1,612 views

Published on

Published in: Technology
  • Be the first to comment

Sqlpass The Magic Of Replication

  1. 1. The Magic of Replication<br />What’s new in SQL Server 2008 Replication?<br />
  2. 2. Who Am I?<br />Meir Dudai<br />SQL Server consultant – Valinor (SQL Server Consulting Services)<br />Working with SQL Server for 10 years<br />Specialize in Replication, my favorite feature in SQL Server<br />Operating SQL Server Israeli website: http://www.SQLServer.co.il/ <br />meir@valinor.co.il<br />
  3. 3. Agenda<br />SQL Server’s greatest challenge<br />Replication overview<br />Peer-to-Peer Replication <br />Replication enhancements – SQL Server 2008<br />
  4. 4. SQL Server’s greatest challenge<br />
  5. 5. SQL Server’s greatest challenge<br />We want availability and scalability!<br />The database is a single point of failure<br />The database sometimes is the performance bottleneck<br />Scale Out<br />Scale Up<br />
  6. 6. Scale Up vs. Scale Out<br />
  7. 7. A DBA’s dream<br />Application/website always online<br />Workload is distributed amongst many servers<br />
  8. 8. Scalability and Availability Options in SQL Server<br />
  9. 9. Scalability and Availability Options in SQL Server<br />
  10. 10. Agenda<br />SQL Server’s greatest challenge<br />Replication overview<br />Peer-to-Peer Replication <br />Replication enhancements – SQL Server 2008<br />
  11. 11. What is Replication?<br />“Make copies of digital material for backup, performance, reliability, or preservation” <br />(Digital Libraries, by William Arms)<br />“The use of redundant resources to improve reliability, fault-tolerance, or performance “ (Wikipedia)<br />
  12. 12. How does it work?<br />
  13. 13. Agenda<br />SQL Server’s greatest challenge<br />Replication overview<br />Peer-to-Peer Replication <br />Replication enhancements – SQL Server 2008<br />
  14. 14. Introduction to Peer-to-Peer Replication<br />Databases replicate reciprocally and are writable<br />Redundancy provides fault tolerance and lowers maintenance downtime<br />Online upgrades possible<br />
  15. 15. Peer-to-Peer Topology<br />Logreader <br />Agent<br />Logreader <br />Agent<br />Logreader<br />Agent<br />Dist<br />DB<br />Dist<br />DB<br />Dist<br />DB<br />Distribution <br />Agent<br />Distribution <br />Agent<br />Distribution <br />Agent<br />Los Angeles<br />London<br />Transactional <br />Replication<br />Taipei<br />
  16. 16. Peer-to-Peer– common scenarios<br />Scale out reads and writes<br />or…<br />Scale out reads, but writes are done to one node only<br />
  17. 17. Peer-to-Peer – Multisite solution?<br />
  18. 18. Back to the DBA’s dream:<br />Peer-to-Peer Replication!<br /><ul><li>Application/website always online
  19. 19. Workload is distributed amongst many servers</li></ul>Implementing <br />Peer-to-Peer<br />
  20. 20. Challenges<br />Design your schema and topology properly to prevent conflicts<br />P2P is an asynchronous solution and does not guarantee zero data loss or zero latency<br />Not completely transparent<br />Although transparent enough!<br />
  21. 21. Agenda<br />SQL Server’s greatest challenge<br />Replication overview<br />Peer-to-Peer Replication <br />Replication enhancements in <br /> SQL Server 2008<br />
  22. 22. Changing replication topology online<br />In SQL Server 2005, replication had to be stopped (quiesced) in order to perform some actions:<br />Add nodes<br />Schema changes<br />In SQL Server 2008, these actions can be done online<br />And you also get a cool wizard in SSMS…<br />
  23. 23. Configure Peer-to-Peer Topology Wizard<br />Demo<br />
  24. 24. Conflict Detection and Resolution<br />SQL Server 2008 introduces conflict detection capability in peer-to-peer replication<br />All types of conflicts are detected and reported though agent error reporting or conflict tables<br />Two options on detecting conflict<br />Fail replication stream<br />Continue stream after logging conflict<br />Update tbl_user set <br />Name =‘camern’<br />Update tbl_user set <br />Name =‘cameron’<br />
  25. 25. Conflict Detection and Resolution<br />Conflicts are resolved based on originator_id value – higher wins<br />Manual resolution of conflicts is required in most cases<br />Best approach: Prevent conflicts through write partitioning even with conflict detection capabilities available<br />Update tbl_user set <br />Name =‘camern’<br />Update tbl_user set <br />Name =‘cameron’<br />
  26. 26.
  27. 27. Enabling Conflict Detection<br />Enable conflict detection in publication properties<br />Set a value for the originator ID<br />Specify action in case of conflict:<br />Stop and alert (default)<br />Continue (may cause data inconsistency)<br />
  28. 28. Viewing conflicts<br />When a conflict occurs, replication will stop by default<br />You can view the conflict using Conflict Viewer in SSMS and address it manually<br />
  29. 29. Conflict Detection and Resolution<br />Demo<br />
  30. 30. Replicating partition switch<br />In SQL Server 2005, switch partition action was unsupported in replicated environment<br />This was a major consideration for organizations when deciding whether to use replication or not<br />In SQL Server 2008, you can switch partition on a replicated table, and replicate this action<br />Requires some settings in publication properties<br />
  31. 31. Replicating partition switch<br />Publication properties:<br />@allow_partition_switch: allows SWITCH PARTITION to be executed against the publication database<br />@replicate_partition_switch: determines whether the SWITCH PARTITION DDL statement should be replicated to Subscribers<br />Preparations:<br />Make sure that all tables that are involved in partition switching exist at the Publisher and Subscriber<br />Make sure that the table and partition definitions are the same<br />Switch partition using ALTER TABLE command<br />
  32. 32. Performance improvements<br />Under Windows Server 2008, replication works faster than ever:<br />Snapshot delivery of more than 500MB/minute<br />One of the interesting benchmarks for a pull subscriber, time to deliver 100,000 varbinary (max) records:<br />Win2003/SQL2005 – 223 minutes<br />Win2008/SQL2008 – less than 2 minutes!<br />
  33. 33. Conclusion<br />Peer-to-Peer Replication can provide one of the best methods for systems scale out<br />Dramatically increase performance<br />Eliminate downtime<br />SQL Server 2008 provides major improvements for Peer-to-Peer Replication, and makes it accessible and more robust<br />
  34. 34. Related sessions<br />Building a High Availability Strategy for your Enterprise <br />Gopal Ashok<br /> Wednesday, 10:15AM<br />Transactional Replication: Beyond The Basics<br /> Kendal Van Dyke <br /> Thursday, 4:00PM<br />
  35. 35. Q&A<br />
  36. 36. Complete the Evaluation Form & Win!<br />You could win a Dell Mini Netbook– every day – just for handing in your completed form! Each session form is another chance to win!<br />Pick up your Evaluation Form:<br />Within each presentation room<br />At the PASS Booth near registration area<br />Drop off your completed Form:<br />Near the exit of each presentation room<br />At the PASS Booth near registration area<br />Sponsored by Dell<br />
  37. 37. Thank you<br />for attending this session and the 2009 PASS Summit in Seattle<br />

×