Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Shrink file

Author  Topic 

carumuga
Posting Yak Master

174 Posts

Posted - 2009-12-08 : 01:16:12
Hey,

There is a command to shrink the database files using DBCC SHRINKFILE. In this command, i should be using the target size for shrinking to the specified size. How to calculate the specified/target size or should i go with the TRUNCATEONLY option where the un used space is recovered to the OS and the target size is ignored.

Also, can this command run "online" against the db files.

Thanks in advance

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2009-12-08 : 12:55:32
You specify the target size in MB.

Yes, it can be run while db is online, but it may be the victim of blocking and deadlocking.

Why are you shrinking the file(s)?
Go to Top of Page

carumuga
Posting Yak Master

174 Posts

Posted - 2009-12-09 : 00:46:36
Say for instance, I have 10 GB of data and Unused space seems to be 5 GB. what should be target size in this case or how do we calculate the target size to pass as an parameter for the DBCC SHRINKFILE command.
Is it also possible to shrink the file below 10 GB?
Go to Top of Page

carumuga
Posting Yak Master

174 Posts

Posted - 2010-03-07 : 22:50:47
Any updates on this incident.
Go to Top of Page

ahmad.osama
Posting Yak Master

183 Posts

Posted - 2010-03-08 : 04:04:41
quote:
Originally posted by carumuga

Say for instance, I have 10 GB of data and Unused space seems to be 5 GB. what should be target size in this case or how do we calculate the target size to pass as an parameter for the DBCC SHRINKFILE command.
Is it also possible to shrink the file below 10 GB?



the target size should be anywhere between 6-10GB..that depends on the amount of space u want to free...y do u need to shrink the file..perhaps if u explain the problem in detail...some one might give u a better solution..
Go to Top of Page
   

- Advertisement -