Solved

sys db files

Posted on 2014-11-18
6
105 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 45

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 45

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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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 45

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
SQL Query Syntax Error 9 33
SQL Help - 12 39
Haw to apply join on 2 tables with this scenario 4 5
Sql query 34 19
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now