Purpose
This statement is used to create a role. You can use roles to manage database privileges.
You can add privileges to a role and grant the role to a user. The user can then enable the role and exercise the privileges granted by the role.
Syntax
CREATE [WITH HINT] ROLE role_name
[ NOT IDENTIFIED
| IDENTIFIED { BY password | BY VALUES password }
]
Parameters
| Parameter | Description |
|---|---|
| WITH HINT | Optional. Specifies the hints used by the query optimizer. |
| role_name | Specifies the name of the role to be created. |
| NOT IDENTIFIED | Specifies that no authentication method is used when the role is enabled. |
| IDENTIFIED BY | Specifies the password for enabling the role. Users granted this role must specify the password to enable the role using the SET ROLE statement. |
| IDENTIFIED BY VALUES | Specifies the encrypted password for the role. Similar to IDENTIFIED BY, but the password is already encrypted. |
Note
If the NOT IDENTIFIED and IDENTIFIED clauses are omitted, the role defaults to NOT IDENTIFIED.
Examples
Create a role named
role1.obclient> CREATE ROLE role1;Create a role named
role2with the password**1***.obclient> CREATE ROLE role2 IDENTIFIED BY "**1***";