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 2000 Forums
 SQL Server Administration (2000)
 DBCC SHRINKDATABASE question

Author  Topic 

rhofing
Starting Member

15 Posts

Posted - 2004-03-18 : 17:07:26
At the risk of sounding like a mathematical moron I have a question about DBCC SHRINKDATABASE. How is the actual free space calculated based on the percentage free value specified in the command?

I take an example from BOL:
mydb data file contains 6 MB of data, 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).

I understand that 2MB is 25% of 8MB. But how did they arrive at the 8MB value in the first place? Another way to ask this question is: 6MB plus how many MB's would represent 25% of the resulting value?

I ask this question because I am taking the 70-228 practice tests and there are a number of similar questions.

I am pulling out what little hair I have left :)

Thank you.

Ric

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-03-18 : 17:17:56
It just depends on your environment. In most environments, you leave 10% of free space in the MDF file. So that would be 6.6MB. I guess for their example, they wanted 20% free. There isn't one answer for this because it just depends on what your environment's needs are.

Tara
Go to Top of Page

MuadDBA

628 Posts

Posted - 2004-03-19 : 13:19:52
Algebra. You need to phrase the question in this way:

6MB is 75% of what value?

or you could phrase it this way:

What value minus 25% equals 6MB.

Either way, once you write it algebraicly, you are going to get an equation looking something like this:

X - .25X = 6
.75X = 6
X = 6/.75
X = 6 * 4 /3 (to divide by a fraction [.75 = 3/4] you multiply by its inverse, or 4/3)
X = 24/3
X = 8

Is this the answer you were looking for?
Go to Top of Page
   

- Advertisement -