Microsoft SQL Server 2008 R2 Unleashed- P150 pdf

10 443 0
Microsoft SQL Server 2008 R2 Unleashed- P150 pdf

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

Thông tin tài liệu

ptg 1434 CHAPTER 39 Monitoring SQL Server Performance FIGURE 39.3 The Configure Management Data Warehouse Wizard’s Select Configuration Task window. The Data Collector has specific roles for data collection and management data warehouse tasks. The logins and roles required for data collection need to be created on the server that performs the data collection. Logins and roles for the MDW need to be created in the server that hosts the MDW. These logins and the MDW are created using the Configure Management Data Warehouse Wizard, which performs the following tasks: . Creates the management data warehouse . Installs the predefined System Data collection sets . Maps logins to management data warehouse roles . Enables data collection . Starts the System Data collection sets To invoke the Configure Management Data Warehouse Wizard, perform the following tasks on the SQL Server instance where you want to host the MDW: 1. Ensure that SQL Server Agent is running (for information on starting SQL Server Agent, see Chapter 16, “SQL Server Scheduling and Notification”). 2. In Object Explorer in SSMS, expand the server instance that will host the MDW and expand the Management node for that server. 3. Right-click Data Collection and then click Configure Management Data Warehouse. This starts the Configure Management Data Warehouse Wizard. 4. Click on Next to display the Select Configuration Task window, as shown in Figure 39.3. ptg 1435 Performance Monitoring Tools 39 TIP If you’ve already created a repository database for the SQL Server Utility (see the “SQL Server Utility” section later in this chapter), you must use this same database as the MDW for the Data Collector. You can skip the process of creating the MDW and jump right to the configuration of the Data Collector. On the Configure Management Data Warehouse Storage screen (look ahead to Figure 39.6), you specify the name of the server that was set up as the utility control point (UCP) and specify the name of the utility data warehouse database that was set up to collect the SQL Server Utility perfor- mance statistics. In the Select Configuration Task window, make sure the radio button for Create or Upgrade a Management Data Warehouse is selected and click Next. Specify the name of the server instance that will host the MDW and click on New to create the MDW data- base. This brings up the standard New Database dialog. Enter the name you want to use for the MDW database and specify the location of the database files if you want the data- base created in different drive or directory than the default data file directory. TIP If you are creating the MDW on a server that you will also be monitoring with the Data Collector, it’s a good idea to put the MDW on drives separate from where your produc- tion databases reside to avoid the potential for any I/O contention between the MDW and your production databases. Also, because of the anticipated growth of the MDW, you might want to change the default autogrow size of the MDW from 50MB to possibly 250 or 500MB and set the initial size to at least 500MB or 1GB. Before saving your settings and creating the MDW database, display the Options page and make sure that the database is configured for Simple recovery mode. For the current release of the Data Collector, the management data warehouse should be created using the Simple recovery model, to minimize logging. When you are satisfied with the database configuration, click on OK to create the MDW database. After the database is created and you are brought back to the Configure Management Data Warehouse Storage screen (see Figure 39.4), click Next to continue to the Map Logins and Users screen. On this screen, assign the appropriate MDW roles to your SQL Server users (see Figure 39.5). Any users who need to view the Data Collector reports need the mdw_reader role. ptg 1436 CHAPTER 39 Monitoring SQL Server Performance FIGURE 39.4 The Configure Management Data Warehouse Storage screen. FIGURE 39.5 The Map Logins and Users screen. By default, no user is a member of the MDW database roles. User membership in these roles must be granted explicitly. Members of the mdw_admin role have Read, Write, Update, and Delete access to the management data warehouse. Members of this role can change the management data warehouse schema when required (for example, adding a new table when a new collection type is installed) and run maintenance jobs on the management data warehouse, such as archive or cleanup. Members of the mdw_writer role can upload and write data to the management data warehouse; any Data Collector that stores data in the management data warehouse has to be a member of this role. Members of the mdw_reader role have Read access to the management data warehouse primarily for the purpose of supporting troubleshooting by providing access to historical data. ptg 1437 Performance Monitoring Tools 39 It is recommended that you create a new login for data collection and map it as shown in Figure 39.5. After you map the users, click on Next to bring up the Complete the Wizard screen, which provides a summary of the tasks to be performed. If everything looks okay, click Finish to perform the configuration of the MDW, which includes running the installation script to install the required schema objects in the MDW. After you have created the MDW and made it available, the next step is to begin data collection for one or more of your SQL Server 2008 instances. Right-click on the Data Collection node in Object Explorer and select the Configure Management Data Warehouse option again. On the Select Configuration Task screen (refer to Figure 39.3), select the Set Up Data Collection radio button and click Next. On the Configure Management Data Warehouse Storage screen (see Figure 39.6), specify the name of the server that hosts the MDW and the name of the MDW database created previously. When specifying the server, you can also specify which directory you want the Data Collector to use for its local file cache (again, if possible, this should be on a different drive than where your database data files reside to minimize I/O contention). If you leave the value blank, it uses the default SQL Agent TEMP directory. FIGURE 39.6 The Configure Management Data Warehouse Storage screen when configuring data collection. When you finish making your selections, click Next to bring up the Complete the Wizard screen, which provides a summary of the tasks to be performed. If everything looks okay, click Finish to have the wizard perform the configuration of the system collection sets and enable data collection. The System Data Collectors When the Configure Management Data Warehouse Wizard is finished, you should see three additional nodes under the Data Collector node: Disk Usage, Query Statistics, ptg 1438 CHAPTER 39 Monitoring SQL Server Performance FIGURE 39.7 Data Collection Set Properties window for the Disk Usage Data Collector. and Server Activity. You can double-click each node, or right-click and select Properties, to open the Properties window. The Properties window for the Disk Usage Data Collector is shown in Figure 39.7. The main item you may want to change in the Data Collection Set Properties window is the data collection and upload schedule. By default, the wizard configures the Disk Usage Collection set to run in noncached mode every six hours. Depending on how active your server is, you might want to increase or decrease the frequency that it runs. You can also configure how long it should retain data in the MDW. By default, it is configured to retain data for two years (730 days). This is probably fine for keeping track of disk usage, but for more active Data Collector Sets, you might want to reduce the retention period to reduce the size of the MDW. For example, the default retention period for the Query Statistics and Server Activity Data Collectors is 14 days. Both the Query Statistics and Server Activity Data Collectors are configured to cache data and upload to the MDW on a separate schedule. If you look in the General page of the Data Collection Set Properties window for these Data Collectors, you see that the schedule Query Statistics Data Collector is to gather information every 10 seconds, and the Server Activity collector gathers information every 60 seconds. To view the upload schedule, click on the Uploads page (see Figure 39.8). Both Data Collectors, by default, are configured to ptg 1439 Performance Monitoring Tools 39 upload the cached data to the MDW every 15 minutes. To change the upload schedule, you can either pick from an existing schedule or create a new one (Figure 39.8 shows the Pick Schedule list). The Upload Properties page also displays the last time the cached data was uploaded to the MDW. In very active servers, the Data Collector can generate a lot of data, and its storage tables can fill up with millions of rows within hours. You might want to modify the collector job schedules and decrease the frequency of data collections depending on the use of each server and your monitoring requirements. NOTE Data collection for the built-in system collection sets begins automatically after the Configure Management Data Warehouse completes. Depending on how active your servers are, it likely will take awhile for some meaningful data to accumulate. You might want to wait an hour or so before looking at the reports. Data Collector Reports After you set up data collection, SQL Server Management Studio provides three new reports for viewing data accumulated by the Data Collector: Server Activity History, Disk FIGURE 39.8 Data Collection Set upload schedule. ptg 1440 CHAPTER 39 Monitoring SQL Server Performance FIGURE 39.9 Disk Usage Summary report. Usage Summary and Query Statistics History. You can view these reports by right-clicking on the Data Collection node and selecting Reports, and then select Management Data Warehouse. From there, you can choose one of the three built-in reports: . Disk Usage Summary—Displays data and log file sizes (starting size and current size) and average daily growth . Query Statistics History—Displays query execution statistics including the top 10 queries by CPU, Duration, Total I/O, Physical Reads, and Logical Writes . Server Activity History—Displays performance statistics in four general areas: CPU %, Disk I/O Usage, Memory Usage, and Network Usage, plus SQL Server Wait statis- tics by wait type and SQL Server activity Figure 39.9 displays an example of the Disk Usage Summary Report. All the data collection reports provide drill-down capabilities on just about every data element and widget displayed in the main report. For example, in the Disk Usage Summary report, you can click on the database name to display a more detailed breakdown of the disk usage for that specific database. Figure 39.10 shows the Disk Usage details for the AdventureWorks2008R2 database. If you click on the Trend graph or the current database or log size, it displays a more detailed graph showing the growth trends for the database over time since the data collection session started. ptg 1441 Performance Monitoring Tools 39 FIGURE 39.10 Disk Usage report for AdventureWorks2008R2 database. If you want to run reports for any of the monitored servers without having navigate to the Data Collection node for each server instance, you can open the server instance that hosts the MDW. Browse to the MDW database in the SSMS Object Browser and right-click on that database. Then select Reports and select the the Management Data Warehouse Overview report (see Figure 39.11). The Management Data Warehouse Overview report lists which servers the data collection is running on and shows the most recent times data was uploaded for each of the collec- tion sets. You can click on the hyperlinks below each of the listed collection sets to bring up that corresponding report for that server. For example, if you click on the link below Server Activity for the LATITUDED830-W7 server, it displays the Server Activity History report, as shown in Figure 39.12. FIGURE 39.11 Management Data Warehouse Overview report. ptg 1442 CHAPTER 39 Monitoring SQL Server Performance FIGURE 39.12 The Server Activity History report. Like the Disk Usage report, most of the data elements in the Server Activity History report are hyperlinks that let you drill down into more detail. For example, you can click in the line in the Disk I/O Usage graph to bring up additional detail by disk of the Disk Response Time, Average Disk Queue Length, Disk Transfer Rate, as well as the average, minimum, and maximum I/O reads and writes for the processes running during the data collection session. If you want to narrow down the report to a specific time frame, you can click on a point in the timeline shown on the report to set the end time of the data displayed. You can click on the magnifying glass to increase or decrease the size of the interval displayed and click the arrow buttons to move to the next or previous interval. For finer control over the time period displayed, click on the calendar icon to bring up the dialog shown in Figure 39.13. Here, you can set the specific start time and choose an interval (15 minutes or 1, 4, 12, or 24 hours) to display from that start time. The Data Collector reports contain a lot of data, especially if you drill down into the details. There are more details than we have space to get into in this chapter. You should plan to spend some time examining each of these reports by drilling down into the various details and selecting different time frames and so on to get familiar with what they have to offer. For example, you can drill from the Query Statistics History report to the individual query details, including the graphical execution plan. ptg 1443 Performance Monitoring Tools 39 FIGURE 39.13 Defining the time frame to display in a data collection report. Managing the Data Collector To stop collecting performance data for a SQL Server instance, right-click on Data Collection in the Management node and click Disable Data Collection. If you want to stop a specific data collection set, expand the Data Collection node and then expand the System Data Collection Sets folder. Right-click on the data collection set you want to stop and select Stop Data Collection Set. You can also force a collection set to gather data and upload statistics manually by right- clicking on the data collection set and selecting Collect and Upload Now. To check on the status and history of the Data Collectors, you can right click on the Data Collection node and select View Logs. This launches the log viewer that displays the activity that has occurred for each of the data collection sets, such as which collection sets are active and the collection and upload history of each of the collection sets. Managing the Data Collector in T-SQL Much of the Data Collector can be managed effectively within SSMS. However, if you have to perform a number of tasks repeatedly, using the wizards and SSMS dialogs can some- times become tedious. Fortunately, the Data Collector provides an extensive collection of stored procedures that you can use to perform any data collection task. In addition, you can use functions and views to retrieve configuration data from the msdb and manage- ment data warehouse databases, execution log data, as well as the performance data stored in the management data warehouse. TIP As with most tools in SSMS, when using the GUI, you can click the Script buttion to generate a script for the actions being performed. This is a great way to become more familiar with the T-SQL commands and procedures for managing the Data Collector. For example, to enable or disable the Data Collector in a SQL Server instance, you can use the sp_syscollector_enable_collector and sp_syscollector_disable_collector stored procedures: . following tasks on the SQL Server instance where you want to host the MDW: 1. Ensure that SQL Server Agent is running (for information on starting SQL Server Agent, see Chapter 16, SQL Server Scheduling. Server Activity History—Displays performance statistics in four general areas: CPU %, Disk I/O Usage, Memory Usage, and Network Usage, plus SQL Server Wait statis- tics by wait type and SQL Server. AdventureWorks200 8R2 database. If you want to run reports for any of the monitored servers without having navigate to the Data Collection node for each server instance, you can open the server instance

Ngày đăng: 05/07/2014, 02:20

Từ khóa liên quan

Mục lục

  • Table of Contents

  • Introduction

  • Part I: Welcome to Microsoft SQL Server

    • 1 SQL Server 2008 Overview

      • SQL Server Components and Features

      • SQL Server 2008 R2 Editions

      • SQL Server Licensing Models

      • Summary

      • 2 What’s New in SQL Server 2008

        • New SQL Server 2008 Features

        • SQL Server 2008 Enhancements

        • Summary

        • 3 Examples of SQL Server Implementations

          • Application Terms

          • OLTP Application Examples

          • DSS Application Examples

          • Summary

          • Part II: SQL Server Tools and Utilities

            • 4 SQL Server Management Studio

              • What’s New in SSMS

              • The Integrated Environment

              • Administration Tools

              • Development Tools

              • Summary

              • 5 SQL Server Command-Line Utilities

                • What’s New in SQL Server Command-Line Utilities

                • The sqlcmd Command-Line Utility

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

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

Tài liệu liên quan