Slide 1. © 2012 Invensys. All Rights Reserved. The names, logos, and taglines identifying the products and services of Invensys are proprietary marks.

Slides:



Advertisements
Similar presentations
Yukon – What is New Rajesh Gala. Yukon – What is new.NET Framework Programming Data Types Exception Handling Batches Databases Database Engine Administration.
Advertisements

Module 13: Performance Tuning. Overview Performance tuning methodologies Instance level Database level Application level Overview of tools and techniques.
Module 17 Tracing Access to SQL Server 2008 R2. Module Overview Capturing Activity using SQL Server Profiler Improving Performance with the Database Engine.
© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 10 Slide 1 IT390 Business Database Administration Unit 10:
Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.
Database Optimization & Maintenance Tim Richard ECM Training Conference#dbwestECM Agenda SQL Configuration OnBase DB Planning Backups Integrity.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment Chapter 11: Monitoring Server Performance.
MCDST : Supporting Users and Troubleshooting a Microsoft Windows XP Operating System Chapter 10: Collect and Analyze Performance Data.
MCTS Guide to Microsoft Windows Server 2008 Network Infrastructure Configuration Chapter 11 Managing and Monitoring a Windows Server 2008 Network.
Chapter 9 Overview  Reasons to monitor SQL Server  Performance Monitoring and Tuning  Tools for Monitoring SQL Server  Common Monitoring and Tuning.
Module 8: Monitoring SQL Server for Performance. Overview Why to Monitor SQL Server Performance Monitoring and Tuning Tools for Monitoring SQL Server.
Managing and Monitoring SQL Server 2005 Shankar Pal Program Manager SQL Server, Redmond.
Transaction log grows unexpectedly
NovaBACKUP 10 xSP Technical Training By: Nathan Fouarge
Module 15: Monitoring. Overview Formulate requirements and identify resources to monitor in a database environment Types of monitoring that can be carried.
Module 8: Server Management. Overview Server-level and instance-level resources such as memory and processes Database-level resources such as logical.
Ch 11 Managing System Reliability and Availability 1.
Module 18 Monitoring SQL Server 2008 R2. Module Overview Monitoring Activity Capturing and Managing Performance Data Analyzing Collected Performance Data.
Introduction and simple using of Oracle Logistics Information System Yaxian Yao
Troubleshooting SQL Server Enterprise Geodatabase Performance Issues
Key Concepts About Performance Factors Affecting SQL Performance SQL Performance Tuning Methodologies SQL Performance Tuning Tools 1.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
CN1176 Computer Support Kemtis Kunanuraksapong MSIS with Distinction MCT, MCTS, MCDST, MCP, A+
Slide 1. © 2012 Invensys. All Rights Reserved. The names, logos, and taglines identifying the products and services of Invensys are proprietary marks.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment, Enhanced Chapter 11: Monitoring Server Performance.
Informix IDS Administration with the New Server Studio 4.0 By Lester Knutsen My experience with the beta of Server Studio and the new Informix database.
Architecture Rajesh. Components of Database Engine.
Administration and Monitoring the Database Oracle 10g.
Oracle Tuning Considerations. Agenda Why Tune ? Why Tune ? Ways to Improve Performance Ways to Improve Performance Hardware Hardware Software Software.
Agenda for Today Do Chapter 14 Final Project Review for Final.
IT 456 Seminar 5 Dr Jeffrey A Robinson. Overview of Course Week 1 – Introduction Week 2 – Installation of SQL and management Tools Week 3 - Creating and.
Active Directory Maintenance, Troubleshooting, and Disaster Recovery Lesson 11.
Learningcomputer.com SQL Server 2008 – Profiling and Monitoring Tools.
Module 16: Performing Ongoing Database Maintenance
1 Chapter Overview Performing Configuration Tasks Setting Up Additional Features Performing Maintenance Tasks.
SQLRX – SQL Server Administration – Tips From the Trenches SQL Server Administration – Tips From the Trenches Troubleshooting Reports of Sudden Slowdowns.
By Shanna Epstein IS 257 September 16, Cnet.com Provides information, tools, and advice to help customers decide what to buy and how to get the.
37 Copyright © 2007, Oracle. All rights reserved. Module 37: Executing Workflow Processes Siebel 8.0 Essentials.
ESRI User Conference 2004 ArcSDE. Some Nuggets Setup Performance Distribution Geodatabase History.
Enterprise Database Administration & Deployment SIG ▪ 313M ▪ Sept 29, 2005 ▪ 10:15 AM SQL Server 2005 Performance Diagnosis and Tuning using SQL Tools.
Troubleshooting SQL Server Performance: Tips &Tools Amit Khandelwal.
3 Copyright © 2006, Oracle. All rights reserved. Using Recovery Manager.
IT System Administration Lesson 3 Dr Jeffrey A Robinson.
Session 1 Module 1: Introduction to Data Integrity
MISSION CRITICAL COMPUTING Siebel Database Considerations.
1 Copyright © 2005, Oracle. All rights reserved. Following a Tuning Methodology.
Module 11: Managing Transactions and Locks
for all Hyperion video tutorial/Training/Certification/Material Essbase Optimization Techniques by Amit.
1 Chapter Overview Monitoring Access to Shared Folders Creating and Sharing Local and Remote Folders Monitoring Network Users Using Offline Folders and.
Copyright Sammamish Software Services All rights reserved. 1 Prog 140  SQL Server Performance Monitoring and Tuning.
SQL SERVER MAINTENANCE PLANS Kat
Scott Fallen Sales Engineer, SQL Sentry Blog: scottfallen.blogspot.com.
ITMT 1371 – Window 7 Configuration 1 ITMT Windows 7 Configuration Chapter 8 – Managing and Monitoring Windows 7 Performance.
SQL Advanced Monitoring Using DMV, Extended Events and Service Broker Javier Villegas – DBA | MCP | MCTS.
Improve query performance with the new SQL Server 2016 query store!! Michelle Gutzait Principal Consultant at
A deep dive into SQL Server Plan Cache Management.
You Inherited a Database Now What? What you should immediately check and start monitoring for. Tim Radney, Senior DBA for a top 40 US Bank President of.
This document is provided for informational purposes only and Microsoft makes no warranties, either express or implied, in this document. Information.
Agenda for Today  DATABASE Definition What is DBMS? Types Of Database Most Popular Primary Database  SQL Definition What is SQL Server? Versions Of SQL.
Session Name Pelin ATICI SQL Premier Field Engineer.
Getting the Most from SQL Server 2005 Don Vilen Program Manager SQL Server Microsoft Corporation.
SQL Database Management
You Inherited a Database Now What?
SQL Server Monitoring Overview
Designing Database Solutions for SQL Server
Dynamics AX Performance
Turbo-Charged Transaction Logs
You Inherited a Database Now What?
Analyzing Performance Problems Using XEvents, DMVs & Query Store
Analyzing Performance Problems Using XEvents, DMVs & Query Store
Presentation transcript:

