Wednesday, March 21, 2012

How to reduce the data space allocated ?

Hi All,
I don't know how to change data space allocated ?
My SQL data have 10GB, but the "space allocated" was allocated 50GB.
The usage of data storage is 79%. I want to restore 20GB space from
the "space allocated". How to do that ?
DBCC SHRINKDATABASE
<http://msdn.microsoft.com/library/en..._dbcc_3pd1.asp>
or
DBCC SHRINKFILE
<http://msdn.microsoft.com/library/en..._dbcc_8b51.asp>
but you should be careful with these because if you're shrinking the
data file(s) these commands will 1) potentially create a stack of
transaction log records (and therefore blow out your transaction log
file size if you're using FULL or BULK-LOGGED recovery model) and 2)
cause inefficiencies if the file(s) that you shrink will need to grow again.
Here is some more info about it from a couple of SQL experts (Aaron
Bertrand & Tibor Karaszi) for your research:
How do I reclaim space in SQL Server?
<http://www.aspfaq.com/show.asp?id=2471>
Why you want to be restrictive with shrink of data files
<http://www.karaszi.com/SQLServer/info_dont_shrink.asp>
Hope this helps.
*mike hodgson*
blog: http://sqlnerd.blogspot.com
kelvinweb@.gmail.com wrote:

>Hi All,
>I don't know how to change data space allocated ?
>My SQL data have 10GB, but the "space allocated" was allocated 50GB.
>The usage of data storage is 79%. I want to restore 20GB space from
>the "space allocated". How to do that ?
>
>
sql

No comments:

Post a Comment