Purpose
You can use this statement to create an OceanBase Database user. After you create a user, you can use it to connect to OceanBase Database.
Required privileges
You must have the CREATE USER system privilege to use the CREATE USER statement. For more information about OceanBase Database privileges, see Privilege types in Oracle mode.
Syntax
CREATE USER user_name
IDENTIFIED BY [VALUES] password
[REQUIRE {NONE | SSL | X509 | tls_option}]
[PROFILE profile_name]
[DEFAULT TABLESPACE tablespace_name];
tls_option:
CIPHER cipher_name
| ISSUER issuer_name
| SUBJECT subject_name
Parameters
| Parameter | Description |
|---|---|
| user_name | The username. For each user created, a new entry is created in the dba_users table. If the username already exists, an error is returned. |
| IDENTIFIED BY | The password in plaintext for the user, which is then saved to the dba_users table in ciphertext. If the password contains special characters, it must be enclosed in double quotation marks ("). Special characters are ~!@#%^&*_-+=`|(){}[]:;’,.?/. |
| IDENTIFIED BY VALUES | The password in ciphertext for the user, which is saved to the dba_users table directly. |
| REQUIRE | The authentication requirements for the user. Valid values:
|
| tls_option | The options for TLS requirements. Valid values:
|
| PROFILE | The user profile, which is a set of predefined privileges and restrictions applicable to the user to be created. |
| DEFAULT TABLESPACE | The default tablespace for the user. A tablespace is a logical structure that stores user data. |
Examples
Create a user named
test1and specify a plaintext password.obclient [SYS]> CREATE USER test1 IDENTIFIED BY "********";Create a user named
test2, specify a ciphertext password, and specify that the user must use an SSL connection for authentication.obclient [SYS]> CREATE USER test2 IDENTIFIED BY VALUES "********" REQUIRE SSL;
References
For more information about how to grant user privileges, see Grant direct privileges.
You can query the information about the created user in the
dba_userstable. For more information about thedba_userstable, see DBA_USERS.For more information about how to use the created user to connect to OceanBase Database, see Connect to OceanBase Database.