?
Solved

sys db files

Posted on 2014-11-18
6
Medium Priority
?
130 Views
Last Modified: 2014-12-04
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
Comment
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
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 51

Expert Comment

by:Vitor Montalvão
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

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

Expert Comment

by:Vitor Montalvão
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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 26

Expert Comment

by:Shaun Kline
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 51

Accepted Solution

by:
Vitor Montalvão earned 2000 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

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

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
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.
Viewers will learn how the fundamental information of how to create a table.
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question