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

SQL Server DBCCÃüÁî


¡ô1.DBCC CacheStats £ºÏÔʾ´æÔÚÓÚµ±Ç° buffer Cache ÖеĶÔÏóµÄÐÅÏ¢£¬ÀýÈç £ºhitrates ±àÒëµÄ¶ÔÏóºÍÖ´Ðмƻ®
 
DBCC CACHESTATS
 
¡¡¡¡´ÓÕâ¸öÃüÁî¿ÉÒԵõ½Ò»Ð©¹Ø¼üµÄͳ¼ÆÐÅÏ¢£º
¡¡¡¡Hit Ratio£ºÏÔÊ¾ÌØ¶¨¶ÔÏó¿ÉÒÔÔÚSql ServerµÄ»º´æÖб»ÃüÖеİٷֱȣ¬Õâ¸öÊýÖµÔ½´ó£¬Ô½ºÃ
¡¡¡¡Object Count£ºÏÔÊ¾ÌØ¶¨ÀàÐ͵ĶÔÏóÔÚsql serverµÄ»º´æÖб»ÃüÖеÄ×ÜÊý
¡¡¡¡Avg.Cost:sql serverÓÃÓÚ²âÁ¿±àÒëÒ»¸öÖ´Ðмƻ®ËùÐèµÄʱ¼ä£¬ÒÔ¼°Õâ¸ö¼Æ»®ËùÐèµÄÄÚ´æ¡£¸ù¾ÝÕâ¸öÖµ£¬¿ÉÒÔ¾ö¶¨Ö´Ðмƻ®ÊÇ·ñÓ¦¸Ã¼ÓÔØÔÚ»º´æÖС£
¡¡¡¡Avg.Pages£º²âÁ¿ÔÚ»º´æÖеĶÔÏóʹÓÃ8KÒ³µÄƽ¾ù×ÜÊý
¡¡¡¡LW Ojbect Count£¬LW Avg Cost£¬WL Avg Stay£¬LW Ave Use£ºÕâЩÁеÄÖµ±íÃ÷ÓжàÉÙÌØ¶¨µÄ¶ÔÏóÒѾ­±»Ð´½ø½ø³Ì´Ó»º´æ×ÜÒÆ×ß¡£ÕâЩÊýÖµÔ½µÍ£¬Ô½ºÃ¡£
¡ô2.DBCC DROPCLEANBUFFERS£º´Ó»º³å³ØÖÐɾ³ýËùÓУ¬Çå³ý»º³åÇø¡£
      ÔÚ½øÐвâÊÔʱ£¬Ê¹ÓÃÕâ¸öÃüÁî¿ÉÒÔ´Ósql server’sµÄÊý¾Ý»º´ædata catch(buffer)Çå³ýËùÓеIJâÊÔÊý¾Ý£¬ÒÔ±£Ö¤²âÊԵĹ«ÕýÐÔ¡£ÐèҪעÒâµÄÊÇÕâ¸öÃüÁîÖ»ÒÆ×߸ɾ»µÄ»º´æ£¬²»ÒÆ×ßÔ໺´æ¡£ÓÉÓÚÕâ¸öÔ­Òò£¬ÔÚÖ´ÐÐÕâ¸öÃüÁîǰ£¬Ó¦¸ÃÏÈÖ´ÐÐCheckPoint£¬½«ËùÓÐÔàµÄ»º´æÐ´Èë´ÅÅÌ£¬ÕâÑùÔÚÔËÐÐDBCC RROPCLEANBUFFERS ʱ£¬¿ÉÒÔ±£Ö¤ËùÓеÄÊý¾Ý»º´æ±»ÇåÀí£¬¶ø²»ÊÇÆäÖеÄÒ»²¿·Ö¡£
¡ô3.DBCC ErrorLog £ºÈç¹ûºÜÉÙÖØÆðmssqlserver·þÎñ£¬ÄÇô·þÎñÆ÷µÄÈÕÖ¾»áÔö³¤µÃºÜ¿ì£¬¶øÇÒ´ò¿ªºÍ²é¿´ÈÕÖ¾µÄËÙ¶ÈÒ²»áºÜÂý¡£Ê¹ÓÃÕâ¸öÃüÁ¿ÉÒԽضϵ±Ç°µÄ·þÎñÆ÷ÈÕÖ¾£¬Ö÷ÒªÊÇÉú³ÉÒ»¸öеÄÈÕÖ¾¡£¿ÉÒÔ¿¼ÂÇÉèÖÃÒ»¸öµ÷¶ÈÈÎÎñ£¬Ã¿ÖÜÖ´ÐÐÕâ¸öÃüÁî×Ô¶¯½Ø¶Ï·þÎñÆ÷ÈÕÖ¾¡£Ê¹Óô洢¹ý³Ìsp_cycle_errorlogÒ²¿ÉÒԴﵽͬÑùµÄÄ¿µÄ¡£
¡ô4.DBCC FLUSHPROCINDB:ÓÃÓÚÇåÀíÒ»¸öÊý¾Ý¿âʵÀýÖÐÖ¸¶¨Êý¾Ý¿âµÄ´æ´¢¹ý³ÌʹÓõĻº´æ¡£Êý¾Ý¿âµÄIDÊDZØÊä²ÎÊý
      ÔÚ²âÊÔʱ±£Ö¤ÒÔǰµÄ´æ´¢¹ý³Ì¼Æ»®²»»á¶Ô²âÊÔ½á¹ûÔì³É¸ºÃæÓ°Ï죬¿ÉÒÔʹÓÃÕâ¸ö´æ´¢¹ý³Ì¡£
¡¡¡¡Àý£º
 
DECLARE @intDBID INTEGER SET @intDBID = (select dbid from master.dbo.sysdatabases where name = 'database_name')
DBCC FLUSHPROCINDB (@intDBID)
 
¡ô5.DBCC FREEPROCCACHE£ºÓÃÓÚÇåÀíËùÓÐÊý¾Ý¿âµÄ¹ý³Ì¸ßËÙ»º´æ¡£
      ÀýÈ磬ÊͷŹý³Ì¸ßËÙ»º´æ½«µ¼ÖÂÖØÐ±àÒëijЩ²¿·Ö(ÀýÈçÌØ±ð SQL Óï¾ä)£¬¶ø²»ÊÇ´Ó¸ßËÙ»º´æÖÐ¶ÔÆäÔÙʹÓÃ


Ïà¹ØÎĵµ£º

linq to sql ²åÈëÖµ£¬ÒÔ¼°ÈçºÎÈ¡»Ø×ÔÔöµÄID

linq to sql ÔÚ²åÈëÖµµÄʱºò»¹ÊǺܷ½±ã¡£ÓÐʱºòÎÒÃÇÐèÒªÔÚ²åÈëÒ»¸öеÄʵÌåÖ®ºóµÃµ½ÄǸöʵÌåµÄÖ÷¼üIDµÄÖµ£¬Õâ¸öIDµ±È»±ØÐëÊÇ×ÔÔö¡£Ò»¶Îʱ¼äÎÒÒ»Ö±ÈÏΪֱ½ÓʹÓÃlinq to sqlµÄ²åÈë»úÖÆÊDz»¿ÉÒÔÔÚ×öµ½µÄ£¬ËùÒÔÖ»ÓÐʹÓô洢¹ý³ÌµÄ£¬¾ßÌå¿ÉÒԲ鿴ÕâÆªÎÄÕ£ºhttp://blog.benhall.me.uk/2008/01/custom-insert-logic-with-linq-to- ......

SQL SERVER£ºselect ×Ö·û´®Æ´½ÓÎÊÌâ

Ò»¡¢ÎÊÌâ
select UserID,LastName,FirstName,UserName from SYSUser
UserID LastName FirstName UserName
------------------------------------------------------
1      A        B        C
2  &nb ......

Oracle ÓëSQL ServerÊÂÎñ´¦ÀíµÄ±È½Ï



OracleÓëSQL ServerÊÂÎñ´¦ÀíµÄ±È½Ï

ÊÂÎñ´¦ÀíÊÇËùÓдóÐÍÊý¾Ý¿â²úÆ·µÄÒ»¸ö¹Ø¼üÎÊÌ⣬¸÷Êý¾Ý¿â³§É̶¼ÔÚÕâ¸ö·½Ã滨·ÑÁ˺ܴó
¾«Á¦£¬²»Í¬µÄÊÂÎñ´¦Àí·½Ê½»áµ¼ÖÂÊý¾Ý¿âÐÔÄܺ͹¦ÄÜÉϵľ޴ó²îÒì¡£
ÊÂÎñ´¦ÀíÒ²ÊÇÊý¾Ý¿â¹ÜÀíÔ±ÓëÊý¾Ý¿âÓ¦ÓóÌÐò¿ª·¢ÈËÔ±±ØÐëÉî¿ÌÀí½âµÄÒ»¸öÎÊÌ⣬¶ÔÕâ¸öÎÊÌâµÄÊèºö¿ÉÄܻᵼÖÂÓ¦ÓóÌÐòÂß¼­´í ......

SQL¡¢PL/SQLѧϰ±Ê¼Ç


 
1£®SQL²¢Ðвéѯ
alter session enable parallel dml execute immediate 'alter session enable parallel dml'; --Ð޸ĻỰ²¢ÐÐDML      select /*+parallel(a,4)*/ * from table_name a       select /*+parallel(a,8)*/ * from table_name a &nbs ......

SQL ³£ÓÃÓï¾ä

(1)Êý¾Ý¼Ç¼ɸѡ£º
sql="select*fromÊý¾Ý±íwhere×Ö¶ÎÃû=×Ö¶ÎÖµorderby×Ö¶ÎÃû[desc]"
sql="select*fromÊý¾Ý±íwhere×Ö¶ÎÃûlike'%×Ö¶ÎÖµ%'orderby×Ö¶ÎÃû[desc]"
sql="selecttop10*fromÊý¾Ý±íwhere×Ö¶ÎÃûorderby×Ö¶ÎÃû[desc]"
sql="select*fromÊý¾Ý±íwhere×Ö¶ÎÃûin('Öµ1','Öµ2','Öµ3')"
sql="select*fromÊý¾Ý±íwhere× ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