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