ÎÒµÄһЩ±Ê¼Ç(»ùÓÚSQL 2005)(ͳ¼ÆÐÅÏ¢µÄһЩ±Ê¼Ç)
---²éѯË÷Òý²Ù×÷µÄÐÅÏ¢
select * from sys.dm_db_index_usage_stats
--²éѯָ¶¨±íµÄͳ¼ÆÐÅÏ¢(sys.statsºÍsysobjectsÁªºÏ²éѯ)
select
o.name,--±íÃû
s.name,--ͳ¼ÆÐÅÏ¢µÄÃû³Æ
auto_created,--ͳ¼ÆÐÅÏ¢ÊÇ·ñÓɲéѯ´¦ÀíÆ÷×Ô¶¯´´½¨
user_created--ͳ¼ÆÐÅÏ¢ÊÇ·ñÓÉÓû§ÏÔʾ´´½¨
from
sys.stats
inner join
sysobjects o
on
s.object_id=o.id
where
o.name='±íÃû'
go
--²é¿´Í³¼ÆÐÅÏ¢ÖÐÁеÄÐÅÏ¢
select
o.name,--±íÃû
s.name,--ͳ¼ÆÐÅÏ¢µÄÃû³Æ
sc.stats_column_id,
c.name---ÁÐÃû
from
sys.stats_columns sc
inner join
sysobjects o
on
sc.object_id=o.id
inner join
sys.stats s
on
sc.stats_id=s.stats_id and sc.object_id=s.object_id
inner join
sys.columns c
on
sc.column_id=c.column_id and sc.object_id=c.object_id
where
o.name='±íÃû'
--²é¿´Í³¼ÆÐÅÏ¢µÄÃ÷ϸÐÅÏ¢
dbcc show_statistics
--²é¿´Ë÷Òý×Ô¶¯´´½¨µÄͳ¼ÆÐÅÏ¢
exec sp_autostats '¶ÔÏóÃû'
--¹Ø±Õ×Ô¶¯Éú³Éͳ¼ÆÐÅÏ¢µÄÊý¾Ý¿âÑ¡Ïî
alter datebase Êý¾Ý¿âÃû set auto_create_statistics off
--´´½¨Í³¼ÆÐÅÏ¢
create statistics ͳ¼ÆÐÅÏ¢Ãû³Æ on ±íÃû(ÁÐÃû)
[with
[[fullscan
sample number{percent|rows}]
[norecompute]
]
go
½âÊÍÒ»ÏÂÉÏÃæµÄ²ÎÊý£º
fullscan:Ö¸¶¨¶Ô±í»òÊÓͼÖÐËùÓеÄÐÐÊÕ¼¯Í³¼ÆÐÅÏ¢
sample number{percent|rows}:Ö¸¶¨Ëæ»ú³éÑùÓ¦¶ÁÈ¡µÄÊý¾ÝÐÐÊý»òÕß°Ù·Ö±È sampleÑ¡Ïî²»ÄÜÓëfullscanÑ¡ÏîͬʱʹÓÃ
norecompute:Ö¸¶¨Êý¾Ý¿âÒýÇæ²»×Ô¶¯ÖØмÆËãͳ¼ÆÐÅÏ¢
--¼ÆËãËæ»ú³éÑùͳ¼ÆÐÅÏ¢
create statistics ͳ¼ÆÐÅÏ¢Ãû³Æ on ±íÃû(ÁÐÃû)
with sample 5 percent---´´½¨Í³¼ÆÐÅÏ¢£¬°´5%¼ÆËãËæ»ú³éÑùͳ¼ÆÐÅÏ¢
go
--´´½¨Í³¼ÆÐÅÏ¢
exec sp_createstats--²ÎÊý×Ô¼ºÈ¥²éÏ°ïÖú£¬ÔÚÕâÀï²»Ò»Ò»ÁоÙ
--ÐÞ¸Äͳ¼ÆÐÅÏ¢
update statistics ±íÃû|ÊÓͼÃû
Ë÷ÒýÃû|ͳ¼ÆÐÅÏ¢Ãû,Ë÷ÒýÃû|ͳ¼ÆÐÅÏ¢Ãû,.....
[with
[[fullscan
sample number{percent|rows}]
[norecompute]
]
---²ÎÊýÓëcreate statistics Óï¾äÏàËÆ£¬ÏÂÃæ½éÉܼ¸ÖÖ³£ÓÃÓ¦ÓÃ
1.¸üÐÂÖ¸¶¨±íµÄËùÓÐͳ¼ÆÐÅÏ¢
update statistics ±íÃû
2.¸üÐÂÖ¸¶¨±íµÄµ¥¸öË÷Òý
Ïà¹ØÎĵµ£º
¶ÔÓÚSQL ServerÊý¾Ý¿â¹ÜÀíÔ±À´½²£¬ÒÑÂúÊÂÎñÈÕÖ¾ÊÇÒ»¸öËöËéµÄ£¬µ«Óֺܳ£¼ûµÄÎÊÌâ¡£ËüÄÜÒý·¢ÊÂÎñµÄÌáÇ°ÖÕÖ¹£¬ÉõÖÁͨ¹ý×èÖ¹ËùÓÐÊÂÎñµÄÒýÈ룬´Ó¶øÒýÆðϵͳµÄ±ÀÀ£¡£¶ÔÓÚÊý¾Ý¿â¹ÜÀíÔ±À´Ëµ£¬¹Ø¼üÊÇÀí½â½«Òª·¢ÉúµÄÇé¿ö£¬ÒÔ±ãËûÃÇ¿ÉÒÔ×·×ÙÒýÆðÎÊÌâµÄÔÒò¡£ ÊÂÎñÈÕÖ¾Ìî³ä·½Ê½
¡¡¡¡ÒÔÏÂÊÇһЩ¿ÉÄÜÒýÆðÊÂÎñÈÕÖ¾ÌîÂúµÄÔÒò£º
¡¡¡¡ÌîÂúµ ......
SQL Server 2008ÖÐ×îеÄÎļþÁ÷¹¦ÄÜʹµÃÄã¿ÉÒÔÅäÖÆÒ»¸öÊý¾ÝÀàÐÍΪvarbinary(max)µÄÁУ¬ÒԱ㽫ʵ¼ÊÊý¾Ý´æ´¢ÔÚÎļþϵͳÖУ¬¶ø·ÇÔÚÊý¾Ý¿âÖС£Ö»ÒªÔ¸Ò⣬ÄãÈÔ¿ÉÒÔ×÷Ϊһ¸ö³£¹æµÄ¶þ½øÖÆÁÐÀ´²éѯ´ËÁУ¬¼´Ê¹Êý¾Ý×ÔÉí´æ´¢ÔÚÍⲿ¡£
¡¡¡¡ÎļþÁ÷ÌØÐÔͨ¹ý½«¶þ½øÖÆ´ó×Ö¶ÎÊý¾Ý´æ´¢ÔÚ±¾µØÎļþϵͳÖÐ,´Ó¶ø½«Windowsм¼ÊõÎļþϵͳ(NTFS)ºÍS ......
SQL Injection with MySQL
±¾ÎÄ×÷Õߣºangel
ÎÄÕÂÐÔÖÊ£ºÔ´´
·¢²¼ÈÕÆÚ£º2004-09-16
±¾ÎÄÒѾ·¢±íÔÚ¡¶ºÚ¿Í·ÀÏß¡·7Ô¿¯£¬×ªÔØÇë×¢Ã÷¡£ÓÉÓÚдÁ˺ܾã¬Ëæ׿¼ÊõµÄ½ø²½£¬±¾ÈËÒ²·¢ÏÖ¸ÃÎÄÀïÓв»ÉÙ´íÎóºÍÂÞàµĵط½¡£Çë¸÷λ¸ßÊÖ¿´Á˲»ÒªÐ¦¡£±¾ÎÄдÓÚ¡¶Advanced SQL Injection with MySQL¡·Ö®Ç°Ò»¸öÔ¡£
ÉùÃ÷
¡¡¡¡±¾ÎĽöÓÃÓÚ½ ......
¡¾×ª¡¿Ò»Ð©³£ÓõÄsqlÓï¾ä×Ö·û´®´¦Àí£¬×ªÓÚÕâÀÒÔ·½±ãʹÓÃ
Ò»¡¢×Ö·ûת»»º¯Êý
1¡¢ASCII()
·µ»Ø×Ö·û±í´ïʽ×î×ó¶Ë×Ö·ûµÄASCII ÂëÖµ¡£ÔÚASCII£¨£©º¯ÊýÖУ¬´¿Êý×ÖµÄ×Ö·û´®¿É²»ÓÑ’À¨ÆðÀ´£¬µ«º¬ÆäËü×Ö·ûµÄ×Ö·û´®±ØÐëÓÑ’À¨ÆðÀ´Ê¹Ó㬷ñÔò»á³ö´í¡£
2¡¢CHAR()
½«ASCII Âëת»»Îª×Ö·û¡£Èç¹ûûÓÐÊäÈë0 ~ ......
¢Ù¡£Æô¶¯Distributed Transaction Coordinator ·þÎñ
´ò¿ª·þÎñ£¬ÔÚ·þÎñÖÐÕÒµ½Distributed Transaction Coordinator·þÎñ£¬Ñ¡Ôñ“ÊôÐÔ”£»
ÔÚ“µÇ¼”Ñ¡ÏÖУ¬Ñ¡Ôñ“´ËÕÊ»§”£¬ÕÊ»§ÃûÌîд“N ......