Solved

# sys db files

Posted on 2014-11-18
127 Views
I have been sent some information relating to database sizes (i beleive from sys.database_files). Do you know what the information in this table is stored in, is it Mb? I want to covert the size of the DB into Gb, so firstly knowing what it represents would help.
0
Question by:pma111
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 3
• 2

LVL 50

Expert Comment

ID: 40449603
Did you try to see in MSDN?
All columns are descripted there. The sizes are in 8-KB pages format so you need to use the following formula to get in GB: size * 8 * 1024 * 1024 (KB * MB * GB).
0

LVL 3

Author Comment

ID: 40449638
Thanks... but that formula cant be right? Arent the last 2 /'s of 1024?
0

LVL 50

Expert Comment

ID: 40449650
Sorry. I couldn't understand your question now but I'll try to explain in other words.

The size field stores the number of pages that the file has. In SQL Server is page has 8KB so you need to multiply the number in size field by 8 so you can have the result in KB. Then you multiply it by 1024 (1MB = 1024KB) and after you need to multiply again by 1024 (1GB=1024MB).
0

LVL 26

Expert Comment

ID: 40449875
No points, just clarifying Vitor's statements:
The data is stored in 8k page files. To convert to GB, you need to divide by 128 (to get to MB) and then divide by 1024 (to get to GB). Another way of looking at it is:
8k_size_page_count * 8 (to get to KB) / 1024 (to get to MB) / 1024 (to get to GB)
0

LVL 50

Accepted Solution

Vitor Montalvão earned 500 total points
ID: 40449889
Oh yes, now I understood the pma111 question.
I don't know why I was so focus in the multiplication. Should be division :)

Thanks Shaun for the correction.

So, should be size * 8 / 1024 / 1024 (KB --> MB --> GB).
0

LVL 26

Expert Comment

ID: 40449973
I owed you one from that TRIM question earlier this week.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

### Suggested Solutions

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
###### Suggested Courses
Course of the Month6 days, 14 hours left to enroll