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

SQL SERVER 2008µÄÊý¾ÝѹËõ


Ò»¡¢Êý¾Ý¿â°æ±¾
Êý¾ÝѹËõÔÚSql Server 2008ÉϲÅÖ§³Ö£¬2005²»ÐУ¬²¢ÇÒ»¹ÒªÊÇÆóÒµ°æ¡£ÎÒ³£³£ÍüÁËÕâÒ»µã£¬ÔÚ2005µÄStudioÉÏÄÖ³öÓï·¨´íÎóµÄ×´¿ö£¬ÕÛÌÚÀË·ÑÁ˺ÃÒ»Õó²ÅÐÑÎò¹ýÀ´¡£
¶þ¡¢Ñ¹Ëõ×´¿ö
´óÔ¼¿ÉÒÔ½ÚÊ¡20%-50%µÄ¿Õ¼ä£¬²¢ÇÒÐÐѹËõºÍҳѹËõÓÐËùÇø±ð¡£
µ«ÈÃÎÒʧÍûµÄÊÇ£¬Ïñº¬ÓÐVarchar(max),xmlÕâÖÖ×Ö¶ÎÀàÐ͵ģ¬·´¶øËƺõѹËõ²»Æðʲô×÷Óá£ÆäʵÎÒ¾õµÃ×îÐèҪѹËõµÄ¾ÍÊÇËüÃÇ¡£
Èý¡¢ÐÐѹËõÓëҳѹËõ
ÐÐѹËõÊǽ«¹Ì¶¨³¤¶ÈÀàÐʹ洢Ϊ¿É±ä³¤¶È´æ´¢ÀàÐÍ¡£Ò³Ñ¹Ëõ³ýÁËÐÐѹËõ£¬»¹ÓÐ×ÖµäѹËõµÈµÈ¡£¾ÍÊÇ˵£¬Ò³¼¶±ÈÐм¶Ñ¹µÃ¸üºÝ£¬¸üÀ÷º¦¡£Í¨³££¬±íµÄ»°ÎÒ²ÉÓÃҳѹËõ£»Ë÷Òý£¬ÐÐѹËõ¡£²»ÎªÊ²Ã´£¬Ï뵱Ȼ¶ú¡£
ËÄ¡¢¿ªÊ¼Ñ¹Ëõ
ѹËõµÄʱºò£¬Ó²ÅÌÒªÓпÕÓàµÄ¿Õ¼ä£¬ÒòΪѹËõÐèÒªÏûºÄ¶îÍâµÄ´ÅÅÌ¡£±ÈÈç˵£¬ÎÒѹËõÒ»¸ö190GBµÄ±í£¬´ó¸Å»¹Òª¶îÍâÕ¼ÓÃ90GBµÄ¿Õ¼ä¡£Ñ¹ËõÍêÁËÒԺ󣬿ÉÒÔͨ¹ýÊÕËõÊý¾Ý¿âÎļþÊÍ·Å¡£ÊÍ·ÅÁËÒÔºó¿Õ¼ä¾ÍÁ¬±¾´øÀû¶àÉÏÒ»µã¡£
·Ç·ÖÇø±íÒ³¼¶Ñ¹Ëõ
ALTER TABLE [table1] REBUILD WITH (DATA_COMPRESSION = PAGE);
GO
·ÖÇø±íÒ³¼¶Ñ¹Ëõ
ALTER TABLE [partitiontable1]
REBUILD PARTITION = ALL
WITH
(
DATA_COMPRESSION = PAGE ON PARTITIONS(1 TO 11)
);
GO
·Ç·ÖÇøË÷ÒýÐм¶Ñ¹Ëõ
ALTER INDEX ix_id
ON table1
REBUILD WITH ( DATA_COMPRESSION = ROW ) ;
GO
·ÖÇøË÷ÒýÐм¶Ñ¹Ëõ
ALTER INDEX Ix_Id ON partitiontable1
REBUILD PARTITION = ALL
WITH
(
DATA_COMPRESSION = ROW ON PARTITIONS(1 TO 16)
);
GO
Î塢ѹËõÒÔºóÊÕËõÊý¾Ý¿âÎļþ
DBCC SHRINKFILE ([Êý¾Ý¿âÎļþÂß¼­Ãû], ÊÕËõÖÁ¶à´ó£¨ÒÔMΪµ¥Î»£©);
GO
Èç
DBCC SHRINKFILE ([data_0], 5371);
GO
Õâ¸öÊÕËõºó´óС£¬ÎÒÊÇÏÈÔÚStudioÖУ¬Ñ¡ÖÐÊý¾Ý¿â£¬Êó±êÓÒ¼ü£¬Ôڲ˵¥ÖÐÑ¡ÈÎÎñ£¬ÊÕËõ£¬È»ºóµÃµ½Õâ¸öÊÕËõºóµÄ×îС³ß´ç£¬ÔÙ³­µ½½Å±¾Éϵġ£
Æäʵ°ïÖúÀïÃæ˵£¬DBCC SHRINKFILE ²»»á½«ÎļþÊÕËõµ½Ð¡ÓÚ´æ´¢ÎļþÖеÄÊý¾ÝËùÐèÒªµÄ´óС¡£ÀýÈ磬Èç¹ûʹÓà 10 MB Êý¾ÝÎļþÖÐµÄ 7 MB£¬Ôò´øÓÐ target_size Ϊ 6 µÄ DBCC SHRINKFILE Óï¾äÖ»Äܽ«¸ÃÎļþÊÕËõµ½ 7 MB£¬¶ø²»ÄÜÊÕËõµ½ 6 MB¡£ÄÇôÎÒÃǽ«5371д³É1£¬Æñ²»¿ìÔÕ£¿ÎÒûÓÐÊÔ£¬¿ÉÄÜ¿ÉÒÔ¡£
Áù¡¢¾­Ñé×ܽá
ѹËõºÍÊÕËõ·ÖÇø±í¡¢·ÖÇøË÷ÒýÏûºÄºÃ¶àʱ¼ä¡£Óиö¼¸Ê®GµÄ·ÖÇø±í£¬ÎÒѹËõÍêÁËÒÔºó£¬ÊÕËõ»¨ÁË2ÌìÓÖ19¸öСʱ£¬ÊÇÓýű¾Ö´Ðеģ¬Ò»¿ÚÆø²»Í£Ðª¡£
·Ç·ÖÇø±íÔòºÜ¿ì£¬100¶àGµÄÎļþ£¬1¡¢2Сʱ¾Í¸ã¶¨ÁË¡£
Æß¡¢ÎªÊ²Ã´ÒªÑ¹Ëõ
ÎÒ¾õµÃÊý¾Ý¿â·þÎñÆ÷µÄÆ¿¾±ÍùÍùÔÚÓ


