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

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
accept rate: 34%

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



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:


question asked: 23 Jan '14, 12:02

question was seen: 3,058 times

last updated: 23 Jan '14, 12:37