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

SQL Server ¾­³£Óõ½µÄ¼¸¸öÉèÖÃÑ¡Ïî

1. SET DEADLOCK_PRIORITY
˵Ã÷£º¿ØÖÆÔÚ·¢ÉúËÀËøÇé¿öʱ»á»°µÄ·´Ó¦·½Ê½¡£Èç¹ûÁ½¸ö½ø³Ì¶¼Ëø¶¨Êý¾Ý£¬²¢ÇÒÖ±µ½ÆäËü½ø³ÌÊÍ·Å×Ô¼ºµÄËøʱ£¬Ã¿¸ö½ø³Ì²ÅÄÜÊÍ·Å×Ô¼ºµÄËø£¬¼´·¢ÉúËÀËøÇé¿ö¡£
Óï·¨£ºSET DEADLOCK_PRIORITY { LOW | NORMAL | @deadlock_var }
²ÎÊý£ºLOW  Ö¸¶¨µ±Ç°»á»°ÎªÊ×Ñ¡ËÀËøÎþÉüÆ·¡£Microsoft® SQL Server™ ×Ô¶¯»Ø¹öËÀËøÎþÉüÆ·µÄÊÂÎñ£¬²¢¸ø¿Í»§¶ËÓ¦ÓóÌÐò·µ»Ø 1205 ºÅËÀËø´íÎóÐÅÏ¢¡£
¡¡¡¡¡¡NORMAL  Ö¸¶¨»á»°·µ»Øµ½Ä¬ÈϵÄËÀËø´¦Àí·½·¨¡£
¡¡¡¡¡¡@deadlock_var ÊÇÖ¸¶¨ËÀËø´¦Àí·½·¨µÄ×Ö·û±äÁ¿¡£Èç¹ûÖ¸¶¨ LOW£¬Ôò @deadlock_var Îª 3£»Èç¹ûÖ¸¶¨ NORMAL£¬Ôò @deadlock_var Îª 6¡£
×¢ÊÍ£ºSET DEADLOCK_PRIORITY µÄÉèÖÃÊÇÔÚÖ´ÐлòÔËÐÐʱÉèÖ㬶ø²»ÊÇÔÚ·ÖÎöʱÉèÖá£
ȨÏÞ£ºSET DEADLOCK_PRIORITY È¨ÏÞĬÈÏÊÚÓèËùÓÐÓû§¡£
 
2. SET LOCK_TIMEOUT
˵Ã÷£ºÖ¸¶¨Óï¾äµÈ´ýËøÊͷŵĺÁÃëÊý¡£
Óï·¨£ºSET LOCK_TIMEOUT timeout_period
²ÎÊý£ºtimeout_period ÊÇÔÚ Microsoft® SQL Server™ ·µ»ØËø¶¨´íÎóÇ°¾­¹ýµÄºÁÃëÊý¡£ÖµÎª -1£¨Ä¬ÈÏÖµ£©Ê±±íʾûÓг¬Ê±ÆÚÏÞ£¨¼´ÎÞÏÞÆڵȴý£©¡£
¡¡¡¡¡¡   µ±ËøµÈ´ý³¬¹ý³¬Ê±ÖµÊ±£¬½«·µ»Ø´íÎó¡£ÖµÎª 0 Ê±±íʾ¸ù±¾²»µÈ´ý£¬²¢ÇÒÒ»Óöµ½Ëø¾Í·µ»ØÐÅÏ¢¡£
×¢ÊÍ£ºÔÚÁ¬½Ó¿ªÊ¼Ê±£¬¸ÃÉèÖõÄֵΪ -1¡£ÉèÖøü¸Äºó£¬ÐÂÉèÖÃÔÚÆäÓàµÄÁ¬½Óʱ¼äÀïÒ»Ö±ÓÐЧ¡£
¡¡¡¡¡¡SET LOCK_TIMEOUT µÄÉèÖÃÊÇÔÚÖ´ÐлòÔËÐÐʱÉèÖ㬶ø²»ÊÇÔÚ·ÖÎöʱÉèÖá£
¡¡¡¡¡¡READPAST Ëø¶¨ÌáʾΪ¸Ã SET Ñ¡ÏîÌṩÁËÁíÒ»ÖÖ·½Ê½¡£
ȨÏÞ£ºSET LOCK_TIMEOUT È¨ÏÞĬÈÏÊÚÓèËùÓÐÓû§¡£
ʾÀý£ºÏÂÀý½«Ëø³¬Ê±ÆÚÏÞÉèÖÃΪ 1,800 ºÁÃë¡£
¡¡¡¡¡¡SET LOCK_TIMEOUT 1800
¡¡¡¡¡¡GO
 
