Tenant
OceanBase AI Database's tenant is a logical concept that serves as a unit of resource allocation and the basis for managing database objects and resources. As a container for various database objects, a tenant also serves as a container for resources such as CPU, memory, and I/O. Data is completely isolated between tenants, with each tenant being equivalent to an instance of a traditional database. Tenants are divided into system tenants and user tenants. The system tenant (the sys tenant) is predefined for management purposes.
User
OceanBase AI Database users are classified into two categories: users in a system tenant and users in a user tenant. The built-in system administrator for a system tenant is the root user. The built-in tenant administrator for a user tenant is also the root user. When you create a user, if the current session is in the system tenant, the created user belongs to the system tenant. Otherwise, the user belongs to a user tenant. Users created by the tenant administrator can only log in to the current tenant, regardless of whether it is a system tenant or a user tenant. Usernames are unique within a tenant, but users in different tenants can have the same username. Therefore, a user is uniquely identified globally in the system in the username@tenant_name format.
Permission
Permission classification
Permissions are classified into the following three levels:
Global permissions: the permissions to manage a tenant, such as modifying system settings and accessing all tables in the tenant.
Database permissions: the permissions to manage all objects in a database, such as creating or deleting tables in the database, and accessing those tables.
Object permissions: the permissions to manage a specific object, such as accessing a specific table, view, or index.
For more information about the permission types, see Permission classification.
Privilege delegation
Privilege delegation addresses the challenge of centralized authorization. By specifying with grant option during the granting process, grantors allow users to delegate those same permissions to other users. When revoking object permissions, the corresponding permissions that the user has delegated to other users are also revoked. For example, if user A grants a permission to user B and user B grants the permission to user C, when user A revokes the permission from user B, the permission of user C is also revoked. Revoking global permissions does not revoke delegated permissions.
Role
In OceanBase AI Database, you can manage permissions by role. A role is a set of system and object permissions. A role can contain other roles. If you assign a role to a user, the user has all the permissions of the role.
By default, OceanBase AI Database does not provide built-in system roles. For more information about role management, see Role management overview.
Indirect permissions
User permissions are divided into direct and indirect permissions. Direct permissions are the system or object permissions that are granted to a user. Indirect permissions are those that are granted to the roles of a user. Most operations can be performed with direct or indirect permissions. Direct permissions are required to perform the following operations:
- When creating a view, the user needs permissions to access objects in the view.
- Permissions are required to execute statements in a named PL block with the definer's rights.
Permission check
The system parses all the permissions required to execute an SQL statement and checks whether you have the corresponding permissions. When you attempt to perform a system operation but you do not have sufficient permissions, an error is returned indicating that you have insufficient permissions. When you attempt to access an object on which you do not have any permission, an error is returned indicating that the object does not exist. If you have permissions other than the required ones on the object that you want to access, an error is returned indicating that you have insufficient permissions.