SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Rebuild Indexes


Rebuild Indexes

Author
Message
AndrewSQLDBA
AndrewSQLDBA
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1848 Visits: 3427
Hello Everyone
I am rebuilding the indexes on a database every week. I am getting complaints that the database is being locked during this process, and failing some transactions. Is there any to rebuild all the indexes and not lock the database? The entire process takes approx 30 - 40 mins.

Thank you in advance for your suggestions, comments and time

Andrew SQLDBA
GilaMonster
GilaMonster
SSC Guru
SSC Guru (90K reputation)SSC Guru (90K reputation)SSC Guru (90K reputation)SSC Guru (90K reputation)SSC Guru (90K reputation)SSC Guru (90K reputation)SSC Guru (90K reputation)SSC Guru (90K reputation)

Group: General Forum Members
Points: 90339 Visits: 45284
If you have Enterprise Edition, you can rebuild the indexes online, they'll probably take longer but don't hold long-duration locks.

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

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


JarJar
JarJar
SSC Eights!
SSC Eights! (814 reputation)SSC Eights! (814 reputation)SSC Eights! (814 reputation)SSC Eights! (814 reputation)SSC Eights! (814 reputation)SSC Eights! (814 reputation)SSC Eights! (814 reputation)SSC Eights! (814 reputation)

Group: General Forum Members
Points: 814 Visits: 1075
is it a 24/7 avail db? Then you'll have to pay for Enterprise Edition for the ONLINE = ON option. If not, can you do if off-hours? I do mine on Sunday mornings at 7am.

Otherwise, just do reorgs instead of full rebuilds. Better than nothing.



Orlando Colamatteo
Orlando Colamatteo
SSCoach
SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)

Group: General Forum Members
Points: 15325 Visits: 14396
Are you rebuilding every index? Maintenance Plans do this.

Consider using a tool that inspects the fragmentation levels and only rebuilds indexes that actually need it. Here is a good one: http://ola.hallengren.com/sql-server-index-and-statistics-maintenance.html

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
sql-lover
sql-lover
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1651 Visits: 1930
opc.three (5/6/2013)
Are you rebuilding every index? Maintenance Plans do this.

Consider using a tool that inspects the fragmentation levels and only rebuilds indexes that actually need it. Here is a good one: http://ola.hallengren.com/sql-server-index-and-statistics-maintenance.html


+1 vote for this.

To the OP ... try to implement Ola's solution and pick a date with few or no connections. It will be impossible to find a perfect time but at least, a night or day with very little activity.

The beauty of Ola's solution, is that it is "smart". It lets you tweak or customize the rebuild options and you can skip tables with less than 1k pages, or customize your own.

I have a 1.5TB database and the job only takes 55 minutes. Initial run was painfully slow though, almost 12 hrs, but after that, that's all it takes.
AndrewSQLDBA
AndrewSQLDBA
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1848 Visits: 3427
Yes, I have already done all of that. I did choose a time with the least amount of connections. There is one that comes from a java source that is open all the time. This one pumps data in at an almost constant basis. This is the one that I am having difficulty with. I have already chosen only the tables and indexes are large. I am not performing this on tables that never change or that are fragmented below a set percentage.

Thank you to everyone that replied

Andrew SQLDBA
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search