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´æ´¢¹ý³ÌµÄ¸ÅÄÓŵ㼰Óï·¨
¡¡¡¡ÕûÀíÔÚѧϰ³ÌÐò¹ý³Ì֮ǰ£¬ÏÈÁ˽âÏÂʲôÊÇ´æ´¢¹ý³Ì?ΪʲôҪÓô洢¹ý³Ì£¬ËûÓÐÄÇЩÓŵã
¡¡¡¡¶¨Ò壺½«³£ÓõĻòºÜ¸´ÔӵŤ×÷£¬Ô¤ÏÈÓÃSQLÓï¾äдºÃ²¢ÓÃÒ»¸öÖ¸¶¨µÄÃû³Æ´æ´¢ÆðÀ´, ÄÇôÒÔºóÒª½ÐÊý¾Ý¿âÌṩÓëÒѶ¨ÒåºÃµÄ´æ´¢¹ý³ÌµÄ¹¦ÄÜÏàͬµÄ·þÎñʱ,Ö»Ðèµ÷ÓÃexecute,¼´¿É×Ô¶¯Íê³ ......
SQL Server ¾Ñé £¨×ªÔØ£©
http://www.cnblogs.com/treeyh/archive/2007/08/06/844763.html
Èç¹ûÄãÕýÔÚ¸ºÔðÒ»¸ö»ùÓÚSQL ServerµÄÏîÄ¿£¬»òÕßÄã¸Õ¸Õ½Ó´¥SQL Server£¬Ä㶼ÓпÉÄÜÒªÃæÁÙһЩÊý¾Ý¿âÐÔÄܵÄÎÊÌ⣬ÕâƪÎÄÕ»áΪÄãÌṩһЩÓÐÓõÄÖ¸µ¼£¨ÆäÖдó¶àÊýÒ²¿ÉÒÔÓÃÓÚÆäËüµÄDBMS£©¡£
ÔÚÕâÀÎÒ²»´òËã½éÉ ......
1¡¢ÏÂÔرر¸Èí¼þ
(1) JDK (Java Development Kit)
SUN¹Ù·½µÄÏÂÔصØÖ·ÊÇhttp://java.sun.com/javase/downloads/index.jsp
(2) JDBC
(3) Eclipse
(4) Microsoft SQL Server 2005 Express£¨µ±È»£¬ÓзÇExpressÒ²OK°¡£©
(5) SQL Server Management Studio
2¡¢°²×°Óë»·¾³ÅäÖÃ
(1) JDK
Ê×ÏÈÔÚWindows»·¾³Ï£¬ÏÂÔغó° ......
SQLServerʱ¼äÈÕÆÚº¯ÊýÏê½â,SQLServer,ʱ¼äÈÕÆÚ,
1. µ±Ç°ÏµÍ³ÈÕÆÚ¡¢Ê±¼ä
select getdate()
2. dateadd ÔÚÏòÖ¸¶¨ÈÕÆÚ¼ÓÉÏÒ»¶Îʱ¼äµÄ»ù´¡ÉÏ£¬·µ»ØÐ嵀 datetime Öµ
ÀýÈ ......
Load the SQL Server 2005 Driver for JDBC before you load the SQL Server 2000 Driver for JDBC. To do this, use the DriverManager class as in the following code example.
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); // 2005 version
Class.forName("com.microsoft.jdbc.sqlserver.SQLSe ......