Building Highly Available Systems with SQL Server™ 2005 Vineet Gupta Evangelist – Data and...
Transcript of Building Highly Available Systems with SQL Server™ 2005 Vineet Gupta Evangelist – Data and...
Building Highly Available Systems with SQL Server™ 2005
Building Highly Available Systems with SQL Server™ 2005
Vineet GuptaVineet GuptaEvangelist – Data and IntegrationEvangelist – Data and IntegrationMicrosoft Corp.Microsoft Corp.
AvailabilityAvailabilityWhat does it mean to you?What does it mean to you?
Why not?Why not? Site is unavailableSite is unavailable System is unavailableSystem is unavailable Database is unavailableDatabase is unavailable Database is Database is partially unpartially unavailableavailable Table is unavailableTable is unavailable Data is unavailableData is unavailable
Can your customers get done, Can your customers get done, what they need to get done, what they need to get done,
when they need to do it?when they need to do it?
24x7x36524x7x365
Barriers To AvailabilityBarriers To Availability
Database Maintenance and Database Maintenance and OperationsOperations
Data Access Concurrency LimitationsData Access Concurrency Limitations Database Server Failure or DisasterDatabase Server Failure or Disaster
Barriers To AvailabilityBarriers To Availability Database Maintenance and Database Maintenance and
OperationsOperations Fast RecoveryFast Recovery Partial AvailabilityPartial Availability Online RestoreOnline Restore Media ReliabilityMedia Reliability Dedicated Administration ConnectionDedicated Administration Connection Dynamic ConfigurationDynamic Configuration
Data Access Concurrency LimitationsData Access Concurrency Limitations Database Server Failure or DisasterDatabase Server Failure or Disaster
What happens when…What happens when…
Disks FailDisks Fail In SQL ServerIn SQL Server™™ 2000 2000
Database is marked suspect Database is marked suspect Users are unable to access the databaseUsers are unable to access the database
In SQL ServerIn SQL Server™™ 2005 2005 Filegroup is marked offlineFilegroup is marked offline Users are able to access undamaged dataUsers are able to access undamaged data
Partial Database AvailabilityPartial Database AvailabilityImproving Availability for Isolated Improving Availability for Isolated DisasterDisaster Undamaged data remains available Undamaged data remains available
while damaged data is inaccessiblewhile damaged data is inaccessible File Status shown in File Status shown in
sys.database_files catalog viewsys.database_files catalog view Page Errors written to suspect_pages Page Errors written to suspect_pages
table in msdbtable in msdb Agent alerts:Agent alerts:
Notification of the damaged fileNotification of the damaged file Can take the database offline, if desiredCan take the database offline, if desired Can automate the restore, for read-only Can automate the restore, for read-only
datadata
What happens when…What happens when…
Recovery beginsRecovery begins In SQL ServerIn SQL Server™™ 2000 2000
DatabaseDatabase is in a restoring state is in a restoring state Users are Users are unableunable to access the database to access the database File needs to be recreated and zero File needs to be recreated and zero
initializedinitialized File Restore can proceed – File Restore can proceed – offlineoffline
In SQL ServerIn SQL Server™™ 2005 2005 FilegroupFilegroup is in a restoring state is in a restoring state Users are Users are ableable to access undamaged data to access undamaged data File can be recreated with instant file File can be recreated with instant file
InitializationInitialization Piecemeal Restore can proceed – Piecemeal Restore can proceed – online online
Online Piecemeal RestoreOnline Piecemeal RestoreImproving Availability during RecoveryImproving Availability during Recovery Almost any component (page, file, Almost any component (page, file,
filegroup) can be restored – ONLINEfilegroup) can be restored – ONLINE If a page is damaged – restore only that If a page is damaged – restore only that
page from a file, filegroup or database page from a file, filegroup or database backupbackup
If a file is damaged – restore only that file If a file is damaged – restore only that file from a file, filegroup or database backupfrom a file, filegroup or database backup
If a filegroup is damaged – restore only If a filegroup is damaged – restore only that filegroup from a filegroup or database that filegroup from a filegroup or database backupbackup
Readonly filegroups can be restored Readonly filegroups can be restored without rolling forward log changeswithout rolling forward log changes
Users can access the database during the Users can access the database during the restorerestore
Partial Database AvailabilityOnline Piecemeal RestorePartial Database AvailabilityOnline Piecemeal Restore
Summary: Maintenance and Summary: Maintenance and OpsOpsTechnologyTechnology ImprovesImproves WhenWhen
Partial Partial Database Database
AvailabilityAvailability
Data AvailabilityData AvailabilityUndamaged data/partitions remains Undamaged data/partitions remains
availableavailable Recovery TimeRecovery Time
Recover only that which is damagedRecover only that which is damaged
Upgrade Upgrade ImmediateImmediate
Instant File Instant File InitializatioInitializatio
nn
Database Creation TimeDatabase Creation TimeFiles are not zero-initialized Files are not zero-initialized
File, Filegroup, and Database File, Filegroup, and Database RestoreRestore
Missing files are created quicklyMissing files are created quickly Autogrow and Manual Growth Autogrow and Manual Growth
timetimeAdditional space is quickly addedAdditional space is quickly added Recovery Time Recovery Time – Less time to – Less time to
create filescreate files
Upgrade Upgrade ImmediateImmediate
Online Online Piecemeal Piecemeal RestoreRestore
Data AvailabilityData Availability Undamaged data/partitions remains Undamaged data/partitions remains
available during recoveryavailable during recovery Recovery TimeRecovery Time
Recover only that which is damaged – Recover only that which is damaged – onlineonline
Upgrade Upgrade ImmediateImmediate
Barriers To AvailabilityBarriers To Availability
Database Maintenance and Database Maintenance and OperationsOperations
Data Access Concurrency LimitationsData Access Concurrency Limitations Snapshot IsolationSnapshot Isolation Online Index OperationsOnline Index Operations ReplicationReplication Data PartitioningData Partitioning
Database Server Failure or DisasterDatabase Server Failure or Disaster
What happens when…What happens when…
Indexes need to be rebuiltIndexes need to be rebuilt In SQL Server™ 2000In SQL Server™ 2000
Index rebuilds require an exclusive table-Index rebuilds require an exclusive table-level lock, resulting in offline rebuildslevel lock, resulting in offline rebuilds
Users are Users are unableunable to access the table to access the table
In SQL Server™ 2005In SQL Server™ 2005 Rebuilds of an index can be performed online Rebuilds of an index can be performed online
if a few simple criteria are metif a few simple criteria are met Users are Users are able able to access the tableto access the table
Online Index OperationsOnline Index OperationsImproving Concurrency during Index Improving Concurrency during Index MaintenanceMaintenance SQL Server™ 2000SQL Server™ 2000
Offline Index RebuildsOffline Index Rebuilds; table data is ; table data is unavailable during operationunavailable during operation
Rebuild options: DBCC DBREINDEX and CREATE Rebuild options: DBCC DBREINDEX and CREATE with DROP_EXISTINGwith DROP_EXISTING
SQL Server™ 2005SQL Server™ 2005 Includes all of the above offline operations, Includes all of the above offline operations,
plus…plus… New ALTER INDEX…REBUILD:New ALTER INDEX…REBUILD:
ONLINE – allows concurrent user access (queries as ONLINE – allows concurrent user access (queries as well as modifications) to the index during rebuildwell as modifications) to the index during rebuild
OFFLINE – works using locks (same as SQL Server™ OFFLINE – works using locks (same as SQL Server™ 2000)2000)
If online is not possible by default, consider If online is not possible by default, consider design alternatives to fully leverage online design alternatives to fully leverage online index rebuildsindex rebuilds
Online Index RebuildsOnline Index Rebuilds
What happens when…What happens when…
Readers and Writers desire the same dataReaders and Writers desire the same data In SQL Server™ 2000In SQL Server™ 2000
Locking Locking is used to guarantee the intended level of is used to guarantee the intended level of isolationisolation
Users must wait to access locked dataUsers must wait to access locked data Concurrency and performance compromisedConcurrency and performance compromised Correctness is compromised when lower isolation Correctness is compromised when lower isolation
levels are used to avoid lockinglevels are used to avoid locking
In SQL Server™ 2005In SQL Server™ 2005 Locking Locking OR OR Versioning Versioning can be used to guarantee a can be used to guarantee a
variety of isolation levelsvariety of isolation levels With With versioningversioning, Readers won’t block writers and , Readers won’t block writers and
writers won’t block readerswriters won’t block readers Performance improved if contention was primary Performance improved if contention was primary
bottleneckbottleneck Correctness is not compromised due to use of lower Correctness is not compromised due to use of lower
isolation levelsisolation levels
Snapshot IsolationSnapshot IsolationImproving Concurrency in Mixed Improving Concurrency in Mixed WorkloadsWorkloads SQL Server™ 2000SQL Server™ 2000
Isolation implemented solely through lockingIsolation implemented solely through locking Mixed workloads may experience:Mixed workloads may experience:
Concurrency problems due to blockingConcurrency problems due to blocking The Inconsistent Analysis problemThe Inconsistent Analysis problem
SQL Server™ 2005SQL Server™ 2005 Isolation implemented using locking and Isolation implemented using locking and
versioningversioning Mixed workloads can improve read consistency Mixed workloads can improve read consistency
and performance using:and performance using: Read committed with Statement-level snapshot to Read committed with Statement-level snapshot to
improve statement-level consistencyimprove statement-level consistency Snapshot Isolation to improve transaction-level Snapshot Isolation to improve transaction-level
consistencyconsistency
Snapshot IsolationSnapshot Isolation
Barriers To AvailabilityBarriers To Availability
Database Maintenance and Database Maintenance and OperationsOperations
Data Access Concurrency LimitationsData Access Concurrency Limitations User or Application ErrorUser or Application Error Database Server Failure or DisasterDatabase Server Failure or Disaster
Failover ClusteringFailover Clustering Database MirroringDatabase Mirroring Peer-to-Peer ReplicationPeer-to-Peer Replication Log ShippingLog Shipping
Database MirroringDatabase MirroringDatabase-level RedundancyDatabase-level Redundancy
Upcoming High Availability Upcoming High Availability TechnologyTechnology
Released for testing and prototyping Released for testing and prototyping in SQL Server™ 2005 RTMin SQL Server™ 2005 RTM
Certified for Production Use in the Certified for Production Use in the first half of 2006first half of 2006
Supports three configurations:Supports three configurations: High AvailabilityHigh Availability High ProtectionHigh Protection High PerformanceHigh Performance
Commit
Write to
Local Log
Transmit to Mirror
Write to Remote
Log
Acknowledge
Committed in Log
Constantly Redoing on Mirror
Acknowledge
Database MirroringDatabase Mirroring
Log DBDB Log
Database MirroringDatabase MirroringConfiguration SummaryConfiguration Summary
No Automatic No Automatic DetectionDetection
Manual FailoverManual Failover Uses synchronous Uses synchronous
form of mirroringform of mirroring Does not require Does not require
WitnessWitness Principal Principal
performance is performance is affected by affected by network speed network speed and distanceand distance
High Availability
High Protection High Performance
Automatic Automatic DetectionDetection
Automatic Automatic FailoverFailover
Uses Uses synchronous synchronous form of form of mirroringmirroring
Requires Requires WitnessWitness
Principal Principal performance is performance is affected by affected by network speed network speed and distanceand distance
No Automatic No Automatic DetectionDetection
Manual FailoverManual Failover Uses Uses
asynchronous asynchronous form of mirroringform of mirroring
Does not require Does not require WitnessWitness
Principal Principal performance is performance is NOT affected by NOT affected by network speed network speed and distanceand distance
Database MirroringDatabase Mirroring
Which Technology When?Which Technology When?
Downtime – Time to Detect, Failover/Recover and Resume WorkloadDowntime – Time to Detect, Failover/Recover and Resume Workloads e c o n d ss e c o n d s to to m i n u t e sm i n u t e s to to h o u r sh o u r s to to d a y sd a y s
Failover Failover ClusteringClusteringFailover Failover
ClusteringClustering
Database Database MirroringMirroring
High Availability Configuration
Database Database MirroringMirroring
High Availability Configuration
Work
loss E
xp
osu
re – A
mou
nt o
f Pote
ntia
l Data
Loss
Work
loss E
xp
osu
re – A
mou
nt o
f Pote
ntia
l Data
Loss
n
on
en
on
e to
to
secon
ds
secon
ds toto
min
ute
s
min
ute
s to
to
days
days
Failover Failover ClusteringClusteringGeographically
Dispersed
Failover Failover ClusteringClusteringGeographically
Dispersed
Database Database MirroringMirroring
High Performance Configuration
Database Database MirroringMirroring
High Performance Configuration ReplicationReplicationPeer-to-Peer Transactional
ReplicationReplicationPeer-to-Peer Transactional
Log Shipping Log Shipping Log Shipping Log Shipping
Backup/RestoreBackup/RestoreOnline Page-level to File-level to Filegroup-level to
Offline Database
Backup/RestoreBackup/RestoreOnline Page-level to File-level to Filegroup-level to
Offline Database
Detach/AttachDetach/AttachDetach/AttachDetach/AttachDatabase Database SnapshotSnapshotDatabase Database SnapshotSnapshot
Summary: Standby Summary: Standby TechnologiesTechnologiesTechnologyTechnology StandbyStandby ProtectionProtection WhenWhen
Failover ClusteringFailover Clustering HotHot ServerServer Minimal Work Minimal Work to Leverageto Leverage
Database MirroringDatabase MirroringHigh Availability ConfigurationHigh Availability Configuration HotHot DatabaseDatabase Minimal Work Minimal Work
to Leverageto Leverage
Log ShippingLog Shipping WarmWarm DatabaseDatabase Minimal Work Minimal Work to Leverageto Leverage
Database MirroringDatabase MirroringHigh Protection ConfigurationHigh Protection Configuration WarmWarm DatabaseDatabase Minimal Work Minimal Work
to Leverageto Leverage
Database MirroringDatabase MirroringHigh Performance ConfigurationHigh Performance Configuration WarmWarm DatabaseDatabase Minimal Work Minimal Work
to Leverageto Leverage
ReplicationReplication WarmWarmDatabaseDatabase(Publication of (Publication of
objects)objects)
Design and Design and ArchitectArchitect
Partial Database Partial Database AvailabilityAvailability OnlineOnline Filegroup/FileFilegroup/File Upgrade Upgrade
ImmediateImmediate
Backup and RestoreBackup and Restore ColdCold DatabaseDatabaseFilegroup/FileFilegroup/File
Upgrade Upgrade ImmediateImmediate
Barriers To AvailabilityBarriers To AvailabilityHow SQL Server 2005 Addresses How SQL Server 2005 Addresses ThemThem Database Maintenance and OperationsDatabase Maintenance and Operations
Fast RecoveryFast Recovery Partial AvailabilityPartial Availability Online RestoreOnline Restore Media ReliabilityMedia Reliability Dedicated Administration ConnectionDedicated Administration Connection Dynamic ConfigurationDynamic Configuration
Data Access Concurrency LimitationsData Access Concurrency Limitations Snapshot IsolationSnapshot Isolation Online Index OperationsOnline Index Operations ReplicationReplication Data PartitioningData Partitioning
Database Server Failure or DisasterDatabase Server Failure or Disaster Failover ClusteringFailover Clustering Database MirroringDatabase Mirroring Peer-to-Peer ReplicationPeer-to-Peer Replication Log ShippingLog Shipping
© 2005 Microsoft Corporation. All rights reserved.This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.