Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 fix fragmentation sql server

Author  Topic 

ronald_yoh
Starting Member

4 Posts

Posted - 2010-09-08 : 23:01:30
Hi,

I just shrunk the database using DBCC SHRINK statement. what would be the best approach to fix the fragmentation after shrinking the database?

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-09-09 : 00:32:03
1. don't shrink your databses.
2. do you mean file fragmentation or index fragmentation?

hopefully you mean index fragmentation, in which case rebuilding the indexes will solve it. the database(s) will likely grow again though.
Go to Top of Page

ronald_yoh
Starting Member

4 Posts

Posted - 2010-09-09 : 01:21:37
It shrunk the database then it would have effected the file. The log has grown to 30 Gb and I needed to release some spaces so I shrunk the database but when I run the sql profiler I noticed that the "reads" column had value of hundreds..
any suggestions?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-09 : 01:25:01
Value of hundreds? Give an example? Do you mean like 500? If so, then that isn't bad.

Also what is your baseline for reads before the shrink?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-09-09 : 02:32:26
"The log has grown to 30 Gb "

It needs backing up more frequently. Or someone did a one-off task (such as a deletion of stale data) and then you should SHRINK it back to normal operating size (absolutely NO smaller!!).

If the file will now just grow back again then all the Shrink has done is to fragment the file, and the database contents. Obviously for a one-time accident or deliberate bulk-delete etc. this isn't the case, but if you repeatedly shrink the database then it needs that space (or you aren't backing it up often enough)
Go to Top of Page
   

- Advertisement -