February 11, 2012 at 11:58 am
Hi Friends,
I am facing a problem while Rebuilding indexes on one of my database,
i use the follwoing script to rebuild all indexes of my database
USE [dbname]
Go
EXEC sp_MSforeachtable @command1="print '?'", @command2="ALTER INDEX ALL ON ? REBUILD WITH (ONLINE=OFF)"
GO
Sp_updatestats
GO
My database infromation;
Database size = 6GB
Data Free space = 16%
Log Free Space = 94%
Auto growth = Restricted
Cluster Indexes = 30 with >50% avg_fragmentation
Heap tables = 20 with >75% avg_fragmentation
after successfull completion of the above script avg_fragmentation of cluster indexes remain same.
Please help me out.
Thanks in advance.
________________________________________
M.I.
[font="Times New Roman"]
February 11, 2012 at 12:04 pm
How big are the indexes? How many pages?
Your rebuild won't affect heaps, that's why they don't change.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
February 11, 2012 at 12:37 pm
GilaMonster (2/11/2012)
How big are the indexes? How many pages?Your rebuild won't affect heaps, that's why they don't change.
The Index size is >=502544KB, and
Pages are >=277 on each cluster and non-cluster index.
________________________________________
M.I.
[font="Times New Roman"]
February 11, 2012 at 3:07 pm
Too small to worry about.
http://sqlskills.com/BLOGS/PAUL/post/Where-do-the-Books-Online-index-fragmentation-thresholds-come-from.aspx[/url]
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
February 12, 2012 at 11:09 pm
Hi Gila,
But on server performance problem, how i can resolve that?
________________________________________
M.I.
[font="Times New Roman"]
February 13, 2012 at 1:43 am
That's a whole nother problem, and the first thing you need to do is identify the cause, not guess the cause.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
February 14, 2012 at 9:11 am
MSQLDBA (2/12/2012)
Hi Gila,But on server performance problem, how i can resolve that?
Get a professional to come in and give your system a performance review. Find problems, fix them, and MENTOR you on how to do the same. Win-Win-Win
Best,
Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru on googles mail service
February 15, 2012 at 2:09 pm
Try and increase your free space to be more than 20% and try again.
In regards to fragmentation also try and run CONTIG.
http://technet.microsoft.com/en-us/sysinternals/bb897428
Contig is a single-file defragmenter that attempts to make files contiguous on disk. Its perfect for quickly optimizing files that are continuously becoming fragmented, or that you want to ensure are in as few fragments as possible
February 15, 2012 at 3:11 pm
Index fragmentation != file fragmentation. If running a file system defrag tool on SQL databases, SQL Server must be stopped for the duration. While there are tools that claim they can defrag open files, there have been cases where those tools have caused problems running on an online SQL database.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
February 15, 2012 at 3:27 pm
Hi,
Not sure if you have a requirement for the system to be online or if there an opportunity in the evening to run maintenance...
RE- EXEC sp_MSforeachtable @command1="print '?'", @command2="ALTER INDEX ALL ON ? REBUILD WITH (ONLINE=OFF)"
As you are trying to do a rebuild offline...then the suggested CONTIG will only work properly with database Offline and even detached.
For Online re-indexing see reference below for further options.
http://www.microsoft.com/technet/prodtechnol/sql/2005/onlineindex.mspx
Summary: Introduced in SQL Server 2005 Enterprise Edition, the online index feature provides a powerful way to perform maintenance operations such as rebuilding or creating indexes in a production system without sacrificing DML concurrency. This paper provides a detailed discussion of the index process and provides guidelines and best practices for implementing this feature in a production environment.
February 16, 2012 at 9:58 am
Is the table a heap or does it have a clustered index?
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply