Description
This statement is used to activate roles that have been granted to the current logged-in user in the current session.
Note
A role activated by the SET ROLE statement affects only the current session and does not affect subsequent sessions.
Syntax
SET ROLE {
DEFAULT
| NONE
| ALL
| ALL EXCEPT role_name [, role_name ...]
| role_name [, role_name ...]
};
Parameters
Parameters |
Description |
|---|---|
| DEFAULT | Specify the setting to keep the default role. The system activates roles based on the value of the activate_all_roles_on_login variable and the default role specified for activation by the SET DEFAULT ROLE or ALTER USER statement:
|
| NONE | Specify all roles granted to the disabled user. |
| ALL | Specify all roles granted to the activated user. |
| ALL EXCEPT | Specifies not to activate roles granted to the user. |
| role_name | Specify the role name. When activating multiple roles, separate the role names with commas (,) separated. |
Examples
Specifies to activate all roles granted to the user in the current session except for role
role001.obclient [(none)]> SET ROLE ALL EXCEPT role001;Specifies to activate the user's
role001androle002roles in the current session.obclient [(none)]> SET ROLE role001, role002;