Slide 1

© 2012 Invensys. All Rights Reserved. The names, logos, and taglines identifying the products and services of Invensys are proprietary marks of Invensys or its subsidiaries. All third party trademarks and service marks are the proprietary marks of their respective owners. WW TSS-09 MS SQL Server Performance & Tuning for Wonderware Databases Pierluigi Iodice Regional Technical Support Engineer October, 2012

Slide 3 Microsoft SQL Server Wonderware Products developed with Microsoft Technologies All Microsoft development languages used are “Glove in Hand” with SQL Server What we need to know about MS SQL Server? i.SQL Server General Setting ii.Database Maintenance iii.Troubleshooting Tools & Diagnostic Query

Slide 4 SQL Server General Settings Min and Max memory continues to acquire memory as needed until Max reached frees the memory allocated until Min reached Addressing Windowing Extensions allows 32-bit operating systems to access large amounts of memory. This will be removed on next SQL Server version

Slide 5 SQL Server General Settings CPU Affinity To carry out multitasking, Microsoft Windows sometimes moves process threads among different processors. This activity can reduce Microsoft SQL Server performance under heavy system loads, as each processor cache is repeatedly reloaded with data. Assigning processors to specific threads can improve performance under these conditions by eliminating processor reloads; such an association between a thread and a processor is called processor affinity.

Slide 6 Maintenance: The Plan One of the first tasks for a new DB is to set up a maintenance plan: Regular backups A restore strategy Check DB fragmentation Clear SQL Server Log

Slide 7 Maintenance: Backup and Restore Backup Under the Simple Recovery Model –This recovery model supports both database backups and file backups, but does not support log backups. The DB administrator must decide on a backup and restore strategy, and choose a recovery mode accordingly: Backup Under the Full Recovery Model The full recovery model uses log backups to prevent data loss in the broadest range of failure scenarios, and backing and restoring the transaction log (log backups) is required.

Slide 8 Maintenance: Galaxy Repository DB Many of the GR DB maintenance tasks are wrapped by the ArchestrA components: Backup/Restore can be done from SMC, or from PowerShell script DB Scrubber utility Index reorganization, stats update, and SQL Server Log cleaning must be setup by a DB admin. You can manually truncate the Change Log. During periods of heavy activity (such as migrations) you can reduce the ArchestrA IDE refresh period.

Slide 9 Maintenance: Runtime DB The Runtime DB size is not affected by the amount of history data. General settings let you purge event and summary data. You need to manually purge the change log (ModLogTracking). Avoid creating custom tables in the Runtime DB.

Slide 10 Maintenance: Alarm DB The Alarm DB Purge and Archive utility can be used to reduce the amount of records in the DB. Use a known query to delete the duplicate alarms periodically Fragmentation is typically not an issue, since there are no UPDATES.

Slide 11 Maintenance: DB Fragmentation The amount of fragmentation can be analyzed by using the sys.dm_db_index_physical_stats view. Fragmentation can be reduced by rebuilding and/or reorganizing indexes. The DB fill factor can help reduce fragmentation. Physical disk fragmentation can also help. Fragmentation occurs when data is modified in a table. When you insert or update data in a table (via INSERT or UPDATE), the table’s corresponding indexes are affected.

Slide 12 Maintenance: DB Fragmentation TIP DBCC INDEXDEFRAG ALTER INDEX REORGANIZE DBCC DBREINDEX ALTER INDEX REBUILD

Slide 13 Maintenance: Transaction Log Shrinking the Transaction Log The size of the log files are physically reduced when: –A DBCC SHRINKDATABASE statement is executed. –A DBCC SHRINKFILE statement referencing a log file is executed. More information on TN 599 or 837 on WDN Site

Slide 14 Troubleshooting and Diagnostic Tools There are several tools that will allow you to: 1.Detect errors and exceptions 2.Monitor performance counters 3.Trace the exact SQL statements executed by the server 4.Use system function / stored procedures 5.SQL in ArchestrA Script

Slide 15 Detect Errors: Logging Mechanisms Useful logs to keep in mind: SQL Server Log Export.log,.txt,.csv Filter condition Search Windows Event Viewer

Slide 16 Performance Monitor You cannot control what you don’t measure MS SQL Server exposes a set of performance counters for virtually every subsystem These counters allow you to create a performance baseline

Slide 17 Performance Monitor Collects detailed information about the utilization of operating system resources. SQL Server provides extensions to the Performance Monitor tool to track a variety performance counters. It allows you to track memory, disk, processor, and the network performance. Allows you to track both system-wide and SQL Server counters. Tracing can occur in real-time or captured as a log.

Slide 18 Performance Monitor: SQL Pen Object(Instance)CounterDescriptionTarget Value SQLServer:Access Methods FreeSpace Scans/secRate of inserts into tables with no indexes No target. Should be monitored over time. SQLServer:Access Methods Full Scans/secRate of unrestricted full scans on tables indexes No target. Should be monitored over time. SQLServer:LatchesTotal Latch Wait TimeWait time before latch requests are acquired No target. Should be monitored over time. SQLServer:LocksLock Timeouts/secAmount of locks that timeout and exit Avg = 0 SQLServer:LocksLock Wait TimeWait time before a lock can be acquired Avg < 10 ms SQLServer:LocksNumber of Deadlocks/sec Amount of deadlocksAvg = 0 SQLServer:General Statistics Processes BlockedAmount of processes that are denied connection to the DB Avg = 0 SQLServer:General Statistics User ConnectionsTotal number of user connections No target. Should be monitored over time.

