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

tempdb¶ÔSQL ServerÊý¾Ý¿âÐÔÄÜÓкÎÓ°Ïì

tempdb¶ÔSQL ServerÊý¾Ý¿âÐÔÄÜÓкÎÓ°Ïì
 
±¾ÎĹؼü´Ê£ºSQL Server ÍøÂç
Ïà·´Èç¹û·ÃÎʺÜƵ·±,loading¾Í»á¼ÓÖØ,tempdbµÄÐÔÄܾͻá¶ÔÕû¸öDB²úÉúÖØÒªµÄÓ°Ïì.ÓÅ»¯tempdbµÄÐÔÄܱäµÄºÜÖØÒªµÄ,ÓÈÆä¶ÔÓÚ´óÐÍÊý¾Ý¿â.Èç¹ûʹÓÃÁÙʱ±í´¢´æ´óÁ¿µÄÊý¾ÝÇÒƵ·±·ÃÎÊ,¿¼ÂÇÌí¼ÓindexÒÔÔö¼Ó²éѯЧÂÊ.
¡¡  1.SQL ServerϵͳÊý¾Ý¿â½éÉÜ
¡¡¡¡SQL ServerÓÐËĸöÖØÒªµÄϵͳ¼¶Êý¾Ý¿â:master,model,msdb,tempdb.
¡¡¡¡master:¼Ç¼SQL ServerϵͳµÄËùÓÐϵͳ¼¶ÐÅÏ¢,°üÀ¨ÊµÀý·¶Î§µÄÔªÊý¾Ý,¶Ëµã,Á´½Ó·þÎñÆ÷ºÍϵͳÅäÖÃÉèÖÃ,»¹¼Ç¼ÆäËûÊý¾Ý¿âÊÇ·ñ´æÔÚÒÔ¼°ÕâЩÊý¾ÝÎÊÎļþµÄλÖõȵÈ.Èç¹ûmaster²»¿ÉÓÃ,Êý¾Ý¿â½«²»ÄÜÆô¶¯.
¡¡¡¡model:ÓÃÔÚSQL Server ʵÀýÉÏ´´½¨µÄËùÓÐÊý¾Ý¿âµÄÄ£°å¡£ÒòΪÿ´ÎÆô¶¯ SQL Server ʱ¶¼»á´´½¨ tempdb£¬ËùÒÔ model Êý¾Ý¿â±ØÐëʼÖÕ´æÔÚÓÚ SQL Server ϵͳÖС£
¡¡¡¡msdb:ÓÉSQL Server ´úÀíÓÃÀ´¼Æ»®¾¯±¨ºÍ×÷Òµ¡£
¡¡¡¡tempdb:ÊÇÁ¬½Óµ½ SQL Server ʵÀýµÄËùÓÐÓû§¶¼¿ÉÓõÄÈ«¾Ö×ÊÔ´£¬Ëü±£´æËùÓÐÁÙʱ±í,ÁÙʱ¹¤×÷±í,ÁÙʱ´æ´¢¹ý³Ì,ÁÙʱ´æ´¢´óµÄÀàÐÍ,Öмä½á¹û¼¯,±í±äÁ¿ºÍÓαêµÈ¡£ÁíÍ⣬Ëü»¹ÓÃÀ´Âú×ãËùÓÐÆäËûÁÙʱ´æ´¢ÒªÇó.
¡¡¡¡2.tempdbÄÚÔÚÔËÐÐÔ­Àí
¡¡¡¡ÓëÆäËûSQL ServerÊý¾Ý¿â²»Í¬µÄÊÇ,tempdbÔÚSQL ServerÍ£µô,ÖØÆôʱ»á×Ô¶¯µÄdrop,re-create. ¸ù¾ÝmodelÊý¾Ý¿â»áĬÈϽ¨Á¢Ò»¸öеÄ8MB(mdf file:8MB;ldf file:1MB, autogtouthÉèÖÃΪ10%)´óСrecovery modelΪsimpleµÄtempdbÊý¾Ý¿â.
¡¡¡¡tempdbÊý¾Ý¿â½¨Á¢Ö®ºó,DBA¿ÉÒÔÔÚÆäËûµÄÊý¾Ý¿âÖн¨Á¢Êý¾Ý¶ÔÏó,ÁÙʱ±í,ÁÙʱ´æ´¢¹ý³Ì,±í±äÁ¿µÈ»á¼Óµ½tempdbÖÐ.ÔÚtempdb»î¶¯ºÜƵ·±Ê±,Äܹ»×Ô¶¯µÄÔö³¤,ÒòΪÊÇsimpleµÄrecovery model,»á×îС»¯ÈÕÖ¾¼Ç¼,ÈÕÖ¾Ò²»á²»¶ÏµÄ½Ø¶Ï.
¡¡¡¡3.ÈçºÎºÏÀíµÄÓÅ»¯tempdbÒÔÌá¸ßSQL ServerµÄÐÔÄÜ
¡¡¡¡Èç¹ûSQL Server¶Ôtempdb·ÃÎʲ»Æµ·±,tempdb¶ÔÊý¾Ý¿â²»»á²úÉúÓ°Ïì;Ïà·´Èç¹û·ÃÎʺÜƵ·±,loading¾Í»á¼ÓÖØ,tempdbµÄÐÔÄܾͻá¶ÔÕû¸öDB²úÉúÖØÒªµÄÓ°Ïì.ÓÅ»¯tempdbµÄÐÔÄܱäµÄºÜÖØÒªµÄ,ÓÈÆä¶ÔÓÚ´óÐÍÊý¾Ý¿â.
¡¡¡¡×¢:ÔÚÓÅ»¯tempdb֮ǰ,ÇëÏÈ¿¼ÂÇtempdb¶ÔSQL ServerÐÔÄܲúÉú¶à´óµÄÓ°Ïì,ÆÀ¹ÀÓöµ½µÄÎÊÌâÒÔ¼°¿ÉÐÐÐÔ.
¡¡¡¡3.1×îС»¯µÄʹÓÃtempdb
¡¡¡¡SQL ServerÖкܶàµÄ»î¶¯¶¼»î·¢ÉúÔÚtempdbÖÐ,ËùÒÔÔÚijÖÖÇé¿ö¿ÉÒÔ¼õÉÙ¶à¶ÔtempdbµÄ¹ý¶ÈʹÓÃ,ÒÔÌá¸ßSQL ServerµÄÕûÌåÐÔÄÜ.
¡¡¡¡ÈçÏÂÓм¸´¦Óõ½tempdbµÄµØ·½:
¡¡¡¡(1)Óû§½¨Á¢µÄÁÙʱ±í.Èç¹ûÄܹ»±ÜÃâ²»ÓÃ,¾Í¾¡Á¿±ÜÃâ. Èç¹ûʹÓÃÁÙʱ±í´¢´æ´óÁ¿µÄÊý¾ÝÇÒƵ·±·ÃÎÊ,¿¼ÂÇÌ


