Đang chuẩn bị liên kết để tải về tài liệu:
Microsoft SQL Server 2008 R2 Unleashed- P155

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Microsoft SQL Server 2008 R2 Unleashed- P155:SQL Server 2005 provided a number of significant new features and enhancements over what was available in SQL Server 2000. This is not too surprising considering there was a five-year gap between these major releases.Microsoft SQL Server 2008 is not as much of a quantum leap forward from SQL Server 2005 | 1484 CHAPTER 39 Monitoring SQL Server Performance FIGURE 39.28 Viewing CPU utilization in the Utility Explorer. SELECT top 10 spid lastwaittype dbid uid cpu physical_io memusage status loginame program_name from sys.sysprocesses ORDER BY cpu desc This statement lists the top 10 CPU resource hogs active in SQL Server. After you identify which processes are causing a burden on the CPU you can check whether they can be either turned off or moved to a different server. If they cannot be turned off or moved you might want to consider upgrading the processor. The same information is available via the new DMV SELECT top 10 session_id command database_id user_id cpu_time reads writes logical_reads from sys.dm_exec_requests order by cpu_time desc Taking a peek at the SQL Server schedulers using the sys.dm_os_schedulers DMV also shows whether the number of runnable tasks is getting bogged down. If the runnable_tasks_count values are nonzero there aren t enough CPU time slices available to run the current SQL Server workload. The following example shows how you query the dm_os_schedulers view for this information SELECT scheduler_id current_tasks_count runnable_tasks_count FROM Sys.dm_os_schedulers And finally to get an idea of the top CPU hogs in SQL Server cached SQL and stored procedures you can query the sys.dm_exec_query_stats DMV and aggregate on total_worker_time to get the total CPU consumption as follows A Performance Monitoring Approach 1485 SELECT top 50 sum total_worker_time as Total_CPU sum execution_count as Total_Count count as Total_Statements plan_handle FROM sys.dm_exec_query_stats GROUP BY plan_handle Order by 1 desc GO To actually see the SQL code that is behind the plan_handle you can execute the dm_exec_sql_text function to get your hog list SELECT total_worker_time b.text FROM sys.dm_exec_query_stats A CROSS APPLY sys.dm_exec_sql_text A.plan_handle AS B order by 1 desc Monitoring Memory Memory like a processor is divided into segments for each process .