[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Frag levels sql 2005

Posted on 2012-08-29
Medium Priority
Last Modified: 2012-09-14
Need the best script to check fragmentation levels on a SQl 2005 database.  I have picked 1 or 2 scripts online and they give me different fragmentation levels.
Question by:Nana Hemaa
LVL 30

Assisted Solution

by:Rich Weissler
Rich Weissler earned 750 total points
ID: 38350221
There are multiple different types of fragmentation possible.  Have you already read this blog on MSDN?  It also gives links to locations to get scripts to fix fragmentation issues.

The scripts you already have could be giving you different values for your current fragmentation because they could be measuring different things which are both called fragmentation... or because there isn't a 'standard' defined for reporting it... it could be a difference in calculation.
LVL 37

Accepted Solution

ValentinoV earned 750 total points
ID: 38350306
As you're asking about fragmentation, I'm assuming you'll also want to get rid of it as much as possible/needed?  Have a look at the following script by Michelle Ufford, you'll most likely find it useful: http://sqlfool.com/2011/06/index-defrag-script-v4-1/

Also check out the following article by colleague-expert mark_wills: http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/A_691-Managing-Fragmentation-for-the-Accidental-DBA.html

Another good write-up on fragmentation (contains interesting links) is the following blog post by Brent Ozar: http://www.brentozar.com/archive/2009/02/index-fragmentation-findings-part-1-the-basics/
LVL 75

Expert Comment

by:Anthony Perkins
ID: 38352456
The following script does not report the fragmentation, but rather reindexes/reorganizes based on the fragmentation level:

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question