SQL ServerÊý¾Ý¿âΪʲô²»Äָܻ´µ¥±íÊý¾Ý
Èç¹ûÄÜ´Ó±¸·ÝÎļþÖÐÖ»»Ö¸´Ò»¸ö±íµÄÊý¾Ý£¬ÄDz»ÊǺܺÃÂ𣿱ÈÈ磬Ä㱸·ÝÁËAdventureWorksÊý¾Ý¿â£¬ÏÖµÄÄãÖ»»Ö¸´ÀïÃæVendor±íÊý¾Ý¡£²»ÐÒµÄÊÇ£¬SQL Server±¾Éí²¢²»Ö§³ÖÕâÑù»¹Ô£¬ÄãÐèÒª´ÓµÚÈý·½ÌṩµÄ¹¤¾ßÖÐÀ´Ö´ÐÐÕâÑùµÄÈÎÎñ¡£
ÌṩÕâÖÖ¹¦ÄܵijÌÐò¶¼ÊÇһЩSQL ServerµÚÈý·½±¸·Ý¹¤¾ß¡£ËüÃÇ¿ÉÒÔÈÃÄã´Ó±¸·ÝÎļþÖгéÈ¡»òÊǶÁÈ¡µ¥¸ö±íÊý¾Ý¡£
µ«ÊÇÕâÀïÓÐÒ»µãҪעÒâÊÇ£¬¼ÙÈçÄãÑ¡Ôñ»Ö¸´Ò»¸öÍêÕûÊý¾Ý¿â£¬ÄÇôÄãÑ¡ÔñÒª»Ö¸´µÄÊý¾ÝÓпÉÄÜÓëÄã»ñÈ¡µÄÊý¾Ý²»Í¬¡£ÔÒò¾ÍÊÇÒòΪµ±ÄãÖ´ÐÐÍêÕûÊý¾Ý¿â±¸·Ýʱ£¬±¸·ÝÎļþ°üÀ¨Êý¾ÝÎļþºÍÊÂÎñÈÕÖ¾Îļþ¡£ÓÐһЩÒѾÌá½»µÄÊÂÎñ»¹Ã»ÓÐдÈëÊý¾ÝÎļþ£¬ÔÚÕâÖÖÇé¿öÏ£¬ÊÂÎñ½ö½ö´æ´¢ÔÚÊÂÎñÈÕÖ¾ÖУ¬»òÕß²¿·ÝÊý¾Ý´æ´¢ÔÚÊý¾ÝÎļþ¡£µ±ÄãʹÓõÚÈý·½³ÌÐò»Ö¸´ËùÑ¡ÔñµÄµ¥±íÊý¾Ýʱ£¬½ö½öÖ»ÄÜ´Ó±¸·ÝÎļþÖеÄÊý¾Ý¿âÎļþÖлñÈ¡Êý¾Ý£¬ÊÂÎñÈÕÖ¾ÖеÄÐÂÊý¾Ý½«»á±»ºöÂÔ¡£
ÏÂͼÏÔʾÁËÔÚ±¸·ÝÆÚ¼äûÓÐcheckpointµÄ±¸·ÝÐòÁС£
ÔÚ±¸·Ý¿ªÊ¼Ö®Ç°£¬Èç¹ûÊÂÎñ»¹Ã»Óб»Ð´µ½Êý¾ÝÎļþÖУ¬ÄÇ»áÔõôÑùÄØ£¿´ð°¸ÊDz»È·¶¨£¬ÒòΪµ±±¸·Ý¿ªÊ¼ºó£¬SQL Server»á×Ô¶¯Ö´ÐÐcheckpoint²Ù×÷¡£µ±checkpointÆڼ䣬ÔàÊý¾ÝÒ³ÒѾ±»Ð´µ½´ÅÅÌÉÏÁË¡£µ±ÎÒÃÇ´Ó±¸·ÝÎļþ»Ö¸´µ¥¶ÀÒ»¸ö±íµÄÊý¾Ýʱ£¬ÎÒÃÇÄܲ»ÄÜÈÏΪҪ»Ö¸´µÄÊý¾Ý¾Í´¦ÓÚ±¸·Ý¿ªÊ¼´¦ÄØ£¿ÕâÈ¡¾öÓÚ±¸·Ý¹ý³Ì¡£Èç¹ûÔÚ±¸·ÝÆÚ¼äûÓÐÊÂÎñÔÚÔËÐУ¬ÄǾÍûÎÊÌâ¡£Èç¹ûÕâÆÚ¼äÓÐÊÂÎñÔÚÔËÐжøÇÒcheckpointҲûÓб»´¥·¢£¬ÄÇҲûÎÊÌâ¡£µ«ÊÇÈç¹ûÔÚ±¸·ÝÆÚ¼äÓÐÊÂÎñÔÚÖ´ÐУ¬ÄÇÎÒÃǻָ´µÄÊý¾ÝÒ²Ðí¾Í»á°üÀ¨±¸·ÝÆðʼʱµÄÊý¾Ý£¬¶øÇÒÔÚ±¸·ÝÆÚ¼äÊý¾Ý±»Ìá½»Á˵Ļ°£¬Èç¹ûÔÚ±¸·ÝÆڼ䷢ÉúÁËcheckpoint¶øÇÒÊý¾ÝÒ²±»Ð´µ½ÁËÊý¾ÝÒ³£¬¶øÕâ¸öÊý¾ÝÒ³ÔÚcheckpoint·¢ÉúʱûÓб»±¸·Ý¡££¨×îºóÕâ¾äʵÔÚ²»ÖªµÀÔõô·Òë²ÅºÃ£¬¸½ÉÏÔÎÄÈçÏ£ºIf however there were transactions performed during the backup, the data we recover may include data at the beginning of the backup, and data that were committed during the backup IF checkpoints occurred during the backup AND the data was written to pages that were not yet backed up yet at the time the checkpoint occurred.£©
ÏÂͼÏÔʾÁË´øcheckpointµÄ±¸·ÝÐòÁÐ
µ±Äã½øÐÐ±í¼¶±ðµÄ»Ö¸´Ö®Ç°£¬ÒªÏÈ¿¼ÂÇһЩÊÂÇé¡£Ò»¸öÍêÕû±¸·Ý°üÀ¨ËùÓеÄÊý¾Ý£¬»¹ÓÐÊý¾Ý¿âËùÓÐÖ±µ½±¸·Ý½áβµÄ¸Ä±ä¡£Ò»¸öµ¥¶ÀµÄÊý¾ÝÎļþÎÞ·¨Ó³Éä³öÖ¸¶¨Ê±¿ÌÊý¾Ý¿âµÄ״̬¡£Òò´Ë£¬±í¼¶±ðµÄ»Ö¸´°üÀ¨¾É¡¢ÔàÊý¾Ý¡£¼ÙÈçÔÚ±¸·ÝÆڼ䷢ÉúcheckpointµÄ»°£¬¾Í»áµ¼ÖÂÊý¾Ý²
Ïà¹ØÎĵµ£º
TRUNCATE TABLE ÔÚ¹¦ÄÜÉÏÓë²»´ø Where ×Ó¾äµÄ Delete
Óï¾äÏàͬ£º¶þÕß¾ùɾ³ý±íÖеÄÈ«²¿ÐС£µ« TRUNCATE TABLE ±È Delete Ëٶȿ죬ÇÒʹÓõÄϵͳºÍÊÂÎñÈÕÖ¾×ÊÔ´ÉÙ¡£
Delete
Óï¾äÿ´Îɾ³ýÒ»ÐУ¬²¢ÔÚÊÂÎñÈÕÖ¾ÖÐΪËùɾ³ýµÄÿÐмǼһÏî¡£TRUNCATE TABLE ͨ¹ýÊÍ·Å´æ´¢±íÊý¾ÝËùÓõÄÊý¾ÝÒ³À´É¾³ýÊý¾Ý£¬²¢ÇÒÖ»ÔÚÊÂÎñÈÕÖ¾ÖмÇÂ¼Ò ......
--´´½¨Ð´ÎļþµÄ´æ´¢¹ý³Ì
ALTER proc [dbo].[p_movefile]
@filename varchar(1000),--Òª²Ù×÷µÄÎı¾ÎļþÃû
@text varchar(8000), --ҪдÈëµÄÄÚÈÝ
@obj int
as
begin
declare @err int,
@src varchar(255),
&n ......
Çë½Ì¸ßÊÖÒ»¸öÎÊÌ⣬ÎÊÌâÃèÊöÈçÏ£º
A±íÊǸ÷¸öµ¥Î»µÄÃû³Æ±í ×Ö¶ÎΪ org_id ºÍ org_name
B±íÊÇÕâЩµ¥Î»µÄµç»°ºÅÂë±í ×Ö¶ÎΪ org_idºÍ tel
A±í B±í¹ØÁª·½Ê½ÎªA.ORG_ID=B.ORG_ID
org_idÊǸ÷¸öµ¥Î»µÄ´úÂë
org_nameÊǸ÷¸öµ¥Î»µÄÃû³Æ
telÊǸ÷¸öµ¥Î»µÄµç»°ºÅÂë
±¾ÈËÏÖÔÚÏëÕë¶Ôÿ¸öµ¥Î»£¨Ã¿Ìõorg_id£©È¡Æä10¸öºÅÂë
Ç ......
SELECT EXECUTIONS , DISK_READS, BUFFER_GETS,
¡¡¡¡ROUND((BUFFER_GETS-DISK_READS)/BUFFER_GETS,2) Hit_radio,
¡¡¡¡ROUND(DISK_READS/EXECUTIONS,2) Reads_per_run,
¡¡¡¡SQL_TEXT
¡¡¡¡from V$SQLAREA
¡¡¡¡WHERE EXECUTIONS>0
¡¡¡¡AND BUFFER_GETS > 0
¡¡¡¡AND (BUFFER_GETS-DISK_READS)/BUFFER_GETS ......
SELECTÓï¾äµÄÍêÕûÓ﷨Ϊ£º
SELECT[ALL|DISTINCT|DISTINCTROW|TOP]
{*|talbe.*|[table.]field1[AS alias1][,[table.]field2[AS alias2][,…]]}
from tableexpression[,…][IN externaldatabase]
[WHERE…]
[GROUP BY…]
[HAVING…]
[ORDER BY…]
[WITH OWNERACCESS OPTION]
×¢ ......