Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database Mirroring in the Real World Craig Purnell.

Similar presentations


Presentation on theme: "Database Mirroring in the Real World Craig Purnell."— Presentation transcript:

1 Database Mirroring in the Real World Craig Purnell

2 About Me Database Administrator with Baker Hostetler Database Administrator with Baker Hostetler Experience with SQL Server 7/2000 and up Experience with SQL Server 7/2000 and up Previously consulted in the transportation industry, programming custom UNIX ERP solutions Previously consulted in the transportation industry, programming custom UNIX ERP solutions MCSE / MCSA / MCITP (DBA) etc. MCSE / MCSA / MCITP (DBA) etc.

3 Overview Mirroring is a high availability technologyMirroring is a high availability technology Continuous stream of log records are sent to the mirror and “replayed”Continuous stream of log records are sent to the mirror and “replayed” Mirror is unavailable for client connectionsMirror is unavailable for client connections Protects a single database at a timeProtects a single database at a time

4 Mirroring Demystified Synchronous with WitnessSynchronous with Witness –No data loss –Auto detection of Failure / Failover Synchronous without WitnessSynchronous without Witness –No data loss –Possibility of downtime AsynchronousAsynchronous –Manual failover –Possibility of data loss.

5 Asynchronous Mirroring

6 Synchronous Mirroring

7 Synchronous Mirroring with Witness Microsoft’s SAP systemMicrosoft’s SAP system Primary Data Center Log Shipping Disaster Recovery Data Center PrincipalMirror Witness Synchronous Database Mirroring Log Shipping Secondary

8 Mirroring with Certificates Different domains without a trust (mergers, acquisitions, DMZ)Different domains without a trust (mergers, acquisitions, DMZ) Internet (partners, affiliates)Internet (partners, affiliates)

9 Mirroring at Baker Hostetler 11 Offices; All SQL is centralized11 Offices; All SQL is centralized Early adopter of the technologyEarly adopter of the technology Was mirroring from Cleveland to DenverWas mirroring from Cleveland to Denver Currently in a state of transition….Currently in a state of transition…. Future: Eagan, MN to ClevelandFuture: Eagan, MN to Cleveland

10 Mirroring at Baker Hostetler

11 Endpoints (1) Required by mirroringRequired by mirroring SQL Server Object that maps in TCP socketSQL Server Object that maps in TCP socket AuthenticationAuthentication Encryption (RC-4 etc)Encryption (RC-4 etc) See BOL for optionsSee BOL for options

12 Limitations (32bit) Best Practice: 10 mirrored databases per server.Best Practice: 10 mirrored databases per server. Effects of mirroring on the target: SQL runs out of VAS (32 bit)Effects of mirroring on the target: SQL runs out of VAS (32 bit) Band-aid: -g512 (increase memtoleave)Band-aid: -g512 (increase memtoleave)

13 Mirror Configuration Identical Hardware not requiredIdentical Hardware not required Memory / Disk requirementsMemory / Disk requirements Drive Letter layoutsDrive Letter layouts File growths/shrinksFile growths/shrinks

14 Demo #1 (T-SQL) Megadata from I1 to I2 Demo #1 (T-SQL) Megadata from I1 to I2

15 WAN acceleration (1) Riverbed Steelhead (hardware based)Riverbed Steelhead (hardware based) Turn off encryption and compressionTurn off encryption and compression SQL 2008 Effects (native compression)SQL 2008 Effects (native compression) Trace Flag -T1462Trace Flag -T1462

16 WAN Acceleration (2) Index Rebuilds : 70-75% compression

17 MPLS Network QOS

18 Mirroring Timeouts

19 Test: 2 servers / 10Mbps crossover, dedicated endpoints

20 Demo #2 (GUI) Adventureworks from I1 to I2 Demo #2 (GUI) Adventureworks from I1 to I2

21 Mirror on a Dedicated IP Assign IP to 2 nd NICAssign IP to 2 nd NIC Create Endpoint to listen only on that IPCreate Endpoint to listen only on that IP Repeat for mirrorRepeat for mirror Have Network ops team configure routingHave Network ops team configure routing

22 Mirroring and Licensing (1) Witness can be SQL ExpressWitness can be SQL Express Mirror server can be unlicensed – as long as you do not have anything running queries against the instance.Mirror server can be unlicensed – as long as you do not have anything running queries against the instance. No snapshots allowed.No snapshots allowed. See SQL Licensing White paper for more detailsSee SQL Licensing White paper for more details

23 Mirroring and Licensing (2) Must use Standard or EnterpriseMust use Standard or Enterprise Synchronous vs. Asynchronous mirroringSynchronous vs. Asynchronous mirroring Can’t mix versions.Can’t mix versions.

24 Demo #3 (T-SQL) Rolling Upgrade of Northwind and Pubs Demo #3 (T-SQL) Rolling Upgrade of Northwind and Pubs

