Database-Level Roles


Updated: December 16, 2016

THIS TOPIC APPLIES TO: yesSQL Server (starting with 2008)yesAzure SQL DatabaseyesAzure SQL Data Warehouse yesParallel Data Warehouse

To easily manage the permissions in your databases, SQL Server provides several roles which are security principals that group other principals. They are like groups in the Microsoft Windows operating system. Database-level roles are database-wide in their permissions scope.

To add and remove users to a database role, use the ADD MEMBER and DROP MEMBER options of the ALTER ROLE statement. Parallel Data Warehouse does not support this use of ALTER ROLE. Use the older sp_addrolemember and sp_droprolemember procedures instead.

There are two types of database-level roles: fixed-database roles that are predefined in the database and user-defined database roles that you can create.

Fixed-database roles are defined at the database level and exist in each database. Members of the db_owner database role can manage fixed-database role membership. There are also some special-purpose database roles in the msdb database.

You can add any database account and other SQL Server roles into database-level roles. Each member of a fixed-database role can add other users to that same role.

System_CAPS_ICON_tip.jpg Tip

Do not add user-defined database roles as members of fixed roles. This could enable unintended privilege escalation.

The permissions of user-defined database roles can be customized by using the GRANT, DENY, and REVOKE statements. For more information, see Permissions (Database Engine).

For a list of all the permissions, see the Database Engine Permissions poster. (Server-level permissions cannot be granted to database roles. Logins and other server-level principals (such as server roles) cannot be added to database roles. For server-level security in SQL Server, use server roles instead. Server-level permissions cannot be granted through roles in SQL Database and SQL Data Warehouse.)

The following table shows the fixed-database roles and their capabilities. These roles exist in all databases. The permissions assigned to the fixed-database roles cannot be changed.

Fixed-Database role nameDescription
db_ownerMembers of the db_owner fixed database role can perform all configuration and maintenance activities on the database, and can also drop the database in SQL Server. (In SQL Database and SQL Data Warehouse, some maintenance activities require server-level permissions and cannot be performed by db_owners.)
db_securityadminMembers of the db_securityadmin fixed database role can modify role membership and manage permissions. Adding principals to this role could enable unintended privilege escalation.
db_accessadminMembers of the db_accessadmin fixed database role can add or remove access to the database for Windows logins, Windows groups, and SQL Server logins.
db_backupoperatorMembers of the db_backupoperator fixed database role can back up the database.
db_ddladminMembers of the db_ddladmin fixed database role can run any Data Definition Language (DDL) command in a database.
db_datawriterMembers of the db_datawriter fixed database role can add, delete, or change data in all user tables.
db_datareaderMembers of the db_datareader fixed database role can read all data from all user tables.
db_denydatawriterMembers of the db_denydatawriter fixed database role cannot add, modify, or delete any data in the user tables within a database.
db_denydatareaderMembers of the db_denydatareader fixed database role cannot read any data in the user tables within a database.

The permissions assigned to the fixed-database roles cannot be changed. The following figure shows the permissions assigned to the fixed-database roles:


These database roles exist only in the virtual master database. Their permissions are restricted to actions performed in master. Only database users in master can be added to these roles. Logins cannot be added to these roles, but users can be created based on logins and then those users can be added to the roles. Contained database users in master, can also be added to these roles.

Role nameDescription
dbmanagerCan create and delete databases. A member of the dbmanager role that creates a database, becomes the owner of that databasee which allows that user to connect to that database as the dbo user. The dbo user has all database permissions in the database. Members of the dbmanager role do not necessarily have permission to access databases that they do not own.
loginmanagerCan create and delete logins in the virtual master database.
System_CAPS_ICON_note.jpg Note

The server-level principal and the Azure Active Directory Administrator (if configured) have all permissions in the SQL Database and SQL Data Warehouse without needing to be members of any roles. For more information, see SQL Database Authentication and Authorization: Granting Access.

The msdb database contains the special-purpose roles that are shown in the following table.

msdb role nameDescription


Members of these database roles can administer and use SSIS. Instances of SQL Server that are upgraded from an earlier version might contain an older version of the role that was named using Data Transformation Services (DTS) instead of SSIS. For more information, see Integration Services Roles (SSIS Service).


Members of these database roles can administer and use the data collector. For more information, see Data Collection.
PolicyAdministratorRoleMembers of the db_ PolicyAdministratorRole database role can perform all configuration and maintenance activities on Policy-Based Management policies and conditions. For more information, see Administer Servers by Using Policy-Based Management.

Members of these database roles can administer and use registered server groups.
dbm_monitorCreated in the msdb database when the first database is registered in Database Mirroring Monitor. The dbm_monitor role has no members until a system administrator assigns users to the role.
System_CAPS_ICON_important.jpg Important

Members of the db_ssisadmin role and the dc_admin role may be able to elevate their privileges to sysadmin. This elevation of privilege can occur because these roles can modify Integration Services packages and Integration Services packages can be executed by SQL Server using the sysadmin security context of SQL Server Agent. To guard against this elevation of privilege when running maintenance plans, data collection sets, and other Integration Services packages, configure SQL Server Agent jobs that run packages to use a proxy account with limited privileges or only add sysadmin members to the db_ssisadmin and dc_admin roles.

Applies to: SQL Server starting with SQL Server vNext

When R Services is installed, additional database roles are available for managing packages. For more information, see R Package management for SQL Server.

Role nameDescription
rpkgs-usersAllows users to use any shared packages that were installed by members of the rpkgs-shared role.
rpkgs-privateProvides access to shared packages with the same permissions as the rpkgs-users role. Members of this role can also install, remove and use privately scoped packages.
rpkgs-sharedProvides the same permissions as the rpkgs-private role. Users who are members of this role can also install or remove shared packages.

The following table explains the commands, views and functions for working with database-level roles.

sp_helpdbfixedrole (Transact-SQL)MetadataReturns a list of the fixed database roles.
sp_dbfixedrolepermission (Transact-SQL)MetadataDisplays the permissions of a fixed database role.
sp_helprole (Transact-SQL)MetadataReturns information about the roles in the current database.
sp_helprolemember (Transact-SQL)MetadataReturns information about the members of a role in the current database.
sys.database_role_members (Transact-SQL)MetadataReturns one row for each member of each database role.
IS_MEMBER (Transact-SQL)MetadataIndicates whether the current user is a member of the specified Microsoft Windows group or Microsoft SQL Server database role.
CREATE ROLE (Transact-SQL)CommandCreates a new database role in the current database.
ALTER ROLE (Transact-SQL)CommandChanges the name or membership of a database role.
DROP ROLE (Transact-SQL)CommandRemoves a role from the database.
sp_addrole (Transact-SQL)CommandCreates a new database role in the current database.
sp_droprole (Transact-SQL)CommandRemoves a database role from the current database.
sp_addrolemember (Transact-SQL)CommandAdds a database user, database role, Windows login, or Windows group to a database role in the current database. All platforms except Parallel Data Warehouse should use ALTER ROLE instead.
sp_droprolemember (Transact-SQL)CommandRemoves a security account from a SQL Server role in the current database. All platforms except Parallel Data Warehouse should use ALTER ROLE instead.
GRANTPermissionsAdds permission to a role.
DENYPermissionsDenys a permission to a role.
REVOKEPermissionsRemoves a previously granted or denied permissions.

Every database user belongs to the public database role. When a user has not been granted or denied specific permissions on a securable object, the user inherits the permissions granted to public on that object. Database users cannot be removed from the public role.

Security Catalog Views (Transact-SQL)

Security Stored Procedures (Transact-SQL)

Security Functions (Transact-SQL)

Securing SQL Server

sp_helprotect (Transact-SQL)

Community Additions