assaf fraenkel principal consultant microsoft consulting services high availability with sql 2005...
Post on 22-Dec-2015
216 views
TRANSCRIPT
Assaf Fraenkel
Principal Consultant
Microsoft Consulting Services
High Availability with SQL 2005 זמינות יתרה והמשך פעילות עסקית
Availability “Stack”Availability “Stack”
Majority of downtime is Majority of downtime is ascribed to operatorsascribed to operatorsApplication Software can Application Software can have dramatic impact on have dramatic impact on fault tolerancefault toleranceSystem Software can System Software can help at all levelshelp at all levelsHardware is very reliable Hardware is very reliable at this pointat this pointHardwareHardware
SystemSystemSoftwareSoftware
ApplicationApplicationSoftwareSoftware
OperatorsOperators
Barriers To AvailabilityBarriers To Availability
SS 2005 gives you greatly SS 2005 gives you greatly improved tools to overcome these improved tools to overcome these barriers barriers
Database Server Failure or DisasterDatabase Server Failure or DisasterUser or Application ErrorUser or Application ErrorData Access Concurrency LimitationsData Access Concurrency LimitationsDatabase Maintenance and Database Maintenance and OperationsOperationsUpgradesUpgrades
Only some are addressable by DBMS technologyOnly some are addressable by DBMS technologyBe sure to consider people, planning, and proceduresBe sure to consider people, planning, and procedures
Availability SolutionsAvailability SolutionsHow Do You Compare the Alternatives How Do You Compare the Alternatives (1/2)(1/2)
Time to Fail OverTime to Fail OverAutomatic or Manual DetectionAutomatic or Manual DetectionAutomatic or Manual FailoverAutomatic or Manual FailoverNumber of Failures it can surviveNumber of Failures it can surviveData Currency / LossData Currency / Loss
Availability SolutionsAvailability SolutionsHow Do You Compare the Alternatives How Do You Compare the Alternatives (2/2)(2/2)
Granularity of Data: Instance, Database, Table, Granularity of Data: Instance, Database, Table, RowRowCost of redundant system(s), additional Cost of redundant system(s), additional hardware, additional managementhardware, additional managementComplexityComplexityData ConsistencyData ConsistencyTransparency to clientsTransparency to clients
Availability Technologies in Availability Technologies in SQL Server 2005SQL Server 2005
Availability Technologies in Availability Technologies in SQL Server 2005SQL Server 2005
Basic:Basic: No failover and a potential data loss No failover and a potential data lossBackup / restoreBackup / restoreDetach / copy / attachDetach / copy / attach
Better:Better: Manual failover - potential data loss Manual failover - potential data lossPeer-to-Peer ReplicationPeer-to-Peer ReplicationLog ShippingLog ShippingDatabase Mirroring - high performance modeDatabase Mirroring - high performance mode
Best:Best: Automatic failover - zero data loss Automatic failover - zero data lossDatabase Mirroring - high availability modeDatabase Mirroring - high availability modeFailover ClusteringFailover Clustering
Backup / RestoreBackup / Restore
Detach / Copy / AttachDetach / Copy / Attach
Cold Standby SolutionsCold Standby SolutionsBackup / Restore and Backup / Restore and Detach / Copy / AttachDetach / Copy / Attach
Cold Standby SolutionsCold Standby SolutionsBackup / Restore and Backup / Restore and Detach / Copy / AttachDetach / Copy / Attach
Both ProvideBoth ProvideManual detectionManual detection and failover and failoverPotential for some work lossPotential for some work lossWhole-database scopeWhole-database scopeStandard serversStandard serversLimited reporting on standbyLimited reporting on standbyDuplicate copy of databaseDuplicate copy of databaseClient must know where to re-Client must know where to re-connectconnectSlowest failover – Most downtimeSlowest failover – Most downtime
Cold Standby SolutionsCold Standby SolutionsBackup / Restore and Backup / Restore and Detach / Copy / AttachDetach / Copy / Attach
Cold Standby SolutionsCold Standby SolutionsBackup / Restore and Backup / Restore and Detach / Copy / AttachDetach / Copy / Attach
Backup / Restore Backup / Restore What’s New in SQL Server 2005What’s New in SQL Server 2005
Fine-Grained Fine-Grained Online RepairOnline RepairOnline Restore – Database remains online; Online Restore – Database remains online; Only Only data being restored is offlinedata being restored is offlinePiecemeal Restore – Online restore of filegroups Piecemeal Restore – Online restore of filegroups by priorityby priorityPage-level RestorePage-level Restore – Can restore individual – Can restore individual pages to repair errors found by page checksum pages to repair errors found by page checksum or torn pagesor torn pages
Instant File Initialization – Instant File Initialization – Skips file zeroingSkips file zeroing, , fast DB create / restorefast DB create / restoreData backups do not block log backupsData backups do not block log backupsRestore read-only filegroups without Restore read-only filegroups without applying logsapplying logsBackup / Restore Backup / Restore includes FullTextincludes FullText data data
Warm Standby SolutionsWarm Standby SolutionsReplication and Log ShippingReplication and Log Shipping
ReplicationReplication
Log ShippingLog Shipping
Warm Standby SolutionsWarm Standby SolutionsReplicationReplication
Multiple copies and Manual Multiple copies and Manual failoverfailoverPrimarily used where Primarily used where availability is required in availability is required in conjunction with scale out of conjunction with scale out of read activityread activityFailover possible; a custom Failover possible; a custom solutionsolutionNot limited to entire Not limited to entire database; database; Can define subset Can define subset of source database or tablesof source database or tablesCopy of database is Copy of database is continuously accessible for continuously accessible for read activityread activityLatency between source and Latency between source and copy can be as low as copy can be as low as secondsseconds
ReplicationReplication
Peer-to-Peer Peer-to-Peer Transactional Transactional ReplicationReplicationAll participants are peersAll participants are peers
Schema is identical on all sitesSchema is identical on all sitesPublish the updates made on ‘their’ dataPublish the updates made on ‘their’ dataSubscribe to others to pick up their changesSubscribe to others to pick up their changesNo hierarchy as in ‘normal’ transactional No hierarchy as in ‘normal’ transactional replicationreplication
A given set of data can be updated at only one A given set of data can be updated at only one site at a timesite at a time
Data ‘ownership’ is purely logical; doesn’t prevent Data ‘ownership’ is purely logical; doesn’t prevent conflictsconflictsSQL Server prevents a change from round-trippingSQL Server prevents a change from round-tripping
Enables load-balancing and high availabilityEnables load-balancing and high availabilityWarm/hot standby - Small possibility of data Warm/hot standby - Small possibility of data lossloss
Peer-to-Peer Transactional Peer-to-Peer Transactional ReplicationReplication
Warm Standby SolutionsWarm Standby SolutionsLog ShippingLog Shipping
Multiple copies and Manual Multiple copies and Manual failoverfailoverBasic idea: Backup, Copy & Basic idea: Backup, Copy & Restore Log will always be Restore Log will always be supportedsupported
But no more investment in the But no more investment in the scriptsscripts
Database scopeDatabase scopeDatabase accessible but read-Database accessible but read-onlyonlyUsers must exit for next log to Users must exit for next log to be appliedbe appliedData backups no longer block Data backups no longer block log backupslog backups
Log ShippingLog Shipping
Hot Standby Failover SolutionsHot Standby Failover SolutionsFailover Clustering and Database MirroringFailover Clustering and Database Mirroring
Both ProvideBoth ProvideAutomatic detectionAutomatic detectionAutomatic, fast failoverAutomatic, fast failoverManual failoverManual failoverTransparent client Transparent client redirectredirectZero work lossZero work loss Database MirroringDatabase MirroringFailover ClusterFailover Cluster
Zero work loss, Zero work loss, zero impact on zero impact on throughputthroughputInstanceInstance Failover –instance fails as a Failover –instance fails as a unitunitSingleSingle copy of instance databases copy of instance databases Standby is Standby is not available for reportingnot available for reporting, , queries, etc.queries, etc.
May support other instancesMay support other instances
Failover Clustering Failover Clustering Microsoft Server ClusterMicrosoft Server Cluster
Failover ClusterFailover Cluster
* Inst1* Inst1
Failover Clustering Failover Clustering SQL Server 2005SQL Server 2005
More nodesMore nodesMatch operating system limitsMatch operating system limitsSupported scenarios: Multiple Active Supported scenarios: Multiple Active Instances, N+1, N+IInstances, N+1, N+ITwo-node Failover Clustering is available Two-node Failover Clustering is available in SQL Server 2005 Standard Editionin SQL Server 2005 Standard Edition
Unattended setupUnattended setupSupport for mounted volumes (Mount Support for mounted volumes (Mount Points)Points)All SQL Server data services participateAll SQL Server data services participate
Database Engine, SQL Server Agent, Database Engine, SQL Server Agent, Full-Text SearchFull-Text SearchAnalysis Services supports Analysis Services supports multiple multiple instancesinstances
N+1: N Active, 1 Inactive N+1: N Active, 1 Inactive InstancesInstances
* Inst1* Inst1
Inst2 *Inst2 *
Multiple Active InstancesMultiple Active Instances N+I: N Active, I Inactive N+I: N Active, I Inactive InstancesInstances
Database MirroringDatabase MirroringNew for SQL Server 2005New for SQL Server 2005Database MirroringDatabase MirroringNew for SQL Server 2005New for SQL Server 2005
Hot StandbyHot StandbyDatabase FailoverDatabase Failover
Very fast failoverVery fast failoverLess than five seconds in Less than five seconds in mostmost cases cases
Zero data lossZero data loss
Automatic or manual failoverAutomatic or manual failoverAutomatic re-sync after failoverAutomatic re-sync after failover
Automatic, transparent client redirectAutomatic, transparent client redirect
Database MirroringDatabase Mirroring
Database MirroringDatabase Mirroring
Fault Tolerant Virtual DatabaseFault Tolerant Virtual Database
PrincipalPrincipal
ClientsClients
WitnessWitness
MirrorMirror
Witness and QuorumWitness and Quorum
SoleSole purpose of the Witness is purpose of the Witness is to provide to provide automaticautomatic failover failoverTo survive the loss of To survive the loss of oneone server you must server you must have at least have at least threethreeWitness is an instance of SQL Server 2005Witness is an instance of SQL Server 2005
Perhaps even SQL Server Express on WinXP Perhaps even SQL Server Express on WinXP
Consumes very little resourcesConsumes very little resourcesCan be witness for multiple sessionsCan be witness for multiple sessions
WitnessWitness
Database Mirroring Database Mirroring How it worksHow it works
MirrorMirrorPrincipalPrincipal
WitnessWitness
Log
Application
SQL Server SQL Server
2
2
4
51
Data DataLog
3>2 >3
Mirror is always Mirror is always redoing – redoing – it remains currentit remains currentCommit
Safety / PerformanceSafety / PerformanceThere is a trade-off between There is a trade-off between performance and safetyperformance and safetyDatabase Mirroring has two safety Database Mirroring has two safety levelslevels
FULL – commit when logged on MirrorFULL – commit when logged on MirrorAllows automatic failoverAllows automatic failoverNo data lossNo data loss
OFF – commit when logged on PrincipalOFF – commit when logged on PrincipalSystem does its best to keep upSystem does its best to keep upPrevents failover; to make mirror availablePrevents failover; to make mirror available
Must ‘force’ serviceMust ‘force’ serviceOr terminate Database Mirroring sessionOr terminate Database Mirroring session
Database MirroringDatabase MirroringHigh Availability ModeHigh Availability Mode
PrincipalPrincipal
ClientsClients
WitnessWitness
MirrorMirror
XX
High Protection ModeHigh Protection ModeHigh Performance ModeHigh Performance Mode
Transparent Client RedirectTransparent Client Redirect
No changes to application codeNo changes to application codeClient automatically redirected if Client automatically redirected if session is droppedsession is dropped
Client library is aware of Principal and Client library is aware of Principal and Mirror serversMirror serversUpon initial connect to Principal, library Upon initial connect to Principal, library caches Mirror namecaches Mirror nameWhen client attempts to reconnectWhen client attempts to reconnect
If Principal is available, connectsIf Principal is available, connectsIf not, client library automatically redirects If not, client library automatically redirects connection to Mirrorconnection to Mirror
Database MirroringDatabase Mirroring
Impact to transaction Impact to transaction throughputthroughput
Depending on environment Depending on environment Depending on workloadDepending on workloadZero to minimalZero to minimal
HardwareHardwareWorks with standard Works with standard computers, storage, computers, storage, and networksand networksNo shared storage components, virtually No shared storage components, virtually no distance limitationsno distance limitationsMy Tips: 1GB Network, Disk for the My Tips: 1GB Network, Disk for the LogLog
Database MirroringDatabase Mirroring
Geographically-Dispersed Geographically-Dispersed Clusters and Clusters and Storage-level ReplicationStorage-level Replication
Solutions from many Microsoft partners Solutions from many Microsoft partners replicate the local I/Os on a remote systemreplicate the local I/Os on a remote system
Hardware and software methodsHardware and software methodsSynchronous and asynchronous solutionsSynchronous and asynchronous solutions
Solutions Solutions mustmust meet Core I/O Requirements meet Core I/O RequirementsMany solutions use MSCS to provide Many solutions use MSCS to provide automatic failoverautomatic failoverOther solutions are primarily to duplicate Other solutions are primarily to duplicate the data at a remote site, often with an the data at a remote site, often with an independent SQL Serverindependent SQL Server
Similar to Log Shipping or Detach / AttachSimilar to Log Shipping or Detach / Attach
Geographical Geographical Failover ClusterFailover Cluster
Complementary Complementary TechnologiesTechnologiesTechnologies can be CombinedTechnologies can be Combined
Maximize availability forMaximize availability forScale outScale out
Offload primary data platformOffload primary data platform
Heavy reportingHeavy reportingMobile/disconnected usersMobile/disconnected usersAutonomous business units that share Autonomous business units that share datadata
Maximize availability of critical Maximize availability of critical systemssystems
Designed for failoverDesigned for failoverFast, automaticFast, automatic
Zero data lossZero data lossTransactionally currentTransactionally currentMasks planned and unplanned Masks planned and unplanned downtimedowntime
ReplicationReplication
Failover SolutionsFailover Solutions
ExampleExampleFault-Tolerant Publisher and Fault-Tolerant Publisher and
Distributor Distributor SubscribersSubscribers
Complementary TechnologiesComplementary TechnologiesFailover Solution + ReplicationFailover Solution + Replication
DistributorDistributor
PublisherPublisher
Combining HA Combining HA TechnologiesTechnologies
Principal Server can be a Failover ClusterPrincipal Server can be a Failover ClusterFailover to mirror will occur before failover Failover to mirror will occur before failover within the clusterwithin the cluster
So Principal will come back up as the MirrorSo Principal will come back up as the Mirror
Mirror can be a Failover Cluster as wellMirror can be a Failover Cluster as well
PrincipalPrincipal MirrorMirror
Failover ClusterFailover Cluster Failover ClusterFailover Cluster
Barriers To AvailabilityBarriers To AvailabilityAs addressed in SQL Server 2005As addressed in SQL Server 2005
Database Server Failure or DisasterDatabase Server Failure or Disaster----------------------------------------------------------------------------------------------------------------
--------Application or User ErrorApplication or User Error
Database SnapshotsDatabase Snapshots
Data Access Concurrency LimitationsData Access Concurrency LimitationsDatabase Maintenance and Database Maintenance and OperationsOperationsUpgradesUpgrades
Barriers to AvailabilityBarriers to Availability
This job would be great
if it weren’t for……the users…the staff
…us
PeopleI’m going I’m going to modify to modify this data…this data…
right…right…
herhere!e!
Database SnapshotDatabase SnapshotNew in SQL Server 2005New in SQL Server 2005
Database Snapshots allow recovery Database Snapshots allow recovery from user errors by allowing the from user errors by allowing the database to go back in timedatabase to go back in timeWorks withWorks with
Single serverSingle serverDatabase MirroringDatabase MirroringFailover ClusterFailover Cluster
Does Does notnot work with Log Shipping work with Log Shipping secondarysecondary
Database Snapshot Database Snapshot How it really worksHow it really works
mydbSnap – Read-Only Database SnapshotmydbSnap – Read-Only Database SnapshotUSE mydbSnapUSE mydbSnapSELECT SELECT (pages 4, 6, 9, 10, 14)(pages 4, 6, 9, 10, 14)
11
PagePage
22 33 44 55 66 77 88 99 1010 1111 1212 1313 1414 1515 1616
CREATE DATABASE mydbSnap AS SNAPSHOT OF mydbCREATE DATABASE mydbSnap AS SNAPSHOT OF mydb
mydb – Databasemydb – Database
USE mydbUSE mydbUPDATEUPDATE (pages 4, 9, 10) (pages 4, 9, 10)
44 99 101011 22 33 44 55 66 77 88 99 1010 1111 1212 1313 1414 1515 1616
Database SnapshotDatabase SnapshotTechnologyTechnology
Extremely space efficientExtremely space efficientDoes Does notnot require a complete copy of require a complete copy of the datathe data
Shares unchanged pages of the databaseShares unchanged pages of the databaseRequires extra storage only for Requires extra storage only for changed pageschanged pages
Uses a “copy-on-write” mechanismUses a “copy-on-write” mechanismDatabase Snapshot may affect Database Snapshot may affect performance on the base databaseperformance on the base database
Reporting on a MirrorReporting on a MirrorUse Database Snapshots on MirrorUse Database Snapshots on Mirror
MirrorMirror
PrincipalPrincipal
Reporting Reporting ClientsClients
Database MirroringDatabase Mirroring
OLTP ClientsOLTP Clients
Snapshot1Snapshot1at 1PMat 1PM
WitnessWitness
Snapshot2Snapshot2at 2PMat 2PM
Barriers To AvailabilityBarriers To AvailabilityAs addressed in SQL Server 2005As addressed in SQL Server 2005
Database Server Failure or DisasterDatabase Server Failure or DisasterApplication or User ErrorApplication or User ErrorData Access Concurrency LimitationsData Access Concurrency Limitations
Snapshot IsolationSnapshot IsolationOnline Index OperationsOnline Index Operations
Database Maintenance and Database Maintenance and OperationsOperationsUpgradesUpgrades
Online Index OperationsOnline Index Operations
Online Index Operations allow concurrent Online Index Operations allow concurrent modification of the underlying table or modification of the underlying table or indexindex
Updates, Inserts, DeletesUpdates, Inserts, Deletes
Online Index MaintenanceOnline Index MaintenanceCreate, Rebuild, DropCreate, Rebuild, DropIndex-based constraints (PrimaryKey, Unique)Index-based constraints (PrimaryKey, Unique)
Data definition language (DDL) is simpleData definition language (DDL) is simpleOnline/Offline are both supported Online/Offline are both supported Updates incur some additional cost during Updates incur some additional cost during an online index operationan online index operation
Maintains old and new indexesMaintains old and new indexes
Barriers To AvailabilityBarriers To AvailabilityAs addressed in SQL Server 2005As addressed in SQL Server 2005
Database Server Failure or DisasterDatabase Server Failure or DisasterApplication or User ErrorApplication or User ErrorData Access Concurrency LimitationsData Access Concurrency LimitationsDatabase Maintenance and Database Maintenance and OperationsOperationsUpgradesUpgrades
Fast RecoveryFast RecoveryRestart of a DatabaseRestart of a Database
SQL Server 2000SQL Server 2000Database is available after Undo Database is available after Undo completescompletes
SQL Server 2005SQL Server 2005Database is available when Undo Database is available when Undo beginsbegins
UndoUndoRedoRedo
AvailableAvailable
UndoUndoRedoRedo
AvailableAvailable
TimeTime
Database Maintenance & Database Maintenance & OperationsOperations
Partial AvailabilityPartial AvailabilityDatabase is available if primary filegroup Database is available if primary filegroup is availableis available
Online RestoreOnline RestoreRestore while database remains availableRestore while database remains availableWorks with all recovery modelsWorks with all recovery models
Backup and RestoreBackup and RestoreData backups don’t block log backupsData backups don’t block log backupsFull-Text Catalog is backed up and Full-Text Catalog is backed up and restored as part of the databaserestored as part of the database
More Operational More Operational Improvements… Improvements…
Dedicated Administration ConnectionDedicated Administration ConnectionProvides DBA access to server regardless of loadProvides DBA access to server regardless of loadNo server restart to kill a runaway sessionNo server restart to kill a runaway session
More configuration is dynamicMore configuration is dynamicNo server restart for CPU affinity, AWENo server restart for CPU affinity, AWEAddress Windowing Extensions (AWE)Address Windowing Extensions (AWE)
Changes to physical size don’t requireChanges to physical size don’t require downtime downtimeDynamically configurable (Min / Max)Dynamically configurable (Min / Max)Dynamically adjusts to “hot-add” memoryDynamically adjusts to “hot-add” memory
AWE is available in Standard Edition (Win2003)AWE is available in Standard Edition (Win2003)
Instant file initializationInstant file initializationWith appropriate security, can bypass zeroingWith appropriate security, can bypass zeroingFor create database, add file, file grow, restoreFor create database, add file, file grow, restore
Barriers To AvailabilityBarriers To AvailabilityAs addressed in SQL Server 2005As addressed in SQL Server 2005
Database Server Failure or DisasterDatabase Server Failure or DisasterApplication or User ErrorApplication or User ErrorData Access Concurrency LimitationsData Access Concurrency LimitationsDatabase Maintenance and Database Maintenance and OperationsOperationsUpgradesUpgrades
Upgrade EnhancementsUpgrade EnhancementsSoftware UpgradeSoftware Upgrade
Re-architected – Re-architected – greatly reduces down timegreatly reduces down timeSide-by-side installationSide-by-side installationResource database is pre-builtResource database is pre-built
No maintenance is needed; new is substituted for old No maintenance is needed; new is substituted for old oneoneDBA can ignore the mssqlsystemresource.mdf and ldfDBA can ignore the mssqlsystemresource.mdf and ldf
PhasedPhasedEngine and Databases (< 3 minutes)Engine and Databases (< 3 minutes)Other components complete upgrade online after Other components complete upgrade online after databases are available (Replication, Workbench, etc.)databases are available (Replication, Workbench, etc.)
Hardware UpgradeHardware UpgradeHot-add memoryHot-add memory supported without server restart supported without server restartDatabase Mirroring minimizes downtimes for Database Mirroring minimizes downtimes for other hardware upgrades, excluding diskother hardware upgrades, excluding disk
SQL Server 2005SQL Server 2005Capabilities by EditionCapabilities by Edition
EnterprisEnterprisee
StandardStandard Workgroup, Workgroup, ExpressExpress
Failover ClusteringFailover Clustering YesYes 2-node2-node NoNoDatabase MirroringDatabase Mirroring YesYes Safety Safety
FullFullWitness Witness onlyonly
Database SnapshotsDatabase Snapshots YesYes NoNo NoNoSnapshot IsolationSnapshot Isolation YesYes YesYes YesYesOnline Index Online Index OperationsOperations
YesYes NoNo NoNo
Fast RecoveryFast Recovery YesYes NoNo NoNoDedicated Admin Dedicated Admin Conn.Conn.
YesYes YesYes No on ExpNo on Exp
Table PartitioningTable Partitioning YesYes NoNo NoNoLog ShippingLog Shipping YesYes YesYes No on ExpNo on ExpPeer-to-Peer Peer-to-Peer ReplicationReplication
YesYes NoNo NoNo
New York! New York!New York! New York!איך ממלאים משוב?איך ממלאים משוב?
בסוף כל יום בסוף כל יום emailemailב - ב - Beat CenterBeat Centerב -ב -
מה מקבלים?מה מקבלים?Feel The BeatFeel The Beatחולצת חולצת
השתתפות בהגרלת כרטיסי טיסההשתתפות בהגרלת כרטיסי טיסה)לממלאים משוב לכל יום()לממלאים משוב לכל יום( ועוד... ועוד...i-matei-mateמכשירי מכשירי
The Prime Grill - SteakhouseThe Prime Grill - Steakhouse
Assaf Fraenkel
60 east 49th st. New York, NY
2126929292
הכשריםהסטייקים בניו- יורק הטובים
ועוד במנהטן!!
HAHAהרצאות מומלצות בנושא הרצאות מומלצות בנושא
Isolaion LevelIsolaion Level עמי לוין בנושא עמי לוין בנושא 11:3011:30היום ב היום ב replicationreplication מאיר דודאי בנושא מאיר דודאי בנושא 8:308:30מחר ב מחר ב
Summary – What is Summary – What is Availability?Availability?