September 15, 2008 at 1:47 am
how can we rebulid index in sql 2005?
September 15, 2008 at 1:55 am
Alter Index ... Rebuild
You can get all the details of the various options from Books Online
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
September 15, 2008 at 3:05 am
Besides REBUILDING, there's also REORGANIZING indexes.
As mentioned, there are a lot of articles about rebuilding/reorganizing indexes
Wilfred
The best things in life are the simple things
September 15, 2008 at 3:06 am
Check the following links:
http://msdn.microsoft.com/en-us/library/ms189858.aspx
http://msdn.microsoft.com/en-us/library/ms188917.aspx which contains a very useful script at the end for reindexing
PSA
September 16, 2008 at 7:55 am
It depends on your version of SQL 2005. If it's Ent. then you'd run it like this if you wish
USE [YourDatabaseName]
GO
ALTER INDEX [IDX_YourIndexName] ON [dbo].[YourTableName] REBUILD WITH ( PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, SORT_IN_TEMPDB = OFF, ONLINE = ON )
GO
unfortunately if you are running a STD version you'd have to turn the ONLINE option OFF, otherwise you get an error like this...
Executing the query
"ALTER INDEX [IDX_YourIndexName] ON [dbo].[YourTableName] REBUILD WITH ( PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, SORT_IN_TEMPDB = OFF, ONLINE = ON )"
failed with the following error: "Online index operations can only be performed in Enterprise edition of SQL Server.".
Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply