Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

calculate database size Expand / Collapse
Author
Message
Posted Friday, September 27, 2013 1:29 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Wednesday, August 13, 2014 7:22 AM
Points: 61, Visits: 409
Friends,

how can i calculate database size with this information:

Processed 8192240 pages for database 'DBOLTP', file 'rm' on file 1. ??

(8192240 *8) = 65537920 (bytes) / 1024 / 1024 = 62MB?

Thanks...
Post #1499571
Posted Saturday, September 28, 2013 12:22 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Yesterday @ 5:18 AM
Points: 311, Visits: 486
Are you looking too deep into a simple problem?

Would this not provide the answer you need?

select name, size from sys.master_files;

Post #1499707
Posted Sunday, September 29, 2013 4:27 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 7:42 AM
Points: 36,955, Visits: 31,463
LOVER OF SQL (9/27/2013)
Friends,

how can i calculate database size with this information:

Processed 8192240 pages for database 'DBOLTP', file 'rm' on file 1. ??

(8192240 *8) = 65537920 (bytes) / 1024 / 1024 = 62MB?

Thanks...


Any size given in pages can be converted to binary (1024^3) MB just by dividing by 128.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1499790
Posted Sunday, September 29, 2013 4:32 PM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 7:54 AM
Points: 42,768, Visits: 35,867
That won't allow you to calculate the size of the database files. It will allow you to calculate the total size of the allocated extents in the database. If you want the size of the files, query sys.database_files.


Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1499791
Posted Monday, October 7, 2013 11:59 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, November 5, 2013 10:40 AM
Points: 3, Visits: 38
Each time I have been asked to return the size of the databases for the systems I manage, I tend to use this query. It returns the size for all databases found in master.

USE master
go
exec sp_helpdb

Here is the relevant Microsoft Article on it.
Post #1502288
Posted Wednesday, October 9, 2013 12:18 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Yesterday @ 5:18 AM
Points: 311, Visits: 486



ahhhhh......Everything seems so much clearer now....
Post #1502923
Posted Monday, October 14, 2013 5:18 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, March 4, 2014 8:34 AM
Points: 43, Visits: 178
Execute
EXEC sp_spaceused

towards the database, the reserved size shows the exact size of the database (Even the backup size for the database)
Post #1504404
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse