SQL Access Advisor
Oracle Êý¾Ý¿â 10g ÌṩÁË´óÁ¿°ïÖú³ÌÐò£¨»ò“¹ËÎʳÌÐò”£©£¬¿É°ïÖúÄú¾ö¶¨×î¼Ñ²Ù×÷Á÷³Ì¡£ÆäÖÐÒ»¸öʾÀýÊÇ SQL Tuning Advisor£¬Ëü¿ÉÒÔÌṩÓйزéѯµ÷ÕûÒÔ¼°ÔÚÁ÷³ÌÖÐÑÓ³¤Õû¸öÓÅ»¯¹ý³ÌµÄ½¨Òé¡£
µ«Ç뿼ÂÇÒÔϵ÷Õû°¸Àý£º¼ÙÉèÒ»¸öË÷ÒýȷʵÓÐÖúÓÚij¸ö²éѯ£¬µ«¸Ã²éѯִֻÐÐÒ»´Î¡£ÕâÑù£¬¼´Ê¹¸Ã²éѯ¿ÉÒÔµÃÒæÓÚ´ËË÷Òý£¬µ«´´½¨Ë÷ÒýµÄ³É±¾Ò²»á³¬³öÆä´øÀ´µÄºÃ´¦¡£Òª°´ÕâÖÖ·½Ê½·ÖÎö°¸Àý£¬ÄúÐèÒªÁ˽â²éѯµÄ·ÃÎÊƵÂʺÍÔÒò¡£
ÁíÒ»¸ö¹ËÎʳÌÐò (SQL Access Advisor) ¿ÉÖ´ÐÐÕâÖÖÀàÐ͵ķÖÎö¡£³ýÁËÏñÔÚ Oracle Êý¾Ý¿â 10g ÖÐÒ»Ñù¿ÉÒÔ·ÖÎöË÷Òý¡¢ÎﻯÊÓͼµÈ£¬Oracle Êý¾Ý¿â 11g ÖÐµÄ SQL Access Advisor »¹¿ÉÒÔ·ÖÎö±íºÍ²éѯÒÔʶ±ð¿ÉÄܵķÖÇø²ßÂÔ — ÕâÔÚÉè¼Æ×î¼Ñģʽʱ¿ÉÒÔÌṩºÜ´ó°ïÖú¡£ÔÚ Oracle Êý¾Ý¿â 11g ÖУ¬SQL Access Advisor ÏÖÔÚ¿ÉÒÔÌṩÓëÕû¸ö¸ºÔØÏà¹ØµÄ½¨Ò飬°üÀ¨¿¼ÂÇ´´½¨³É±¾ºÍά»¤·ÃÎʽṹ¡£
ÔÚ±¾ÎÄÖУ¬Äú½«Á˽âÐ嵀 SQL Access Advisor ÈçºÎ½â¾ö³£¼ûÎÊÌâ¡££¨×¢£º³öÓÚÑÝʾĿµÄ£¬ÎÒÃǽ«Í¨¹ýÒ»¸öÓï¾äÑÝʾÕâ¸ö¹¦ÄÜ£»µ«ÊÇ£¬Oracle ½¨ÒéʹÓà SQL Access Advisor À´°ïÖúµ÷ÕûÕû¸ö¸ºÔØ£¬¶ø²»Ö»ÊÇÒ»¸ö SQL Óï¾ä¡££©
ÎÊÌâ
ÏÂÃæÊÇÒ»¸öµäÐÍÎÊÌâ¡£Ó¦ÓóÌÐò·¢³öÁËÒÔÏ SQL Óï¾ä¡£¸Ã²éѯËƺõÒªÏûºÄ´óÁ¿×ÊÔ´²¢ÇÒËٶȺÜÂý¡£
select store_id, guest_id, count(1) cnt
from res r, trans t
where r.res_id between 2 and 40
and t.res_id = r.res_id
group by store_id, guest_id
/
¸Ã SQL Éæ¼°Á½¸ö±í£¬¼´ RES ºÍ TRANS£»ºóÕßÊÇÇ°ÕßµÄ×Ó±í¡£ÄúÐèÒªÕÒµ½Ìá¸ß²éѯÐÔÄܵĽâ¾ö·½°¸ — SQL Access Advisor ÕýÊÇ×îºÏÊʵŤ¾ß¡£
Äú¿ÉÒÔͨ¹ýÃüÁîÐлò Oracle ÆóÒµ¹ÜÀíÆ÷Êý¾Ý¿â¿ØÖÆÓë¹ËÎʳÌÐò½øÐн»»¥£¬µ«Ê¹Óà GUI ¿ÉÒÔÌṩ¸üºÃµÄÖµ£¨GUI ¿ÉÈÃÄú½«½â¾ö·½°¸¿ÉÊÓ»¯£¬²¢½«Ðí¶àÈÎÎñ¼ò»¯Îª¼òµ¥µÄµã»÷²Ù×÷£©¡£
ҪʹÓÃÆóÒµ¹ÜÀíÆ÷ÖÐµÄ SQL Access Advisor ½â¾ö SQL ÖеÄÎÊÌ⣬Çë×ñÑÒÔϲ½Öè¡£
µ±È»£¬µÚÒ»¸öÈÎÎñÊÇÆô¶¯ÆóÒµ¹ÜÀíÆ÷¡£ÔÚ Database Ö÷Ò³ÉÏ£¬ÏòϹö¶¯µ½Ò³Ãæµ×²¿£¬Äú½«ÔÚÕâÀï¿´µ½¼¸¸ö³¬Á´½Ó£¬ÈçÏÂͼËùʾ£º
Ôڸò˵¥ÖУ¬µ¥»÷ Advisor Central£¬Õ⽫ÏÔʾһ¸öÓëÏÂͼÀàËƵÄÆÁÄ»¡£ÏÂÃæ½öÏÔʾÁ˸ÃÆÁÄ»µÄ¶¥²¿¡£
µ¥»÷ SQL Advisors£¬Õ⽫ÏÔʾһ¸öÓëÏÂͼÀàËƵÄÆÁÄ»¡£
ÔÚ¸ÃÆÁÄ»ÖУ¬Äú¿ÉÒԼƻ® SQL Access Advisor »á»°£¬²¢Ö¸¶¨ÆäÑ¡Ïî¡£¹ËÎʳÌÐò±ØÐëÊÕ¼¯Ò»Ð©ÒªÊ¹ÓÃµÄ SQL Óï¾ä¡£×î¼òµ¥µÄÑ¡Ïî¾ÍÊÇͨ¹ý Current and Recent SQL Activity ´Ó¹²Ïí³Ø
Ïà¹ØÎĵµ£º
1.Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)¡¡¡¡
¡¡¡¡ SQLSERVERµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬Òò´Ëfrom×Ó¾äÖÐдÔÚ×îºóµÄ±í£¨»ù´¡±ídriving table£©½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏ£¬±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í£¬µ±SQLSERVER´¦Àí¶à¸ö±íʱ£¬»áÔËÓÃÅÅÐò¼°ºÏ²¢µÄ·½Ê½Á ......
£¨×ªÔØ£©SQL 2K Êý¾ÝÀàÐÍ
(1)char¡¢varchar¡¢textºÍnchar¡¢nvarchar¡¢ntext
charºÍvarcharµÄ³¤¶È¶¼ÔÚ1µ½8000Ö®¼ä£¬ËüÃǵÄÇø±ðÔÚÓÚcharÊǶ¨³¤×Ö·ûÊý¾Ý£¬¶øvarcharÊDZ䳤×Ö·ûÊý¾Ý¡£Ëùν¶¨³¤¾ÍÊdz¤¶È¹Ì¶¨µÄ£¬µ±ÊäÈëµÄÊý¾Ý³¤¶ÈûÓдﵽָ¶¨µÄ³¤¶Èʱ½«×Ô¶¯ÒÔÓ¢ÎÄ¿Õ¸ñÔÚÆäºóÃæÌî³ä£¬Ê¹³¤¶È´ïµ½ÏàÓ¦µÄ³¤¶È£»¶ø±ä³¤×Ö·ûÊý¾Ý ......
×¢'svw'Ϊ³öÎÊÌâµÄÊý¾Ý¿â,´Ë·½Ê½¶Ôsql7.0ÒÔÉÏ°æ±¾ÓÐЧ,ÆäËüµÍ°æ±¾Îª²âÊÔ
sp_configure 'allow',1
go
reconfigure with override
go
update sysdatabases set status=32768 where name='svw'
go
dbcc rebuild_log('svw','D:\mssql7\data ......
·½·¨Ò»£ºÊ¹ÓÃÓαê
declare @ProductName nvarchar(50)
declare pcurr cursor for select ProductName from Products
open pcurr
fetch next from pcurr into @ProductName
while (@@fetch_status = 0)
begin
print (@ProductName)
fetch next from pcurr into @ProductName
end
close pcurr
deallocate pcurr ......
<!--[if !supportLists]-->Ò»¡¢<!--[endif]-->SQL Server 2005Êý¾Ý¿â¹ÜÀíµÄ10¸ö×îÖØÒªÌصã
<!--[if !supportLists]-->1. <!--[endif]-->Êý¾Ý¿â¾µÏñ
ͨ¹ýÐÂÊý¾Ý¿â¾µÏñ·½·¨£¬½«¼Ç¼µµ°¸´«ËÍÐÔÄܽøÐÐÑÓÉì¡£Äú½«¿ÉÒÔʹÓÃÊý¾Ý¿â¾µÏñ£¬Í¨¹ý½«×Ô¶¯Ê§Ð§ ......