Security 在SQL 2008 Server中创建自定义SQL Server角色
我想添加新的自定义SQL Server角色,并将新用户分别分配给这些适当的角色。我试图找到如何创建角色,但找不到添加该角色的位置。您能指导我如何达到我的要求吗?您在2008版中还不能做到这一点-这是SQL Server 2011(也称为“Denali”)将在2011/2012年的某个时候提供的一项新功能 请参阅一些参考资料:Security 在SQL 2008 Server中创建自定义SQL Server角色,security,sql-server-2008,Security,Sql Server 2008,我想添加新的自定义SQL Server角色,并将新用户分别分配给这些适当的角色。我试图找到如何创建角色,但找不到添加该角色的位置。您能指导我如何达到我的要求吗?您在2008版中还不能做到这一点-这是SQL Server 2011(也称为“Denali”)将在2011/2012年的某个时候提供的一项新功能 请参阅一些参考资料: 您可以创建数据库级别的角色,有关详细信息,请参阅和页面上的链接。您只需授予登录权限,而不是SQL Server 2011之前的角色。当然不理想,但它确实有效 我们使
CREATE LOGIN [MyDOmain\FolkITrustGroup] FROM WINDOWS;
GO
GRANT VIEW SERVER STATE TO [MyDOmain\FolkITrustGroup]
GRANT VIEW ANY DEFINITION TO [MyDOmain\FolkITrustGroup]
GO
编辑:这在不使用服务器角色的情况下达到了您的要求,而服务器角色还不存在…我现在没有安装SQL server,因此无法检查。但我对SQL的了解告诉我: 创建角色:
create role <rolename>;
这是标准的SQL方式。在某些DBMS的当前版本中,它还不可用。不确定SQL server。这不是OP询问的服务器角色吗?我不清楚他问的是创建服务器级角色还是数据库级角色,他们只问在SQL server中创建角色。你是说在数据库中还是在服务器级?SPE109有一个很好的观点,我和marc_可能理解错误,最后一句话是错误的。它应该是:
EXEC sp\u addrole成员“经理”、“约翰”
****A. Creating a server role that is owned by a login****
****The following example creates the server role buyers that is owned by login BenMiller.****
USE master;
CREATE SERVER ROLE buyers AUTHORIZATION BenMiller;
GO
****B. Creating a server role that is owned by a fixed server role****
****The following example creates the server role auditors that is owned the securityadmin fixed server role.****
USE master;
CREATE SERVER ROLE auditors AUTHORIZATION securityadmin;
GO
revoke <priv> on <rel> from <rolename>;
grant <rolename> to user;
create role supervisor;
grant select, insert on db.table to supervisor;
create role manager;
grant supervisor to manager;
grant manager to John;
****A. Creating a server role that is owned by a login****
****The following example creates the server role buyers that is owned by login BenMiller.****
USE master;
CREATE SERVER ROLE buyers AUTHORIZATION BenMiller;
GO
****B. Creating a server role that is owned by a fixed server role****
****The following example creates the server role auditors that is owned the securityadmin fixed server role.****
USE master;
CREATE SERVER ROLE auditors AUTHORIZATION securityadmin;
GO