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.
Author |
Topic |
dbalearner
Constraint Violating Yak Guru
272 Posts |
Posted - 2011-08-11 : 01:52:45
|
I have database which needs to do the shrink as it has grown 10 times more and happened to shrink.After shrinking only LDF got shrunk but not MDF, and returned the error as 'DBCC SHRINKDATABASE: File ID 1 of database ID 8 was skipped because the file does not have enough free space to reclaim'When I used the SP_SPACEUSED then I got the Database usage history and again I used this commanddatabase_name database_size unallocated spaceExtranet 2846.00 GB 1234.17 GBreserved data index_size unused1587088 MB 1577872 MB 5704 MB 3512 MBdbcc shrinkfile ('filename',more than database_size)Still i could not achieve the desired shrinking,Any ideas.Many Thanks |
|
manju3606
Yak Posting Veteran
78 Posts |
Posted - 2011-08-11 : 10:27:27
|
The numeric target_percent argument passed to the DBCC SHRINKDATABASE command is a percentage of free space to leave in each file of the database. For example, if you've used 60 MB of a 100-MB database file, you can specify a shrink percentage of 25 percent. SQL Server will then shrink the file to a size of 80 MB, and you'll have 20 MB of free space in addition to the original 60 MB of data. In other words, the 80-MB file will have 25 percent of its space free. If, on the other hand, you've used 80 MB or more of a 100-MB database file, there is no way SQL Server can shrink this file to leave 25 percent free space. In that case, the file size remains unchanged.Because DBCC SHRINKDATABASE shrinks the database on a file-by-file basis, the mechanism used to perform the actual shrinking is the same as that used with DBCC SHRINKFILE. SQL Server first moves pages to the front of files to free up space at the end, and then it releases the appropriate number of freed pages to the operating system.it will help's you Manju |
|
|
|
|
|
|
|