Slide 19 Performance Monitor and Profiler Trace

Slide 20 SQL Server Profiler Trace each query into SQL Server DB Analyze performance and diagnose problems. Debug T-SQL statements and Stored Procedures. Replay SQL Server activity in a simulation. Combine with other debug instruments. A rich interface to create and manage traces and analyze and replay trace results.

Slide 21 SQL Server Profiler: How to Run General Setting Trace Name Trace Provider name Trace Provider Type Use template: Standard TSQL TSQL Duration TSQL Lock And so on… Save to file {.trc, xml, …} Save to table Enable trace stop time

Slide 22 SQL Server Profiler: How to Run

Slide 23 SQL Server Profiler: the Results

Slide 24 SQL Server Profiler: Debug and Execute

Slide 25 SQL Server Profiler: External Free Tool QURE Workload Analyzer

Slide 26 SQL Server Profiler: PID and SPID Client Process ID report exactly the PID of Task Manager or Process Explorer. It has used to identify the Application that is still running something into SQL Server Database A SPID in SQL Server is a Server Process ID. These process ID’s are essentially sessions in SQL Server. Every time an application connects to SQL Server, a new SPID is created. This connection has a defined scope and memory space and cannot interact with other SPIDs. The term SPID is synonymous with Connection, or Session.

Slide 27 Diagnostic Query: From SPID to SQL TIP Get Last Running Query Based on SPID

Slide 28 Diagnostic Query:Concatenate SPID TIP See Who Is Blocking Your SQL Server

Slide 29 Diagnostic Query: Userful Query Execution related dynamic objects provide information about current sessions, connections, client requests, opened cursors and execution plans. These objects can be particularly helpful in identifying resource bottlenecks such as CPU, memory or disk. You can also peruse execution related objects to troubleshoot blocking issues. Each object in this category is prefixed with "dm_exec.” TIP Sys.dm_exec_query_stats provides a wealth of performance statistics for cached query plans.

Slide 30 Diagnostic Query:...on CPU TIP Top 10 most CPU intensive SQL Statements

Slide 31 Diagnostic Query:...by Frequency TIP Top 10 Stored Procedures ordered by the frequency of their execution

Slide 32 Diagnostic Query:...by Recompile TIP most frequently re-compiled statements

Slide 33 Diagnostic Tools:...by I/O TIP The most I/O intensive queries:

Slide 34 Tips: Writing SQL Queries How to write an efficient query: – Write correctly formed queries, using correct ON clause and avoid DISINCT – Return only the rows and columns needed, avoid * and use TOP x – Avoid expensive operators such as NOT LIKE. – Avoid explicit or implicit functions in WHERE clauses. – Use stored procedures or parameterized queries. – Minimize cursor use. – Avoid long actions in triggers, or best, Avoid Trigger! – Use temporary tables and table variables appropriately. – Limit query and index hints use.

Slide 35 Tips: Optimize SQL Queries When Identified Long-Running Query: –Put it on SQLS Management Studio and start to analyze the cause of slowness: 1.Using SET statements: SHOWPLAN_ALL, STATISTIC IO/TIME/PROFILE ON 2.Using SQL Query Analyzer options

Slide 36 Tips: Optimize SQL Queries Fastest query improve your application Analyzing the Results: Physical Operation: Avoid Table Scan Estimated cost: I/O vs CPU intensive Estimated Number of Execution Avoid no needed loops Estimate Row Size: Avoid Large size

Slide 37 SQL Server from ArchestrA Scripts These components offer a lot of flexibility: –Connection pooling –Transaction support –Synchronous and Asynchronous execution The recommended method is to use the included SQL Server Data Components: –$–$SQLData object, scripting library, and SQLGrid control.

Slide 38 SQL Server from ArchestrA scripts If you absolutely need to use.NET scripting to access the DB: Ensure that scripts are asynchronous. Use Multiple Active Result Set option (MARS) Manage the DB connection lifecycle. Use Stored Procedures Use System.Data.SqlClient Don't care about all these recommendations to make an

Slide 39 Questions? Thank you!