25 Mirroring: Lessons Learned Not a substitute for T-Log backupsNot a substitute for T-Log backups Network latency definitely is a factorNetwork latency definitely is a factor Timeouts due to “design flaw” in Riverbed dual WAN configurationTimeouts due to “design flaw” in Riverbed dual WAN configuration Log Buildup on PrimaryLog Buildup on Primary QOS network rulesQOS network rules Great way to shovel data from A to BGreat way to shovel data from A to B

26 Index Rebuilds Carefully Schedule production instancesCarefully Schedule production instances Selective rebuild script really helps.Selective rebuild script really helps. Your mileage may vary.Your mileage may vary.

27 Monitoring Mirroring (1) System Monitor CountersSystem Monitor Counters T-SQLT-SQL Mirroring Monitor GUIMirroring Monitor GUI DMVs: sys.dm_db_mirroring_connectionsDMVs: sys.dm_db_mirroring_connections sys.database_mirroring sys.database_mirroring sys.database_mirroring_witnesses sys.database_mirroring_witnesses sys.database_mirroring_endpoints sys.database_mirroring_endpoints sys.tcp_endpoints sys.tcp_endpoints sys.server_principals sys.server_principals sys.database_recovery_status sys.database_recovery_status

28 Demo #4 Index Rebuilds and Monitoring Demo #4 Index Rebuilds and Monitoring

29 SQL Agent Alerting Configure SQL Agent to alert you of mirroring problemsConfigure SQL Agent to alert you of mirroring problems See Technical Article: Alerting on Mirroring Events (escape macros are wrong).See Technical Article: Alerting on Mirroring Events (escape macros are wrong).

30 Error messages: T-SQL vs. GUI Msg 1418, Level 16, State 1, Line 1 The server network address "TCP://MYMIRROREDSERVER.domainname.com:5022" can not be reached or does not exist. Check the network address name and that the ports for the local and remote endpoints are operational. Same error condition (mixing SQL versions)

31 Troubleshooting netstat –anonetstat –ano tcping hostname 5022tcping hostname 5022 Verify endpoints are using the same encryption, authenticationVerify endpoints are using the same encryption, authentication Are you running SQL as LocalSystem?Are you running SQL as LocalSystem? Use the GUI to configure the endpoints for youUse the GUI to configure the endpoints for you Try and recreate the problem with the GUITry and recreate the problem with the GUI

32 Troubleshooting Verify the service accounts are LoginsVerify the service accounts are Logins Verify both service accounts has CONNECT rights on the endpoint(s)Verify both service accounts has CONNECT rights on the endpoint(s) You must make a Backup and a T-Log backup AFTER the DB is in full recovery mode (watch for extraneous Tlog backups)You must make a Backup and a T-Log backup AFTER the DB is in full recovery mode (watch for extraneous Tlog backups) Look in the Error logLook in the Error log Windows Firewall must be configuredWindows Firewall must be configured IPV6!IPV6!

33 Other Issues Logins are NOT transferredLogins are NOT transferred Use sp_help_revlogin to get an exact sid / SQL login listUse sp_help_revlogin to get an exact sid / SQL login list SQL Agent Jobs are not transferredSQL Agent Jobs are not transferred Extended Stored ProceduresExtended Stored Procedures Linked serversLinked servers

34 Key Takeaways Database Mirroring can eliminate the single point of failure of clustering (aka the shared disk problem)Database Mirroring can eliminate the single point of failure of clustering (aka the shared disk problem) Database Mirroring, coupled with clustering can raise your business database uptime an order of magnitude.Database Mirroring, coupled with clustering can raise your business database uptime an order of magnitude. This technology can be implemented without the need of expensive SAN…just a little creativity on YOUR partThis technology can be implemented without the need of expensive SAN…just a little creativity on YOUR part

35 Any Questions?

36 Contact Information or

37 References (1) Tcping SQL Server Licensing White PaperSQL Server Licensing White Paper df9c5c2/SQLServer2005Licensingv1.1.dochttp://download.microsoft.com/download/e/c/a/ecafe5d1-b514-48ab-93eb df9c5c2/SQLServer2005Licensingv1.1.dochttp://download.microsoft.com/download/e/c/a/ecafe5d1-b514-48ab-93eb df9c5c2/SQLServer2005Licensingv1.1.dochttp://download.microsoft.com/download/e/c/a/ecafe5d1-b514-48ab-93eb df9c5c2/SQLServer2005Licensingv1.1.doc Asynchronous Database Mirroring with Log Compression in SQL Server with-log-compression-in-sql-server-2008.aspxAsynchronous Database Mirroring with Log Compression in SQL Server with-log-compression-in-sql-server-2008.aspx with-log-compression-in-sql-server-2008.aspx with-log-compression-in-sql-server-2008.aspx Database Mirroring White Paper 29f31282b04d/DatabaseMirroring.docDatabase Mirroring White Paper 29f31282b04d/DatabaseMirroring.doc 29f31282b04d/DatabaseMirroring.doc 29f31282b04d/DatabaseMirroring.doc Database Mirroring: Best Practices and Performance Considerations 29f31282b04d/DBM_Best_Pract.docDatabase Mirroring: Best Practices and Performance Considerations 29f31282b04d/DBM_Best_Pract.doc 29f31282b04d/DBM_Best_Pract.doc 29f31282b04d/DBM_Best_Pract.doc Mirroring with Certificates: with Certificates: Transferring Logins and Passwords between instances: Logins and Passwords between instances:

