Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

calculate size of sql azure database

How can I calculate the current size of a SQL Azure Database? (Not the maximum size limit)

Several places (like this) suggest using this sql:

SELECT SUM(reserved_page_count) * 8192
FROM    sys.dm_db_partition_stats

However when executing this as the Administrator login I get this error:

Msg 297, Level 16, State 1, Line 1
The user does not have permission to perform this action.
like image 857
Rory Avatar asked Nov 08 '12 19:11

Rory


People also ask

How can I check the size of my Azure SQL Database?

database_files DMV is the more accurate way to know the size of the database. There are multiple ways to calculating the size of the database as exposed on the article. Users have also documented this discrepancy between Portal and T-SQL on the Web.

What is the size of an SQL database Azure?

Azure SQL database has a different size for different plans, like for Basic plan, it offers 2Gb, for Standard tier it offers 250Gb, and for the Premium tier it offers a storage limit up to 1Tb.

How do I determine the size of a SQL database?

To estimate the size of a database, estimate the size of each table individually and then add the values obtained. The size of a table depends on whether the table has indexes and, if they do, what type of indexes.

How do I find the size of my database?

The size of the database is the space the files physically consume on disk. You can find this with: select sum(bytes)/1024/1024 size_in_mb from dba_data_files; But not all this space is necessarily allocated.

How big is my Azure SQL database?

How big is my Azure SQL database? Mar 13 2019 06:14 PM Assuming you have S3 database you will be limited to maximum of 250GB data size. This is not because we happy to give free bytes, this is because of the way we calculate the size. So 268,435,456,000 / 1000 / 1000 / 1000 = 268.435456 which is exactly the size shown on the portal.

How to check the size of a SQL Server database?

If you're using SQL Server Management Studio, choose your database first (not the master database), and execute the query. This should work. Oh and by the way, if you want the size in megabytes, try the following: OR You can check your database size and its usage through Windows Azure Management Portal also.

Why can't I see the size of a query in megabytes?

This is probably because you're running the query on the master database. If you're using SQL Server Management Studio, choose your database first (not the master database), and execute the query. This should work. Oh and by the way, if you want the size in megabytes, try the following:

How do I determine the size of a V12 database?

For V12 databases, the measurement we are interested in is determined using the sys.database_files DMV and the FILEPROPERTY function with the 'SpaceUsed' argument. Only ROWS files are considered. Log and XTP files are excluded for the purposes of determining database size. SELECT SUM (CAST (FILEPROPERTY (name, 'SpaceUsed') AS bigint) * 8192.)


1 Answers

This is probably because you're running the query on the master database. If you're using SQL Server Management Studio, choose your database first (not the master database), and execute the query. This should work. Oh and by the way, if you want the size in megabytes, try the following:

SELECT (SUM(reserved_page_count) * 8192) / 1024 / 1024 AS DbSizeInMB
FROM    sys.dm_db_partition_stats

OR You can check your database size and its usage through Windows Azure Management Portal also. enter image description here

Source: https://azure.microsoft.com/en-us/documentation/articles/sql-database-monitoring-with-dmvs/

like image 82
Sandrino Di Mattia Avatar answered Oct 07 '22 20:10

Sandrino Di Mattia