Which privileges does a user need to query used size in SQL Azure database?

若如初见. 提交于 2019-12-11 03:23:18

问题


I'm trying to query the consumed size of a SQL Azure database using code from this answer:

SELECT SUM(reserved_page_count)*8.0/1024 FROM sys.dm_db_partition_stats;

That query runs just fine under the database admin, but not under another user - I get

The user does not have permission to perform this action.

and when I try to GRANT SELECT permission I get this error message:

Permissions on server scoped catalog views or system stored procedures or extended stored procedures can be granted only when the current database is master.

If I log to master and try to GRANT there I get this message:

Permissions for system stored procedures, server scoped catalog views, and extended stored procedures cannot be changed in this version of SQL Server.

So it looks like users other than database admin can't get the used space.

How do I query the used space in the SQL Azure database under a user other than database admin?


回答1:


I seem to recall that we had to grant the login "VIEW DATABASE STATE" and "VIEW DEFINITION" in order to run that query.



来源:https://stackoverflow.com/questions/11364141/which-privileges-does-a-user-need-to-query-used-size-in-sql-azure-database

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