Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2005
»
SQL Server 2005 General Discussion
»
DB Shrinking Question
DB Shrinking Question
Rate Topic
Display Mode
Topic Options
Author
Message
broonie27
broonie27
Posted Wednesday, January 16, 2013 9:09 PM
Forum Newbie
Group: General Forum Members
Last Login: Monday, January 28, 2013 2:25 PM
Points: 4,
Visits: 10
First off, I'm no DBA just a server sys admin.
I run a maintenance plan on my Prod DBs every week that used to shrink the DBs but after doing some investigation I see that shrinking regularly is a very bad idea so I have removed shrinking from the plan. However I have a 55GB DB that has 10GB space available and the shrink from the maintenance plan (before I removed it) never seemed to free up the space. Backup times and space are a bit of an issue on the server so I'm trying clean up as much as I can. Why would the DB still be showing 10GB free space after a shrink?
Post #1408131
SQLRNNR
SQLRNNR
Posted Wednesday, January 16, 2013 9:30 PM
SSCoach
Group: General Forum Members
Last Login: Yesterday @ 3:33 PM
Points: 18,858,
Visits: 12,443
Have you tried to manually shrink?
Also, after shrinking, did you also do an index defrag? Reindexing can cause the database to grow back out.
Jason
AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server 2008
SQL RNNR
Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1408132
Bhuvnesh
Bhuvnesh
Posted Thursday, January 17, 2013 1:43 AM
SSCrazy
Group: General Forum Members
Last Login: Thursday, June 13, 2013 7:03 AM
Points: 2,562,
Visits: 3,453
broonie27 (1/16/2013)
Why would the DB still be showing 10GB free space after a shrink?
From BOL
If target_size is specified, DBCC SHRINKFILE tries to shrink the file to the specified size. Used pages in the part of the file to be freed are relocated to available free space in the part of the file retained. For example, if there is a 10-MB data file, a DBCC SHRINKFILE operations with a target_size of 8 causes all used pages in the last 2 MB of the file to be reallocated into any unallocated pages in the first 8 MB of the file. DBCC SHRINKFILE does not shrink a file past the size needed to store the data in the file. For example, if 7 MB of a 10-MB data file is used, a DBCC SHRINKFILE statement with a target_size of 6 shrinks the file to only 7 MB, not 6 MB.
See
http://technet.microsoft.com/en-us/library/ms189493.aspx
-------Bhuvnesh----------
While 1 = 1 (Learning SQL....)
Click to get fast response of your post
Post #1408214
broonie27
broonie27
Posted Thursday, January 17, 2013 12:22 PM
Forum Newbie
Group: General Forum Members
Last Login: Monday, January 28, 2013 2:25 PM
Points: 4,
Visits: 10
The old maintenance plan, when it had the shrink task actually did a re-index before the shrink which I now know is very silly indeed.
I haven't actually manually run a shrink since I changed the maintenance plan but would it be an idea to a) Run a manual shrink and see what happens to the free space then b) run a manual re-index on the DB and see if the free space increases again?
Post #1408565
SQLRNNR
SQLRNNR
Posted Thursday, January 17, 2013 12:27 PM
SSCoach
Group: General Forum Members
Last Login: Yesterday @ 3:33 PM
Points: 18,858,
Visits: 12,443
You could do that, but the index job will cause it to grow again.
Jason
AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server 2008
SQL RNNR
Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1408566
broonie27
broonie27
Posted Thursday, January 17, 2013 12:29 PM
Forum Newbie
Group: General Forum Members
Last Login: Monday, January 28, 2013 2:25 PM
Points: 4,
Visits: 10
Bhuvnesh (1/17/2013)
broonie27 (1/16/2013)
Why would the DB still be showing 10GB free space after a shrink?
From BOL
If target_size is specified, DBCC SHRINKFILE tries to shrink the file to the specified size. Used pages in the part of the file to be freed are relocated to available free space in the part of the file retained. For example, if there is a 10-MB data file, a DBCC SHRINKFILE operations with a target_size of 8 causes all used pages in the last 2 MB of the file to be reallocated into any unallocated pages in the first 8 MB of the file. DBCC SHRINKFILE does not shrink a file past the size needed to store the data in the file. For example, if 7 MB of a 10-MB data file is used, a DBCC SHRINKFILE statement with a target_size of 6 shrinks the file to only 7 MB, not 6 MB.
See
http://technet.microsoft.com/en-us/library/ms189493.aspx
No, I'm not running the task with target_size I don't think but it does run with the default of 10% of free space to remain after shrink. Maybe that is my problem?
Post #1408567
broonie27
broonie27
Posted Thursday, January 17, 2013 12:32 PM
Forum Newbie
Group: General Forum Members
Last Login: Monday, January 28, 2013 2:25 PM
Points: 4,
Visits: 10
Not a good idea to do this during working hours I take it?
Post #1408568
SQLRNNR
SQLRNNR
Posted Thursday, January 17, 2013 12:33 PM
SSCoach
Group: General Forum Members
Last Login: Yesterday @ 3:33 PM
Points: 18,858,
Visits: 12,443
No. You should do it during a maintenance window or after business hours.
Jason
AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server 2008
SQL RNNR
Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1408570
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.