Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Rebuild Indexes


Rebuild Indexes

Author
Message
AndrewSQLDBA
AndrewSQLDBA
Ten Centuries
Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)

Group: General Forum Members
Points: 1008 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-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47376 Visits: 44398
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-Addicted
SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)

Group: General Forum Members
Points: 402 Visits: 1021
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
SSCrazy Eights
SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)

Group: General Forum Members
Points: 8261 Visits: 14368
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
Say Hey Kid
Say Hey Kid (673 reputation)Say Hey Kid (673 reputation)Say Hey Kid (673 reputation)Say Hey Kid (673 reputation)Say Hey Kid (673 reputation)Say Hey Kid (673 reputation)Say Hey Kid (673 reputation)Say Hey Kid (673 reputation)

Group: General Forum Members
Points: 673 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
Ten Centuries
Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)

Group: General Forum Members
Points: 1008 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