SlideShare ist ein Scribd-Unternehmen logo
1 von 25
Watch Re-runs
OnYour SQL Server!
David Cobb
sql@davidcobb.net
All slides and content available
on my blog:
http://bit.ly/1HicQw9http://www.imdb.com/find?s=all&q=good%20times
David Cobb
SQLTrainer / Consultant
MCT, MCSE Data Platform for SQL 2012
sql@davidcobb.net
daveslog.com
Presenter
Past Roles:
Tech Support, Network Admin, Web
Developer, DBA
Current:
Systems Architect for CheckAlt.com
Training SQL Since: 2002
FavoriteTechs of the Moment:
PowerShell & Azure
Free 8-part series
THURSDAYS, 6:00 PM – 9:00 PM
Session 3: Legal & IP, 3d Printing (May 28)
Session 4: Design UIUX & Machine Learning (Jun 4)
Session 5: Finance & Programming services for IoT
Session 6: KPIs & Test-to-Manufacture
Session 7: Distribution & Programming Drones
Session 8: Funding/Investments & Programming Wearables
Details and Registration: aka.ms/micmeetup
What Are RML Utilities
 Microsoft internal tool used by the SQL support team
 Precursor to Distributed Replay Client introduced in SQL 2012
 Has both replay and stress test modes.
 Supports SQL Server versions 2005 thru SQL 2014.
 Not officially supported! Good email responsiveness from the support team
though. sstlbugs@microsoft.com
WhyWould I UseThem?
 PRE-SQL 2012 (otherwise look at the Distributed Replay Client,
it IS supported)
 Testing effect on SQL statement performance from
environment changes using real production query load
(including inserts/updates/deletes) .
 Test with new version of SQL (or hotfix, CU, or SP)
 Test with different server or database settings (MAXDOP changes, RCSI)
 Test with different files or disks (additional files, filegroups, different
RAID or LUN, SSDs)
 Test index changes
 Etc.
Where Do I Start?
 RML Utilities Quickstart - Install the tool, (http://bit.ly/1IPGGfJ)locate the RML
Help.pdf and walk through the quickstart in a test environment to get familiar
with it.
 Documentation is thorough, covering many use cases, but often at a high level of
technical detail.
How Would I UseThisTo Capture And Replay
Production Workloads?
 Workflow diagram
 Before you start:
 Install RML Utilities and requirements (ReportViewer 2008) on test server
 Create folders for config files, scripts, backups, traces and RML files on test server and
production
 Optional: Install SQLNexus, PSSDIAG
(To be covered in a future presentation  )
Overview OfThe RML Replay Process:
 RML Utilities BasicWorkflow Diagram (github link)
BASELINE CAPTURE:
On Production Server (SQL1)
 Take a full backup in advance, plus tlog backups of all relevant user databases databases.
 Note the time
 Using a customized copy of SD_Detailed.XML (which is generated by running SQLDIAG ), with
ProfilerCollector disabled, start a SQLDIAG session to newly created folder.
 sqldiag.exe /OC:RMLDemooutputsqldiagrun01
/IC:RMLDemoconfigSD_Detailed.XML
 Also start capture of a SQL trace using sp_trace to a newly created folder.
 using TraceCaptureDef.sql saving to a named folder (i.e. trace01 or trace0521).
 exec @rc = sp_trace_create @TraceID output, 2 /* rollover*/,
N'C:RMLDemooutputtracerun01replay01' , @maxfilesize, NULL
 Alternately, use StartSQLDiagForReplay2008.cmd from PSSDIAG
 DON'T USE REPLAYTRACETEMPLATE IN SQL PROFILER!
BASELINE CAPTURE : Continued..
 Start simulated workload if testing, or wait for production activity
 When capture of production load is complete (timeframe up to you, 15 minutes, 1
hour?) stop the trace and SQLDIAG (ctrl-C in SQLDIAG window)
 Take final tlog backups, then copy the following from production to the test server
(or other server that will analyze the results):
 Trace files
 SQLDIAG output
 Full andTLog backups
DEMO: BASELINE CAPTURE
 From RML Help.pdf, pg 17
DEMO : ReadTrace
 I’m performing the demos that take some time so I can talk while they run..
PROCESS : OnTest Server (SQL2)
Using the ReadTrace tool
 Use readtrace.exe from RML Cmd Prompt on the test server (or
any other), to process the trace files into replayable RML files
 ReadTrace consumes as input trace (.TRC) or (.XEL) files and
.CAB or .ZIP files which contain .TRC files from a SQLTrace or
Extended Events
 It generates .RML (Replay Mark-up Language) files and the
Performance Analysis (PerfAnalysis) database. (A populated
performance analysis database is required for reporter.exe
functionality.)
 TIP! Save your command line statements in text file and paste
to console.
 Track what statements and parameters were used exactly, and when.
 Minimize typos.
ReadTrace Continued..
 ReadTrace -I<PATH_TO_FIRST_TRACE_FILE> -o<PATH_TO_RML_OUTPUT_FOLDER>
-S<DBSERVER> -d<NEW_PERF_ANALYSIS_DB_NAME>
 Note: No space between the parameter flag and the value in any RML Utilities commands!
 Using ReadTrace this way creates RML files and stores performance in a new performance analysis
database
 Many options for ReadTrace.exe
 limit start time (-b) or end time (-e)
 limit databases (-C), application (-A) or host (-H)
 trace flags, MARS support, etc.. 5 pages of parameters in RML Help pdf, pg 35-40
 ReadTrace –IC:RMLDemoFROMSQL1outputtracetrace01trace01.trc
–oC:RMLDemooutputrmlrun01-1 –SSQL2 –dPerfAnalysis_run01_1
-CAdventureworks2008R2
 Upon completion, will open the result report using reporter.exe
 Also review contents of RML output folder
REPLAY : OnTest Server (SQL2)
 Prepare environment on test server
 Ensure you won't have access to / affect production!
 Restore databases up to point in time that you began the trace
 Start SQLDIAG Session, just like on production
 sqldiag.exe /OC:RMLDemooutputsqldiagrun01replay01
/IC:RMLDemoconfigSD_Detailed.XML
 Also start capture of a replay trace using sp_trace, just like on production
 exec @rc = sp_trace_create @TraceID output, 2 /rollover*/,
N'C:RMLDemooutputtracerun01' , @maxfilesize, NULL
DEMO : Ostress
 Again, I’m performing the demos that take some time so I can talk while they run..
OSTRESS :The Replay Command
 OStress is a scalable, ODBC based application which can replay database commands in two modes:
 Replay mode orchestrates the order of the commands, to accurately simulate OLTP activity.
(i.e. Insert table 1, when done then update table 2, then delete table 3..)
 Note that replay mode can take around 5 times longer that original capture, due to orchestration
overhead
 Stress mode plays back SQL statements as quickly as possible, based on parameters you provide.
(i.e. Firehose mode)
 No respecting order of statements, not useful for Inserts/Updates/Deletes with Foreign Key
relationships.
 Many parameters for this tool as well
 RML Help.pdf pg 93
Use OstressTo Start Replay
 Start replay with ostress.exe from RML Cmd Prompt
 ostress -E -SSQL2 -iC:RMLDemooutputrmlrun01*.rml
-cC:RMLDemoconfigostress_config.ini
-oC:RMLDemooutputostressrun01replay01 -mreplay
 (again, no spaces between parameter flags and their values)
 The ostress command and its parameters:
 -E,-S server info
 -i path to RML files to replay
 -c Configuration file (copied from RML samples)
 -o Output path for replay result
 -m Mode is replay.This plays back in order. Also can be stress mode, aka fire hose mode
 Once replay complete, stop the trace and SQLDIAG (ctrl-C in SQLDIAG window)
PROCESS : OnTest Server (SQL2)
 Now we need to analyze the results of the replay on the test server.
 We use readtrace.exe from RML Cmd Prompt again, but this time use -f
parameter just to create the performance analysis database, not to create
another set of replay files.
 ReadTrace -IC:RMLDemooutputtracerun01replay01.trc -f
-SSQL2 -dPerfAnalysis_run01_replay01 -C"AdventureWorks2008R2"
ANALYZE : OnTest Server (SQL2)
 reporter.exe runs once readtrace.exe is
complete. From Properties tab, enter the names
of both the performance analysis databases
(Baseline and test) for reports that compare
results.
 Review ER Schema of the PerfAnalysis database.
Understand how we can query these tables for
our own analysis
 Use Performance Analysis Comparison Script.sql
 Dave is on github!
https://github.com/dave-007/RML-Utilities-Demo
BUTWAIT,THERE'S MORE!
 SQLNexus
 Visual reports from SQL traces (generated using PSSDIAG script) and SQLDIAG
 http://sqlnexus.codeplex.com/
 PSSDIAG Manager
 RML Utilities big brother. More features
 https://diagmanager.codeplex.com/
 PAL
 Gathers performance monitor logs and generates visual reports.
 Compares metrics to thresholds defined by Microsoft geniuses!
 https://pal.codeplex.com/
QUESTIONS?
sql@davidcobb.net
Daveslog.com
RESOURCE LINKS
 Description of the Replay Markup Language (RML) Utilities for SQL Server -
https://support.microsoft.com/en-us/kb/944837/
 Download RML Utilities for SQL Server (x64) CU4 -
https://www.microsoft.com/en-us/download/details.aspx?id=4511
 Dependency: Download ReportViewer 2008 SP1 -
https://www.microsoft.com/en-us/download/confirmation.aspx?id=3841
 SQL Nexus - http://sqlnexus.codeplex.com/
 SQL Server 2012: RML, XEventViewer and Distributed Replay -
http://blogs.msdn.com/b/psssql/archive/2012/04/06/sql-server-2012-rml-xevent-viewer-and-distributed-
replay.aspx
 AdventureWorks RandomWorkload from Jonathan Kehayias -
https://www.sqlskills.com/blogs/jonathan/the-adventureworks2008r2-books-online-random-workload-
generator/
 Distributed Replay walkthrough -
http://blogs.msdn.com/b/mspfe/archive/2012/11/08/using-distributed-replay-to-load-test-your-sql-server-part-1.aspx
 RML Demo files on Github: https://github.com/dave-007/RML-Utilities-Demo

Weitere ähnliche Inhalte

Was ist angesagt?

Oracle business intelligence enterprise edition 11g
Oracle business intelligence enterprise edition 11gOracle business intelligence enterprise edition 11g
Oracle business intelligence enterprise edition 11g
uzzal basak
 
FIXING BLOCK CORRUPTION (RMAN) on 11G
FIXING BLOCK CORRUPTION (RMAN) on 11GFIXING BLOCK CORRUPTION (RMAN) on 11G
FIXING BLOCK CORRUPTION (RMAN) on 11G
N/A
 
Oracle Database 11g Product Family
Oracle Database 11g Product FamilyOracle Database 11g Product Family
Oracle Database 11g Product Family
N/A
 
Oracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid cloneOracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid clone
Deepti Singh
 
Oracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid cloneOracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid clone
Deepti Singh
 

Was ist angesagt? (20)

261 Pdfsam
261 Pdfsam261 Pdfsam
261 Pdfsam
 
61 Rac
61 Rac61 Rac
61 Rac
 
41 Pdfsam
41 Pdfsam41 Pdfsam
41 Pdfsam
 
Oracle business intelligence enterprise edition 11g
Oracle business intelligence enterprise edition 11gOracle business intelligence enterprise edition 11g
Oracle business intelligence enterprise edition 11g
 
An introduction to_rac_system_test_planning_methods
An introduction to_rac_system_test_planning_methodsAn introduction to_rac_system_test_planning_methods
An introduction to_rac_system_test_planning_methods
 
Postgresql quick guide
Postgresql quick guidePostgresql quick guide
Postgresql quick guide
 
Test Dml With Nologging
Test Dml With NologgingTest Dml With Nologging
Test Dml With Nologging
 
Pluggable database tutorial 2
Pluggable database tutorial 2Pluggable database tutorial 2
Pluggable database tutorial 2
 
Cloning 2
Cloning 2Cloning 2
Cloning 2
 
141 Pdfsam
141 Pdfsam141 Pdfsam
141 Pdfsam
 
FIXING BLOCK CORRUPTION (RMAN) on 11G
FIXING BLOCK CORRUPTION (RMAN) on 11GFIXING BLOCK CORRUPTION (RMAN) on 11G
FIXING BLOCK CORRUPTION (RMAN) on 11G
 
Best practices for_large_oracle_apps_r12_implementations
Best practices for_large_oracle_apps_r12_implementationsBest practices for_large_oracle_apps_r12_implementations
Best practices for_large_oracle_apps_r12_implementations
 
161 Rac
161 Rac161 Rac
161 Rac
 
Oracle Database 11g Product Family
Oracle Database 11g Product FamilyOracle Database 11g Product Family
Oracle Database 11g Product Family
 
Rac&asm
Rac&asmRac&asm
Rac&asm
 
141 Rac
141 Rac141 Rac
141 Rac
 
10053 otw
10053 otw10053 otw
10053 otw
 
Oracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid cloneOracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid clone
 
Database upgradation
Database upgradationDatabase upgradation
Database upgradation
 
Oracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid cloneOracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid clone
 

Ähnlich wie Watch Re-runs on your SQL Server with RML Utilities

Tony Jambu (obscure) tools of the trade for tuning oracle sq ls
Tony Jambu   (obscure) tools of the trade for tuning oracle sq lsTony Jambu   (obscure) tools of the trade for tuning oracle sq ls
Tony Jambu (obscure) tools of the trade for tuning oracle sq ls
InSync Conference
 
Introduction to Threading in .Net
Introduction to Threading in .NetIntroduction to Threading in .Net
Introduction to Threading in .Net
webhostingguy
 

Ähnlich wie Watch Re-runs on your SQL Server with RML Utilities (20)

Tony Jambu (obscure) tools of the trade for tuning oracle sq ls
Tony Jambu   (obscure) tools of the trade for tuning oracle sq lsTony Jambu   (obscure) tools of the trade for tuning oracle sq ls
Tony Jambu (obscure) tools of the trade for tuning oracle sq ls
 
Usertracing
UsertracingUsertracing
Usertracing
 
Sql saturday oc 2019
Sql saturday oc 2019Sql saturday oc 2019
Sql saturday oc 2019
 
Sql Nexus
Sql NexusSql Nexus
Sql Nexus
 
Introduction to Threading in .Net
Introduction to Threading in .NetIntroduction to Threading in .Net
Introduction to Threading in .Net
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
 
Tony jambu (obscure) tools of the trade for tuning oracle sq ls
Tony jambu   (obscure) tools of the trade for tuning oracle sq lsTony jambu   (obscure) tools of the trade for tuning oracle sq ls
Tony jambu (obscure) tools of the trade for tuning oracle sq ls
 
Sql Functions And Procedures
Sql Functions And ProceduresSql Functions And Procedures
Sql Functions And Procedures
 
MS SQLSERVER:Sql Functions And Procedures
MS SQLSERVER:Sql Functions And ProceduresMS SQLSERVER:Sql Functions And Procedures
MS SQLSERVER:Sql Functions And Procedures
 
MS SQL SERVER: Sql Functions And Procedures
MS SQL SERVER: Sql Functions And ProceduresMS SQL SERVER: Sql Functions And Procedures
MS SQL SERVER: Sql Functions And Procedures
 
Performance tuning a quick intoduction
Performance tuning   a quick intoductionPerformance tuning   a quick intoduction
Performance tuning a quick intoduction
 
SQL Server - High availability
SQL Server - High availabilitySQL Server - High availability
SQL Server - High availability
 
Sherlock holmes for dba’s
Sherlock holmes for dba’sSherlock holmes for dba’s
Sherlock holmes for dba’s
 
Using AWR for SQL Analysis
Using AWR for SQL AnalysisUsing AWR for SQL Analysis
Using AWR for SQL Analysis
 
Von neumann workers
Von neumann workersVon neumann workers
Von neumann workers
 
SQL Server R Services: What Every SQL Professional Should Know
SQL Server R Services: What Every SQL Professional Should KnowSQL Server R Services: What Every SQL Professional Should Know
SQL Server R Services: What Every SQL Professional Should Know
 
Quantifying Container Runtime Performance: OSCON 2017 Open Container Day
Quantifying Container Runtime Performance: OSCON 2017 Open Container DayQuantifying Container Runtime Performance: OSCON 2017 Open Container Day
Quantifying Container Runtime Performance: OSCON 2017 Open Container Day
 
Pro Techniques for the SSAS MD Developer
Pro Techniques for the SSAS MD DeveloperPro Techniques for the SSAS MD Developer
Pro Techniques for the SSAS MD Developer
 
DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2
 

Kürzlich hochgeladen

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Kürzlich hochgeladen (20)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

Watch Re-runs on your SQL Server with RML Utilities

  • 1. Watch Re-runs OnYour SQL Server! David Cobb sql@davidcobb.net All slides and content available on my blog: http://bit.ly/1HicQw9http://www.imdb.com/find?s=all&q=good%20times
  • 2. David Cobb SQLTrainer / Consultant MCT, MCSE Data Platform for SQL 2012 sql@davidcobb.net daveslog.com Presenter Past Roles: Tech Support, Network Admin, Web Developer, DBA Current: Systems Architect for CheckAlt.com Training SQL Since: 2002 FavoriteTechs of the Moment: PowerShell & Azure
  • 3.
  • 4. Free 8-part series THURSDAYS, 6:00 PM – 9:00 PM Session 3: Legal & IP, 3d Printing (May 28) Session 4: Design UIUX & Machine Learning (Jun 4) Session 5: Finance & Programming services for IoT Session 6: KPIs & Test-to-Manufacture Session 7: Distribution & Programming Drones Session 8: Funding/Investments & Programming Wearables Details and Registration: aka.ms/micmeetup
  • 5. What Are RML Utilities  Microsoft internal tool used by the SQL support team  Precursor to Distributed Replay Client introduced in SQL 2012  Has both replay and stress test modes.  Supports SQL Server versions 2005 thru SQL 2014.  Not officially supported! Good email responsiveness from the support team though. sstlbugs@microsoft.com
  • 6. WhyWould I UseThem?  PRE-SQL 2012 (otherwise look at the Distributed Replay Client, it IS supported)  Testing effect on SQL statement performance from environment changes using real production query load (including inserts/updates/deletes) .  Test with new version of SQL (or hotfix, CU, or SP)  Test with different server or database settings (MAXDOP changes, RCSI)  Test with different files or disks (additional files, filegroups, different RAID or LUN, SSDs)  Test index changes  Etc.
  • 7. Where Do I Start?  RML Utilities Quickstart - Install the tool, (http://bit.ly/1IPGGfJ)locate the RML Help.pdf and walk through the quickstart in a test environment to get familiar with it.  Documentation is thorough, covering many use cases, but often at a high level of technical detail.
  • 8. How Would I UseThisTo Capture And Replay Production Workloads?  Workflow diagram  Before you start:  Install RML Utilities and requirements (ReportViewer 2008) on test server  Create folders for config files, scripts, backups, traces and RML files on test server and production  Optional: Install SQLNexus, PSSDIAG (To be covered in a future presentation  )
  • 9. Overview OfThe RML Replay Process:  RML Utilities BasicWorkflow Diagram (github link)
  • 10.
  • 11. BASELINE CAPTURE: On Production Server (SQL1)  Take a full backup in advance, plus tlog backups of all relevant user databases databases.  Note the time  Using a customized copy of SD_Detailed.XML (which is generated by running SQLDIAG ), with ProfilerCollector disabled, start a SQLDIAG session to newly created folder.  sqldiag.exe /OC:RMLDemooutputsqldiagrun01 /IC:RMLDemoconfigSD_Detailed.XML  Also start capture of a SQL trace using sp_trace to a newly created folder.  using TraceCaptureDef.sql saving to a named folder (i.e. trace01 or trace0521).  exec @rc = sp_trace_create @TraceID output, 2 /* rollover*/, N'C:RMLDemooutputtracerun01replay01' , @maxfilesize, NULL  Alternately, use StartSQLDiagForReplay2008.cmd from PSSDIAG  DON'T USE REPLAYTRACETEMPLATE IN SQL PROFILER!
  • 12. BASELINE CAPTURE : Continued..  Start simulated workload if testing, or wait for production activity  When capture of production load is complete (timeframe up to you, 15 minutes, 1 hour?) stop the trace and SQLDIAG (ctrl-C in SQLDIAG window)  Take final tlog backups, then copy the following from production to the test server (or other server that will analyze the results):  Trace files  SQLDIAG output  Full andTLog backups
  • 13. DEMO: BASELINE CAPTURE  From RML Help.pdf, pg 17
  • 14. DEMO : ReadTrace  I’m performing the demos that take some time so I can talk while they run..
  • 15. PROCESS : OnTest Server (SQL2) Using the ReadTrace tool  Use readtrace.exe from RML Cmd Prompt on the test server (or any other), to process the trace files into replayable RML files  ReadTrace consumes as input trace (.TRC) or (.XEL) files and .CAB or .ZIP files which contain .TRC files from a SQLTrace or Extended Events  It generates .RML (Replay Mark-up Language) files and the Performance Analysis (PerfAnalysis) database. (A populated performance analysis database is required for reporter.exe functionality.)  TIP! Save your command line statements in text file and paste to console.  Track what statements and parameters were used exactly, and when.  Minimize typos.
  • 16. ReadTrace Continued..  ReadTrace -I<PATH_TO_FIRST_TRACE_FILE> -o<PATH_TO_RML_OUTPUT_FOLDER> -S<DBSERVER> -d<NEW_PERF_ANALYSIS_DB_NAME>  Note: No space between the parameter flag and the value in any RML Utilities commands!  Using ReadTrace this way creates RML files and stores performance in a new performance analysis database  Many options for ReadTrace.exe  limit start time (-b) or end time (-e)  limit databases (-C), application (-A) or host (-H)  trace flags, MARS support, etc.. 5 pages of parameters in RML Help pdf, pg 35-40  ReadTrace –IC:RMLDemoFROMSQL1outputtracetrace01trace01.trc –oC:RMLDemooutputrmlrun01-1 –SSQL2 –dPerfAnalysis_run01_1 -CAdventureworks2008R2  Upon completion, will open the result report using reporter.exe  Also review contents of RML output folder
  • 17. REPLAY : OnTest Server (SQL2)  Prepare environment on test server  Ensure you won't have access to / affect production!  Restore databases up to point in time that you began the trace  Start SQLDIAG Session, just like on production  sqldiag.exe /OC:RMLDemooutputsqldiagrun01replay01 /IC:RMLDemoconfigSD_Detailed.XML  Also start capture of a replay trace using sp_trace, just like on production  exec @rc = sp_trace_create @TraceID output, 2 /rollover*/, N'C:RMLDemooutputtracerun01' , @maxfilesize, NULL
  • 18. DEMO : Ostress  Again, I’m performing the demos that take some time so I can talk while they run..
  • 19. OSTRESS :The Replay Command  OStress is a scalable, ODBC based application which can replay database commands in two modes:  Replay mode orchestrates the order of the commands, to accurately simulate OLTP activity. (i.e. Insert table 1, when done then update table 2, then delete table 3..)  Note that replay mode can take around 5 times longer that original capture, due to orchestration overhead  Stress mode plays back SQL statements as quickly as possible, based on parameters you provide. (i.e. Firehose mode)  No respecting order of statements, not useful for Inserts/Updates/Deletes with Foreign Key relationships.  Many parameters for this tool as well  RML Help.pdf pg 93
  • 20. Use OstressTo Start Replay  Start replay with ostress.exe from RML Cmd Prompt  ostress -E -SSQL2 -iC:RMLDemooutputrmlrun01*.rml -cC:RMLDemoconfigostress_config.ini -oC:RMLDemooutputostressrun01replay01 -mreplay  (again, no spaces between parameter flags and their values)  The ostress command and its parameters:  -E,-S server info  -i path to RML files to replay  -c Configuration file (copied from RML samples)  -o Output path for replay result  -m Mode is replay.This plays back in order. Also can be stress mode, aka fire hose mode  Once replay complete, stop the trace and SQLDIAG (ctrl-C in SQLDIAG window)
  • 21. PROCESS : OnTest Server (SQL2)  Now we need to analyze the results of the replay on the test server.  We use readtrace.exe from RML Cmd Prompt again, but this time use -f parameter just to create the performance analysis database, not to create another set of replay files.  ReadTrace -IC:RMLDemooutputtracerun01replay01.trc -f -SSQL2 -dPerfAnalysis_run01_replay01 -C"AdventureWorks2008R2"
  • 22. ANALYZE : OnTest Server (SQL2)  reporter.exe runs once readtrace.exe is complete. From Properties tab, enter the names of both the performance analysis databases (Baseline and test) for reports that compare results.  Review ER Schema of the PerfAnalysis database. Understand how we can query these tables for our own analysis  Use Performance Analysis Comparison Script.sql  Dave is on github! https://github.com/dave-007/RML-Utilities-Demo
  • 23. BUTWAIT,THERE'S MORE!  SQLNexus  Visual reports from SQL traces (generated using PSSDIAG script) and SQLDIAG  http://sqlnexus.codeplex.com/  PSSDIAG Manager  RML Utilities big brother. More features  https://diagmanager.codeplex.com/  PAL  Gathers performance monitor logs and generates visual reports.  Compares metrics to thresholds defined by Microsoft geniuses!  https://pal.codeplex.com/
  • 25. RESOURCE LINKS  Description of the Replay Markup Language (RML) Utilities for SQL Server - https://support.microsoft.com/en-us/kb/944837/  Download RML Utilities for SQL Server (x64) CU4 - https://www.microsoft.com/en-us/download/details.aspx?id=4511  Dependency: Download ReportViewer 2008 SP1 - https://www.microsoft.com/en-us/download/confirmation.aspx?id=3841  SQL Nexus - http://sqlnexus.codeplex.com/  SQL Server 2012: RML, XEventViewer and Distributed Replay - http://blogs.msdn.com/b/psssql/archive/2012/04/06/sql-server-2012-rml-xevent-viewer-and-distributed- replay.aspx  AdventureWorks RandomWorkload from Jonathan Kehayias - https://www.sqlskills.com/blogs/jonathan/the-adventureworks2008r2-books-online-random-workload- generator/  Distributed Replay walkthrough - http://blogs.msdn.com/b/mspfe/archive/2012/11/08/using-distributed-replay-to-load-test-your-sql-server-part-1.aspx  RML Demo files on Github: https://github.com/dave-007/RML-Utilities-Demo

Hinweis der Redaktion

  1. OVERVIEW: Have an idea for a hardware product, but not sure where to start? Join us at the Microsoft Innovation Center at Venture Hive for a crash course in both building a hardware product & a business! The course will last for eight weeks, geared for students & local community members alike. There will be weekly sessions featuring industry leaders in both hardware & business development. We will cover topics all across the spectrum, from internet of things to key performance indicators in a business, from wearables to legal & IP considerations in a business. Come to one or all of the sessions.