Tuesday, March 27, 2012

DBCC SHRINKDATABASE

In my company, we use this command to shink databse, but it was not like our
expectation after it was done because the size was reduced less than
expectation. Could someone tell me if there are some factor to impact this
operation? What can I do to shrink much more size of database. Thanks.
Jerry Mu
See DBCC SHRINKFILE, section 'The File Does Not Shrink' on BOL.
Run the query listed there to see if sufficient free space is available
SELECT name ,size/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS int)/128.0
AS AvailableSpaceInMB
FROM sys.database_files;
Hope this helps,
Ben Nevarez
Senior Database Administrator
"Iter" wrote:

> In my company, we use this command to shink databse, but it was not like our
> expectation after it was done because the size was reduced less than
> expectation. Could someone tell me if there are some factor to impact this
> operation? What can I do to shrink much more size of database. Thanks.
> Jerry Mu
>
|||Also, see the following article:
http://www.karaszi.com/SQLServer/info_dont_shrink.asp
Ekrem ?nsoy
"Iter" <Iter@.discussions.microsoft.com> wrote in message
news:75F13788-9781-4DE1-8BEF-AA39A6977CEB@.microsoft.com...
> In my company, we use this command to shink databse, but it was not like
> our
> expectation after it was done because the size was reduced less than
> expectation. Could someone tell me if there are some factor to impact this
> operation? What can I do to shrink much more size of database. Thanks.
> Jerry Mu
>
|||Are you sure there is free space in the database? What is your goal in
shrinking the database? Reclaiming disk space temporarily? Unless your
database is large only because of a very unusual data load, and that data is
now gone, I would not allocate that disk space to something else just yet.
If your database is large because of normal activity, then shrinking it will
only mean that later it has to grow again, and you do not want this to be an
unexpected event that happens during peak activity, because you will have a
lot of unhappy users. Better off leaving the file large...
"Iter" <Iter@.discussions.microsoft.com> wrote in message
news:75F13788-9781-4DE1-8BEF-AA39A6977CEB@.microsoft.com...
> In my company, we use this command to shink databse, but it was not like
> our
> expectation after it was done because the size was reduced less than
> expectation. Could someone tell me if there are some factor to impact this
> operation? What can I do to shrink much more size of database. Thanks.
> Jerry Mu
>
|||Also I second the recommendation to read Tibor's article, posted by Ekrem.
It echoes my suggestions but in much more detail.
A
"Iter" <Iter@.discussions.microsoft.com> wrote in message
news:75F13788-9781-4DE1-8BEF-AA39A6977CEB@.microsoft.com...
> In my company, we use this command to shink databse, but it was not like
> our
> expectation after it was done because the size was reduced less than
> expectation. Could someone tell me if there are some factor to impact this
> operation? What can I do to shrink much more size of database. Thanks.
> Jerry Mu
>

No comments:

Post a Comment