38 References (2) Alerting on Database Mirroring Events on Database Mirroring Events How to: Minimize Downtime for Mirrored Databases When Upgrading Server Instances us/library/bb aspxHow to: Minimize Downtime for Mirrored Databases When Upgrading Server Instances us/library/bb aspxhttp://msdn.microsoft.com/en- us/library/bb aspxhttp://msdn.microsoft.com/en- us/library/bb aspx Asynchronous Database Mirroring with Log Compression in SQL Server s-database-mirroring-with-log-compression-in-sql-server-2008.aspxAsynchronous Database Mirroring with Log Compression in SQL Server s-database-mirroring-with-log-compression-in-sql-server-2008.aspx s-database-mirroring-with-log-compression-in-sql-server-2008.aspx s-database-mirroring-with-log-compression-in-sql-server-2008.aspx High Availability and Disaster Recovery for Microsoft’s SAP Data Tier: A SQL Server 2008 Technical Case Study 40fa-a026-5bfcf076d9b9/MSIT_SAP_Data_Tier_HA_DR.docxHigh Availability and Disaster Recovery for Microsoft’s SAP Data Tier: A SQL Server 2008 Technical Case Study 40fa-a026-5bfcf076d9b9/MSIT_SAP_Data_Tier_HA_DR.docx 40fa-a026-5bfcf076d9b9/MSIT_SAP_Data_Tier_HA_DR.docx 40fa-a026-5bfcf076d9b9/MSIT_SAP_Data_Tier_HA_DR.docx

39 Resources SHunra VE Desktop – simulates latencySHunra VE Desktop – simulates latency To simulate satellite latency in my test environment, I used a product from called VE Desktop. It is a simple to use application providing programmatic tweaks to the network adapter.To simulate satellite latency in my test environment, I used a product from called VE Desktop. It is a simple to use application providing programmatic tweaks to the network adapter.

40 Review of H.A. technology

41 Monitoring Mirroring (3) @interval WHERE: – the mirrored - 0 = last row, 1 last two hours, 2 last four, 3 last eight, 4 last day, 5 last two days, 6 last 100, 7 last 500, 8 last 1000, 9 ALL

42 Mirroring Options ModeAlternate name Requires a witness? Supports automatic failover? Supports manual failover? Waits for mirror to write log block before client transaction is committed? High Availability Synchronous (with Witness) Yes Yes – if mirror not connected then no delay High Protection SynchronousNo Yes High Performance AsynchronousNo No, must be changed to Synchronous No

43 Network Overview

44 VLDB Considerations Multiple Log Restores (not in LSN window)Multiple Log Restores (not in LSN window) FEDEXnet (portable hard drive)FEDEXnet (portable hard drive) Data safeguarding implicationsData safeguarding implications

45 Timeouts OKB Sent -> SQL Refuses to transmitOKB Sent -> SQL Refuses to transmit Infinite to Send -> Can’t see mirror – why?Infinite to Send -> Can’t see mirror – why? Ping –l hostname (good)Ping –l hostname (good) (better)(better) Work closely with Network WAN teamWork closely with Network WAN team

46 Common Errors Msg 1412, Level 16, State 0, Line 1The remote copy of database “Adventureworks" has not been rolled forward to a point in time that is encompassed in the local copy of the database log.Msg 1412, Level 16, State 0, Line 1The remote copy of database “Adventureworks" has not been rolled forward to a point in time that is encompassed in the local copy of the database log. Msg 1408, Level 16, State 0, Line 1Msg 1408, Level 16, State 0, Line 1 The remote copy of database "Northwind" is not recovered far enough to enable database mirroring.The remote copy of database "Northwind" is not recovered far enough to enable database mirroring. Error 1416: DB is in standby or recovered mode. The last transaction log must be restored with NORECOVERY option.Error 1416: DB is in standby or recovered mode. The last transaction log must be restored with NORECOVERY option. Errors 1418 and 1486 – these are communications related errors.Errors 1418 and 1486 – these are communications related errors.

47 WAN Traffic Report

48 Mirroring Demystified Operating Mode Transactio n safety Transfer mechanis m Quorum required Witness server Failover Type High AvailabilityFULLSynchronousYYAutomatic or Manual High ProtectionFULLSynchronousYNManual Only High Performance OFFAsynchronousNN/AForced Only


Download ppt "Database Mirroring in the Real World Craig Purnell."

Similar presentations


Ads by Google