calculate size of sql azure database

狂风中的少年 提交于 2019-12-09 04:10:17

问题


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.

回答1:


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.

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



来源:https://stackoverflow.com/questions/13296150/calculate-size-of-sql-azure-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!