All Products
Search
Document Center

ApsaraDB for OceanBase:CreateTenantUser

Last Updated:Oct 21, 2024

You can call this operation to create an account in a tenant that has access to a database.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
TenantIdstringYes

The ID of the tenant.

ob2mr3oae0****
UserNamestringYes

The name of the database account. You cannot use reserved keywords, such as SYS and root.

pay_test
UserTypestringYes

The type of the database account. Valid values: Admin: the super administrator account. Normal: a general account.

Normal
UserPasswordstringYes

The password of the database account. It must be 10 to 32 characters in length and contain three types of the following characters: uppercase letters, lowercase letters, digits, and special characters. The special characters are ! @ # $ % \ ^ \ & \ * ( ) _ + - =

!Aliyun4Oceanbase
RolesstringNo

The role of the user account. In Oracle mode, this parameter unspecified is left unspecified. In MySQL mode, the super administrator account has ALL PRIVILEGES, and you can leave this parameter unspecified. You need to specify the account information for a general user account. By default, the account information is a JSON array that contains the information of the role and the schema (Oracle mode) or database (MySQL mode). Valid values: ReadWrite: a role that has the read and write privileges, namely ALL PRIVILEGES. ReadOnly: a role that has only the read-only privilege SELECT. DDL: a role that has DDL privileges such as CREATE, DROP, ALTER, SHOW VIEW, and CREATE VIEW. DML: a role that has DML privileges such as SELECT, INSERT, UPDATE, DELETE, and SHOW VIEW.

[{"Database":"oceanbase1","Role":"readwrite"},{"Database":"oceanbase2","Role":"readonly"}]
InstanceIdstringYes

The ID of the OceanBase cluster.

ob317v4uif****
DescriptionstringNo

The description of the database.

this is a test database

You can call this operation to create an account in a tenant that has access to a database.

Response parameters

ParameterTypeDescriptionExample
object

The return result of the request.

TenantUserarray<object>

The list of database accounts in the tenant.

Dataobject

The list of database accounts in the tenant.

UserTypestring

The type of the database account. Valid values: - Admin: the super administrator account. - Normal: a general account.

Normal
Rolesarray<object>

The roles of the accounts.

Rolesobject

The roles of the accounts.

Databasestring

The name of the database.

db_pay1
Rolestring

The role of the account. In Oracle mode, a role is a schema-level role. Valid values: - ReadWrite: a role that has the read and write privileges, including CREATE TABLE, CREATE VIEW, CREATE PROCEDURE, CREATE SYNONYM, CREATE SEQUENCE, CREATE TRIGGER, CREATE TYPE, CREATE SESSION, EXECUTE ANY PROCEDURE, CREATE ANY OUTLINE, ALTER ANY OUTLINE, DROP ANY OUTLINE, CREATE ANY PROCEDURE, ALTER ANY PROCEDURE, DROP ANY PROCEDURE, CREATE ANY SEQUENCE, ALTER ANY SEQUENCE, DROP ANY SEQUENCE, CREATE ANY TYPE, ALTER ANY TYPE, DROP ANY TYPE, SYSKM, CREATE ANY TRIGGER, ALTER ANY TRIGGER, DROP ANY TRIGGER, CREATE PROFILE, ALTER PROFILE, and DROP PROFILE. - ReadOnly: a role that has only the read-only privilege SELECT. In MySQL mode, a role is a database-level role. Valid values: - ReadWrite: a role that has the read and write privileges, namely ALL PRIVILEGES. - ReadOnly: a role that has only the read-only privilege SELECT. - DDL: a role that has the DDL privileges such as CREATE, DROP, ALTER, SHOW VIEW, and CREATE VIEW. - DML: a role that has the DML privileges such as SELECT, INSERT, UPDATE, DELETE, and SHOW VIEW.

  • By default, an Oracle account has the read and write privileges on its own schema, which are not listed here.
ReadOnly
UserStatusstring

The status of the database account. Valid values: - Locked: The account is locked. - ONLINE: The account is unlocked. The default status of a new account is ONLINE after it is created.

ONLINE
UserNamestring

The name of the database account.

pay_test
RequestIdstring

The request ID.

EE205C00-30E4-XXXX-XXXX-87E3A8A2AA0C

Examples

Sample success responses

JSONformat

{
  "TenantUser": [
    {
      "UserType": "Normal",
      "Roles": [
        {
          "Database": "db_pay1",
          "Role": "ReadOnly"
        }
      ],
      "UserStatus": "ONLINE",
      "UserName": "pay_test"
    }
  ],
  "RequestId": "EE205C00-30E4-XXXX-XXXX-87E3A8A2AA0C"
}

Error codes

HTTP status codeError codeError message
500InternalErrorThe request processing has failed due to some unknown error.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-12-26The Error code has changed. The response structure of the API has changedView Change Details
2023-07-04The Error code has changedView Change Details
2023-04-06The Error code has changed. The request parameters of the API has changedView Change Details