Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Rebuild Indexes Expand / Collapse
Author
Message
Posted Sunday, May 5, 2013 7:33 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, August 12, 2014 2:35 PM
Points: 975, Visits: 3,350
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
Post #1449559
Posted Monday, May 6, 2013 2:08 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 11:31 AM
Points: 42,756, Visits: 35,848
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 2008, MVP
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

Post #1449620
Posted Monday, May 6, 2013 5:38 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Today @ 7:26 AM
Points: 321, Visits: 604
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.



Post #1449671
Posted Monday, May 6, 2013 11:31 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Tuesday, August 12, 2014 4:51 PM
Points: 7,097, Visits: 12,597
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
Post #1449816
Posted Monday, May 6, 2013 2:51 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: 2 days ago @ 3:01 PM
Points: 384, Visits: 1,257
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.
Post #1449890
Posted Monday, May 6, 2013 6:38 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, August 12, 2014 2:35 PM
Points: 975, Visits: 3,350
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
Post #1449944
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse