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 |
aap
Starting Member
3 Posts |
Posted - 2007-10-19 : 03:10:23
|
Hi,I'm new here and actually I want to know, how does DBCC SHRINKDATABASE work ?According to the BOL :Assume a database named mydb with two data files and two log files. Both data and log files are 10 MB in size. The first data file contains 6 MB of data.For each file, SQL Server calculates a target size, which is the size to which the file is to be shrunk. When DBCC SHRINKDATABASE is specified with target_percent, SQL Server calculates target size to be the target_percent amount of space free in the file after shrinking. For example, if you specify a target_percent of 25 for shrinking mydb. SQL Server calculates the target size for this file to be 8 MB (6 MB of data plus 2 MB of free space). Therefore, SQL Server moves any data from the last 2 MB of the data file to any free space in the first 8 MB of the data file and then shrinks the file.--------------------------------------------------------------------If the size is 10 MB and target_percent is 25, how is the calculation so the final size become 8 MB and the free space become 2 MB ?I can't understand this section..., so I think I need some explanation about this.Okay..thanks and I'm waiting for the reply |
|
Kristen
Test
22859 Posts |
Posted - 2007-10-19 : 03:24:39
|
After shrinking the file will be 8MB or which 6MB data and 2MB free space.The 2MB will be 25% of the total - 2MB of 8MB file is 25%, so when shrinking the Target Percentage is of the file-after-it-has-been-shrunkKristen |
 |
|
aap
Starting Member
3 Posts |
Posted - 2007-10-22 : 06:23:23
|
Okay thanks. So if I describe, it will be : Y = 25% * Y + Z Y = 25 % * Y + 6 MBY = Size of File After ShrinkZ = Size of Data |
 |
|
|
|
|