Ïà¹ØÎĵµ£º

ÔÚ SQl SERVER 2005Öе÷Óõ±Ç°Óû§£É£Ä


ÎÊÌ⣺
ÎÒÏÖÔÚÄÚÈݶ¼µ÷ÓóöÀ´ÁË  ¾ÍÊÇΨһµÄÒ»¸öÎÊÌâ¡¡¡¡ÎÒÒªµ÷µ±Ç°Óû§ID¡¡ÎÒÓõÄPHPCMS {$r[userid]}Õâ¸ö±äÁ¿ ÔÚSqlServerÉϵ÷Óò»µ½ 
$sql="SELECT CustomerID, Carid, TotolPoints, TakePoints, LeavingPoints, CarType,Activation,Consumption 
fro ......

SQL ³£ÓÃµÄ Ôö¡¢É¾¡¢¸Ä¡¢²é »¹ÊÇÀμÇÓÚÐÄ àÞ

¼¸¸ö¼òµ¥µÄ»ù±¾µÄsqlÓï¾ä
 
Ñ¡Ôñ£ºselect * from table1 where ·¶Î§
²åÈ룺insert into table1(field1,field2) values(value1,value2)
ɾ³ý£ºdelete from table1 where ·¶Î§
¸üУºupdate table1 set field1=value1 where ·¶Î§
²éÕÒ£ºselect * from table1 where field1 like ’%value1%’
ÅÅÐò£ ......

SQL Server·ÖÒ³3ÖÖ·½°¸

 SQL Server·ÖÒ³3ÖÖ·½°¸±ÈÆ´
´ËתÔØÔ´×ÔÀîºé¸ùµÄblog.×÷ÕßÊÇ΢ÈíµÄMVP!Ï£Íû´ó¼Ò²Î¿¼ÒÔÏÂ3ÖÖ·½°¸,°´Êµ¼ÊÇé¿öÑ¡Ôñ!
½¨Á¢±í£º
CREATE TABLE [TestTable] (
 [ID] [int] IDENTITY (1, 1) NOT NULL ,
 [FirstName] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
 [LastName] [nvarchar] (100) ......

sqlÓï¾äÓÅ»¯30Àý×Ó

ÔÚSQLÓï¾äÓÅ»¯¹ý³ÌÖУ¬ÎÒÃǾ­³£»áÓõ½hint,ÏÖ×ܽáÒ»ÏÂÔÚSQLÓÅ»¯¹ý³ÌÖг£¼ûOracle HINTµÄÓ÷¨£º
1. /*+ALL_ROWS*/
±íÃ÷¶ÔÓï¾ä¿éÑ¡Ôñ»ùÓÚ¿ªÏúµÄÓÅ»¯·½·¨,²¢»ñµÃ×î¼ÑÍÌÍÂÁ¿,ʹ×ÊÔ´ÏûºÄ×îС»¯.
ÀýÈç:
SELECT /*+ALL+_ROWS*/ EMP_NO,EMP_NAM,DAT_IN from BSEMPMS WHERE EMP_NO='SCOTT';
2. /*+FIRST_ROWS*/
±íÃ÷¶ÔÓï¾ä¿éÑ ......

·ÀÖ¹SQL SERVERµÄʼþ̽²éÆ÷¸ú×Ù³ÌÐòÖÐSQL½Å±¾

ÈçºÎ·ÀÖ¹³ÌÐòÖÐSQL½Å±¾±»SQL SERVERµÄʼþ̽²éÆ÷¸ú×Ù£¬±£ÕÏ×Ô¼ºµÄÈí¼þ²»±»ËûÈË·ÖÎö£¿
ÏÂÃæÊÇÒ»¸öÍ£Ö¹ËùÓÐSQLSERVERµÄ¸ú×ÙÆ÷µÄ½Å±¾(Á½ÖÖ·½·¨µÄÔ­ÀíÏàͬ)£º
µÚÒ»ÖÖ·½·¨£º
procedure SQLCloseAllTrack;
const
sql = 'declare @TID integer ' +
'declare Trac Cursor For ' +
'SELECT Distinct Traceid from ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