The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.

Hi folks,

I would like to know which command I use to know database physical size. In SQL Server I can use sp_helpdb ou sp_spaceused. Is there any command like these?

Also, any command to know the dbpsace allocated size and the file size.

Thanks! Roger

asked 23 Jan '14, 12:02

Roger's gravatar image

Roger
1265510
accept rate: 0%


I don't know whether this is the easiest way for a running database, but you can calculate that with the database properties FileSize (number of database pages) and PageSize (size of a database page), say in MB - for the system dbspace (i.e. the database .db file):

select db_property('FileSize') * db_property('PageSize') / 1024 / 1024;

and accordingly for other dbspaces like the transaction log (.log):

select db_extended_property('FileSize', 'TransLog') * db_property('PageSize') / 1024 / 1024;

Note: This tells the whole size of these files, not the "used space" vs. free space. There are other properties for that, or the DBINFO utility.

permanent link

answered 23 Jan '14, 12:35

Volker%20Barth's gravatar image

Volker Barth
29.3k287438644
accept rate: 32%

edited 23 Jan '14, 12:37

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×17
×10

question asked: 23 Jan '14, 12:02

question was seen: 454 times

last updated: 23 Jan '14, 12:37