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: Yesterday @ 4:39 AM
Points: 39, Visits: 315

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
Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Yesterday @ 9:42 AM
Points: 743, Visits: 1,066
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: Yesterday @ 4:39 AM
Points: 39, Visits: 315
thank you
Post #1454035
Posted Tuesday, May 21, 2013 10:58 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 9:25 AM
Points: 7,070, Visits: 12,523
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

Believe you can and you're halfway there. --Theodore Roosevelt

Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein

The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein

1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
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: Today @ 1:58 PM
Points: 75, Visits: 261
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: Thursday, April 10, 2014 2:31 PM
Points: 11, Visits: 247
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, April 11, 2014 8:47 AM
Points: 7, Visits: 150
+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: Yesterday @ 4:39 AM
Points: 39, Visits: 315
thanks for all updates
Post #1455888
Posted Thursday, May 23, 2013 2:46 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Thursday, April 10, 2014 3:36 AM
Points: 407, Visits: 383
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, April 11, 2014 8:47 AM
Points: 7, Visits: 150
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