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

INDEX REBULID Expand / Collapse
Author
Message
Posted Friday, May 17, 2013 5:23 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, November 17, 2014 6:17 AM
Points: 40, Visits: 371

HI,

ANY ONE GIVE ME SCRIPT FOR INDEX REBULID AND UPDATE STATISTICS IN SQL 2008 R2
Post #1453939
Posted Friday, May 17, 2013 8:21 AM
SSC Eights!

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

Group: General Forum Members
Last Login: Friday, October 31, 2014 4:01 PM
Points: 835, Visits: 1,192
Index rebuild itself update stats so, you do not have to update stats after index rebuild.

here is one script from web. But if you google it you will find many more., Choose the one which suits you best.

http://sqlfool.com/2009/03/automated-index-defrag-script/

But before implementing this... read through this..

http://msdn.microsoft.com/en-us/library/ms189858.aspx
Post #1454031
Posted Friday, May 17, 2013 8:23 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, November 17, 2014 6:17 AM
Points: 40, Visits: 371
thank you
Post #1454035
Posted Tuesday, May 21, 2013 10:58 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 7:21 AM
Points: 7,135, Visits: 12,749
Another option for automating index and stats maintenance that I highly recommend:

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 #1455303
Posted Wednesday, May 22, 2013 12:29 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Tuesday, October 7, 2014 1:57 PM
Points: 82, Visits: 303
I agree with opc.three. This is one of the best scripts ever.

http://ola.hallengren.com/sql-server-index-and-statistics-maintenance.html
Post #1455643
Posted Wednesday, May 22, 2013 7:50 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, November 18, 2014 1:02 PM
Points: 23, Visits: 275
The Ola Hollengren scripts are hands down best.
Post #1455783
Posted Thursday, May 23, 2013 2:41 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, June 6, 2014 2:44 AM
Points: 7, Visits: 157
+1 for Ola Hallengren.
Post #1455884
Posted Thursday, May 23, 2013 2:45 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, November 17, 2014 6:17 AM
Points: 40, Visits: 371
thanks for all updates
Post #1455888
Posted Thursday, May 23, 2013 2:46 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Today @ 1:55 AM
Points: 540, Visits: 443
ReIndex all the Indexes from the Databases.
EXEC sp_msforeachtable @COMMAND1="PRINT '?' DBCC DBREINDEX('?','',80)"
GO

Update all Statistics from the Database.
EXEC SP_UPDATESTATS
GO

Post #1455889
Posted Thursday, May 23, 2013 3:08 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, June 6, 2014 2:44 AM
Points: 7, Visits: 157
The reason why Ola Hallengren's solution is better than the DBCC REINDEX commands:
- Microsoft recommends doing a reorganize only when fragmentation > 5% and < 30% and even do nothing when fragmentation < 5%, and then even ignore tables with < 10 000 rows.
- DBCC REINDEX syntax is deprecated (SQL 2000 syntax).

Ola Hallengren's script will dynamically choose what to do based on several factors:
- Licensing models (REBUILD ONLINE when possible)
- fragmentation level
- fields in tables (XML fields will prohibit REBUILD ONLINE and force REBUILD OFFLINE)

I have struggled for years with Microsoft Maintenance plans, and when this came along, I have started using it on all my db's. Whorks everytime, it's a no brainer and is even actively supported and updated.
Post #1455900
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse