Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Sql server troubleshooting

2,425 views

Published on

Stacy Hein

Published in: Technology
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m77EgH } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m77EgH } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Sql server troubleshooting

  1. 1. SQL Server Troubleshooting and Performance Monitoring<br />And throw in some performance tuning for giggles<br />
  2. 2. Intro <br />Stacy Hein<br />Database Guy<br />
  3. 3. Start with the Basics<br />Start with the tools you know<br />Logs, Logs, Logs<br />Performance Monitor<br />Some tools you might not know<br />Traces<br />Profiler Traces<br />Execution plans<br />Toad or other third party applications<br />
  4. 4. Why do performance monitoring? <br />Goes hand-in-hand with troubleshooting<br />Identify bottlenecks (CPU, Memory, SQL queries, etc.)<br />Planning (capacity management, end-of-life, etc.)<br />Identify server/instance configuration issues<br />Base-lining your servers<br />Should start troubleshooting the SQL Server before the client says there is an issue.<br />
  5. 5. The Usual Suspects<br />Memory<br />Processor<br />Disk<br />Database instance configuration<br />Queries<br />Maintenance<br />
  6. 6. Performance Counters<br />Remember that performance counters should not be taken individually. Get the whole story.<br />Most thresholds are dependent on the system and application.<br />Ignore spikes. Sustained thresholds are the only ones that count.<br />
  7. 7. Memory <br />A good place to start generally.<br />64 bit has helped with both memory and processor bottlenecks.<br />More is good – always.<br />
  8. 8. Memory Performance Counters<br />Memory: Available Bytes<br />Key counter especially when used with others.<br />Memory: Pages / sec <br />Hard page faults – going to disk to get it.<br />VMM goes to pagefile to retrieve.<br />Above 20 suggests possible memory issue.<br />Memory: Page Faults / Sec <br />Sum of hard an soft page faults<br />
  9. 9. Memory Performance Counters<br />Page File: % Usage <br />Also useful with the other counters.<br />Some rules for the pagefile<br />Move from system disk<br />Put on more than one drive if possible<br />Make it 2 times the size of the physical RAM in the server<br />
  10. 10. Processor Performance Counters<br />Processor:% Processor Time<br />Total processing time for non-idle thread<br />80-90% means need processor<br />Processor: %User Time<br />Total time used for executing user processes (e.g. SQL)<br />System: Processor Queue<br />Over 2 = bad<br />Consider how many cores and divide total by number of cores <br />
  11. 11. Disk Performance Counters<br />Physical disk<br />PhysicalDisk: Avg. Read Queue Length  Should be less than  2 <br />PhysicalDisk: Avg. Write Queue Length  Should be less than 2 <br />PhysicalDisk: % Disk Time  more than 50% indicates a bottleneck <br />
  12. 12. Disk Performance Counters<br />Logical Disk<br />SQL Server:BufferManager:Page reads/sec <br />SQL Server reading pages from disk. If you are near your hardware maximums for this counter tune your database by adding indexes, redesign queries, etc.<br />SQL Server:BufferManager:Page writes/sec <br />SQL Server writing pages to disk. If you are near your hardware maximums for this counter tune your database by adding indexes, redesign queries, etc.<br />
  13. 13. Networking Performance Counters<br />Network Interface Bytes Total/sec <br />Network Interface Bytes Sent/sec <br />Network Interface Bytes Received/sec <br />Network Interface Current Bandwidth5<br />Don’t usually have a networking issue that is not the cable, the NIC, or route/rule issues.<br />
  14. 14. Dynamic Management Views and Functions<br />Can get performance counter data from these. <br />Is a snapshot not continuous<br />Common ones used<br />sys.dm_os_performance_counters<br />sys.dm_os_sys_info<br />sys.dm_os_wait_stats<br />sys.dm_io_virtual_file_stats - function<br />
  15. 15. Trace Flags<br />Used in determining deadlocks (in this case anyway)<br />1204<br />Reports deadlock information formatted by each node involved in the deadlock<br />1222<br />formats deadlock information, first by processes and then by resources<br />Use DBCC TRACEON to set<br />
  16. 16. Profiler is your Friend<br />Can execute and capture trace information for all transactions running on SQL server instance.<br />Can isolate transactions you need to capture.<br />
  17. 17. Database Instance Configuration<br />Can affect server performance<br />Examples<br />Memory settings, processor affinity settings, affinity masks, AWE setting (for 32 bit instances), etc.<br />If you are going to change your settings, understand the instances role<br />
  18. 18. Instance Roles<br />High Write Instance<br />The database and log disk should be RAID 10 and separated on different physical volumes.<br />The logical and physical model of the database is important. High write tables should be on their own partitions. This is also be true for very large, clustered indexes.<br />Tempdb should be on its own RAID 10 partition and should have one data file for each core dedicated to SQL Server.<br />Although disk is usually the primary issue with a high write system, put as much RAM as you can in this system.<br />
  19. 19. Instance Roles<br />High Read Instance (Reporting?)<br />Memory, Memory, Memory is the most important component to a read-intensive system. The more you have the more that can be accessed in memory and not read from disk.<br />Tempdb should be on its own RAID 10 partition and should have one data file for each core dedicated to SQL Server. If you are doing massive reads, you are probably doing calculations for reporting. This operations are handled in tempdb now in SQL Server 2005 and forward.<br />Although memory is the key to a system that does massive read operations, if you can afford it, make the database and log file partitions RAID 10 for when you would need to access them.<br />
  20. 20. Instance Roles<br />If your system is a hybrid the defaults should work for the server. If not, tweak design and system settings as necessary careful to consider what the instance might be processing (i.e. more reads or more writes).<br />
  21. 21. Other Keys to Troubleshooting <br />Understand the data and applications on the instance<br />The physical and logical design of the database coupled with the system setting will go far in establishing a high performing instance/server. <br />Well designed queries are also <br />
  22. 22. Tuning Queries<br />Execution Plans<br />Profiler<br />Third party apps<br />Toad for SQL Server<br />
  23. 23. Tuning Queries<br />Rules for code creation<br />Use procedures for the repetitive queries<br />Avoid cursors<br />Reduces the use of temp tables <br />Return only the rows an app needs<br />Set NOCOUNT ON<br />Use the schema when naming the object<br />Do all DDL at top of procedures<br />Use ANSI JOIN language<br />Look for ANSI SET commands in your code<br />
  24. 24. Maintenance<br />Database maintenance is key to mitigating some performance problems. <br />Backups for obvious reasons<br />Index fragmentation can cause issues for the server.<br />Two options DBCC DBREINDEX and DBCC INDEXDEFRAG<br />UPDATE STATISTICS - depends on your application.<br />Be careful there is a performance trade off for recompiling queries.<br /> <br />Maintenance is a key component to the preventative side of server support.<br />

×