3B.7 Administering and Troubleshooting SQL Server 2000Optimizing and troubleshooting SQL server Lesson 3B/ Slide 6 of 51 ©NIIT Optimizing and Troubleshooting SQL Server Optimizing Hardwa
Trang 13B.1 Administering and Troubleshooting SQL Server 2000
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
Trang 2Administering and Troubleshooting SQL Server 2000 3B.2
Optimizing SQL Server 2000 system activity
Troubleshooting SQL Server 2000 system activity
Optimizing and troubleshooting SQL server Lesson 3B/ Slide 2 of 51
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
Trang 33B.3 Administering and Troubleshooting SQL Server 2000
Optimizing and troubleshooting SQL server Lesson 3B/ Slide 3 of 51
©NIIT
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
Trang 4Administering and Troubleshooting SQL Server 2000 3B.4
Optimizing and troubleshooting SQL server Lesson 3B/ Slide 4 of 51
Trang 53B.5 Administering and Troubleshooting SQL Server 2000
Optimizing and troubleshooting SQL server Lesson 3B/ Slide 5 of 51
©NIIT
Ans 1 a SQLMail Ans 2 b Linked Server Ans 3 a Impersonate Ans 4 a Allow template queries Ans 5 d Product name
Trang 6Administering and Troubleshooting SQL Server 2000 3B.6
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 disk subsystem
Resolving system 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
Trang 73B.7 Administering and Troubleshooting SQL Server 2000
Optimizing and troubleshooting SQL server Lesson 3B/ Slide 6 of 51
©NIIT
Optimizing and Troubleshooting SQL Server
Optimizing Hardware Resource Usage
in SQL Server 2000
• 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
Trang 8Administering and Troubleshooting SQL Server 2000 3B.8
Optimizing and troubleshooting SQL server Lesson 3B/ Slide 7 of 51
©NIIT
in SQL Server 2000 (Contd.)
• 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
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 under-utilized
Trang 93B.9 Administering and Troubleshooting SQL Server 2000
Configuring SQL Server 2000 disk subsystem
Resolving system bottlenecks
Placing Data on Multiple Disks
Optimizing and troubleshooting SQL server Lesson 3B/ Slide 8 of 51
©NIIT
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.
• Using multiple disks to store data provides the following advantages:
Trang 10Administering and Troubleshooting SQL Server 2000 3B.10
Optimizing and troubleshooting SQL server Lesson 3B/ Slide 9 of 51
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
Trang 113B.11 Administering and Troubleshooting SQL Server 2000
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
Trang 12Administering and Troubleshooting SQL Server 2000 3B.12
Optimizing and troubleshooting SQL server Lesson 3B/ Slide 10 of 51
©NIIT
Optimizing and Troubleshooting SQL Server
Configuring SQL Server 2000 Disk
Subsystem
• 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.
Trang 133B.13 Administering and Troubleshooting SQL Server 2000
Optimizing and troubleshooting SQL server Lesson 3B/ Slide 11 of 51
• Transaction log files
• Tempdb system database
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 It increases the performance of the memory resources
x It provides fault tolerance to the system
x It provides fast read and write operations
x It enables fast and accurate data recoverability
Trang 14Administering and Troubleshooting SQL Server 2000 3B.14
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
Trang 153B.15 Administering and Troubleshooting SQL Server 2000
Optimizing and troubleshooting SQL server Lesson 3B/ Slide 12 of 51
©NIIT
Optimizing and Troubleshooting SQL Server
Resolving System Bottlenecks
•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.
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
Trang 16Administering and Troubleshooting SQL Server 2000 3B.16
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
Trang 173B.17 Administering and Troubleshooting SQL Server 2000
Optimizing and troubleshooting SQL server Lesson 3B/ Slide 13 of 51
©NIIT
Optimizing and Troubleshooting SQL Server
Monitoring Hardware Resources
• 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.
Trang 18Administering and Troubleshooting SQL Server 2000 3B.18
Optimizing and troubleshooting SQL server Lesson 3B/ Slide 14 of 51
©NIIT
(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
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 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
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
Trang 193B.19 Administering and Troubleshooting SQL Server 2000
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 Lesson 3B/ Slide 15 of 51
©NIIT
Optimizing and Troubleshooting SQL Server
Monitoring Resource Usage
•These objects are categorized in to the following three categories:
• Memory objects and counters
• Input/Output objects and counters
• Processor objects and counters
Trang 20Administering and Troubleshooting SQL Server 2000 3B.20
Optimizing and troubleshooting SQL server Lesson 3B/ Slide 16 of 51
©NIIT
• 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:
A value more than 20 indicates excessive hard disk paging because of inadequate memory
Number of pages accessed from disk or written to disk due to page faults
Memory \ Pages/sec
A low value indicates inadequate memory or memory blocked by a process
Megabytes of memory presently available for use
Trang 213B.21 Administering and Troubleshooting SQL Server 2000
Optimizing and troubleshooting SQL server Lesson 3B/ Slide 17 of 51
©NIIT
A high value for overall page faults/sec indicates shortage of memory
The rate at which the faulty pages occur because of a SQL server process of a SQL Server instance
Average numbers of both read and write requests
Disk Queue Length
Trang 22Administering and Troubleshooting SQL Server 2000 3B.22
Optimizing and troubleshooting SQL server Lesson 3B/ Slide 18 of 51
©NIIT
If this value is close to the total amount of physical memory of the computer, it indicates shortage of memory
The total amount of dynamic memory currently used by SQL Server for its memory buffer
Manager \ Total Pages
Value and its Interpretation This Object determines
Memory Object
Trang 233B.23 Administering and Troubleshooting SQL Server 2000
Optimizing and troubleshooting SQL server Lesson 3B/ Slide 19 of 51
©NIIT
• Input/Output Objects and Counters
• Small Computer System Interface (SCSI)
• The following table lists the input/output objects, their functions, and their values:
A low rate of disk paging accompanied with a high rate of disk usage indicates a disk bottleneck
Average numbers of both read and write requests that were in queue
PhysicalDisk \ Average
Disk Queue Length
A low rate of disk paging accompanied with a high rate of disk usage and disk queuing indicates a disk bottleneck
Percentage of time during which the hard disk was processing a read or write request
PhysicalDisk \ %Disk
Time
This Object determines Value and its Interpretation Input/Output Object
Trang 24Administering and Troubleshooting SQL Server 2000 3B.24
Optimizing and troubleshooting SQL server Lesson 3B/ Slide 20 of 51
Rate of read operations per second
PhysicalDisk \ Disk
Reads/sec
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
Rate of write operations per second
PhysicalDisk \ Disk
Writes/sec
This Object determines Value and its Interpretation Input/Output Object
Trang 253B.25 Administering and Troubleshooting SQL Server 2000
Optimizing and troubleshooting SQL server Lesson 3B/ Slide 21 of 51
©NIIT
• 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:
A processor queue containing more than two threads indicates a processor bottleneck
Number of processes in the processor queue
Processor \ %
Processor Time
This Object determines Value and its Interpretation Processor Object
Trang 26Administering and Troubleshooting SQL Server 2000 3B.26
Optimizing and troubleshooting SQL server Lesson 3B/ Slide 22 of 51
1 Right-click the Windows Taskbar This displays a pop-up menu.
2 Select the Task Manager option This displays the Windows Task Manager
Trang 273B.27 Administering and Troubleshooting SQL Server 2000
Optimizing and troubleshooting SQL server Lesson 3B/ Slide 23 of 51
©NIIT
• 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.
Trang 28Administering and Troubleshooting SQL Server 2000 3B.28
Optimizing and troubleshooting SQL server Lesson 3B/ Slide 24 of 51
©NIIT
5.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.
Trang 293B.29 Administering and Troubleshooting SQL Server 2000
Optimizing and troubleshooting SQL server Lesson 3B/ Slide 25 of 51
©NIIT
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)
Trang 30Administering and Troubleshooting SQL Server 2000 3B.30
Optimizing and troubleshooting SQL server Lesson 3B/ Slide 26 of 51
©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
7 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
Trang 313B.31 Administering and Troubleshooting SQL Server 2000
Optimizing and troubleshooting SQL server Lesson 3B/ Slide 27 of 51
• 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.
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
Trang 32Administering and Troubleshooting SQL Server 2000 3B.32
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
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
of a SQL Server instance
A high value for overall page faults/sec indicates shortage of memory
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
Trang 333B.33 Administering and Troubleshooting SQL Server 2000
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 Interpretation Value and its
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
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
Trang 34Administering and Troubleshooting SQL Server 2000 3B.34
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:
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
Trang 353B.35 Administering and Troubleshooting SQL Server 2000
The Windows Task Manager window displays the following five tabs:
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
Trang 36Administering and Troubleshooting SQL Server 2000 3B.36
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
Trang 373B.37 Administering and Troubleshooting SQL Server 2000
The different graphical sections of the Performance tab include:
The different non-graphical sections of the Performance tab include:
Totals: This section displays the number of the currently active Handles, Threads, and Processes.
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
Trang 38Administering and Troubleshooting SQL Server 2000 3B.38
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 adapter
Network Utilization: This column displays the network resource utilization in
percentage
Trang 393B.39 Administering and Troubleshooting SQL Server 2000
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.
Trang 40Administering and Troubleshooting SQL Server 2000 3B.40
I NSTRUCTOR N OTES
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