Bài giảng Cơ sở dữ liệu nâng cao Chapter 8 Monitoring SQL server

47 753 0
Bài giảng Cơ sở dữ liệu nâng cao  Chapter 8 Monitoring SQL server

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Bài giảng Cơ sở dữ liệu nâng cao Chapter 8 Monitoring SQL server Bài giảng Cơ sở dữ liệu nâng cao Chapter 8 Monitoring SQL server. Chương này trình bày một số nội dung The goal of monitoring, performance monitor, dynamic management views, monitoring events, event notifications,...

Monitoring SQL Server The Goal of Monitoring  The goal of monitoring databases is to see:  What’s going on inside SQL Server,  How effectively SQL Server is using the server resources (CPU, Memory, I/O)  The information enables DBA identify abnormal activities The Goal of Monitoring  Once you define your monitoring goals you should select the appropriate tools for monitoring  The following list describes basic monitoring tools to view the current activities:  Performance Monitor: a 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  SQL Profiler: a graphical application that enables you to capture a trace of events that occurred in SQL Server The Goal of Monitoring  The following list describes the basic monitoring tools:  SQL Trace: 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  It’s scriptable  enables the automation of trace capture  Default trace: a light weight trace that runs in a continuous loop and captures a small set of key database and server events  useful in diagnosing events that may have occurred when no other monitoring was in place The Goal of Monitoring  The following list describes the basic monitoring tools:  Activity Monitor: a tool graphically displays the following information:     Processes running on an instance of SQL Server Locks User activity Blocked processes  Dynamic management views: return server state information that can be used to monitor the health of a server instance, diagnose problems, and tune performance  Transact-SQL: Some system stored procedures provide useful information for SQL Server monitoring, such as Performance Monitor  Performance Monitor is an important tool because it enables to know:  How SQL Server is performing  How Windows is performing  Three server resources needs to be monitored:  CPU  Memory  I/O Performance Monitor  CPU Resource Counters:  Several counters show the state of the available CPU resources  Bottlenecks due to CPU resource shortages are frequently caused by problems such as:    More users than expected One or more users running very expensive queries Routine operational activities such as index rebuilding Performance Monitor  CPU Resource Counters:  The following counters will help to find the cause of the bottleneck so that to identify that the bottleneck is a CPU resource issue:    Processor: % Processor Time: displays the total percentage of time spent processing non-idle threads On a multipleprocessor machine, each individual processor can be monitored independently Process: % Processor Time (sqlservr): can be used to determine how much of the total processing time can be attributed to SQL Server System: Processor Queue Length: displays the number of threads waiting to be processed by a CPU Performance Monitor  Disk Activity:  SQL Server relies on the Windows operating system to perform I/O operations  The disk system handles the storage and movement of data on your system Disk I/O is frequently the cause of bottlenecks in a system Need to observe many factors in determining the performance of the disk system  Several disk counters return disk Read and Write performance information, as well as data transfer information, for each physical disk or all disks Performance Monitor  Memory Counters:  Used by the DBA to get an overall picture of database I/O  A lack of memory will have a direct impact on disk activity When optimizing a server, adding memory should always be considered  These are some Memory counters:    Memory: Pages/Sec: measures the number of pages per second that re paged out of memory to disk or paged into memory from disk Memory: Available Bytes: indicates how much memory is available to processes Process: Working Set (sqlservr) - The SQL Server instance of the Working Set counter shows how much memory is in use by SQLServer Troubleshooting SQL Server  Filtering objects Troubleshooting SQL Server  Error log:  When something goes wrong with an application, the first thing should be done is connecting to the server and looking at the SQL Server instance error logs and the Windows event logs  To view the logs, right-click SQL Server Logs under the Management tree and select View  SQL Server and Windows Log to open “Log File Viewer” screen  From this screen, user can check and uncheck log files that you want to bring into the view or can consolidate logs from SQL Server, Agent, Database Mail, and the Windows Event Files Troubleshooting SQL Server  Error log: Troubleshooting SQL Server  Activity monitoring: give a view of current connections on an instance The monitor can be used to determine whether you have any processes blocking other processes  To open the Activity Monitor in Management Studio, right click on the Server in the Object Explorer, then select Activity Monitor Troubleshooting SQL Server  Activity monitoring:  In the view:   The top section shows graphs:  Processor time  Waiting tasks  Database i/o  Batch requests/sec There are lists under the graphs:  Processes  Resource Waits  Data File I/O  Recent Expensive Queries Troubleshooting SQL Server  Activity monitoring: Troubleshooting SQL Server  Process monitoring:  User can also monitor the activity of your server via TSQL  sp_who: returns who is connecting to your instance,  sp_who2: gives you much more information about each process   To see all the connections to your server, run sp_who2 without any parameters To see only the active connections to your server, execute this command: sp_who2 ‘active’  sys.dm_exec_connections: gives more information to help to troubleshoot the Database Engine Troubleshooting SQL Server  Process monitoring:  DBCC INPUTBUFFER: is a great DBCC command that enables to see what SQL command an individual process ID is running   The command accepts only a single input parameter, which is the process id for the connection that you’d like to diagnose Ex: DBCC INPUTBUFFER (55) Performance Tuning  The goal of monitoring databases is to assess how a server is performing  Effective monitoring current performance is go isolate processes that are causing problems, and gathering data continuously over time to track performance trends Performance Tuning  Monitoring SQL Server lets you the following:  Determine whether you can improve performance  Evaluate user activity  Troubleshoot any problems or debug application components, such as stored procedures Performance Tuning  Monitoring lets administrators identify performance trends to determine if changes are necessary Performance Tuning  To monitor SQL Server effectively  should clearly identify your reason for monitoring  Establish a baseline for performance  Identify performance changes over time  Diagnose specific performance problems  Identify components or processes to optimize  Compare the effect of different client applications on performance  Audit user activity Performance Tuning  To monitor SQL Server effectively  should clearly identify your reason for monitoring  Test a server under different loads Test database architecture  Test maintenance schedules  Test backup and restore plans  Determining when to modify your hardware configuration Performance Tuning  The performance of enterprise database systems depends on:  A effective configuration of physical design strunctures in the databases that compose those systems  These physical design structures include indexes, clustered indexes, indexed views, and partitions, whose purpose is to enhance performance and manageability of databases Performance Tuning  SQL Server provides Database Engine Tuning Advisor - a tool that analyzes the performance effects of workloads (a set of Transact-SQL statements that executes against databases you want to tune) on one or more databases ... defined, click Run to launch the trace Monitoring Events  SQL Server Profiler: Monitoring Events  SQL Server Profiler: Monitoring Events  Working with SQL Server Profiler:  Starting, Pausing,... of SQL Server and selecting Reports from the menu A report favorite at the server level is the Server Dashboard Troubleshooting SQL Server  Reports:  Server Reports: Troubleshooting SQL Server. .. given database Troubleshooting SQL Server  Reports:  Database Reports: Troubleshooting SQL Server  Configuring SQL Server:  ways for SQL Server configuration:   SQL Configuration Manager The

Ngày đăng: 15/05/2017, 11:28

Từ khóa liên quan

Mục lục

  • Chapter 8

  • The Goal of Monitoring

  • Slide 3

  • Slide 4

  • Slide 5

  • Performance Monitor

  • Slide 7

  • Slide 8

  • Slide 9

  • Slide 10

  • Slide 11

  • Slide 12

  • Dynamic Management Views

  • Slide 14

  • Monitoring Events

  • Slide 16

  • Slide 17

  • Slide 18

  • Slide 19

  • Slide 20

  • Slide 21

  • Event Notifications

  • Slide 23

  • Troubleshooting SQL Server

  • Slide 25

  • Slide 26

  • Slide 27

  • Slide 28

  • Slide 29

  • Slide 30

  • Slide 31

  • Slide 32

  • Slide 33

  • Slide 34

  • Slide 35

  • Slide 36

  • Slide 37

  • Slide 38

  • Slide 39

  • Slide 40

  • Performance Tuning

  • Slide 42

  • Slide 43

  • Slide 44

  • Slide 45

  • Slide 46

  • Slide 47

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan