GRANT ROLE Statement

Grants roles to users or other roles, with or without administrative rights.

Quick Links:

Go to Parameters

Go to Examples

Go to Usage

Go to Standards

Go to Permissions

Syntax

GRANT ROLE role_name [, …] 
   TO grantee [, …]
   [ {WITH NO ADMIN | WITH ADMIN [ ONLY ] } OPTION ]
   [ WITH NO SYSTEM PRIVILEGE INHERITANCE ]

role_name
   dbo†††
   | diagnostics†††
   | PUBLIC†††
   | rs_systabgroup†††
   | SA_DEBUG†††
   | SYS†††
   | SYS_AUTH_SA_ROLE
   | SYS_AUTH_SSO_ROLE
   | SYS_AUTH_DBA_ROLE††
   | SYS_AUTH_RESOURCE_ROLE
   | SYS_AUTH_BACKUP_ROLE
   | SYS_AUTH_VALIDATE_ROLE
   | SYS_AUTH_WRITEFILE_ROLE 
   | SYS_AUTH_WRITEFILECLIENT_ROLE
   | SYS_AUTH_READFILE_ROLE 
   | SYS_AUTH_READFILECLIENT_ROLE 
   | SYS_AUTH_PROFILE_ROLE 
   | SYS_AUTH_USER_ADMIN_ROLE 
   | SYS_AUTH_SPACE_ADMIN_ROLE 
   | SYS_AUTH_MULTIPLEX_ADMIN_ROLE 
   | SYS_AUTH_OPERATOR_ROLE 
   | SYS_AUTH_PERMS_ADMIN_ROLE
   | SYS_REPLICATE_ADMIN_ROLE†††
   | SYS_RUN_REPLICATE_ROLE†††
   | SYS_SPATIAL_ADMIN_ROLE†††
   | user-defined role name
  • The WITH NO SYSTEM PRIVILEGE INHERITANCE clause can be used when granting select compatibility roles to other roles. It prevents automatic inheritance of the compatibility role's underlying system privileges by members of the role. When granted to user-extended roles, the WITH NO SYSTEM PRIVILEGE INHERITANCE clause applies to members of the role only. The user acting as a role automatically inherits the underlying system privileges regardless of the clause.
  • The WITH NO ADMIN OPTION WITH NO SYSTEM PRIVILEGE INHERITANCE and WITH NO SYSTEM PRIVILEGE INHERITANCE clauses are semantically equivalent.
  • The WITH ADMIN OPTION or WITH ADMIN ONLY clauses can not be specified in combination with the WITH NO SYSTEM PRIVILEGE INHERITANCE clause when granting the SYS_AUTH_BACKUP_ROLE, SYS_AUTH_RESOURCE_ROLE, or SYS_AUTH_VALIDATE_ROLE roles.
  • ††The WITH ADMIN OPTION clause can only be specified in combination with the WITH NO SYSTEM PRIVILEGE INHERITANCE clause when granting the SYS_AUTH_DBA_ROLE or SYS_RUN_REPLICATION_ROLE roles.
  • †††The WITH ADMIN OPTION and WITH ADMIN ONLY OPTION clauses are not supported for system roles.

Parameters

(back to top)

Examples

(back to top)

Usage

(back to top)

Use of the WITH ADMIN OPTION or WITH ADMIN ONLY OPTION clause allows the grantee to grant or revoke the role, but does not allow the grantee to drop the role.
By default, if no administrative clause is specified in the grant statement, each compatibility role is granted with these default administrative rights:
WITH ADMIN OPTION WITH ADMIN ONLY OPTION WITH NO ADMIN OPTION
SYS_AUTH_SA_ROLE SYS_AUTH_SSO_ROLE SYS_AUTH_DBA_ROLE

SYS_AUTH_RESOURCE_ROLE

SYS_AUTH_BACKUP_ROLE

SYS_AUTH_VALIDATE_ROLE

SYS_AUTH_WRITEFILE_ROLE

SYS_AUTH_WRITEFILECLIENT_ROLE

SYS_AUTH_READFILE_ROLE

SYS_AUTH_READFILECLIENT_ROLE

SYS_AUTH_PROFILE_ROLE

SYS_AUTH_USER_ADMIN_ROLE

SYS_AUTH_SPACE_ADMIN_ROLE

SYS_AUTH_MULTIPLEX_ADMIN_ROLE

SYS_AUTH_OPERATOR_ROLE

SA_DEBUG

SYS_RUN_REPLICATION_ROLE

The SYS_AUTH_PERMS_ADMIN_ROLE role grants these underlying roles with these default administrative rights:
WITH ADMIN OPTION WITH NO ADMIN OPTION

SYS_AUTH_BACKUP_ROLE

SYS_AUTH_OPERATOR_ROLE

SYS_AUTH_USER_ADMIN_ROLE

SYS_AUTH_SPACE_ADMIN_ROLE

SYS_AUTH_MULTIPLEX_ADMIN_ROLE

SYS_AUTH_RESOURCE_ROLE

SYS_AUTH_VALIDATE_ROLE

SYS_AUTH_PROFILE_ROLE

SYS_AUTH_WRITEFILE_ROLE

SYS_AUTH_WRITEFILECLIENT_ROLE

SYS_AUTH_READFILE_ROLE

SYS_AUTH_READFILECLIENT_ROLE

MANAGE ROLES

MANAGE ANY OBJECT PRIVILEGE

CHANGE PASSWORD

Standards

(back to top)

  • SQL–Other syntaxes are vendor extensions to ISO/ANSI SQL grammar.
  • SAP Sybase Database product–Syntax is supported in Adaptive Server.

Permissions

(back to top)

Related reference
CREATE USER Statement
REVOKE System Privilege Statement
REVOKE ROLE Statement
VERIFY_PASSWORD_FUNCTION Option