3. @@LOCK_TIMEOUT
˵Ã÷£º·µ»Øµ±Ç°»á»°µÄµ±Ç°Ëø³¬Ê±ÉèÖ㬵¥Î»ÎªºÁÃë¡£
Óï·¨£º@@LOCK_TIMEOUT
·µ»ØÀàÐÍ£ºinteger
×¢ÊÍ£ºSET LOCK_TIMEOUT ÔÊÐíÓ¦ÓóÌÐòÉèÖÃÓï¾äµÈ´ý×èÈû×ÊÔ´µÄ×ʱ¼ä¡£µ±Ò»ÌõÓï¾äÒѵȴý³¬¹ý LOCK_TIMEOUT ËùÉèÖõÄʱ¼ä£¬Ôò±»ËøסµÄÓï¾ä½«×Ô¶¯È¡Ïû£¬²¢¸øÓ¦ÓóÌÐò·µ»ØÒ»Ìõ´íÎóÐÅÏ¢¡£
¡¡¡¡¡¡ÔÚÒ»¸öÁ¬½ÓµÄ¿ªÊ


Ïà¹ØÎĵµ£º

SQLÓï¾äPART1

Oracle SQL(partI)
Data manipulation language(DML): select, insert, update, delete, merge.
Data definition language(DDL): create, alter, drop, rename, truncate, comment
Data control language(DCL): grant, revoke
Transaction control: commit, rollback, savepoint
Arithmetic Expressions:
+, -, *, / ......

SQL ServerϵͳÊÓͼ


--> Title  : SQL ServerϵͳÊÓͼ
--> Author : wufeng4552
--> Date   : 2009-10-28
 
Ŀ¼ÊÓͼ
Ŀ¼ÊÓͼ·µ»Ø SQL Server Êý¾Ý¿âÒýÇæʹÓõÄÐÅÏ¢¡£½¨ÒéÄúʹÓÃĿ¼ÊÓͼÕâÒ»×î³£ÓõÄĿ¼ԪÊý¾Ý½çÃ棬Ëü¿ÉΪÄúÌṩ×îÓÐЧµÄ·½·¨À´»ñÈ¡¡¢×ª»»²¢ÏÔʾ´ËÐÅÏ¢µÄ×Ô¶¨ÒåÐÎʽ¡£ËùÓÐÓû§¿ÉÓÃĿ¼Ԫ ......

[SQL Server]ÑÓ³ÙÖ´ÐÐ


WAITFOR
Ö¸¶¨´¥·¢Óï¾ä¿é¡¢´æ´¢¹ý³Ì»òÊÂÎñÖ´ÐеÄʱ¼ä¡¢Ê±¼ä¼ä¸ô»òʼþ¡£
Óï·¨
WAITFOR { DELAY 'time' | TIME
'time' }
²ÎÊý
DELAY
ָʾ Microsoft® SQL Server™ Ò»Ö±µÈµ½Ö¸¶¨µÄʱ¼ä¹ýÈ¥£¬×¿É´ï 24 Сʱ¡£
'time'
ÒªµÈ´ýµÄʱ¼ä¡£¿ÉÒÔ°´ datetime Êý¾Ý¿É½ÓÊܵĸñʽָ¶¨
time£¬Ò²¿ÉÒÔÓþֲ¿±äÁ¿Ö¸¶ ......

¡¾×ª¡¿MySQLÖÐSQLÓÅ»¯ºÍ¼Ü¹¹Éè¼ÆµÄһЩ¼òµ¥Ïë·¨

ÆÕͨMySQLÔËÐУ¬Êý¾ÝÁ¿ºÍ·ÃÎÊÁ¿²»´óµÄ»°£¬ÊÇ×ã¹»¿ìµÄ£¬µ«Êǵ±Êý¾ÝÁ¿ºÍ·ÃÎÊÁ¿¾çÔöµÄʱºò£¬ÄÇô¾Í»áÃ÷ÏÔ·¢ÏÖMySQLºÜÂý£¬ÉõÖÁdownµô£¬ÄÇô¾ÍÒª¿¼ÂÇÓÅ»¯ÎÒÃǵÄMySQLÁË¡£
ÓÅ»¯ÎÞ·ÇÊÇ´ÓÈý¸ö½Ç¶ÈÈëÊÖ£º
µÚÒ»¸öÊÇ´ÓÓ²¼þ£¬Ôö¼ÓÓ²¼þ£¬Ôö¼Ó·þÎñÆ÷
µÚ¶þ¸ö¾ÍÊǶÔÎÒÃǵÄMySQL·þÎñÆ÷½øÐÐÓÅ»¯£¬Ôö¼Ó»º´æ´óС£¬¿ª¶à¶Ë¿Ú£¬¶Áд·Ö¿ª
µÚÈý¸ö ......

SQLÊý¾Ý¿â»¹Ô­Óï¾ä

---¸½¼ÓÊý¾Ý¿â
sp_attach_db   'Êý¾Ý¿âÃû','Êý¾Ý¿âȫ·¾¶','Êý¾Ý¿âÈÕ־ȫ·¾¶'
---²é¿´Êý¾Ý¿âÂß¼­ÎļþÃû
RESTORE FILELISTONLY from disk = '±¸·ÝÎļþ'
---»¹Ô­Êý¾Ý¿â
restore database hzrb from disk = '±¸·ÝÎļþ'
with move 'Ö÷Âß¼­Ãû'     to '´æ·Åmdf·¾¶'    ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