Thursday, March 22, 2012

database File size problem

Hi,
I have a database which is 10 GB big but on disk it shows 20GB. I did
backup and shrinkdb but it doesn't shrink. I could shrink log but not
the actual db. Any hints why I cannot do this? Also weird thing is that
when I run DBCC shrinkdb I don't get any error message.
Here is the exact command I run:
DBCC SHRINKDATABASE (MYDB, 5, TRUNCATEONLY)
GO
Tnank you,
hjHi
DBCC SHRINKDATABASE will not shrink a file smaller than it's initial size,
which may be the issue in your case. Use DBCC SHRINKFILE to shrink the
individual file, but if you are will be expanding to 20GB at some time, then
you may not want to shrink it at all. Your log file should be a reasonably
constant size, if you backup the log regularly (in FULL recovery mode).
John
"Hitesh" wrote:

> Hi,
> I have a database which is 10 GB big but on disk it shows 20GB. I did
> backup and shrinkdb but it doesn't shrink. I could shrink log but not
> the actual db. Any hints why I cannot do this? Also weird thing is that
> when I run DBCC shrinkdb I don't get any error message.
> Here is the exact command I run:
> DBCC SHRINKDATABASE (MYDB, 5, TRUNCATEONLY)
> GO
> Tnank you,
> hj
>|||DBCC SHRINKDATABASE will not shrink a file smaller than its shrinkpoint.
The shrinkpoint starts out at the initial size of the file, but once you use
DBCC SHRINKFILE, that can set a new shrinkpoint, and subsequent DBCC
SHRINKDATABASE operations can shrink to that new smaller size.
Also, Hitesh, make sure you're aware what the parameters to DBCC
SHRINKDATABASE mean. The 5 parameter means to shrink so that there is 5%
free space in the file. If there is already more than 5% free space, no
shrinking will take place.
When you run DBCC SHRINKFILE, then the number is the size in MB to which you
want to shrink the file.
Why do you think you might get an error message?
--
HTH
Kalen Delaney, SQL Server MVP
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:79C1DC8D-4BB0-4D11-BBED-A98A9BA35A2C@.microsoft.com...[vbcol=seagreen]
> Hi
> DBCC SHRINKDATABASE will not shrink a file smaller than it's initial size,
> which may be the issue in your case. Use DBCC SHRINKFILE to shrink the
> individual file, but if you are will be expanding to 20GB at some time,
> then
> you may not want to shrink it at all. Your log file should be a reasonably
> constant size, if you backup the log regularly (in FULL recovery mode).
> John
> "Hitesh" wrote:
>|||Thank you John & Kalean.
When I used DBCC SHRINKFILE on indivisual database files, it worked.
Kalean is right I might be using wrong free space percentage.
Thank you both for your help.
hj
Kalen Delaney wrote:[vbcol=seagreen]
> DBCC SHRINKDATABASE will not shrink a file smaller than its shrinkpoint.
> The shrinkpoint starts out at the initial size of the file, but once you u
se
> DBCC SHRINKFILE, that can set a new shrinkpoint, and subsequent DBCC
> SHRINKDATABASE operations can shrink to that new smaller size.
> Also, Hitesh, make sure you're aware what the parameters to DBCC
> SHRINKDATABASE mean. The 5 parameter means to shrink so that there is 5%
> free space in the file. If there is already more than 5% free space, no
> shrinking will take place.
> When you run DBCC SHRINKFILE, then the number is the size in MB to which y
ou
> want to shrink the file.
> Why do you think you might get an error message?
> --
> HTH
> Kalen Delaney, SQL Server MVP
>
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:79C1DC8D-4BB0-4D11-BBED-A98A9BA35A2C@.microsoft.com...

No comments:

Post a Comment