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¿ç±í×éºÏ²éѯ´æÔÚЧÂÊÎÊÌ⣬¾ÙÀý±ÈÈç
delete from media_source where movie_id in ( select media_id from media where type=2 ) and origin = 3;
ºÍ
delete from media_source where origin = 3 and movie_id in ( select media_id from media where type=2 );
µÄЧÂÊÊDz»Ò»ÑùµÄ¡£
Èôorigin=3µÄÇé¿öÏÂmedia_so ......
ÉÏÒ»½Ú½²ÊöµÄÊÇɾ³ý²Ù×÷£¬±¾½Ú½«½²ÊöÈçºÎÖ±½ÓÖ´ÐÐsqlÓï¾ä¡£ Ö±½ÓÖ´ÐÐsqlÓï¾äÊÇʹÓÃfromSql·½·¨¡£ DbSession.Default.fromSql("select * from products").ToDataTable();
ÕâÑù¿´ÆðÀ´Ç×ÇжàÁË°É£¬Ö±½Ósql¾Í¿ÉÒÔÖ´ÐС£
µ±È»Ò²¿ÉÌí¼Ó²ÎÊýµÄ°¡¡£
DbSession.Default.fromSql("select * ......
·þÎñÆ÷¶Ë×Ö·û¼¯NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK
¿ØÖÆÎļþctl:
LOAD DATA
CHARACTERSET ZHS16GBK
INFILE 'c:\test.csv'
APPEND INTO TABLE stk_al_version
FIELDS TERMINATED BY ","
(org_no,stk_c,version,name)
¼ÓÈëºìÉ«Õâ¶ÎÎÄ×Ö ......
¿Í»§Ãû³Æ
´óÁ¬Ä³ÍøÂçÓÎÏ··þÎñÆ÷ £¨SQL SERVER 2008£© ÐÞ¸´³É¹¦
Êý¾Ý¿â°æ±¾
SQL SERVER 2008
Îļþ´óС
5G
¹ÊÕÏÃèÊö
¿Í»§µÄÓÎÏ··þ ......
¼Æ»®ÓÚ2008ÄêµÚÒ»¼¾¶È·¢²¼µÄSQL Server 2008²»½ö¶ÔÔÓÐÐÔÄܽøÐÐÁ˸Ľø£¬»¹Ìí¼ÓÁËÐí¶àÐÂÌØÐÔ£¬±ÈÈçÐÂÌíÁËÊý¾Ý¼¯³É¹¦ÄÜ£¬¸Ä½øÁË·ÖÎö·þÎñ£¬±¨¸æ·þÎñ£¬ÒÔ¼°Office¼¯³ÉµÈµÈ¡£
¡¡¡¡SQL Server¼¯³É·þÎñ
¡¡¡¡SSIS(SQL Server¼¯³É·þÎñ)ÊÇÒ»¸öǶÈëʽӦÓóÌÐò£¬ÓÃÓÚ¿ª·¢ºÍÖ´ÐÐETL(½âѹËõ¡¢×ª»»ºÍ¼ÓÔØ)°ü¡£SSIS´úÌæÁËSQL 2000µÄDTS¡£Õ ......