计算SQL Azure数据库的大小 [英] calculate size of sql azure database
问题描述
如何计算SQL Azure数据库的当前大小? (不是最大大小限制)
How can I calculate the current size of a SQL Azure Database? (Not the maximum size limit)
几个地方(类似)建议使用以下sql:
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.
推荐答案
这可能是因为您正在 master 数据库上运行查询.如果使用的是SQL Server Management Studio,请首先选择数据库(而不是master数据库),然后执行查询.这应该工作.哦,顺便说一句,如果您想要以兆字节为单位的大小,请尝试以下操作:
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 您也可以通过Windows Azure管理门户检查数据库大小及其使用情况.
OR You can check your database size and its usage through Windows Azure Management Portal also.
来源: 查看全文