Presentation is loading. Please wait.

Presentation is loading. Please wait.

SQL Server Monitoring Overview

Similar presentations


Presentation on theme: "SQL Server Monitoring Overview"— Presentation transcript:

1 SQL Server Monitoring Overview
A good SQL Server monitoring plan can help you stay on top of :- Performance Growth Security As a DBA, you need to support the database workloads that the applications and services in your organization rely on. SQL Server provides several tools for monitoring events in SQL Server and for tuning the physical database design. A good SQL Server monitoring plan can help you stay on top of: Performance: Decide if a performance increase is necessary or feasible. For instance, by keeping a track record of query completion times you could spot any suboptimal areas and come up with possible improvements. Checking queries as they are executed might reveal issues that need fixing. Growth: Observe requirements in terms of users and traffic. Database usage needs tend to evolve faster than expected. Security: Ensure adequate security measures have been applied.

2 the Appropriate Monitoring Tools
Performance Monitor SQL Profiler SQL Trace Default trace Activity Monitor in SQL Server Management Studio Dynamic management views return server state information Transact-SQL

3 Explanation Performance Monitor SQL Profiler SQL Trace Default trace
Performance Monitor: Performance Monitor is a very useful tool that tracks resource use on Microsoft operating systems. It can monitor resource usage for the server and provide information specific to SQL Server either locally or for a remote server. It can be used to capture a baseline of server resource usage, or it can monitor over longer periods of time to help identify trends. SQL Profiler: This tool is a graphical application that enables you to capture a trace of events that occurred in SQL Server. All SQL Server events can be captured by this tool into the trace. The trace can be stored in a file or written to a SQL Server table. SQL Trace: SQL Trace is the T-SQL stored procedure way to invoke a SQL Server trace without having to start up the SQL Profiler application. It requires a little more work to set up, but it’s a lightweight way to capture a trace; and because it’s scriptable, it enables the automation of trace capture, making it very easy to repeatedly capture the same events. Default trace: Introduced with SQL Server 2005, the default trace is a lightweight trace that runs in a continuous loop and captures a small set of key database and server events. This can be very useful in diagnosing events that may have occurred when no other monitoring was in place.

4 Explanation Activity Monitor in SQL Server Management Studio.
Dynamic management views. Transact-SQL. Activity Monitor Performance Monitor Activity Monitor in SQL Server Management Studio: This tool graphically displays the following information: ❑ Processes running on an instance of SQL Server ❑ Locks ❑ User activity ❑ Blocked processes Activity Monitor works well for ad hoc monitoring, but not very well for trend analysis. Dynamic management views: Dynamic management views return server state information that can be used to monitor the health of a server instance, diagnose problems, and tune performance. This is one of the best tools added to SQL Server 2005 for ad hoc monitoring. These views provide a snapshot of the exact state of SQL Server at the point they are queried. Transact-SQL: Some system stored procedures provide useful information for SQL Server monitoring, such as sp_who, sp_who2, sp_lock, and several others. These stored procedures are best for ad hoc monitoring, not trend analysis. Activity Monitor A component of SQL Server Management Studio that enables DBAs to view details of current activity in the database engine. Performance Monitor A windows administrative tool that you can use to record values for multiple performance counters over a period of time, and analyze the results in a variety of chart and report formats.

5 Activity Monitor In sql server management studio Overview Processes
Resource Waits Data File I/O Recent Expensive Queries Activity Monitor is a tool in SQL Server Management Studio (SSMS) that shows information about processes, waits, I/O resource performance, and recent expensive queries. You can use it to investigate both current and recent historical issues. You must have the VIEW SERVER STATE permission to use Activity Monitor. The Overview section contains graphical information about processor usage, waiting tasks, database I/O, and batch requests per second. • The Processes section includes detailed information on processes, their IDs, logins, databases, and commands. This section also shows details of processes that are blocking other processes. • The Resource Waits section shows categories of processes that are waiting for resources and information about the wait times. • The Data File I/O section shows information about the physical database files in use and their recent performance. • The Recent Expensive Queries section shows detailed information about the most expensive recent queries, and resources consumed by those queries. You can right-click the queries in this section to view either the query or an execution plan for the query.

6 SSMS Activity Monitor

7 Dynamic Management Views and Functions
DMVs (dynamic management views) DMFs (dynamic management functions) DMOs (dynamic management objects) The DMVs were introduced in SQL 2005 and with each new release, Microsoft has been adding additional DMVs to help troubleshoot issues. DMVs actually come in two flavors DMVs (dynamic management views) and DMFs (dynamic management functions) and are sometimes classified as DMOs (dynamic management objects).  In earlier versions of SQL Server, database administrators often used third-party tools to monitor the internal state of SQL Server. Most third-party tools performed this monitoring by using extended stored procedures. This approach is not recommended because the extended stored procedures operate within the memory space of the SQL Server process.

8 Some commonly used categories of DMVs and DMFs are in the following table:
sys.dm_exec_% sys.dm_os_% sys.dm_tran_% sys.dm_io_% sys.dm_db_% These objects provide information about connections, sessions, requests, and query execution. For example, sys.dm_exec_sessions provides one row for every session that is currently connected to the server. These objects provide access to SQL OS-related information. For example, sys.dm_os_performance_counters provides access to SQL Server performance counters without needing to reach them using operating system tools. These objects provide access to transaction management. For example, sys.dm_os_tran_active_transactions gives details of currently active transactions. These objects provide information on I/O processes. For example, sys.dm_io_virtual_file_stats shows details of I/O performance and statistics for each database file. These objects provide database-scoped information. For example, sys.dm_db_index_usage_stats has information about how each index in the database has been used.

9 Viewing Activity by Using Dynamic Management Views
Returning Historical Information Both DMVs and DMFs are viewable in Object Explorer—DMVs are in the System Views node for any database and DMFs are in the Table Valued Function node in the master database. Returning Historical Information SELECT * FROM sys.dm_os_wait_stats ORDER BY wait_time_ms DESC;

10 Performance Monitor

11 Performance Monitor CPU Memory
I/O (primarily disk I/O, but in some cases network as well) Performance Monitor is an important tool because not only does it enable you to know how SQL Server is performing, it is also the tool that indicates how Windows is performing. Performance Monitor provides a huge set of counters. This section is not about how to use Performance Monitor (although later in this section you will learn about two very valuable tools, Logman, and Relog, that make using Performance Monitor a lot easier in a production environment). Objects. Objects represent course-grained resource categories, such as Processor, Memory, or Logical Disk. There are a great many built-in objects provided by Windows, and server applications such as SQL Server often install additional objects that relate to application-specific resources. • Counters. An object contains one or more counters, which are the metrics that you can monitor. For example, the Processor object includes the % Processor Time counter, which measures processor utilization. • Instances. Some counters can be captured for specific instances of objects. For example, when monitoring the % Processor Time counter in a multi-CPU server, you capture measurements for each individual CPU. Additionally, most multi-instance counters provide a _Total instance, which measures the counter for all instances combined. Processor Time (_Total). When describing the _Total instance, or if an object has only one instance, the (instance) part is often omitted; for example Processor: % Processor Time. Performance Monitor provides multiple ways to visualize the counter values that you have captured.


Download ppt "SQL Server Monitoring Overview"

Similar presentations


Ads by Google