LESSON: 3B OPTIMIZING AND TROUBLESHOOTING SQL SERVER Objectives Optimizing and Troubleshooting SQL Server Objectives In this section, you will learn about: • Optimizing hardware resource usage • Monitoring hardware resources • Resolving system bottlenecks • Monitoring SQL Server 2000 system activity • Optimizing SQL Server 2000 system activity • Troubleshooting SQL Server 2000 system activity ©NIIT 3B.1 Optimizing and troubleshooting SQL server Lesson 3B/ Slide 1 of 51 Administering and Troubleshooting SQL Server 2000 In this lesson, you will learn about: Optimizing hardware resource usage Monitoring hardware resources Resolving system bottlenecks Monitoring SQL Server 2000 system activity Optimizing SQL Server 2000 system activity Troubleshooting SQL Server 2000 system activity Optimizing and Troubleshooting SQL Server Pre-Assessment Questions ©NIIT 1. Which component of the SQL Server 2000 do you need to configure to send messages to pagers? a) SQLMail b) SQLAgentMail c) Linked Server d) SQL Server XML support in IIS 2. Which of the following component of SQL Server 2000 enables you to retrieve and use data from an Oracle database? a) SQL Server XML support in IIS b) Linked Server c) SQLAgentMail d) SQLMail Optimizing and troubleshooting SQL server Lesson 3B/ Slide 2 of 51 Administering and Troubleshooting SQL Server 2000 3B.2 Optimizing and Troubleshooting SQL Server Pre-Assessment Questions ©NIIT 3B.3 3. Which option do you need to select to verify the local login id with the login id on the linked server? a) Impersonate b) Local Login c) Remote password d) Remote User 4. Which option is used to execute queries in “http://iisserver/vdir/myquery.xml “to retrieve information from a database? a) Allow template queries b) Allow URL queries c) Allows XPATH d) Allow Post Optimizing and troubleshooting SQL server Lesson 3B/ Slide 3 of 51 Administering and Troubleshooting SQL Server 2000 Optimizing and Troubleshooting SQL Server Pre-Assessment Questions 5. ©NIIT Which of the following options of the Linked Server provides the product name for the OLEDB data source that you want to add as a linked server? a) Provider name b) Data source c) Provider string d) Product name Optimizing and troubleshooting SQL server Lesson 3B/ Slide 4 of 51 Administering and Troubleshooting SQL Server 2000 3B.4 Optimizing and Troubleshooting SQL Server Solutions to Pre-assessment Questions: Ans 1. a. SQLMail Ans 2. b. Linked Server Ans 3. a. Impersonate Ans 4. a. Allow template queries Ans 5. d. Product name ©NIIT 3B.5 Optimizing and troubleshooting SQL server Lesson 3B/ Slide 5 of 51 Administering and Troubleshooting SQL Server 2000 INSTRUCTOR NOTES Start the session by telling the students about the need to optimize the hardware usage in SQL Server 2000. Also discuss the different functional areas that need to be optimized. Then tell the students that SQL Server 2000 optimizes its hardware resources using the following techniques: Placing data on multiple disks Configuring SQL Server 2000 Resolving system disk subsystem bottlenecks Explain each technique in detail. Tell the students about the advantages of placing data on multiple disks. Also tell the students about the various RAID levels used in SQL Server 2000. Then discuss the SCSI and IDE disk subsystems in detail. Also tell the students that SCSI disk subsystem is used to store the following types of files of SQL Server 2000: Data files Transaction log files Tempdb system database Then discuss about bottlenecks and methods that can be used to resolve bottlenecks in SQL Server 2000. Administering and Troubleshooting SQL Server 2000 3B.6 OPTIMIZING HARDWARE RESOURCES Optimizing and Troubleshooting SQL Server Optimizing Hardware Resource Usage in SQL Server 2000 • • ©NIIT 3B.7 It is essential to optimize usage of hardware resources, such as CPU and memory so that SQL Server 2000 functions properly and provides the required output. Optimizing hardware resource usage in SQL Server 2000 allows you to identify: • Hardware utilization • Task scheduling • Load balancing Optimizing and troubleshooting SQL server Lesson 3B/ Slide 6 of 51 Administering and Troubleshooting SQL Server 2000 Optimizing and Troubleshooting SQL Server Optimizing Hardware Resource Usage in SQL Server 2000 (Contd.) • ©NIIT SQL Server 2000 enables you to optimize its hardware resource usage using the following techniques: • Placing data on multiple disks • Configuring SQL Server 2000 disk subsystem • Resolving system bottlenecks Optimizing and troubleshooting SQL server Lesson 3B/ Slide 7 of 51 You need to optimize the usage of hardware resources, such as CPU, processor power, disks, network subsystem, and memory so that SQL Server 2000 functions properly and provides the required output. Optimizing hardware resource usage in SQL Server 2000 allows you to identify: Hardware utilization: You can identify the time range when the hardware resources are fully utilized. This time range is called the Peak time. Task scheduling: You can identify the time range when the hardware resources are partially utilized or not utilized at all. Load balancing: Depending on the level of utilization of hardware resources, you can schedule the tasks to be performed so that the hardware resources, especially the CPU is neither over-burdened with tasks nor is idle. You can implement load balancing so that the memory is neither over-utilized nor underutilized. Administering and Troubleshooting SQL Server 2000 3B.8 SQL Server 2000 enables you to optimize its hardware resource usage using the following techniques: Placing data on multiple disks Configuring SQL Server 2000 disk subsystem Resolving system bottlenecks Placing Data on Multiple Disks Optimizing and Troubleshooting SQL Server Placing Data on Multiple Disks • You can place database files on multiple disks to optimize database . performance along with hardware resource usage • • ©NIIT 3B.9 Using multiple disks to store data provides the following advantages: • Data recoverability • Increased system performance and efficiency • Fault tolerance A RAID system consists of two or more disk drives that are used to store the database and the transaction log files. Optimizing and troubleshooting SQL server Lesson 3B/ Slide 8 of 51 Administering and Troubleshooting SQL Server 2000 Optimizing and Troubleshooting SQL Server Placing Data on Multiple Disks (Contd.) • A RAID system can be classified into two categories, Hardware RAID and Software RAID • RAID system provides the following levels that enable SQL Server 2000 to place database files on multiple disks: •RAID level 0 •RAID level 1 •RAID level 5 •RAID level 10 ©NIIT Optimizing and troubleshooting SQL server Lesson 3B/ Slide 9 of 51 You can place database files on multiple disks to optimize database performance along with hardware resource usage. Using multiple disks to store data provides the following advantages: Data recoverability Increased system performance and efficiency Fault tolerance To place database files on multiple disks, SQL Server 2000 uses Redundant Array of Independent Disk (RAID) system. A RAID system consists of two or more disk drives that are used to store the database and the transaction log files. Since RAID consists of multiple disk drives, it provides increased performance with respect to data access and retrieval and fault tolerance to the computer system than a single disk drive. A RAID system can be classified in the two categories, Hardware RAID and Software RAID. When the Windows operating system provides the RAID support, it is called the Software RAID and when the disk storage system provides the RAID support, it is known as the Hardware RAID. Administering and Troubleshooting SQL Server 2000 3B.10 RAID system provides the following levels that enable SQL Server 2000 to place database files on multiple disks: RAID level 0: The write operation in this level, writes data in blocks that are spread evenly across all the disks. This accelerates the read operation and the write operation. This level provides 100% utilization of the disk capacity but is not fault tolerant. RAID level 1: The write operation writes the data completely on all the disks used. The read operation is faster than the write operation. This level utilizes only 50% of the disk capacity but is fault tolerant. RAID level 5: The write operation writes data in blocks across all the disks. This level provides faster read operation as compared to the write operation. This level efficiently utilizes the disk space as compared to the other levels and is fault tolerant. RAID level 10: The read and write operations are fastest at this level as compared to the other levels. This level uses only 50% of the disk capacity but is fault tolerant. Since software RAID requires SQL Server 2000 to share processor resources with the RAID system that decreases system performance, hardware RAID is commonly used. 3B.11 Administering and Troubleshooting SQL Server 2000 Configuring SQL Server 2000 Disk Subsystem Optimizing and Troubleshooting SQL Server Configuring SQL Server 2000 Disk Subsystem ©NIIT • You can configure the disk subsystem to optimize the usage of memory resources. • The disk subsystems are of the following two standards: •Small Computer System Interface (SCSI) •Integrated Drive Electronics (IDE) • The following are the reasons to use SCSI disk subsystem: •It is used to increase the performance of the memory resources. •It is used to provide fault tolerance to the system. •It is used to provide fast read and write operations. •It is used to enable fast and accurate data recoverability. Optimizing and troubleshooting SQL server Lesson 3B/ Slide 10 of 51 Administering and Troubleshooting SQL Server 2000 3B.12 Optimizing and Troubleshooting SQL Server Configuring SQL Server 2000 Disk Subsystem (Contd.) • ©NIIT The SCSI subsystem is used for the following three files in SQL Server 2000: • Data files • Transaction log files • Tempdb system database Optimizing and troubleshooting SQL server Lesson 3B/ Slide 11 of 51 You can also optimize the hardware resource usage of SQL Server 2000 using the disk subsystem. For this you need to configure the disk subsystem. The disk subsystems are of the following two standards: Small Computer System Interface (SCSI): The hard disk using this standard follows the bus architecture. Using this standard the disk subsystem can be connected to maximum of 15 other devices. These 15 devices can include storage, input, and output devices. This subsystem provides reduced access and execution time. It also provides fault tolerance to the system and can coordinate slow devices with the fast devices. Integrated Drive Electronics (IDE): The hard disk using this standard also follows the bus architecture. Using this standard, the disk subsystem can be connected to maximum 2 other storage devices. This disk subsystem is slow as compared to SCSI disk subsystem and does not provide connections to any other devices other than storage devices. The following are the reasons to use SCSI disk subsystem: x x x x 3B.13 It increases the performance of the memory resources. It provides fault tolerance to the system. It provides fast read and write operations. It enables fast and accurate data recoverability. Administering and Troubleshooting SQL Server 2000 The SCSI subsystem is used for the following three files in SQL Server 2000: x x x Data files Transaction log files Tempdb system database Using SCSI Disk Subsystem for Data Files You can use SCSI disk subsystem to store data files in SQL Server 2000. A separate disk subsystem is used to store data files to prevent data loss and to reduce access time. It is essential to store data files on a separate disk subsystem so that CPU operations do not conflict with the input/output operations. Storing data files and transaction log files on separate disk subsystems also improves the performance of input/output operations by reducing bottlenecks. The performance of input/output operations improves because SQL Server 2000 has the ability to perform multiple scans on data that is spread across multiple disks. Using SCSI Disk Subsystem for Transaction Log Files SCSI disk subsystem is used to store transaction log files also. Storing transaction log files on a separate disk subsystem provides fast and efficient recoverability of data because transaction log files are used for recovering and restoring databases. The disk subsystem stores the data of transaction log files in sequential order because this data is used for transactional rollbacks, transactional commits, and database backups. Using SCSI Disk Subsystem for Tempdb System Database A separate SCSI disk subsystem is used to store Tempdb database because this database stores intermediate results of complex Transact-SQL queries and DBCC operations. Optimizing the storage of Tempdb system database enables it to handle large number of read and write operations. Tempdb database is stored on a separate disk subsystem so that it does not interfere with other databases to access the memory resource. Data recoverability is not considered with the Tempdb database because it is rebuilt every time the SQL Server 2000 starts. Administering and Troubleshooting SQL Server 2000 3B.14 Resolving System Bottlenecks Optimizing and Troubleshooting SQL Server Resolving System Bottlenecks • • • • ©NIIT Bottlenecks are defined as a situation when multiple databases are competing for a single resource at one instance. A bottleneck is caused due to inadequate hardware resources, such as processor or memory. Bottlenecks cause under utilization of databases and database objects. Putting additional resources, such as increasing the storage capacity and incorporating additional processors, can resolve hardware as well as performance bottlenecks. Optimizing and troubleshooting SQL server Lesson 3B/ Slide 12 of 51 Bottlenecks are defined as a situation when multiple databases are competing for a single resource at one instance. Occasionally bottlenecks are also caused when there is an excessive demand for a database object. A bottleneck is caused due to inadequate hardware resources, such as processor or memory. Bottlenecks cause under utilization of databases and database objects. This happens because multiple databases and database objects compete for a single resource and finally none of the competing databases gets the resource and the resource remains idle. You can detect a hardware bottleneck when a hardware resource is being excessively utilized. Similarly, you can detect a performance bottleneck when the request response time is low. These bottlenecks have to be resolved to optimize system performance. Putting additional resources, such as increasing the storage capacity and incorporating additional processors, can resolve hardware as well as performance bottlenecks. 3B.15 Administering and Troubleshooting SQL Server 2000 INSTRUCTOR NOTES Next, tell the students about monitoring hardware resources and their usage in SQL Server 2000. Prior to discussing the methods to monitor the hardware resource usage, tell the students about the reasons to monitor hardware resource usage in SQL Server 2000. Then, tell the students that to monitor the performance of hardware resources, you need to identify the following types of problem objects of these resources and their values: Memory objects and counters Input/Output objects and counters Processor objects and counters Discuss each type of object and counters in detail, explaining the different objects in each type. Finally, tell the students about monitoring the hardware resources using the Task Manager, explaining each step in detail. Administering and Troubleshooting SQL Server 2000 3B.16 MONITORING HARDWARE RESOURCES Optimizing and Troubleshooting SQL Server Monitoring Hardware Resources • • ©NIIT 3B.17 You need to monitor the working of hardware resources of SQL Server 2000 to analyze and increase their performance. The following are the reasons to monitor the hardware resources of SQL Server 2000: • Inadequate hardware resources may be over-loading SQL Server 2000 unnecessarily, for example insufficient memory resource may lead to loss of important data. • Additional server applications, such as Internet Information Server may be consuming excessive resources. • Malfunctioning of the hardware resources, such as the hard disk containing bad sectors resulting in loss of important data. Optimizing and troubleshooting SQL server Lesson 3B/ Slide 13 of 51 Administering and Troubleshooting SQL Server 2000 Optimizing and Troubleshooting SQL Server Monitoring Hardware Resources (Contd.) • • • • • • Uneven usage of hardware resources, for example one storage device is overused and another storage device is underused Excessive network traffic that results in network congestion Incorrect usage of queries Transferring large amount of data between the client and the server. Excessive use of locks on resources that result in under-utilization of these resources Poor database design that results in redundancy of data ©NIIT Optimizing and troubleshooting SQL server Lesson 3B/ Slide 14 of 51 You need to monitor the working of hardware resources of the system to analyse and increase their performance. The following are the reasons to monitor the hardware resources of the system: Inadequate hardware resources may be over-loading SQL Server 2000 unnecessarily, for example insufficient memory resource may lead to loss of data. Additional server applications, such as Internet Information Server may consuming excessive resources. Malfunctioning of the hardware resources, such as the hard disk sectors resulting in loss of important data. be containing bad Uneven usage of hardware resources, for example one storage device is overused and another storage device is underused. Excessive network traffic that results in network congestion. Incorrect usage of queries results in the wastage of resources utilized during the execution of the queries, for example executing a query resulting in a syntax error wastes the resources utilized during the execution of that query. Administering and Troubleshooting SQL Server 2000 3B.18 Transferring large amount of data between the client and the server. Excessive use of locks on resources that result in under-utilization of these resources. Poor database design results in redundancy of data. This results in wastage of resources utilized by the database. Monitoring Resource Usage Optimizing and Troubleshooting SQL Server Monitoring Resource Usage • ©NIIT 3B.19 These objects are categorized in to the following three categories: • Memory objects and counters • Input/Output objects and counters • Processor objects and counters Optimizing and troubleshooting SQL server Lesson 3B/ Slide 15 of 51 Administering and Troubleshooting SQL Server 2000 Optimizing and Troubleshooting SQL Server Monitoring Resource Usage (Contd.) • Memory objects and counters You need to monitor the available memory resource and determine whether it is adequate for the processes that are running. • The following table lists the memory objects, their functions, and their values: • Memory Object This Object determines Value and its Interpretation Memory \ Available Mbytes Megabytes of memory presently available for use A low value indicates inadequate memory or memory blocked by a process Memory \ Pages/sec Number of pages accessed from disk or written to disk due to page faults A value more than 20 indicates excessive hard disk paging because of inadequate memory ©NIIT Optimizing and troubleshooting SQL server Lesson 3B/ Slide 16 of 51 Administering and Troubleshooting SQL Server 2000 3B.20 Optimizing and Troubleshooting SQL Server Monitoring Resource Usage (Contd.) Memory Object This Object determines Value and its Interpretation Physical Disk \ Average Disk Queue Length Average numbers of both read and write requests in queue An increase in disk queue that is not accompanied by decrease in memory paging indicates inadequate memory Memory \ Page Faults/sec The rate at which the processor handles the faulty pages A high value indicates inadequate memory Process \ Page faults/sec for SQL Server instance The rate at which the faulty pages occur because of a SQL server process of a SQL Server instance A high value for overall page faults/sec indicates shortage of memory ©NIIT 3B.21 Optimizing and troubleshooting SQL server Lesson 3B/ Slide 17 of 51 Administering and Troubleshooting SQL Server 2000 Optimizing and Troubleshooting SQL Server Monitoring Resource Usage (Contd.) Memory Object This Object determines Value and its Interpretation SQL Server: Memory Manager \ Total Server Memory (KB) The total amount of dynamic memory currently used by SQL Server for its memory buffer If this value is close to the total amount of physical memory of the computer, it indicates shortage of memory SQL server: Buffer Manager \ Total Pages Total number of pages in the buffer A low value indicates inadequate memory for the buffer ©NIIT Optimizing and troubleshooting SQL server Lesson 3B/ Slide 18 of 51 Administering and Troubleshooting SQL Server 2000 3B.22 Optimizing and Troubleshooting SQL Server Monitoring Resource Usage (Contd.) • Input/Output Object This Object determines Value and its Interpretation PhysicalDisk \ %Disk Time Percentage of time during which the hard disk was processing a read or write request A low rate of disk paging accompanied with a high rate of disk usage and disk queuing indicates a disk bottleneck PhysicalDisk \ Average Disk Queue Length Average numbers of both read and write requests that were in queue A low rate of disk paging accompanied with a high rate of disk usage indicates a disk bottleneck ©NIIT 3B.23 Input/Output Objects and Counters • Small Computer System Interface (SCSI) • The following table lists the input/output objects, their functions, and their values: Optimizing and troubleshooting SQL server Lesson 3B/ Slide 19 of 51 Administering and Troubleshooting SQL Server 2000 Optimizing and Troubleshooting SQL Server Monitoring Resource Usage (Contd.) Input/Output Object This Object determines Value and its Interpretation PhysicalDisk \ Current Disk Queue Length Instantaneous numbers of both read and write requests that are queued Used along with PhysicalDisk \ Average Disk Queue Length PhysicalDisk \ Average disk/sec Write Average time to write data to disk, also known as disk latency A value above 20 milliseconds indicates a disk bottleneck PhysicalDisk \ Disk Writes/sec Rate of write operations per second If the rate of disk writes is not close to the hard disk capacity and the disk latency is high, it indicates a faulty disk PhysicalDisk \ Disk Reads/sec Rate of read operations per second If the rate of disk reads is not close to the hard disk capacity and the disk latency is high, it indicates a faulty disk ©NIIT Optimizing and troubleshooting SQL server Lesson 3B/ Slide 20 of 51 Administering and Troubleshooting SQL Server 2000 3B.24 Optimizing and Troubleshooting SQL Server Monitoring Resource Usage (Contd.) • Processor Objects and Counters • To monitor the processor resources, SQL Server 2000 provides you with processor objects. • The following table lists the processor objects, their functions, and their values: Processor Object This Object determines Value and its Interpretation Processor \ % Processor Time Percentage of time the processor spent executing non-idle processes If the rate is more than 75%, it indicates a processor bottleneck System \ processor Queue Length Number of processes in the processor queue A processor queue containing more than two threads indicates a processor bottleneck ©NIIT 3B.25 Optimizing and troubleshooting SQL server Lesson 3B/ Slide 21 of 51 Administering and Troubleshooting SQL Server 2000 Optimizing and Troubleshooting SQL Server Monitoring Resource Usage (Contd.) • • Windows operating system enables you to monitor the performance and usage of the processor, input/output devices, and the memory using the Task Manager and the Performance Monitor. The following are the steps to monitor the usage of hardware resource using the Task Manager of Windows operating system: 1. 2. 3. ©NIIT Right-click the Windows Taskbar. This displays a pop-up menu. Select the Task Manager option. This displays the Windows Task Manager window. The Windows Task Manager window displays the following three tabs: • Applications • Processes • Performance • Networking • Users Optimizing and troubleshooting SQL server Lesson 3B/ Slide 22 of 51 Administering and Troubleshooting SQL Server 2000 3B.26 Optimizing and Troubleshooting SQL Server Monitoring Resource Usage (Contd.) • • ©NIIT 3B.27 The Status column of the list box displays the status of the currently running programs. Windows Task Manager also displays the following three buttons: • End Task: This button enables you to end a task that is not responding. • Switch Task: This button enables you to switch between currently active tasks. • New Task: This button enables you to create a new task. Optimizing and troubleshooting SQL server Lesson 3B/ Slide 23 of 51 Administering and Troubleshooting SQL Server 2000 Optimizing and Troubleshooting SQL Server Monitoring Resource Usage (Contd.) 5. • ©NIIT Click the Processes tab displays the currently active system processes and user processes in the Image Name column of the list box. The list box also displays the following columns: • Image Name: This column displays the name of the process, which is given by the system itself. • User Name: This column displays the name of the process owner. • CPU: This column displays the CPU usage time in percentage. • Mem Usage: This column displays the amount of memory used by each active process. Optimizing and troubleshooting SQL server Lesson 3B/ Slide 24 of 51 Administering and Troubleshooting SQL Server 2000 3B.28 Optimizing and Troubleshooting SQL Server Monitoring Resource Usage (Contd.) 6. The Performance tab displays the following graphical and non-graphical sections. • The different graphical sections of the Performance tab include: • CPU Usage and CPU Usage History • MEM Usage and MEM Usage History • The different non-graphical sections of the Performance tab include: • Totals • Physical Memory (K) • Commit Charge (K) • Kernel Memory (K) ©NIIT 3B.29 Optimizing and troubleshooting SQL server Lesson 3B/ Slide 25 of 51 Administering and Troubleshooting SQL Server 2000 Optimizing and Troubleshooting SQL Server Monitoring Resource Usage (Contd.) • 7. ©NIIT The Status Bar of the Windows NT Task Manager displays the following information: • Number of Processes • Total CPU Usage in percentage • Total Mem Usage The networking tab displays information about network traffic in Local Area Connection. The Networking tab shows: • Local Area Connection: This graphical section displays the information about resource utilization. • Adapter Name: This column displays the name of the network adapter. • Network Utilization: This column displays the network resource utilization in percentage. • Link Speed: This column displays the connection speed for the Local Area Connection. • State: This column displays the state of the network connection. Optimizing and troubleshooting SQL server Lesson 3B/ Slide 26 of 51 Administering and Troubleshooting SQL Server 2000 3B.30 Optimizing and Troubleshooting SQL Server Monitoring Resource Usage (Contd.) 6. The User tab displays information about various users and sessions. The information is displayed in a table with following fields: • User: This field displays the name of the users currently logged onto the computer. • ID: This field displays the numeric session identifier. • Status: This field displays the status of a session. • Client Name: This field displays the name of the client computer. • Session: This field displays the session name on the computer. ©NIIT Optimizing and troubleshooting SQL server Lesson 3B/ Slide 27 of 51 The hardware resources include memory, processor, and input/output devices. You need to monitor the usage of these resources so that SQL Server 2000 functions properly. To monitor the performance of these hardware resources, you need to identify the problem objects of these resources and their values. These objects are categorized in to the following three categories: Memory objects and counters Input/Output objects and counters Processor objects and counters Memory Objects and Counters You need to monitor the available memory resource and determine whether it is adequate for the processes that are running. SQL Server 2000 provides certain objects and their values that can determine the usage of memory. These memory objects can be monitored using the System Monitor tool of Windows 2000 operating system. 3B.31 Administering and Troubleshooting SQL Server 2000 The following table lists the memory objects, their functions, and their values: Memory Object This Object determines Value and its Interpretation Memory \ Available Mbytes Megabytes of memory presently available for use. A low value indicates inadequate memory or memory blocked by a process. Memory \ Pages/sec Number of pages accessed from disk or written to disk due to page faults. A value more than 20 indicates excessive hard disk paging because of inadequate memory. PhysicalDisk \ Average Disk Queue Length Average numbers of both read and write requests in queue. An increase in disk queue that is not accompanied by decrease in memory paging indicates inadequate memory. Memory \ Page Faults/sec The rate at which the processor handles the faulty pages. A high value indicates inadequate memory. Process \ Page faults/sec for SQL Server instance The rate at which the faulty pages occur because of a SQL server process of a SQL Server instance. A high value for overall page faults/sec indicates shortage of memory. SQL Server: Memory Manager \ Total Server Memory (KB) The total amount of dynamic memory currently used by SQL Server for its memory buffer. If this value is close to the total amount of physical memory of the computer, it indicates shortage of memory. SQL Server: Buffer Manager \ Total Pages Total number of pages in the buffer. A low value indicates inadequate memory for the buffer. Administering and Troubleshooting SQL Server 2000 3B.32 Input/Output Objects and Counters You need to monitor the input/output-bound disk subsystems. If these disk subsystems are over-loaded, they cause decreases system performance and disk queuing. SQL Server 2000 provides certain objects and their values that can determine the usage and performance of input/output subsystems. You can monitor these objects and determine the performance of the input/output subsystems on the basis of their values using the System Monitor of Windows 2000 operating system. The following table lists the input/output objects, their functions, and their values: Input/Output Object This Object determines Value and its Interpretation PhysicalDisk \ %Disk Time Percentage of time during which the hard disk was processing a read or write request. A low rate of disk paging accompanied with a high rate of disk usage and disk queuing indicates a disk bottleneck. PhysicalDisk \ Average Disk Queue Length Average numbers of both read and write requests that were in queue. A low rate of disk paging accompanied with a high rate of disk usage indicates a disk bottleneck. PhysicalDisk \ Current Disk Queue Length Instantaneous numbers of both read and write requests that are queued. Used along with PhysicalDisk \ Average Disk Queue Length. PhysicalDisk \ Average disk/sec Write Average time to write data to disk, also known as disk latency. A value above 20 milliseconds indicates a disk bottleneck. PhysicalDisk \ Disk Writes/sec Rate of write operations per second. If the rate of disk writes is not close to the hard disk capacity and the disk latency is high, it indicates a faulty disk. PhysicalDisk \ Disk Reads/sec Rate of read operations per second. If the rate of disk reads is not close to the hard disk capacity and the disk latency is high, it indicates a faulty disk. 3B.33 Administering and Troubleshooting SQL Server 2000 Processor Objects and Counters You need to monitor the processor resources to determine the performance of the system. Inadequate processors resources lead to decreased system efficiency and performance. To monitor the processor resources, SQL Server 2000 provides you with processor objects. These objects have certain values that indicate the performance level of the processor and also indicate any system bottlenecks that may be present. These objects can be monitored using the System Monitor of Windows 2000 operating system. The following table lists the processor objects, their functions, and their values: Processor Object This Object determines Value and its Interpretation Processor \ % Processor Time Percentage of time the processor spent executing nonidle processes. If the rate is more than 75%, it indicates a processor bottleneck. System \ processor Queue Length Number of processes in the processor queue. A processor queue containing more than two threads indicates a processor bottleneck. Windows operating system enables you to monitor the performance and usage of the processor, input/output devices, and the memory using the Task Manager and the System Monitor. The following are the steps to monitor the usage of hardware resource using the Task Manager of Windows operating system: 1. Right-click the Windows Taskbar. This displays a pop-up menu. Administering and Troubleshooting SQL Server 2000 3B.34 2. Select the Task Manager option. This displays the Windows Task Manager window, as shown. The Windows Task Manager window displays the following five tabs: Applications Processes Performance Networking Users The Status column of the list box displays the status of the currently running programs. Windows Task Manager also displays the following three buttons: End Task: This button enables you to end a task that is not responding. Switch To: This button enables you to switch between currently active tasks. New Task: This button enables you to create a new task. 3B.35 Administering and Troubleshooting SQL Server 2000 You can observe the status of the currently active system processes from the Status column to monitor the performance of sensitive system processes, such as SQLSERVR.EXE and WINLOGON.EXE. 3. Click the Processes tab to display the currently active system processes and user processes in the Image Name column of the list box, as shown. The list box also displays the following columns: Image Name: This column displays the name of the process, which is given by the system itself. User Name: This column displays the name the process owner. CPU: This column displays the CPU usage time in percentage. Mem Usage: This column displays the amount of memory used by each active process. Observe the CPU time and memory usage of these system processes from the CPU Time and Mem Usage columns respectively. You can use these inputs to calculate the amount of memory used by the currently active system process and estimate the amount of memory available for installation of other applications. Administering and Troubleshooting SQL Server 2000 3B.36 4. The Performance tab displays the following graphical and non-graphical sections, as shown. The different graphical sections of the Performance tab include: CPU Usage and CPU Usage History PF Usage and Page File Usage History The different non-graphical sections of the Performance tab include: Totals: This section displays the number of the currently Threads, and Processes. active Handles, Physical Memory (K): This section displays the total amount of Total, Available, and System Cache. Commit Charge (K): This section displays the total amount of Total, Limit, and Peak commit charge. Commit Charge indicates the memory allocated to the system and user processes. Kernel Memory (K): This section displays the Total, Paged, and Nonpaged memory. 3B.37 Administering and Troubleshooting SQL Server 2000 Observe the graphical representation of CPU usage history and memory usage history displayed on the screen to estimate the memory availability for installation of other applications. The Status Bar of the Windows Task Manager displays the following information: Number of Processes Total CPU Usage in percentage Total Mem Usage 5. The Networking tab displays the following graphical and non-graphical sections, as shown. The Networking tab shows: Local Area Connection: This graphical section displays the information about resource utilization. Adapter Name: This column displays the name of the network Network Utilization: This column displays the network percentage. adapter. resource utilization in Administering and Troubleshooting SQL Server 2000 3B.38 Link Speed: This column displays the connection speed for the Local Area Connection. State: This column displays the state of the network connection. 6. The Users tab displays a table, as shown. The various fields of the table are: User: This field displays the name of the users currently logged onto the computer. ID: This field displays the numeric session identifier. Status: This field displays the status of a session. Client Name: This field displays the name of the client computer. Session: This field displays the session name on the computer. 7. Click the Close button to close the Windows Task Manager window. 3B.39 Administering and Troubleshooting SQL Server 2000 In the Users tab page of the Windows Task Manager, scroll horizontally to view information from all the columns. INSTRUCTOR NOTES Next, tell the students about monitoring hardware resources using the Performance Monitor, present the students with a business problem that requires monitoring the hardware resources of the system using the system monitor. Discuss the solution of the problem in detail. Administering and Troubleshooting SQL Server 2000 3B.40 MONITORING HARDWARE RESOURCES USAGE USING THE SYSTEM MONITOR WIZARD Optimizing and Troubleshooting SQL Server Monitoring Hardware Resources Usage using the System Monitor The System Administrator of Mac Aluminum, Inc. wants to monitor the hardware resources usage of computers running SQL Server 2000. He wants to monitor the usage using the Performance tool of the Windows 2000 operating system. He wants to monitor the %Idle Time, Interrupt/sec, and Buffer cache hit ratio Transactions performance counters in the form of a chart. These counters should be selected from the system on which the system administrator is working. The system administrator also wants to monitor the resource usage of multiple instances of SQL Server 2000. ©NIIT Optimizing and troubleshooting SQL server Lesson 3B/ Slide 28 of 51 Problem Statement The System Administrator of Mac Aluminum, Inc. wants to monitor the hardware resources usage of computers running SQL Server 2000. He wants to monitor the usage using the Performance tool of the Windows 2000 operating system. He wants to monitor the %Idle Time, Interrupt/sec, and Buffer cache hit ratio Transactions performance counters in the form of a chart. These counters should be selected from the system on which the system administrator is working. The system administrator also wants to monitor the resource usage of multiple instances of SQL Server 2000. 3B.41 Administering and Troubleshooting SQL Server 2000 Solution Optimizing and Troubleshooting SQL Server Task List • • Start the System Monitor Monitor the hardware resources ©NIIT Optimizing and troubleshooting SQL server Lesson 3B/ Slide 29 of 51 To solve the preceding problem, perform the following tasks: 1. Start the System Monitor. 2. Monitor the hardware resources. Administering and Troubleshooting SQL Server 2000 3B.42 1: Start the System Monitor Action: 1. To start the Performance Monitor, select StartÆ All ProgramsÆ Administrative ToolsÆ Performance. This displays the Performance window, as shown. Add icon 2: Monitor the hardware resources. Action: 1. Click the Add icon from the tool bar of the screen performance monitor screen. The Add Counters dialog box displays the following options, as shown: Use local computer counters: This option enables you to use the counters stored in local computer. 3B.43 Administering and Troubleshooting SQL Server 2000 Select counters from computer: This option enables you to select counters from any computer. Performance object: This option enables you to select the required performance objects from the drop-down list box. All counters: This option displays the graphical format of all the counters. Select counters from list: This option allows you to select the required counters from the drop-down list box. All instances: This option enables you to apply the selected counters to all the instances of SQL Server 2000. Select instances from list: This option enables you to apply the selected counters to the selected instances of SQL Server 2000. 2. From the Performance object drop-down list box, select the Processor option. 3. From the Select counters from the list list box select the % Idle Time option. 4. Click the Add button and then click the Close button. Administering and Troubleshooting SQL Server 2000 3B.44 5. The Performance window shows the working of the processor in the form of a chart, as shown. 6. Similarly add the Interrupts/sec counter from the Processor Performance object and Buffer cache hit ratio counter from the SQLSERVER: Buffer Manager performance counters. 7. The Idle Time, Interrupts/sec, and Buffer hit cache ratio counters are displayed in the chart, as shown. 3B.45 Administering and Troubleshooting SQL Server 2000 INSTRUCTOR NOTES Additional Inputs Using the Performance Monitor The Performance Monitor of the Windows 2000 operating system is used to monitor the usage of hardware resources in SQL Server 2000. It is also used to monitor realtime performance data or record data to the disk for later analysis. It is also used to detect inadequate resources and errors that require immediate attention. Performance Monitor includes the following objects, instances, and counters to monitor the hardware resource usage: Performance Objects: These are associated with hardware resources, such as memory, CPU, and input/output devices. They are also associated with the Windows services, such as server work queue. Counters: These are data items that that are associated with each performance object. Instances: These are multiple performance objects of same type, such as multiple processors. Administering and Troubleshooting SQL Server 2000 3B.46 INSTRUCTOR NOTES Tell the students about the need to monitor the system activity of SQL Server 2000 from the user’s perspective and the system’s perspective. Also tell the students about the various factors that that affect SQL Server 2000 system activity. Then, discuss about tracking system activity using the performance objects of SQL Server 2000. Explain the available performance objects, such as SQL Server: Buffer Manager, SQL Server: Access Methods, or SQL Server: Backup Device and the activities they monitor. Also, explain how the Task Manager monitors the system activity of SQL Server 2000. 3B.47 Administering and Troubleshooting SQL Server 2000 MONITORING SQL SERVER 2000 SYSTEM ACTIVITY Optimizing and Troubleshooting SQL Server Monitoring SQL Server 2000 System Activity • • • To monitor the performance of a SQL Server 2000 system, it is essential to understand the basic performance objectives of installing SQL Server 2000. The following are the performance objectives of any SQL Server 2000 installation: • Reducing the request response time • Maximizing system throughput To achieve these performance objectives, it is essential to monitor the SQL Server 2000 system activity, identify the possible problem areas, and provide a suitable solution to optimize the system performance. ©NIIT Optimizing and troubleshooting SQL server Lesson 3B/ Slide 30 of 51 Administering and Troubleshooting SQL Server 2000 3B.48 Optimizing and Troubleshooting SQL Server Monitoring SQL Server 2000 System Activity (Contd.) • The following table lists the various performance objects, the system activity they monitor and measure, provided by SQL Server 2000: SQL Server Performance Object This object measures This object monitors SQL Server: Access Methods The access to logical database objects of SQL Server, such as data pages and index pages. It also measures the allocation of these logical database objects. The index and query efficiency based on types of pages accessed, page splits, and page allocations. ©NIIT 3B.49 Optimizing and troubleshooting SQL server Lesson 3B/ Slide 31 of 51 Administering and Troubleshooting SQL Server 2000 Optimizing and Troubleshooting SQL Server Monitoring SQL Server 2000 System Activity (Contd.) SQL Server Performance Object This object measures This object monitors SQL Server: Backup Device Backup and restore performance on a per-device basis The throughput and progress of the backup and restore processes on a perdevice basis SQL server: Buffer Manager The use of memory buffer that includes free buffer pages and buffer cache hit ratio The efficiency of query performance, inadequacy of physical memory, and frequency of disk reads ©NIIT Optimizing and troubleshooting SQL server Lesson 3B/ Slide 32 of 51 Administering and Troubleshooting SQL Server 2000 3B.50 Optimizing and Troubleshooting SQL Server Monitoring SQL Server 2000 System Activity (Contd.) SQL Server Performance Object This object measures This object monitors SQL Server: Cache Manager The memory used for caching stored procedures, TransactSQL statements, and triggers The efficiency of plan caching and its reusability SQL Server: Databases Database activity that includes active transactions, bulk copy throughput, transaction log activities, and backup and restore throughput The level of user activity in a database, autogrowth and autoshrink operations, and performance of backup and restore operations ©NIIT 3B.51 Optimizing and troubleshooting SQL server Lesson 3B/ Slide 33 of 51 Administering and Troubleshooting SQL Server 2000 Optimizing and Troubleshooting SQL Server Monitoring SQL Server 2000 System Activity (Contd.) SQL Server Performance Object This object measures This object monitors SQL Server: General Statistics General server-wide activity that includes connections and logins The entire connection activity SQL Server: Latches Internal locks used by SQL Server 2000 that are known as Latches Performance bottlenecks and the time required to grant these internal locks ©NIIT Optimizing and troubleshooting SQL server Lesson 3B/ Slide 34 of 51 Administering and Troubleshooting SQL Server 2000 3B.52 Optimizing and Troubleshooting SQL Server Monitoring SQL Server 2000 System Activity (Contd.) SQL Server Performance Object This object measures This object monitors SQL Server: Locks Individual lock requests mode by SQL Server 2000 that also includes deadlocks The total number and types of locks SQL Server: Memory Manager The total memory used, which includes total available memory and the memory granted for use The use of memory by the databases and database objects. It also monitors the shortage of memory, if it exists ©NIIT 3B.53 Optimizing and troubleshooting SQL server Lesson 3B/ Slide 35 of 51 Administering and Troubleshooting SQL Server 2000 Optimizing and Troubleshooting SQL Server Monitoring SQL Server 2000 System Activity (Contd.) SQL Server Performance Object This object measures This object monitors SQL Server: SQL Statistics Transact-SQL queries, which include Transact-SQL compilations, Transact-SQL recompilations, and total number of batches The efficiency and speed of query compilation of the Query Optimizer SQL Server: User Settable Objects The custom counters based on Transact-SQL statements or stored procedures Custom information ©NIIT Optimizing and troubleshooting SQL server Lesson 3B/ Slide 36 of 51 Administering and Troubleshooting SQL Server 2000 3B.54 Optimizing and Troubleshooting SQL Server Monitoring SQL Server 2000 System Activity (Contd.) • The following factors of SQL Server 2000 need to be identified and monitored for better performance: • • • • • ©NIIT 3B.55 Identify applications that are consuming excessive system resources, such as RAM and Processor time. Identify incorrect or poorly written queries. Determine the amount of data being transferred from the client to the server. Identify faults in database design. Identify deadlock situations and possible causes for the deadlock. Optimizing and troubleshooting SQL server Lesson 3B/ Slide 37 of 51 Administering and Troubleshooting SQL Server 2000 Optimizing and Troubleshooting SQL Server Monitoring SQL Server 2000 System Activity (Contd.) • • • • Identify the amount of usage of system resources and determine whether the use of these resources is balanced or not. Identify the availability and usage of hardware resources. Identify faulty hardware resource. Identify network problems and network congestion. ©NIIT Optimizing and troubleshooting SQL server Lesson 3B/ Slide 38 of 51 To monitor the performance of a SQL Server 2000 system, it is essential to understand the basic performance objectives of installing SQL Server 2000. The following are the performance objectives of any SQL Server 2000 installation: Reducing the request response time: The response time is defined as the time taken to deliver the result of a request to the user. The objective of SQL Server 2000, from users’ perspective, is to minimize the response time for any request, such as a Transact-SQL query. Maximizing system throughput: System throughput is defined as the total numbers of request processed in a given time period. The objective of SQL Server 2000, from the system’s perspective, is to maximize the total system throughput so that maximum numbers of requests are processed within a specified time period. To achieve these performance objectives, it is essential to monitor the SQL Server 2000 system activity, identify the possible problem areas, and provide a suitable solution to optimize the system performance. To monitor and optimize the SQL Server 2000 system activity, SQL Server 2000 provides you with number of monitoring tools, such as SQL Profiler, SQL Server Enterprise Manager, and Task Manager. Administering and Troubleshooting SQL Server 2000 3B.56 To monitor the SQL Server 2000 system activity, you need to monitor and analyze the trends of different system activities. SQL Server 2000 provides certain objects and counters that can be used to analyze these trends. Tracking SQL Server 2000 System Activity SQL Server 2000 provides performance objects to track its system activity. These objects are used to track and monitor various system activities. The following table lists the various performance objects, the system activity they monitor and measure, provided by SQL Server 2000: SQL Server Performance Object This Object Measures This Object Monitors SQL Server: Access Methods The access to logical database objects of SQL Server, such as data pages and index pages. It also measures the allocation of these logical database objects. The index and query efficiency based on types of pages accessed, page splits, and page allocations. SQL Server: Backup Device Backup and restore performance on a per-device basis. The throughput and progress of the backup and restore processes on a per-device basis. SQL Server: Buffer Manager The use of memory buffer that includes free buffer pages and buffer cache hit ratio. The efficiency of query performance, inadequacy of physical memory, and frequency of disk reads. SQL Server: Cache Manager The memory used for caching stored procedures, TransactSQL statements, and triggers. The use of cache memory in the system. SQL Server: Databases Database activity that includes active transactions, bulk copy throughput, transaction log activities, and backup and restore throughput. The level of user activity in a database, autogrowth and autoshrink operations, and performance of backup and restore operations. 3B.57 Administering and Troubleshooting SQL Server 2000 SQL Server Performance Object This Object Measures This Object Monitors SQL Server: General Statistics General server-wide activity that includes connections and logins. The entire connection activity. SQL Server: Latches Internal locks used by SQL Server 2000 that are known as Latches. Performance bottlenecks and the time required to grant these internal locks. SQL Server: Locks Individual lock requests mode by SQL Server 2000 that also includes deadlocks. The total number and types of locks. SQL Server: Memory Manager The total memory used, which includes total available memory and the memory granted for use. The use of memory by the databases and database objects. It also monitors the shortage of memory, if it exists. SQL Server: SQL Statistics Transact-SQL queries, which include Transact-SQL compilations, Transact-SQL recompilations, and total number of batches. The efficiency and speed of query compilation of the Query Optimizer. SQL Server: User Settable Objects The custom counters based on Transact-SQL statements or stored procedures. Custom information. Monitoring SQL Server 2000 System Activity Using Task Manager There are certain factors that affect the performance of SQL Server 2000. These factors need to be identified to analyze the system performance. The following factors of SQL Server 2000 need to be identified and monitored: Identify applications that are consuming excessive system RAM and Processor time. resources, such as Identify incorrect or poorly written queries. Administering and Troubleshooting SQL Server 2000 3B.58 Determine the amount of data being transferred from the client to the server. Identify faults in database design. Identify deadlock situations and possible causes for the deadlock. Identify the amount of usage of system resources and determine whether the use of these resources is balanced or not. Identify the availability and usage of hardware resources. Identify faulty hardware resource. Identify network problems and network congestion. To monitor the status of the currently active system processes, you need to perform following steps: 1. Right-click the Windows Task Bar. This displays a pop-up menu. 2. Select the Task Manager option from the pop-up menu. This displays the Windows Task Manager window. The task manager is the component of Windows operating system that is used to monitor the usage of memory and processor resources by each process and application being executed on the system. You can monitor the SQL Server 2000 system activity by clicking the Applications tab, Processes tab, and the Performance tab. The Task Manager is not available with the Windows Me and Windows 98 edition of Windows operating system. INSTRUCTOR NOTES Finally, tell the students about monitoring and troubleshooting current locking and user activity of SQL Server 2000 using the SQL Server 2000 Enterprise Manager. 3B.59 Administering and Troubleshooting SQL Server 2000 MONITORING AND TROUBLESHOOTING CURRENT LOCKING AND USER ACTIVITY Optimizing and Troubleshooting SQL Server Monitoring and Troubleshooting Current Locking and User Activity The Chicago branch of Mac. Aluminum is the largest branch in comparison with the other branches, consisting of 30 workstations. These workstations are connected with each other over the network and they are also connected with the headquarters, at Denver. Mark, the Manager, Chief Operations, of the Chicago branch wants to incorporate 10 more workstations in to the network for which he wants to monitor the current system activity. He asks James, the system administrator at the Chicago branch, to monitor the system activity of SQL Server 2000 database of all the workstations. James wants to use SQL Server 2000 Enterprise Manager to monitor the system activity of SQL Server 2000. ©NIIT Optimizing and troubleshooting SQL server Lesson 3B/ Slide 39 of 51 Administering and Troubleshooting SQL Server 2000 3B.60 Optimizing and Troubleshooting SQL Server Monitoring and Troubleshooting Current Locking and User Activity (Contd.) He wants to monitor the Process ID and the process users. He also wants to monitor the number of processes used by the system itself for analysing the system performance. He also wants to view the locks held by different active processes and objects, especially the locks held by the process named SPID 51 and the master.dbo object of the Master system database. Based on all these monitoring events, James will send a report of the status of SQL Server 2000 system activity, to Mark. ©NIIT Optimizing and troubleshooting SQL server Lesson 3B/ Slide 40 of 51 Problem Statement The Chicago branch of Mac. Aluminium is the largest branch in comparison with the other branches, consisting of 30 workstations. These workstations are connected with each other over the network and they are also connected with the headquarters, at Denver. Mark, the Manager, Chief Operations, of the Chicago branch wants to incorporate 10 more workstations in to the network for which he wants to monitor the current system activity. He asks James, the system administrator at the Chicago branch, to monitor the system activity of SQL Server 2000 database of all the workstations. James wants to use SQL Server 2000 Enterprise Manager to monitor the system activity of SQL Server 2000. He wants to monitor the Process ID and the process users. He also wants to monitor the number of processes used by the system itself for analysing the system performance. He also wants to view the locks held by different active processes and objects, especially the locks held by the process named SPID 51 and the master.dbo object of the Master system database. Based on all these monitoring events, James will send a report of the status of SQL Server 2000 system activity, to Mark. 3B.61 Administering and Troubleshooting SQL Server 2000 Solution Optimizing and Troubleshooting SQL Server Task List • • • • ©NIIT Monitor the details of the current activity. Monitor all the currently active processes. Monitor the locked database objects. Verify the status of SQL Server 2000 system activity. Optimizing and troubleshooting SQL server Lesson 3B/ Slide 41 of 51 To solve the preceding problem, perform the following tasks: 1. Monitor the details of the current activity. 2. Monitor all the currently active processes. 3. Monitor the locked database objects. 4. Verify the status of SQL Server 2000 system activity. Administering and Troubleshooting SQL Server 2000 3B.62 1: Monitor the details of the current activity Action: You use SQL Server 2000 Enterprise Manager to monitor the current locking and user activity. In addition, you can monitor the performance of SQL Server 2000 and troubleshoot any problems related to processes and locks. 1. Select StartÆ All ProgramsÆ Microsoft SQL ServerÆ Enterprise Manager, to invoke the Enterprise Manager. 2. From the Console Root option, expand the Microsoft SQL Servers option. Then expand the SQL Server Group option. 3. Expand the SQL Server default instance and then expand the Management option to display its components, as shown. 3B.63 Administering and Troubleshooting SQL Server 2000 4. From the Management option, select the Current Activity option. The current date is also displayed along with this option, as shown. 2: Monitor all the currently active processes. The Current Activity option displays the following three components in the details pane: Process Info Locks / Process ID Locks / Objects Action: Administering and Troubleshooting SQL Server 2000 3B.64 1. Click the Process Info option in the details pane to display the details of all the currently active processes, as shown. 2. Observe the Process ID and the User columns to identify which process is being used by which user. Count the number of processes that are being used by the system itself. 3. Click the Locks / Process ID option in the details pane to display all the currently active processes in the details pane. The process number identifies a process and is provided by the system itself. 3B.65 Administering and Troubleshooting SQL Server 2000 4. Click the process named as SPID 51 to view the locks held by that process, as shown. The lock held by this process is of type DB signifying a database level lock. The output might vary depending on the Spid assigned. There can be different Spid for different servers. 3: Monitor the locked database objects. Action: 1. Expand the Locks / Object option to display all the database objects that are locked. Administering and Troubleshooting SQL Server 2000 3B.66 2. Click the master.dbo object to view the locks held by this object in the details pane, as shown. The lock held by this process is the system specified TAB type, which is a table level lock. 4: Verify the status of the SQL Server 2000 system activity Result: Depending on the number of processes used by the system and the number of locks held by the master.dbo object of Master system database, James, generates a report for Mark. In this report he gives the status information of SQL Server 2000 system activity and allows incorporation of 10 new workstations in to the network 3B.67 Administering and Troubleshooting SQL Server 2000 INSTRUCTOR NOTES Additional Inputs Current Activity The Current Activity option in the Console tree of SQL Server 2000 Enterprise Manager contains the Process Info option. The Process Info option displays the details of the all the process in the details pane. The following table lists the information displayed by the Process Info option in the details pane: Column Name Description Process ID This refers to the SQL Server Process ID (SPID) of the process. Context ID This refers to the Execution Context ID (ECID) of the sub-thread operating on the behalf of the process. User This refers to the User ID of the user who executed the command to start the process. Database This refers to the current database context of the process. Status This refers to the process status, such as running, waiting, sleeping, or background. Open Transactions This refers to the total number of open transactions for the process. Command This refers to the SQL Server command that is currently executing the process. Application This refers to the application program that the process is using. Wait Time This refers to the wait time for a process. The wait time is measured in milliseconds. Wait Type This refers to the string indicating the current or last wait type for the process. Administering and Troubleshooting SQL Server 2000 3B.68 Wait Resource This refers to the textual representation of the lock resource, such as Row Identifier (RID). CPU This refers to the cumulative processor time for the process. Physical I/O This refers to the cumulative disk read and write operations performed by the process. Memory Usage This refers to the total number of pages in the procedure cache that are presently allocated to the process. Login Time This refers to the time when a client process logged in to the server. For server processes, this refers to the time when the server started. Last Batch This refers to the last time a client process executed the EXECUTE command or a remote stored procedure call. Host This refers to the name of the computer that initiated the process. Network Library This refers to the Net-library used by the client to start the process. Network Address This refers to the network address on the client computer that started the process. Blocked By This refers to the SPID of the blocking process for the specified process. Blocking This refers to the SPID of the process that is being blocked by the specified process. 3B.69 Administering and Troubleshooting SQL Server 2000 INSTRUCTOR NOTES FAQs 1. Do hardware and software RAID provide all the four levels of RAID? Ans: No, RAID levels 0,1, and 5 are provided by both hardware and software RAID, but RAID level 10 is provided by only hardware RAID. 2. What is a deadlock? Ans: A deadlock is a situation when two processes holding different locks on different resources, block each other from accessing the locked resource. When SQL Server 2000 detects a deadlock, it terminates one of the processes and continues with the other process. 3. How do poorly written applications affect the system activity of SQL Server 2000? Ans: The applications that are poorly written cause deadlocks when different processes access these applications. The deadlocks decrease system performance and efficiency, as valuable resources are not utilized. 4. Does large amount of data transfer between the client and the server adversely affect the system activity? Ans: Yes, transferring large amount of data between the client and the server using incorrect queries can adversely affect the system activity. Administering and Troubleshooting SQL Server 2000 3B.70 SUMMARY Optimizing and Troubleshooting SQL Server Summary In this lesson, you learned that: • You need to optimize usage of hardware resources, such as CPU and memory so that SQL Server 2000 functions properly and provides the required output. • Optimizing hardware resource usage in SQL Server 2000 allows you to identify: • Hardware utilization • Task scheduling • Load balancing ©NIIT 3B.71 Optimizing and troubleshooting SQL server Lesson 3B/ Slide 42 of 51 Administering and Troubleshooting SQL Server 2000 Optimizing and Troubleshooting SQL Server Summary (Contd.) • • • The advantages of storing data on multiple disks are: • Data recoverability • Increased system performance and efficiency • Fault tolerance SQL Server 2000 disk subsystem is of the following two types: • SCSI disk subsystem • EDI disk subsystem Bottleneck is defined as a situation when multiple databases are competing for a single resource at one instance. ©NIIT Optimizing and troubleshooting SQL server Lesson 3B/ Slide 43 of 51 Administering and Troubleshooting SQL Server 2000 3B.72 Optimizing and Troubleshooting SQL Server Summary (Contd.) • Some of the reasons to monitor the hardware resources are : • Inadequate hardware resources may be over-loading SQL Server 2000 unnecessarily, for example insufficient memory resource may lead to loss of important data. • Additional server applications, such as Internet Information Server may be consuming excessive resources. • Malfunctioning of the hardware resources, such as the hard disk containing bad sectors resulting in loss of important data. • Uneven usage of hardware resources, for example one storage device is overused and another storage device is underused. ©NIIT 3B.73 Optimizing and troubleshooting SQL server Lesson 3B/ Slide 44 of 51 Administering and Troubleshooting SQL Server 2000 Optimizing and Troubleshooting SQL Server Summary (Contd.) • Objects are used to monitor the performance and usage of hardware resources. Objects are categorized in to the following three categories: • Memory objects and counters • Input/Output objects and counters • Processor objects and counters ©NIIT Optimizing and troubleshooting SQL server Lesson 3B/ Slide 45 of 51 Administering and Troubleshooting SQL Server 2000 3B.74 Optimizing and Troubleshooting SQL Server Summary (Contd.) • The memory objects are: • Memory \ Available Mbytes • Memory \ Pages/sec • PhysicalDisk \ Average Disk Queue Length • Memory \ Page Faults/sec • Process \ Page faults/sec for SQL Server instance • SQL Server: Memory Manager\ Total Server Memory • SQL Server: Buffer Manager\Total Pages ©NIIT 3B.75 Optimizing and troubleshooting SQL server Lesson 3B/ Slide 46 of 51 Administering and Troubleshooting SQL Server 2000 Optimizing and Troubleshooting SQL Server Summary (Contd.) • The input/output objects are: • • • • • • ©NIIT PhysicalDisk PhysicalDisk PhysicalDisk PhysicalDisk PhysicalDisk PhysicalDisk \ %Disk Time \ Average Disk Queue Length \ Current Disk Queue Length Write\ Average disk/sec \ Disk Writes/sec \ Disk Reads/sec Optimizing and troubleshooting SQL server Lesson 3B/ Slide 47 of 51 Administering and Troubleshooting SQL Server 2000 3B.76 Optimizing and Troubleshooting SQL Server Summary (Contd.) • • The processor objects are: • Processor \ % Processor Time • System \ processor Queue Length You can monitor hardware resources and their performance using: • Task Manager • Performance Monitor ©NIIT 3B.77 Optimizing and troubleshooting SQL server Lesson 3B/ Slide 48 of 51 Administering and Troubleshooting SQL Server 2000 Optimizing and Troubleshooting SQL Server Summary (Contd.) In this lesson, you learned that: • You need to monitor and optimize SQL Server system activity to achieve the following two objectives: • Reducing response time • Maximizing system throughput • Some of the factors that affect SQL Server 2000 system activity are: • Identify the availability and usage of hardware resources. • Identify applications that are consuming excessive system resources, such as RAM and Processor time. ©NIIT Optimizing and troubleshooting SQL server Lesson 3B/ Slide 49 of 51 Administering and Troubleshooting SQL Server 2000 3B.78 Optimizing and Troubleshooting SQL Server Summary (Contd.) • • • Identify the amount of usage of system resources and determine whether the use of these resources is balanced or not. Identify faulty hardware resource. You can track SQL Server system activity using the performance objects provided by SQL Server 2000. Some of the performance objects are: • SQL Server: Access Methods • SQL Server: Backup Device • SQL Server: Buffer Manager • SQL Server: Cache Manager • SQL Server: Databases ©NIIT 3B.79 Optimizing and troubleshooting SQL server Lesson 3B/ Slide 50 of 51 Administering and Troubleshooting SQL Server 2000 Optimizing and Troubleshooting SQL Server Summary (Contd.) • You can monitor and optimize SQL Server 2000 system activity using the following tools: • Task Manager ©NIIT Optimizing and troubleshooting SQL server Lesson 3B/ Slide 51 of 51 In this lesson, you have learnt that: You need to optimize usage of hardware resources, such as CPU and memory so that SQL Server 2000 functions properly and provides the required output. Optimizing hardware resource usage in SQL Server 2000 allows you to identify: x x x x Hardware utilization Task scheduling Load balancing You can optimize the hardware resource usage using the following techniques: x Placing data on multiple disks x Configuring DQL Server 2000 disk subsystem x Resolving system bottlenecks The advantages of storing data on multiple disks are: x x x Data recoverability Increased system performance and efficiency Fault tolerance Administering and Troubleshooting SQL Server 2000 3B.80 SQL Server 2000 disk subsystem is of the following two types: x SCSI disk subsystem x EDI disk subsystem Bottleneck is defined as a situation when multiple databases are competing for a single resource at one instance. Some of the reasons to monitor the hardware resources are: x Inadequate hardware resources may be over-loading SQL Server 2000 unnecessarily, for example insufficient memory resource may lead to loss of important data. x Additional server applications, such as Internet Information Server may be consuming excessive resources. x Malfunctioning of the hardware resources, such as the hard disk containing bad sectors resulting in loss of important data. x Uneven usage of hardware resources, for example one storage device is overused and another storage device is underused. Objects are used to monitor the performance and usage of hardware resources. Objects are categorized in to the following three categories: x Memory objects and counters x Input/Output objects and counters x Processor objects and counters The memory objects are: x Memory \ Available Mbytes x Memory \ Pages/sec x PhysicalDisk \ Average Disk Queue Length x Memory \ Page Faults/sec x Process \ Page faults/sec for SQL Server instance x SQL Server: Memory Manager\ Total Server Memory x SQL Server: Buffer Manager\Total Pages The input/output objects are: x PhysicalDisk \ %Disk Time x PhysicalDisk \ Average Disk Queue Length x PhysicalDisk \ Current Disk Queue Length x PhysicalDisk Write\ Average disk/sec x PhysicalDisk \ Disk Writes/sec x PhysicalDisk \ Disk Reads/sec The processor objects are: 3B.81 Administering and Troubleshooting SQL Server 2000 x Processor \ % Processor Time x System \ processor Queue Length You can monitor hardware resources and their performance using: x Task Manager x Performance Monitor You need to monitor and optimize SQL Server system following two objectives: x Reducing response time x Maximizing system throughput Some of the factors that affect SQL Server 2000 activity to achieve the system activity are: x x Identify the availability and usage of hardware resources. x Identify the amount of usage of system resources and determine whether the use of these resources is balanced or not. Identify applications that are consuming excessive system resources, such as RAM and Processor time. x Identify faulty hardware resource. You can track SQL Server system activity using the performance objects provided by SQL Server 2000. Some of the performance objects are: x SQL Server: Access Methods x SQL Server: Backup Device x SQL Server: Buffer Manager x SQL Server: Cache Manager x SQL Server: Databases You can monitor and optimize SQL Server 2000 Manager tool. system activity using the Task You can monitor and troubleshoot the current locking and user activity using the SQL Server Enterprise Manager. Administering and Troubleshooting SQL Server 2000 3B.82 [...]... provide fast read and write operations •It is used to enable fast and accurate data recoverability Optimizing and troubleshooting SQL server Lesson 3B/ Slide 10 of 51 Administering and Troubleshooting SQL Server 2000 3B.12 Optimizing and Troubleshooting SQL Server Configuring SQL Server 2000 Disk Subsystem (Contd.) • ©NIIT The SCSI subsystem is used for the following three files in SQL Server 2000: •... categories: • Memory objects and counters • Input/Output objects and counters • Processor objects and counters Optimizing and troubleshooting SQL server Lesson 3B/ Slide 15 of 51 Administering and Troubleshooting SQL Server 2000 Optimizing and Troubleshooting SQL Server Monitoring Resource Usage (Contd.) • Memory objects and counters You need to monitor the available memory resource and determine whether... memory SQL server: Buffer Manager \ Total Pages Total number of pages in the buffer A low value indicates inadequate memory for the buffer ©NIIT Optimizing and troubleshooting SQL server Lesson 3B/ Slide 18 of 51 Administering and Troubleshooting SQL Server 2000 3B.22 Optimizing and Troubleshooting SQL Server Monitoring Resource Usage (Contd.) • Input/Output Object This Object determines Value and its... objects, their functions, and their values: Optimizing and troubleshooting SQL server Lesson 3B/ Slide 19 of 51 Administering and Troubleshooting SQL Server 2000 Optimizing and Troubleshooting SQL Server Monitoring Resource Usage (Contd.) Input/Output Object This Object determines Value and its Interpretation PhysicalDisk \ Current Disk Queue Length Instantaneous numbers of both read and write requests that... processor bottleneck ©NIIT 3B.25 Optimizing and troubleshooting SQL server Lesson 3B/ Slide 21 of 51 Administering and Troubleshooting SQL Server 2000 Optimizing and Troubleshooting SQL Server Monitoring Resource Usage (Contd.) • • Windows operating system enables you to monitor the performance and usage of the processor, input/output devices, and the memory using the Task Manager and the Performance Monitor... process Optimizing and troubleshooting SQL server Lesson 3B/ Slide 24 of 51 Administering and Troubleshooting SQL Server 2000 3B.28 Optimizing and Troubleshooting SQL Server Monitoring Resource Usage (Contd.) 6 The Performance tab displays the following graphical and non-graphical sections • The different graphical sections of the Performance tab include: • CPU Usage and CPU Usage History • MEM Usage and. .. because of inadequate memory ©NIIT Optimizing and troubleshooting SQL server Lesson 3B/ Slide 16 of 51 Administering and Troubleshooting SQL Server 2000 3B.20 Optimizing and Troubleshooting SQL Server Monitoring Resource Usage (Contd.) Memory Object This Object determines Value and its Interpretation Physical Disk \ Average Disk Queue Length Average numbers of both read and write requests in queue An increase... tasks • New Task: This button enables you to create a new task Optimizing and troubleshooting SQL server Lesson 3B/ Slide 23 of 51 Administering and Troubleshooting SQL Server 2000 Optimizing and Troubleshooting SQL Server Monitoring Resource Usage (Contd.) 5 • ©NIIT Click the Processes tab displays the currently active system processes and user processes in the Image Name column of the list box The... processor handles the faulty pages A high value indicates inadequate memory Process \ Page faults/sec for SQL Server instance The rate at which the faulty pages occur because of a SQL server process of a SQL Server instance A high value for overall page faults/sec indicates shortage of memory ©NIIT 3B.21 Optimizing and troubleshooting SQL server Lesson 3B/ Slide 17 of 51 Administering and Troubleshooting SQL. .. Connection • State: This column displays the state of the network connection Optimizing and troubleshooting SQL server Lesson 3B/ Slide 26 of 51 Administering and Troubleshooting SQL Server 2000 3B.30 Optimizing and Troubleshooting SQL Server Monitoring Resource Usage (Contd.) 6 The User tab displays information about various users and sessions The information is displayed in a table with following fields: