Friday, March 30, 2012

How to shrink my database

hello

i know how to do shrinking DBCC SHRINKDATABASE( XXX,10).

But my question is how we know minumum shrinking Database value through stroed procedure.

please help me i need to shrink Database.

thanx

kiran

Kiran,

With DBCC SHRINKDATABASE, you specify the percentage of free space to leave after the shrink. i.e. : in your example,"10" will leave about 10 % free space after the shrink.

DBCC SHRINKFILE allows you to shrink a specific file within the database (i.e. : the transaction log or one of the data files). If the value you specify for target size is less than the minimum size, it will shrink the file to the minimum possible, therefore, if you specify "1", then it will shrink to the minimum possible.

Examples ;

DBCC SHRINKDATABASE (northwind, 10) -- Leaves about 10 % free space after the shrink

DBCC SHRINKFILE (datafile, 5) -- Shrinks "datafile" to 5 MB (or the minimum possible if more than 5 MB used)

Rod.

|||

thanx for you response rod.

but i have some small question can u we put defaulut "1" every time

like DBCC SHRINKDATABASE (northwind, 1) ?

regards

kiran

|||I wouldn't do that if I were you. If your autogrow property is not enabled, you end up with a non-functional database in no time.

No comments:

Post a Comment