Ïà¹ØÎĵµ£º

SQL Server ¾­Ñé £¨×ªÔØ£©

SQL Server ¾­Ñé £¨×ªÔØ£©
http://www.cnblogs.com/treeyh/archive/2007/08/06/844763.html
Èç¹ûÄãÕýÔÚ¸ºÔðÒ»¸ö»ùÓÚSQL ServerµÄÏîÄ¿£¬»òÕßÄã¸Õ¸Õ½Ó´¥SQL Server£¬Ä㶼ÓпÉÄÜÒªÃæÁÙһЩÊý¾Ý¿âÐÔÄܵÄÎÊÌ⣬ÕâƪÎÄÕ»áΪÄãÌṩһЩÓÐÓõÄÖ¸µ¼£¨ÆäÖдó¶àÊýÒ²¿ÉÒÔÓÃÓÚÆäËüµÄDBMS£©¡£
   ÔÚÕâÀÎÒ²»´òËã½éÉ ......

VC++µÄADOÁ¬½ÓSQL Server²½Öè

 1£ºSQL  ServerÊý¾Ý¿âÅäÖÃ
 
 
 
¿ªÆô·þÎñÆ÷
 
 
ÍÐÅÌÏÔʾ·þÎñÆ÷Æô¶¯
 
 
 
2:ÔÚStaAfx.h ÖÐÌí¼ÓÈçÏ´úÂë
#import "C:\\Program Files\\Common Files\\System\\ado\\msado15.dll" no_namespace      rename("EOF","adoEOF")rena ......

sqlÈÕÆÚº¯Êý

SQLServerʱ¼äÈÕÆÚº¯ÊýÏê½â,SQLServer,ʱ¼äÈÕÆÚ,
1.      µ±Ç°ÏµÍ³ÈÕÆÚ¡¢Ê±¼ä
        select getdate()
2. dateadd      ÔÚÏòÖ¸¶¨ÈÕÆÚ¼ÓÉÏÒ»¶Îʱ¼äµÄ»ù´¡ÉÏ£¬·µ»ØÐ嵀 datetime Öµ
       ÀýÈ ......

Sql Server»ù±¾º¯Êý

1.×Ö·û´®º¯Êý
³¤¶ÈÓë·ÖÎöÓÃ
datalength(Char_expr) ·µ»Ø×Ö·û´®°üº¬×Ö·ûÊý,µ«²»°üº¬ºóÃæµÄ¿Õ¸ñ
substring(expression,start,length) ²»¶à˵ÁË,È¡×Ó´®
right(char_expr,int_expr) ·µ»Ø×Ö·û´®ÓÒ±ßint_expr¸ö×Ö·û
×Ö·û²Ù×÷Àà
upper(char_expr) תΪ´óд
lower(char_expr) תΪСд
space(int_expr) Éú³Éint_expr¸ö¿Õ¸ñ ......

SQL ServerÖÐDateTime¸ñʽת»»

SQLʹÓÃconvertÀ´È¡µÃdatetimeÈÕÆÚÊý¾Ý£¬ÒÔÏÂʵÀý°üº¬¸÷ÖÖÈÕÆÚ¸ñʽµÄת»»,
¿ÉÒÔͨ¹ý²éѯÓï¾ä¼°²éѯ½á¹ûÀ´ÏÔʾ²»Í¬µÄ¸ñʽ£¬Èç¹ûÊÇDate¸ñʽҲ¿ÉÒÔÓãº
Select CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM
Select CONVERT(varchar(100), GETDATE(), 1): 05/16/06
Select CONVERT(varchar(100), GETDATE(), 2 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