Defines mutually exclusive relationships between roles; adds, drops, and changes passwords for roles; specifies the password expiration interval, the minimum password length, and the maximum number of failed logins allowed for a specified role. Also locks and unlocks roles.
alter role role1 {add | drop} exclusive {membership | activation} role2
alter role role_name [add passwd "password" | drop passwd] [lock | unlock]
alter role {role_name | "all overrides"} set {passwd expiration | min passwd length | max failed_logins} option_value
alter role intern_role add exclusive membership specialist_role
alter role specialist_role add exclusive membership intern_role alter role intern_role add exclusive activation surgeon_role
alter role doctor_role add passwd "physician"
alter role doctor_role drop passwd
alter role physician_role lock
alter role physician_role unlock
alter role physician_role set max failed_logins 5
alter role physician_role set min passwd length 5
alter role "all overrides" set min passwd length -1
alter role "all overrides" set max failed_logins -1
The alter role command defines mutually exclusive relationships between roles, and adds, drops, and changes passwords for roles.
passwd expiration
max failed_logins
min passwd length
Dropping the role password removes the overrides for the password expiration and the maximum failed logins options.
Password complexity checks are set at the login level using create login or alter login. Set the options at the global level using sp_passwordpolicy or sp_configure. See Manage Roles in the Security Administration Guide.When you use alter role to lock or unlock roles, you set (or unset) the locksuid, lockdate, and lockreason columns that are added to syssrvroles.
For more information on altering roles, see the System Administration Guide.
mut_excl_roles, proc_role, role_contain, role_id, role_name in Reference Manual: Building Block
sp_activeroles, sp_displaylogin, sp_displayroles in Reference Manual: Procedures
ANSI SQL – Compliance level: Transact-SQL extension.
The permission checks for alter role differ based on your granular permissions settings.
Setting | Description |
---|---|
Enabled | With granular permissions enabled, you must have the manage roles privilege. |
Disabled | With granular permissions disabled, you must be a user with sso_role. |
Values in event and extrainfo columns of sysaudits are:
Information | Values |
---|---|
Event | 85 |
Audit option | roles |
Command or access audited | create role, drop role, alter role, grant role, or revoke role |
Information in extrainfo |
|