ÈçºÎ¼ì²éSQL Server×èÈû
--²éѯӦÓóÌÐòµÄµÈ´ý
SELECT TOP 10
wait_type,waiting_tasks_count AS tasks,
wait_time_ms,max_wait_time_ms AS max_wait,
signal_wait_time_ms AS signal
from sys.dm_os_wait_stats
ORDER BY wait_time_ms DESC
--²éѯÔÚÈÎһʱ¿ÌËùÓÐÊÚȨ¸øµ±Ç°Ö´ÐÐÊÂÎñ»òµ±Ç°Ö´ÐÐÊÂÎñµÈ´ýµÄËø
SELECT
request_session_id AS spid,resource_type AS rt,
resource_database_id AS rdb,
(CASE resource_type
WHEN 'OBJECT' THEN OBJECT_NAME(resource_associated_entity_id)
WHEN 'DATABASE' THEN ' '
ELSE (SELECT OBJECT_NAME(object_id)
from sys.partitions WHERE hobt_id=resource_associated_entity_id)
END)AS objname,
resource_description AS rd,
request_mode AS rm,
request_status AS rs
from sys.dm_tran_locks
--×èÈûµÄÉú´æÆÚºÍÕý±»×èÈûÊÂÎñÖ´ÐеÄSQLÓï¾ä
SELECT
t1.resource_type,
'databse'=DB_NAME(resource_database_id),
'blk object'=resource_associated_entity_id,
request_mode,request_session_id,wait_duration_ms,
(SELECT SUBSTRING(text,statement_start_offset/2+1,
(CASE WHEN statement_end_offset=-1
THEN LEN(CONVERT(NVARCHAR(max),text))*2
ELSE statement_end_offset
END -statement_start_offset)/2)
from sys.dm_exec_sql_text(sql_handle)
) AS query_text,
t1.resource_description
from sys.dm_tran_locks AS t1,
sys.dm_os_waiting_tasks t2,
sys.dm_exec_requests t3
WHERE
t1.lock_owner_address=t2.resource_address AND
t1.request_request_id=t3.request_id AND
t2.session_id=t3.session_id
Ïà¹ØÎĵµ£º
SQL Server µ¼Èë/µ¼³ö½Ì³Ì
¸ü¶àÇë²é¿´£º http://faq.gzidc.com/index.php?option=com_content&task=category§ionid=12&id=21&Itemid=43
1¡¢´ò¿ª±¾µØÆóÒµ¹ÜÀíÆ÷£¬ÏÈ´´½¨Ò»¸öSQL Server×¢²áÀ´Ô¶³ÌÁ¬½Ó·þÎñÆ÷¶Ë¿ÚSQL Server¡£
²½ÖèÈçÏÂͼ£º
ͼ1:
2¡¢µ¯³ö´°¿ÚºóÊäÈëÄÚÈÝ¡£"×ÜÊÇÌáʾÊäÈëµÇ½ÃûºÍÃÜÂë" ......
ÆäʵÄã¿ÉÒÔʹÓÃÊÂÎñ´¦Àí
±È·½ËµÔÚÒ»¸ö×Ö¶ÎÀïÃæÌí¼ÓÒ»¸öboolean µÄ×ֶε±ÄãÒª´¦Àí¸Ã×ֶεÄʱºò¾Í True ÄÄô±ðµÄÈ˶¼²»¿ÉÒÔ½øÐвÙ×÷
¡¡Èç¹ûÊÇFalse ÄÄô¾Í¿ÉÒÔ½øÐвÙ×÷¡«¡«ºÇ¿É¡«¡«ÎÒÊÇÕâÑùµÄ
¡¡¡¡²»¹ýÄã¿ÉÒÔ¿´¿´¡¡
¡¡SQLËø»úÖÆ
¡¡¡¡ÒÔÏÂÊÇÎÒÕÒµÄһЩÁÏ¡¡Èç¹ûÒªÀí½âSQLËø»úÖÆ ×îºÃ°ÑÏÂÀ´¿´ÍêŶ
ĬÈϵÄÊÂÎñ¸ôÀë¼ ......
string error_syntaxfromSQL, error_create
string new_sql, new_syntax
new_sql = 'SELECT emp_data.emp_id, ' &
& ......
SQL Server 2005 (MSSQLSERVER) ·þÎñ²»ÄÜÆô¶¯
ÔÒò:VIAÐÒ锸øÆôÓÃÁË£¬Í£ÓÓVIAÐÒé”ÎÊÌâ½â¾ö¡£
"VIAÐÒé"Í£Ó÷½·¨£º¿ªÊ¼->³ÌÐò->Microsoft SQL Server 2005->ÅäÖù¤¾ß->SQL Server Configuration Manager ->´ò¿ªºóÕÒµ½"SQL Server 2005 ÍøÂçÅäÖÃ"->MSSQLSERVER ÊôÐÔµÄÐÒé &nb ......