Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ÀûÓö¯Ì¬¹ÜÀíÊÓͼÌá¸ßSQL ServerË÷ÒýЧÂÊ

¡¡¾ÍÈçͬÊý¾Ý¿âDBAÁ˽âµÄÒ»Ñù£¬ºÏÊʵÄË÷ÒýÄܹ»Ìá¸ß²éѯÐÔÄܺÍÓ¦ÓóÌÐò¿É²âÁ¿ÐÔ¡£µ«ÊÇÿ¸ö¸½¼ÓµÄË÷Òý£¬¶¼¸øϵͳÔö¼ÓÁ˶îÍ⿪Ïú£¬ÒòΪËæ×ÅÊý¾Ý´Ó±íºÍÊÓͼÖ⻶ÏÔö¼Ó¡¢Ð޸ĻòÇå³ý£¬SQL ServerÐèҪά»¤ÕâЩË÷Òý¡£
¡¡¡¡Ö®Ç°£¬ÎÒ½éÉÜÁËһ϶¯Ì¬¹ÜÀíÊÓͼ(DMV)¡£ËüÊÇÒ»ÖÖºÜÓÐÓõļà¿ØºÍ½â¾öSQL Server¹ÊÕϵŤ¾ß¡£±¾ÎÄÊÇËüµÄÐøƪ£¬ÎÒ½«¼ÌÐøºÍ´ó¼ÒÒ»Æð̽ÌÖÆäËûµÄһЩÊý¾Ý¿â¹ÜÀíÔ±ÓÃÀ´Äܹ»²â¶¨ÏÖ´æË÷ÒýЧÂʵĶ¯Ì¬¹ÜÀíÊÓͼ(DMV)ºÍ·ÖƬ¼¶±ð¡£´ËÍ⣬ÎÒ»¹ÌṩÁËÓ¦¸ÃÓÃÀ´¼ìË÷Ö¸¶¨µÄSQL Server³ÌÐòIDºÅ(SPID)Ö´ÐеÄ×îºóÓï¾ä¡£
¡¡¡¡DMVÌá¸ßË÷ÒýЧÂÊ
¡¡¡¡¾ÍÈçͬÊý¾Ý¿âDBAÁ˽âµÄÒ»Ñù£¬ºÏÊʵÄË÷ÒýÄܹ»Ìá¸ß²éѯÐÔÄܺÍÓ¦ÓóÌÐò¿É²âÁ¿ÐÔ¡£µ«ÊÇÿ¸ö¸½¼ÓµÄË÷Òý£¬¶¼¸øϵͳÔö¼ÓÁ˶îÍ⿪Ïú£¬ÒòΪËæ×ÅÊý¾Ý´Ó±íºÍÊÓͼÖ⻶ÏÔö¼Ó¡¢Ð޸ĻòÇå³ý£¬SQL ServerÐèҪά»¤ÕâЩË÷Òý¡£ÔÚ°²×°ÐµÄË÷Òý֮ǰ£¬ÄãÐèÒª¼ì²âÊý¾Ý¿â»î¶¯£¬±£Ö¤ÄãÖ»ÓÐһЩÄÜÌá¸ßƽ³£Ö´ÐеIJéѯµÄË÷Òý¡£×¢ÒâSQL Server²¢²»ÄÜ×èÖ¹ÄãÔÚÏàͬµÄÁÐÉϽ¨Á¢¶à¸öË÷Òý¡£ËüÒ²²»ÄÜÌáÐÑÄãÄã¼´½«½¨Á¢µÄ²éѯ²¢²»ÄÜÓÅ»¯²éѯ¡£
¡¡¡¡¸´ÖÆË÷Òý¶Ôϵͳ²¢Ã»Óкô¦¡£Í¬ÑùµØ£¬SQL Server²éѯÓÅ»¯³ÌÐò²»ÄÜÓýâ¾ö²éѯÎÊÌâµÄË÷ÒýÒ²²»ÄܶÔϵͳ´øÀ´Ê²Ã´ºÃ´¦¡£Òò´Ë£¬ÔÚÕâÀïÎÒÃÇÖÁ¹ØÖØÒªµÄÊÂÇé¾ÍÊÇÁ˽âË÷ÒýµÄÀûÓÃЧÂʺÍËüÃǶԲéѯÐÔÄܵÄÓ°Ïì¡£ÐÒÔ˵ÄÊÇ£¬SQL Server 2005ºÍ2008°üÀ¨ÁËsys.dm_db_index_usage_stats¶¯Ì¬¹ÜÀíÊÓͼ£¬ÎÒÃÇ¿ÉÒÔÓÃËüÀ´²âÁ¿Ë÷ÒýµÄЧÂÊ¡£ºÍËùÓÐÆäËûµÄ¶¯Ì¬¹ÜÀíÊÓͼһÑù£¬contents of sys.dm_db_index_usage_statsµÄÄÚÈÝÔÚÄãÖØÆôSQL ServerʵÀýʱ¾Í±»¶ªÆúÁË¡£ËùÒÔÈç¹ûÄãÏëÊÕ¼¯Ë÷ÒýʹÓÃͳ¼ÆÊý¾Ý£¬Äã¾ÍÓ¦¸Ã¶Ô×Ô¶¨Òå±í¶¨ÆÚ¸´ÖÆDMV¡£
¡¡¡¡Ã¿´ÎÓÃË÷Òý½øÐÐɨÃèʱ£¬DMV¾ÍÔö¼ÓÁËÔÚSQL ServerÖÐËÑË÷»ò²éÕÒÁС£ÀýÈçһϵIJéѯ¾ÍÔÚAdventureWorksDWʾÀýÊý¾Ý¿âÖмìË÷Óû§±íºÍÏàÓ¦ÊÓͼʹÓÃͳ¼Æ£º
¡¡¡¡SELECT
¡¡¡¡object_name(a.object_id) AS table_name£¬
¡¡¡¡COALESCE(name£¬ 'object with no clustered index') AS index_name£¬
¡¡¡¡type_desc AS index_type£¬
¡¡¡¡user_seeks£¬
¡¡¡¡user_scans£¬
¡¡¡¡user_lookups£¬
¡¡¡¡user_updates
¡¡¡¡from sys.dm_db_index_usage_stats a INNER JOIN sys.indexes b
¡¡¡¡ON a.index_id = b.index_id
¡¡¡¡AND a.object_id = b.object_id
¡¡¡¡WHERE database_id = DB_ID('AdventureWorksDW')
¡¡¡¡AND a.object_id > 1000
¡¡¡¡ÓÐÓõÄË÷ÒýÔÚuser_seeksÁÐÖеÄ×ÜÊý×î´ó¡£Òª×¢Òâuser_updatesÕâ


