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

Rebuild indexes online with SQL Server 2005

Rebuild indexes online with SQL Server 2005
http://blogs.techrepublic.com.com/datacenter/?p=249
Online index rebuild
SQL Server 2005 introduces the ability to rebuild your indexes in an
online fashion so that other processes are able to access the table
while the rebuild is occurring. Because you can access the indexes
during the rebuild, you are not limited to only rebuilding indexes
during off-peak hours.
To accomplish this, the database engine takes some special actions
to rebuild the index and to allow access to the index at the same time.
The original index will remain available to users for reading data and
data modification. Row versioning is used to allow for transactional
consistency. During the rebuild, a new index is created that mimics the
old index. Any data modifications that alter the original index will
also be applied to this index by SQL Server during the rebuild. This
new index is not read from at all — it is write-only. It is essential
that you have enough available disk space to accommodate the data for
the two concurrent indexes during the online rebuild. While the rebuild
is taking place, SQL Server uses a mapping index to determine records
to modify in the new index when modifications occur in the original
index. Once the rebuild process has finished, any queries or data
modifications occur to the new index, and the original index is dropped.
Example
The process to rebuild an index online is not much different than
the typical rebuild process; however, there are a few ways to
accomplish the rebuild. One way is to simply drop the index using a
DROP INDEX statement followed by a CREATE INDEX statement. Rebuilding
indexes in this fashion leaves the table without an index until the
index is completely created. For this reason (and a number of other
reasons), dropping the index and recreating it is not recommended.
The CREATE INDEX statement can still be used to rebuild an index if
the DROP_EXISTING option is u


Ïà¹ØÎĵµ£º

SQL Server 2005ÆôÓÃsaÕ˺Å


SQL Server 2005ÆôÓÃsaÕ˺Å
ÆôÓÃsaÓû§ºÍÔ¶³ÌÁ¬½Ó 
²Ëµ¥Start->Microsoft SQL Server 2005->Configuration Tools->SQL Server Configuration Manager 
Ñ¡ÖÐSQL Server 2005 Network Configuration 
ÔÚÓұߵÄTCP/IPÉϵãÓÒ¼ü£¬enabled 
²Ëµ¥Start->Microsoft SQL Server 2005->SQL ......

²»Í¬SQL Server°æ±¾¼äµÄÊý¾Ý¿â»Ö¸´ÎÊÌâ

      ÔÚÕâÀï,ÎÒËùÖ¸µÄ°æ±¾ÊÇÖ¸µÄ2000,2005,2008ÕâÑùµÄ°æ±¾Çø±ð,¶ø²»ÊÇÆóÒµ°æ,¿ª·¢°æÕâÑùµÄ°æ±¾Çø±ð.´Ó¹Ù·½µÄ˵·¨À´¿´,SQL ServerÊÇÔÊÐíÊý¾Ý¿â´ÓµÍ°æ±¾Ïò¸ß°æ±¾»Ö¸´,µ«²»Ö§³Ö¸ß°æ±¾ÏòµÍ°æ±¾µÄ»Ö¸´,Èç¹ûÎÒÃÇÓø߰汾µÄÊý¾Ý¿âÔڵͰ汾µÄÊý¾Ý¿âÒýÇæÏ»ָ´,»á³öÏÖʲô´íÎóÃèÊöÄØ?
    ......

SQLÖÐobject_idº¯ÊýµÄÓ÷¨

 ¾­³£»á¿´¼ûÔÚSQL³ÌÐòµÄ¿ªÍ·ÓÐÕâÑùÒ»¾ä»°
if OBJECT_ID('tb') is not null
drop table tb  
º¯ÊýÓï·¨ÊÇÕâÑù£º
int OBJECT_ID('objectname');
×÷ÓÃÊÇ¿´¶ÔÏóobjectnameÊÇ·ñ´æÔÚ¡£
ÆäÖвÎÊýobjectname±íʾҪʹÓõĶÔÏó£¬ÊÇchar»òÕßncharÀàÐÍ¡£
·µ»ØÖµÀàÐÍΪint£¬Èç¹û¶ÔÏó´æÔÚ£¬Ôò·µ»Ø´Ë¶ÔÏóÔÚϵͳÖеı ......

SQLÓïÑÔ»ù´¡ Êý¾Ý¶¨Òå

1¡¢¶¨Òå»ù±¾±í
SQLÓïÑÔʹÓö¯´ÊCREATE¶¨Òå»ù±¾±í£¬Æä¾ßÌåÓï·¨¸ñʽÈçÏ£º
CREATE TABLE <±íÃû>
(<ÁÐÃû><Êý¾ÝÀàÐÍ>[Áм¶ÍêÕûÐÔÔ¼ÊøÌõ¼þ]...[£¬<ÁÐÃû><Êý¾ÝÀàÐÍ>[Áм¶ÍêÕûÐÔÔ¼ÊøÌõ¼þ]][,<±í¼¶ÍêÕûÐÔÔ¼ÊøÌõ¼þ>])£»
ÀýÈ磺½¨Á¢Ò»¸öѧÉú±íStudent£¬ËüÓÉѧºÅSno£¬ÐÕÃûSname£¬ÐÔ±ðSsex£¬Äê ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