Solved

sys db files

Posted on 2014-11-18
6
114 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
  • 3
  • 2
6 Comments
 
LVL 47

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 47

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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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 47

Accepted Solution

by:
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

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

Featured Post

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.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

808 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