Ïà¹ØÎĵµ£º

º½¿Õ¹«Ë¾¹ÜÀíϵͳ(VC++ ÓëSQL 2005)

ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
      ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......

Ìá¸ßÊý¾Ý¿âSQLÓï¾ä²éѯËٶȵļ¸¸ö·½·¨£¨×ª£©


Ìá¸ßÊý¾Ý¿âSQLÓï¾ä²éѯËٶȵļ¸¸ö·½·¨
1¡¢³ÌÐòÖУ¬
±£Ö¤ÔÚʵÏÖ¹¦ÄܵĻù´¡ÉÏ£¬¾¡Á¿¼õÉÙ¶ÔÊý¾Ý¿âµÄ·ÃÎÊ´ÎÊý£»
ͨ¹ýËÑË÷²ÎÊý£¬¾¡Á¿¼õÉÙ¶Ô±íµÄ·ÃÎÊÐÐÊý,×îС»¯½á¹û¼¯£¬´Ó¶ø¼õÇáÍøÂ縺µ££»
Äܹ»·Ö¿ªµÄ²Ù×÷¾¡Á¿·Ö¿ª´¦Àí£¬Ìá¸ßÿ´ÎµÄÏìÓ¦Ëٶȣ»
ÔÚÊý¾Ý´°¿ÚʹÓÃSQLʱ£¬¾¡Á¿°ÑʹÓõÄË÷Òý·ÅÔÚÑ¡ÔñµÄÊ×ÁУ»
Ëã·¨µÄ½á¹¹¾¡Á¿¼òµ¥ ......

SQL server 2005ÖÐÎÞ·¨Ð½¨×÷Òµ£¨Job£©µÄÎÊÌâ

ÔÚʹÓÃsqlserver2005´´½¨×÷ҵʱ£¬´´½¨²»ÁË£¬Ìáʾ
ÎÞ·¨½«ÀàÐÍΪ“Microsoft.SqlServer.Management.Smo.SimpleObjectKey”µÄ¶ÔÏóÇ¿ÖÆת»»ÎªÀàÐÍ“Microsoft.SqlServer.Management.Smo.Agent.JobObjectKey”¡£   (Microsoft.SqlServer.Smo)
ÓÚÊǾÍgoogle£¬°Ù¶ÈÁËһϣ¬ºÃ¶àÎÄÕºÍÌù×Ó˵ÐèÒª° ......

SQL Server 2005 Express Edition ɵ¹Ïʽ°²×°

      ÓÉÓÚ×î½üÒªÓõ½´ò°üSQL Server 2005 Express Edition £¬ÓÉÓÚÔÚ°²×°¹ý³ÌÖÐÐèÒªÉèÖúܶණÎ÷¡£´øÀ´ºÜ¶àµÄ²»±ã£¬ÓÚÊÇÔÚÍøÉϺÍMSDNÕÒÁ˺þÃÖÕÓÚÕÒµ½°ì·¨ÁË ^_^
ÎÒÓõÄÊÇÅú´¦ÀíÀ´ÊµÏֵģ¬ºÃÁËÖ±½ÓÌù´úÂë
CLS  
@ECHO OFF  
ECHO.     
ECH ......

Ê®²½ÓÅ»¯SQL ServerÖеÄÊý¾Ý·ÃÎÊ

¡¡¡¾IT168 ¼¼ÊõÎĵµ¡¿¹ÊÊ¿ªÆª£ºÄãºÍÄãµÄÍŶӾ­¹ý²»Ð¸Å¬Á¦£¬ÖÕÓÚʹÍøÕ¾³É¹¦ÉÏÏߣ¬¸Õ¿ªÊ¼Ê±£¬×¢²áÓû§½ÏÉÙ£¬ÍøÕ¾ÐÔÄܱíÏÖ²»´í£¬µ«Ëæ×Å×¢²áÓû§µÄÔö¶à£¬·ÃÎÊËٶȿªÊ¼±äÂý£¬Ò»Ð©Óû§¿ªÊ¼·¢À´Óʼþ±íʾ¿¹Ò飬ÊÂÇé±äµÃÔ½À´Ô½Ô㣬ΪÁËÁôסÓû§£¬Ä㿪ʼ×ÅÊÖµ÷²é·ÃÎʱäÂýµÄÔ­Òò¡£
¡¡¡¡¾­¹ý½ôÕŵĵ÷²é£¬Äã·¢ÏÖÎÊÌâ³öÔÚÊý¾Ý¿âÉÏ£¬µ±Ó¦ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