17

如何计算 SQL Azure 数据库的当前大小?(不是最大尺寸限制)

几个地方(像这样)建议使用这个sql:

SELECT SUM(reserved_page_count) * 8192
FROM    sys.dm_db_partition_stats

但是,当以管理员登录名执行此操作时,出现此错误:

Msg 297, Level 16, State 1, Line 1
The user does not have permission to perform this action.
4

1 回答 1

37

这可能是因为您在数据库上运行查询。如果您使用的是 SQL Server Management Studio,请先选择您的数据库(而不是主数据库),然后执行查询。这应该有效。哦,顺便说一下,如果您想要以兆字节为单位的大小,请尝试以下操作:

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

或者 您也可以通过 Windows Azure 管理门户检查您的数据库大小及其使用情况。 在此处输入图像描述

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

于 2012-11-08T21:58:59.853 回答