用户需要什么特权来查询SQL Azure数据库中已使用的大小? [英] Which privileges does a user need to query used size in SQL Azure database?

查看:94
本文介绍了用户需要什么特权来查询SQL Azure数据库中已使用的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用代码从此答案中查询SQL Azure数据库的已用大小:

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.

,当我尝试获得GRANT SELECT权限时,出现以下错误消息:

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

仅当当前数据库为master数据库时,才可以授予服务器范围的目录视图,系统存储过程或扩展存储过程的权限.

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

如果我登录到master并尝试访问GRANT,则会收到此消息:

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

在此版本的SQL Server中,无法更改系统存储过程,服务器范围的目录视图和扩展存储过程的权限.

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.

如何在数据库管理员以外的用户下查询SQL Azure数据库中的已用空间?

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

推荐答案

我似乎还记得我们必须授予登录名"VIEW DATABASE STATE"和"VIEW DEFINITION"才能运行该查询.

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

这篇关于用户需要什么特权来查询SQL Azure数据库中已使用的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