OceanBase AI Database adopts a multi-tenant architecture. This architecture is suitable for scenarios such as resource consolidation and cloud services, while also reducing operational complexity.
OceanBase AI Database has three types of tenants: the system tenant, user tenants, and the Meta tenant corresponding to each user tenant.
Log in to the system tenant
The system tenant is a database instance used internally in OceanBase AI Database to handle cluster-wide tasks. Root Service manages OceanBase AI Database based on the system tenant, including cluster management, tenant management, resource management, load balancing, daily major compaction scheduling, migration, and replication. The system tenant is the default tenant created in a cluster and has the same lifecycle as the cluster. It is responsible for managing the lifecycles of the cluster and all tenants.
You can log in to the system tenant using either the MySQL client or OceanBase Client (OBClient).
Log in using the MySQL client
The following sample code shows the connection string for logging in to the database using the MySQL client:
mysql -h<host IP> -P<port number> -u<account> -p<'database password'> -D<default database> -A -c --prompt "OceanBase(\u@\d)> "
The following table describes the parameters.
-h: the IP address of the host for logging in to OceanBase AI Database. OceanBase AI Database supports logging in through ODP or directly connecting to an OBServer node. We recommend that you log in through ODP, because ODP can better handle the distributed features of OceanBase AI Database, including routing and disaster recovery.-P: the port number for logging in to OceanBase AI Database. You can modify the port number in the configuration file during deployment. You can view themysql_portparameter of each OBServer node and thelisten_portparameter of ODP in the configuration file. If not explicitly specified, the default value is used.For logging in through ODP, the default port number is 2883.
For logging in by directly connecting to an OBServer node, the default port number is 2881.
-u: the account for logging in to OceanBase AI Database. Different from traditional databases, an account in OceanBase AI Database contains more fields, including the username, tenant name, and cluster name.When logging in through ODP, you must specify the username, tenant name, and cluster name. The supported formats are
username@tenant name#cluster name,cluster name:tenant name:username,cluster name-tenant name-username, andcluster name.tenant name.username. For example, to log in to theSYStenant of thetestcluster as therootuser, the account isroot@sys#test.When logging in by directly connecting to an OBServer node, you must specify the username and tenant name. The format is
username@tenant name. For example, to log in to theSYStenant of thetestcluster as therootuser, the account isroot@sys.
-p: the password for logging in to OceanBase AI Database. In a newly created cluster, the initial password of therootuser in theSYStenant is empty. We recommend that you change the password of therootuser immediately after creating a cluster by executing the statementalter user root identified by '******'.
For more information about connecting to OceanBase AI Database using the MySQL client, see Connect to OceanBase AI Database by using the MySQL client.
Log in using OBClient
In addition to using the MySQL client, you can also use OceanBase Client (OBClient) to log in. OBClient is the recommended command-line client tool for OceanBase AI Database. Its user interface is compatible with that of the MySQL client. The following sample code shows the connection string:
obclient -h<host IP> -P<port number> -u<account> -p<'database password'> -D<default database> -A -c --prompt "OceanBase(\u@\d)> "
For more information about connecting through the OBClient client, see Connect to OceanBase AI Database by using OBClient.
Best practices for login
The root user has high privileges. If these privileges are granted indiscriminately, they can pose a significant security risk to the database. It is recommended that the root user be used only for managing other users, and that dedicated O&M users and read-only users be created in accordance with the "least privilege" principle.
We recommend that you log in as a dedicated read-only user to view these views.
In OceanBase AI Database, you can view rich view information in the
oceanbasedatabase of the system tenant.obclient> use oceanbase obclient> show tables; +-------------------------------------------+ | Tables_in_oceanbase | +-------------------------------------------+ | CDB_INDEXES | | CDB_IND_COLUMNS | | CDB_IND_PARTITIONS | | CDB_IND_SUBPARTITIONS | | CDB_OBJECTS | | CDB_OB_ARCHIVELOG | | CDB_OB_ARCHIVELOG_PIECE_FILES | ......These views are divided into two categories: data dictionary views and dynamic performance views.
Data dictionary views: They are named with
DBA_orCDB_as the prefix. Views starting withDBA_display information within each tenant. For example, theDBA_OB_LSview displays log stream information within a tenant. TheDBA_OB_LStable in the sys tenant shows only the log stream information of the sys tenant itself. Views starting withCDB_are specific to the sys tenant and are used to view the database status of all tenants in the cluster within the sys tenant. For example, theCDB_OB_LSview displays all log stream information for all tenants in the cluster. Generally, each view starting withDBA_has a corresponding view starting withCDB_under the sys tenant.Dynamic performance views: They are named with
GV$orV$as the prefix.V$views display information on the machine where the current session is logged in, whileGV$views display summarized information from all machines of a tenant. OceanBase AI Database V4.0 also adds many dynamic performance views in user tenants. For example, theGV$OB_UNITSview allows you to query the unit distribution information of the current tenant. The dynamic performance views in the sys tenant are specially processed and directly display summarized information of all tenants in the entire cluster.
For example, to view the node information of an OceanBase AI Database cluster:
obclient> use oceanbase Database changedobclient> select * from dba_ob_servers;The query result is as follows:
+--------------+----------+----+-------+----------+-----------------+--------+----------------------------+-----------+-----------------------+----------------------------+----------------------------+-------------------------------------------------------------------------------------------+-------------------+ | SVR_IP | SVR_PORT | ID | ZONE | SQL_PORT | WITH_ROOTSERVER | STATUS | START_SERVICE_TIME | STOP_TIME | BLOCK_MIGRATE_IN_TIME | CREATE_TIME | MODIFY_TIME | BUILD_VERSION | LAST_OFFLINE_TIME | +--------------+----------+----+-------+----------+-----------------+--------+----------------------------+-----------+-----------------------+----------------------------+----------------------------+-------------------------------------------------------------------------------------------+-------------------+ | xx.xx.xx.127 | 2882 | 2 | zone2 | 2881 | NO | ACTIVE | 2026-08-06 16:19:42.070720 | NULL | NULL | 2026-08-06 16:15:59.089837 | 2026-08-06 16:19:43.461355 | 4.6.2.0_100000152026080511-badbf70c3cb794062ff02f65dbef947e7177fccd(Aug 5 2026 13:10:33) | NULL | | xx.xx.xx.91 | 2882 | 1 | zone1 | 2881 | YES | ACTIVE | 2026-08-06 16:19:41.978836 | NULL | NULL | 2026-08-06 16:15:59.064097 | 2026-08-06 16:19:43.466653 | 4.6.2.0_100000152026080511-badbf70c3cb794062ff02f65dbef947e7177fccd(Aug 5 2026 13:10:33) | NULL | +--------------+----------+----+-------+----------+-----------------+--------+----------------------------+-----------+-----------------------+----------------------------+----------------------------+-------------------------------------------------------------------------------------------+-------------------+ 3 rows in setIt is recommended to use a dedicated O&M user to execute cluster O&M commands.
You can execute cluster O&M commands through the sys tenant. For example, to isolate an abnormal node:
obclient> ALTER SYSTEM STOP SERVER 'xx.xx.xx.xx:2882';After successful execution, you can confirm whether the isolation was successful by checking the
STOP_TIMEfield of the corresponding node in theDBA_OB_SERVERSview.
Log in to a user tenant
Corresponding to the sys tenant is the user tenant. A user tenant is created by a user and provides full database functionality, supporting the MySQL-compatible mode.
To log in to the sys tenant and query all tenant information, view the DBA_OB_TENANTS view:
TENANT_TYPEindicates the tenant type:SYSfor the sys tenant,METAfor the Meta tenant, andUserfor a user tenant. The tenant with ID 1 is the sys tenant. Among tenants with IDs greater than 1000, those with even IDs are user tenants, those with odd IDs are Meta tenants, and the tenant ID of a user tenant is 1 greater than its corresponding Meta tenant's ID.COMPATIBILITY_MODEindicates the tenant compatibility mode:MYSQLfor the MySQL-compatible mode.
To log in to a user tenant, you can use either a MySQL client or an OBClient client. The login method is the same as logging in to the sys tenant, except that the tenant name in the login credentials must be changed to the corresponding tenant name.
In a user tenant, all data dictionary views and dynamic performance views inherent to OceanBase AI Database reside in the oceanbase namespace.
Log in to the Meta tenant
The Meta tenant is an internally managed tenant of OceanBase AI Database. A corresponding Meta tenant is created for each user tenant, and their lifecycles are aligned. The Meta tenant cannot be logged into directly; its information can be accessed through the user tenant or the system tenant.
References
For more information about how to connect to and access OceanBase AI Database, see: