Purpose
This statement is used to set the default role that is activated when a user logs in.
Limitations and considerations
The current user must have the role to be assigned before you can perform this operation.
Privilege requirements
Notice
If you are setting a default activated role for yourself, no permissions are required.
The current user must have the CREATE USER privilege to activate a role. For more information about OceanBase AI Database privileges, see Permission classification.
Syntax
SET DEFAULT ROLE
{NONE | ALL | role_name [, role_name ...]}
TO user_name [, user_name ...];
Parameters
Parameters |
Description |
|---|---|
| NONE | Specify all roles granted to the disabled user. |
| ALL | Specify to activate all roles under the user. |
| role_name | Specifies the role name. When activating multiple roles, separate the role names with commas (,) separated. |
| user_name | When specifying user names to activate roles for multiple users, separate the names with commas (,). |
Examples
Specifies that when the user user001 logs in, the roles role001 and role002 granted to the default activated user are activated.
obclient [test]> SET DEFAULT ROLE role001, role002 TO user001;