简体   繁体   English

计算sql azure数据库的大小

[英]calculate size of sql azure database

How can I calculate the current size of a SQL Azure Database? 如何计算SQL Azure数据库的当前大小? (Not the maximum size limit) (不是最大尺寸限制)

Several places ( like this ) suggest using this sql: 几个地方( 像这样 )建议使用这个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.

This is probably because you're running the query on the master database. 这可能是因为您在master数据库上运行查询。 If you're using SQL Server Management Studio, choose your database first (not the master database), and execute the query. 如果您使用的是SQL Server Management Studio,请先选择数据库(而不是master数据库),然后执行查询。 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. 或者您也可以通过Windows Azure管理门户检查数据库大小及其使用情况。 在此输入图像描述

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM