Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Yet another way to defrag indexes

By Gaby Abed,

Lovingly modified from example D in the world famous dm_db_index_physical_stats books online entry.

By putting the script in an query that can be executed, it lets me pass database names to it, without having to create the proc in each DB.  Feel free to play with the defaults, but these seem to work for us.  Because these are very critical online systems, I have decided to keep the ONLINE=ON setting by default.  But because there are tables that may have column types that can't be built online, such as text or XML, then a TRY/CATCH block switches it to OFF.

Total article views: 1308 | Views in the last 30 days: 77
 
Related Articles
FORUM

Online testing sql server...

online testing sql server...

FORUM

Filegroup online backup and restore

online ...but online at all time :-)

BLOG

TechEd Online

 I'm glad I'm not this slow, or maybe it's timed for the SQL Server release, but my TechEd Online pa...

ARTICLE

Trusting Online

How do you earn trust online? How do you decide who to trust? Steve Jones comments a bit about this ...

FORUM

checking database online or not

checking database online or not

Tags
defrag    
defragmentation    
indexes    
indices    
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones