Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server...
-
Upload
bryan-norman -
Category
Documents
-
view
213 -
download
2
Transcript of Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server...
![Page 1: Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server Performance Data with PowerShell.](https://reader030.fdocuments.us/reader030/viewer/2022032606/56649e9c5503460f94b9d3f4/html5/thumbnails/1.jpg)
Gather Microsoft SQL Server Performance Data with Windows PowerShellAllen WhiteUpSearch Technology ServicesSQL Server MVP
SESSION CODE: DAT306
![Page 2: Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server Performance Data with PowerShell.](https://reader030.fdocuments.us/reader030/viewer/2022032606/56649e9c5503460f94b9d3f4/html5/thumbnails/2.jpg)
About MeSQL Server Consultant with UpsearchOver 35 years in ITCareer covered multiple disciplines – operations, development, telecommunications, network design/administration and database design and administrationStarted using Sybase in 1992, MS SQL Server in 1995Microsoft Certified IT Professional: Database Administrator and Database Developer, Microsoft Certified Trainer (MCT)Awarded Microsoft MVP Award for SQL Server for last 3 years
![Page 4: Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server Performance Data with PowerShell.](https://reader030.fdocuments.us/reader030/viewer/2022032606/56649e9c5503460f94b9d3f4/html5/thumbnails/4.jpg)
AgendaPerformance CountersCapture OptionsPowerShell ScriptPerformance Analysis ReportNotifications
![Page 5: Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server Performance Data with PowerShell.](https://reader030.fdocuments.us/reader030/viewer/2022032606/56649e9c5503460f94b9d3f4/html5/thumbnails/5.jpg)
Goal - Capture Performance BaselineBaseline shows normal performanceDeviations from Baseline require investigationProblem
Data comes from disparate sourcesCoordination of multiple gathering toolsSynchronizing data for true baseline analysis
SolutionPowerShell
Gather SQL Server Performance Data with PowerShell
![Page 6: Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server Performance Data with PowerShell.](https://reader030.fdocuments.us/reader030/viewer/2022032606/56649e9c5503460f94b9d3f4/html5/thumbnails/6.jpg)
Key Performance IndicatorsWhich counters show us system healthThere’s no “right” answerThese are my choices
Gather SQL Server Performance Data with PowerShell
![Page 7: Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server Performance Data with PowerShell.](https://reader030.fdocuments.us/reader030/viewer/2022032606/56649e9c5503460f94b9d3f4/html5/thumbnails/7.jpg)
Operating System Counters
Object Counter Look For
Processor % Processor Time Should be <= 80%
Memory Available MBytesLow Memory, Server Paging
Paging File(_Total) % Usage Should be < 70%
PhysicalDisk(*) Disk Reads/secBaseline, watch for unusual variations
PhysicalDisk(*) Disk Writes/secBaseline, watch for unusual variations
System Processor Queue Length> 10 threads/proc and CPU > 80% is concern
Gather SQL Server Performance Data with PowerShell
![Page 8: Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server Performance Data with PowerShell.](https://reader030.fdocuments.us/reader030/viewer/2022032606/56649e9c5503460f94b9d3f4/html5/thumbnails/8.jpg)
SQL Server Counters
Object Counter Look For
Access Methods Forwarded Records/secShould be < 10 per 100 batch requests/sec
Access Methods Page Splits/secShould be <20 per 100 batch requests/sec
Buffer Manager Buffer cache hit ratio Should be > 90%
Buffer Manager Page life expectancy Should be >=300
General Statistics Processes blocked Baseline, check for changes
SQL Statistics Batch Requests/sec > 1000 is busy system
SQL Statistics SQL Compilations/secShould be < 10% of batch requests/sec
SQL Statistics SQL Re-Compilations/secShould be < 10% of compilations/sec
Gather SQL Server Performance Data with PowerShell
![Page 9: Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server Performance Data with PowerShell.](https://reader030.fdocuments.us/reader030/viewer/2022032606/56649e9c5503460f94b9d3f4/html5/thumbnails/9.jpg)
Sources for Performance Data
PerfmonSave data to .CSVUse SSIS or PowerShell to import results
DMVsGreat source of SQL Server data
sys.dm_os_performance_countersOnly returns SQL Server current instance counters
WMIAllows access to all aspects of serverCrunching the numbers can be tricky
Gather SQL Server Performance Data with PowerShell
![Page 10: Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server Performance Data with PowerShell.](https://reader030.fdocuments.us/reader030/viewer/2022032606/56649e9c5503460f94b9d3f4/html5/thumbnails/10.jpg)
Performance Data in PowerShellGet-Counter cmdlet (PowerShell 2.0)
Invocation sets own interval handlerSystem.Diagnostics.PerformanceCounter
Support directly within .NETResults directly match Perfmon valuesAccessible from PowerShell
Gather SQL Server Performance Data with PowerShell
![Page 11: Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server Performance Data with PowerShell.](https://reader030.fdocuments.us/reader030/viewer/2022032606/56649e9c5503460f94b9d3f4/html5/thumbnails/11.jpg)
Collecting PerformanceCounter data
DEMO
![Page 12: Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server Performance Data with PowerShell.](https://reader030.fdocuments.us/reader030/viewer/2022032606/56649e9c5503460f94b9d3f4/html5/thumbnails/12.jpg)
Performance Database
Every Admin should have oneStore Baseline DataStore Server Side Trace infoStore Server and Instance infoKeep all management info in one place
Gather SQL Server Performance Data with PowerShell
![Page 13: Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server Performance Data with PowerShell.](https://reader030.fdocuments.us/reader030/viewer/2022032606/56649e9c5503460f94b9d3f4/html5/thumbnails/13.jpg)
Scripting the Data Capture
Capture the counter dataInsert into Performance DatabaseWait defined interval and do it again
Gather SQL Server Performance Data with PowerShell
![Page 14: Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server Performance Data with PowerShell.](https://reader030.fdocuments.us/reader030/viewer/2022032606/56649e9c5503460f94b9d3f4/html5/thumbnails/14.jpg)
Capture the counter data# Initialize Perfcounters$ppt = new-object System.Diagnostics.PerformanceCounter$ppt.CategoryName = 'Processor'$ppt.CounterName = '% Processor Time'$ppt.InstanceName = '_Total'
![Page 15: Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server Performance Data with PowerShell.](https://reader030.fdocuments.us/reader030/viewer/2022032606/56649e9c5503460f94b9d3f4/html5/thumbnails/15.jpg)
Logic Flow for getperf.ps1
Gather SQL Server Performance Data with PowerShell
Connect to ServerFind Instances
Initialize Server
Counters
For Each Instance
Initialize Instance Counters
While Not EndDate
Capture Server Counters
For Each Instance
Capture Instance Counters
![Page 16: Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server Performance Data with PowerShell.](https://reader030.fdocuments.us/reader030/viewer/2022032606/56649e9c5503460f94b9d3f4/html5/thumbnails/16.jpg)
The getperf.ps1 script
DEMO
![Page 17: Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server Performance Data with PowerShell.](https://reader030.fdocuments.us/reader030/viewer/2022032606/56649e9c5503460f94b9d3f4/html5/thumbnails/17.jpg)
Creating the Analysis Reports
Create Basic ReportAdd Table for Counter DataAdd Graphs to see TrendsAdd Dashboard Report to SSMS
Demo
Gather SQL Server Performance Data with PowerShell
![Page 18: Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server Performance Data with PowerShell.](https://reader030.fdocuments.us/reader030/viewer/2022032606/56649e9c5503460f94b9d3f4/html5/thumbnails/18.jpg)
Notifications
Once Baseline is understoodDefine deviation amount for warningDefine deviation amount for error condition
Build notification mechanismsIf warning send emailIf error send text message
SQL Server Agent Alerts can watch some counters
Gather SQL Server Performance Data with PowerShell
![Page 19: Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server Performance Data with PowerShell.](https://reader030.fdocuments.us/reader030/viewer/2022032606/56649e9c5503460f94b9d3f4/html5/thumbnails/19.jpg)
Build Alerts with PowerShell
DEMO
![Page 20: Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server Performance Data with PowerShell.](https://reader030.fdocuments.us/reader030/viewer/2022032606/56649e9c5503460f94b9d3f4/html5/thumbnails/20.jpg)
References
Master-PowerShell | With Dr. Tobias Weltnerhttp://powershell.com/cs/blogs/ebook/default.aspx
Let PowerShell do an Inventory of your Servershttp://www.simple-talk.com/sql/database-administration/let-powershell-do-an-inventory-of-your-servers/
Initialize-SqlpsEnvironment.ps1 scripthttp://blogs.msdn.com/mwories/archive/2008/06/14/SQL2008_5F00_Powershell.aspx
Midnight DBA – PowerShell webcastshttp://midnightdba.itbookworm.com/
Gather SQL Server Performance Data with PowerShell
![Page 21: Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server Performance Data with PowerShell.](https://reader030.fdocuments.us/reader030/viewer/2022032606/56649e9c5503460f94b9d3f4/html5/thumbnails/21.jpg)
Thank you
![Page 22: Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server Performance Data with PowerShell.](https://reader030.fdocuments.us/reader030/viewer/2022032606/56649e9c5503460f94b9d3f4/html5/thumbnails/22.jpg)
DAT Track Scratch 2 Win
Find the DAT Track Surface Table in the Yellow Section of the TLCTry your luck to win a Zune HDSimply scratch the game pieces on the DAT Track Surface Table and Match 3 Zune HDs to win
![Page 23: Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server Performance Data with PowerShell.](https://reader030.fdocuments.us/reader030/viewer/2022032606/56649e9c5503460f94b9d3f4/html5/thumbnails/23.jpg)
Resources
www.microsoft.com/teched
Sessions On-Demand & Community Microsoft Certification & Training Resources
Resources for IT Professionals Resources for Developers
www.microsoft.com/learning
http://microsoft.com/technet http://microsoft.com/msdn
Learning
![Page 24: Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server Performance Data with PowerShell.](https://reader030.fdocuments.us/reader030/viewer/2022032606/56649e9c5503460f94b9d3f4/html5/thumbnails/24.jpg)
Complete an evaluation on CommNet and enter to win!
![Page 25: Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server Performance Data with PowerShell.](https://reader030.fdocuments.us/reader030/viewer/2022032606/56649e9c5503460f94b9d3f4/html5/thumbnails/25.jpg)
Sign up for Tech·Ed 2011 and save $500 starting June 8 – June 31st
http://northamerica.msteched.com/registration
You can also register at the
North America 2011 kiosk located at registrationJoin us in Atlanta next year
![Page 26: Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server Performance Data with PowerShell.](https://reader030.fdocuments.us/reader030/viewer/2022032606/56649e9c5503460f94b9d3f4/html5/thumbnails/26.jpg)
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to
be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
![Page 27: Allen White UpSearch Technology Services SQL Server MVP SESSION CODE: DAT306 Gather SQL Server Performance Data with PowerShell.](https://reader030.fdocuments.us/reader030/viewer/2022032606/56649e9c5503460f94b9d3f4/html5/thumbnails/27.jpg)
JUNE 7-10, 2010 | NEW ORLEANS, LA