2 Achieving High Availability with SQL Server using EMC SRDF Prem Mehra – SQL Server Development, MicrosoftArt Ullman - CSC
3 Topics CoveredShare experiences gained on deploying SQL Server and SAN for a Highly Available Data Warehouse. Emphasis onIntersection of SAN and SQL Server TechnologiesNot on Large Data Base Implementation or on Data Warehouse Best PracticesProject OverviewBest Practices in a SAN environmentRemote Site Fail-over using EMC SRDF and SQL Server Log Shipping
4 USDA GDW Project Overview Build Geo-spatial Data Warehouse for two sites with remote fail-overClientUSDAStorageEMC SAN (46 terabytes)DatabaseSQL Server 2000ImplementationUSDA / CSCConsultantsEMC / CSC / Microsoft / ESRIGeo-spatial SoftwareESRI Data Management Software
5 Application Requirements A large (46 TB total storage) geo-spatial data warehouse for 2 USDA sites: Salt Lake City & Fort WorthProvide database fail-over and fail-back between remote sitesRun data replication across DS3 network between sites (45Mb/sec)Support read- only access at fail-over sites on ongoing basis
6 SAN Implementation 1Understand your throughput, response time and availability requirements and potential bottlenecks and issuesWork with your storage vendorGet Best PracticesGet design advice on LUN size, sector alignment, etcUnderstand the available backend monitoring toolsDo not try to over optimize, keep LUN, filegroup, file design simple, if possible
7 SAN Implementation 2Balance I/O across all HBAs when possible using balancing software (e.g., EMC’s PowerPath)Provides redundant data pathsOffers the most flexibility and much easier to design when compared to static mappingSome vendors are now offering implementations which use Microsoft’s MPIO (multi-path IO). Permits more flexibility in heterogeneous storage environments.Managing growthSome configurations offer dynamic growth of existing LUNs for added flexibility (e.g., Veritas Volume Manger or SAN Vendor Utilities)Working with SAN vendor engineers is highly recommended
8 SAN Implementation 3 Benchmarking the I/O System Before implementing SQL Server, benchmark the SAN. Shake out hardware/driver problemsTest a variety of I/O types and sizes. Combinations - read/write & sequential/random Include I/O of at least 8K, 64K, 128K, and 256K.Ensure test files are significantly larger than SAN Cache – At least 2 to 4 timesTest each I/O path individually & in combination to cover all paths Ideally - linear scale up of throughput (MB/s) as paths are addedSave the benchmark data for comparison when SQL is being deployed
9 SAN Implementation 4 Benchmarking the I/O System Share results with vendor: Is performance reasonable for the configuration?SQLIO.exe is an internal Microsoft toolOn-going discussions to post it as an unsupported tool at
10 SAN Implementation 5Among other factors, parallelism also influenced byNumber of CPUs on the hostNumber of LUNsFor optimizing Create Database and Backup/Restore performance, considerMore or as many volumes as the number of CPUs.Could be volumes created by dividing a dynamic disk or separate LUNsDatabase and TempDB FilesInternal file structures require synchronization, consider the # of processors on the serverNumber of data files should be >= the number of processors
11 Remote Site Fail-over with SQL Server and EMC SRDF USDA Geo-spatial Database
12 Data Requirements23 terabytes of EMC SAN storage per site (46 TB total storage)2 primary SQL Servers and 2 fail-over servers per site15 TB of image data in SQL Server at Salt Lake City site with fail-over to Fort Worth3 TB of vector data in SQL server at Fort Worth site with fail-over to Salt Lake City80 GB of daily updates that need to be processed and pushed to fail-over site
13 Solution Combination of SRDF and SQL Server Log Shipping Initial Synchronization using SRDFPush updates using SQL Server Log ShippingUse SRDF incremental update to fail-back after a fail-overUse SRDF to move log backups to remote site
14 Hardware Infrastructure Site Configuration (identical at each site)
15 Technical Overview – EMC Devices EMC SAN is partitioned into Hyper- Volumes and Meta-Volumes (collections of Hyper-Volumes) through BIN File configurationAll drives are either mirrored or Raid 7+1Hypers and or Metas are masked to hosts and are viewable as LUNs to the OSEMC Devices are identified by Sym IdEMC Devices are defined as R1, R2, Local or BCV devices in the Bin File
16 Technical Overview – Device Mapping Windows Device Manager and SYMPD LIST Output
17 Technical Overview – SRDF 1 SRDF provides track to track data mirroring between remote EMC SAN devices. BCVs are for local copies.Track to track replication (independent of host)R1 Device is sourceR2 Device is targetR2 is read/write disabled until the mirror is split
18 Technical Overview – SRDF 2 Synchronous ModeSemi-Synchronous Synchronous with some lagAdaptive Copy Mode – AsynchronousAdaptive Copy A – Asynchronous with guaranteed write sequence using buffered track copiesNote: only Adaptive Copy A requires additional storage space. All other SRDF replications simply keep a table of tracks that have changed.
19 Technical Overview – SRDF 3 SRDF replicates by Sym Device (Hyper or Meta).SRDF Devices can be “Grouped” for synchronizing.SQL Server databases are replicated “by database” or “by groupings of databases” if TSIMSNAP2 is used.Primary HostFail-over HostR1 Group ADatabase 1R1R2R1 Group BDatabase 2R1R2
20 Process OverviewInitial Synchronization using SRDF in Adaptive Copy Mode (all database files).Use TSIMSNAP(2) to split SRDF group after synchronization is complete.Restore fail-over databases using TSIMSNAP(2) after splitting SRDF mirror.Use SQL Server Log shipping to push all updates to fail-over server (after initial sync).Fail-over database is up and running at all times, giving you confidence that the fail-over server is working.
21 PlanningInstall SQL Server and system databases on Primary and Fail-over Servers (on Local non-replicated devices)Create user databases on R1 devices (MDF, NDF and LDF) on Primary HostDon’t share devices among databases, if you need to keep databases independent for fail-over and fail-back. (Important)Database volumes can be drive letters or mount points
22 Initial StepCreate Databases on R1 DevicesLoad Data
23 Synchronize to Fail-over host 1 Create SRDF Group for Database on R1Set Group to Adaptive Copy ModeEstablish SRDF Mirror to R2
24 Synchronize to Fail-over host 2 Wait until Adaptive Copy is “synchronized”Use TSIMSNAP command to split SRDF group after device synchronization is complete.Use TSIMSNAP2 for multiple databases.TSIMSNAP writes Meta Data about databases to R1, which is used for recovering databases on R2 host.Break MirrorWrite Meta Data
25 Attach Database on Fail-over Host Verify SQL Server is installed and running on Fail-over host.Mount R2 volumes on remote host.Run TSIMSNAP RESTORE command on Fail-over host. Specify either standby (read-only) or norecovery mode.Database is now available for log shipping on fail-over.SRDF Mirror is now broken, but the track changes are still tracked (for incremental mirror and/or for fail-back).
26 Log Shipping – at Primary Site Log Shipping volume on separate R1 device (not the same as the database R1)Log Backup Maintenance Plan to backup logs to log shipping volume, which is an R1 deviceSet R1 to Adaptive Copy ModeEstablish R1/R2 Mirror. Logs automatically get copied to R2.
27 Log Shipping – at Fail-over Site BCV (mirror) of R2Schedule a script that splits and mounts BCV, then restores logs to SQL Server database(s)Flush, un-mount and re-establish BCV mirror after logs have been restored
28 Process Overview Summary Initial Synchronization using SRDF in Adaptive Copy Mode.Use TSIMSNAP(2) to split SRDF group after synchronization is complete.Use SQL Server Log shipping to push updates to fail-over server.Fail-over database is up and running at all times, giving you confidence that the fail-over server is working.
29 Fail-over Process Fail-over Type Required Action Read-only Full Update No Server Action. Clients would need to point to fail-over server.Full UpdateSQL Command:Restore Database DBName with Recovery
30 Fail-back Process From Required Action Read-only Fail-over None Required. Point Clients to Primary.Full Update Fail-overRun SYMRDF Update command to copy from R2 to R1 in Adaptive Copy Mode.Detach database on R2 after Update Complete.Flush and un-mount volumes on R2Run SYMRDF FAILBACK to replicate final changes back to R1 and write enable R1Mount R1 volumesAttach Database on Primary Host
31 Closing ObservationsSo far SQL Server 2000 has met High Availability objectivesNetwork traffic across the WAN was minimized, (by shipping only SQL Server Log Copies, once the initial synchronization was completed.)The dual Nishan fiber-to-IP switches allowed for data transfer at about 16 GB / hour, taking full advantage of the DS3. This transfer rate easily met USDA’s needs for initial synchronization, daily log shipping, and the fail-back process.The working read-only version of the fail-over database meant that the administrators always knew the status of their fail-over system.The USDA implementation did not require a large number of BCV volumes - as some other replication schemes require.
32 Closing ObservationsAfter the R1/R2 mirror has been split, SRDF continues to track updates to R1 (from normal processing) and R2 (from log restore process). SRDF is then able to ship only the modified tracks during fail-back or re-synchronization. This process is called an Incremental Establish, or an Incremental Fail-back and is much more efficient than a Full Establish or Full Fail-back.After fail-back, the R1 and R2 devices will be “in-sync”, and ready for log shipping startup with a minimal amount of effort.Since SRDF (initial synchronization, fail-back, and log shipping) all run in adaptive copy mode, the performance on the primary server is not impacted.
33 Software SQL Server 2000 Enterprise Edition Windows 2000 / Windows 2003 ServerEMC SYM Command Line InterfaceEMC Resource Pack
34 Call To Action For more information, please email Understand your HA requirementsWork with your SAN Vendor to architect and design for SQL Server deploymentPlan your device & database allocation before requesting a BIN FileDecide if sharing devices for databases (use TSIMSNAP or TSIMSNAP2). Decision effects convenience, space & flexibility of operationsStress test subsystem prior to deploying SQL ServerFor more information, pleaseYou can download all presentations at