Link to home
Start Free TrialLog in
Avatar of tech-
tech-

asked on

SQL 2008 Offline Database Rebuild

I have a a database running in SQL 2008 I need help to run an Offline or a detached Database Rebuild...  I look forward to the help.  500 Points,  time
Avatar of Raja Jegan R
Raja Jegan R
Flag of India image

In order to perform Database Index Rebuild, database must be Attached and Online..
You can't perform Rebuild on a database that is either Detaches or offline.
Avatar of tech-
tech-

ASKER

How do I rebuild a database online?  It is a 160GB database that needs to be rebuilt ASAP.
ASKER CERTIFIED SOLUTION
Avatar of Raja Jegan R
Raja Jegan R
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tech-

ASKER

rrjegan17:

I ran that command suiccessful... The index physical report is still showing a few tables it recommends a rebuild on...  

Also, I was told by the software company that this rebuild could take days to complete.... and it only appeared to take a few minutes.  The server has dual core, x64 with 10GB ram...

>> The index physical report is still showing a few tables it recommends a rebuild on...  

Does those tables have Primary keys or Clustered indexes defined on it..
Else the report would say that it needs Rebuilds..

>> Also, I was told by the software company that this rebuild could take days to complete

It depends upon the fragmentation of indexes.

Kindly run the script above one more time and check whether those tables are not shown again in the report..
Avatar of tech-

ASKER

I ran it  sgsin...   Few tables are still reporting...

nonclustered index rebuild
Cluster index reorganize.

This report looks much better, it was every table prior.

Is there another in depth command?  Thank you
Use the script in "D. Using sys.dm_db_index_physical_stats in a script to rebuild or reorganize indexes" of the below link to selectively Reindex or Reorganize table based upon the fragmentation

http://msdn.microsoft.com/en-us/library/ms188917.aspx
>> nonclustered index rebuild
Cluster index reorganize.

For Nonclustered index, it would require a index rebuild which can be ignored as the records would be stored in a random order.
And for Clustered index, reorganizing using the script in the earlier comment should help..