When you create a data source in OceanBase Migration Service (OMS), you need to specify a database user and password. These credentials are used by OMS to migrate or synchronize data between the source and target. This topic describes how to create different types of database users.
User instructions
When creating a new data source in MySQL-compatible mode of OceanBase Database, three different types of users are involved: the OceanBase database user, the DRC user (the user of the sys tenant), and the __oceanbase_inner_drc_user user. You can create them as needed.
OceanBase database user (required): This user is required for data migration or data synchronization between the source and target.
DRC user (optional): This user is optional and is used to read incremental log data and database object structure information from OceanBase Database.
If you need to perform schema migration, schema synchronization, or incremental synchronization as the source, create a DRC user under the source
systenant. If you need to perform reverse incremental synchronization as the target, create a DRC user under the targetsystenant.Note
In the case of an OceanBase Cloud data source, you need to create a user under the sys tenant to configure the sys tenant username.
__oceanbase_inner_drc_useruser (optional): This user is optional and is created only when tables without unique keys need to be migrated.
Create an OceanBase database user
When performing data migration or data synchronization between the source and target, you need to create an OceanBase database user. This user is used to fill in the Database Username field when creating a new OceanBase data source (including physical, logical, and cloud data sources). For example, you can enter OMSTEST as the database username.
Log in to OceanBase Database as the system administrator.
Create a user under the source business tenant for data migration or data synchronization.
CREATE USER '<user_name>' IDENTIFIED BY '<password>';Use the
GRANTstatement to grant privileges to the created database user. For details, see User privileges.
(Optional) Create a DRC user
When using an OceanBase data source as the source for schema migration, schema synchronization, or incremental synchronization, and when using it as the target for reverse incremental synchronization, in addition to creating an OceanBase database user, you also need to create a DRC user under the business cluster's sys tenant to read incremental log data and database object structure information from OceanBase Database.
This user is used to fill in the DRC User Name field in the Advanced Options section when creating a new OceanBase data source (including physical and logical data sources). For example, you can enter user01 as the DRC username.
CREATE USER <drc_user> IDENTIFIED BY '<drc_password>';
GRANT SELECT ON *.* TO <drc_user>;
If you are creating an OceanBase Cloud data source and the OceanBase cluster version is earlier than V4.2.0, and you use this data source as the source for schema migration, in addition to creating an OceanBase database user, you also need to create a user under the sys tenant to read the structure information of OceanBase database objects.
This user is used to fill in the sys Tenant Username field in the Advanced Options section. For example, you can enter user02 as the sys tenant username.
CREATE USER <drc_user> IDENTIFIED BY '<drc_password>';
GRANT SELECT ON *.* TO <drc_user>;
(Optional) Create a __oceanbase_inner_drc_user user
When you need to migrate tables without unique keys from OceanBase Database in MySQL-compatible mode to the target, in addition to creating an OceanBase Database user, you also need to create the __oceanbase_inner_drc_user user under the source business tenant. This user is used when filling in the __oceanbase_inner_drc_password for creating a new OceanBase data source with a Tenant Type of MySQL.
Create a user
CREATE USER __oceanbase_inner_drc_user IDENTIFIED BY '<password>';Grant privileges
GRANT SELECT ON *.* TO __oceanbase_inner_drc_user;
User description
When creating a new OceanBase Database data source in Oracle compatible mode, three different types of users are involved: the OceanBase Database user, the DRC user (the sys tenant user), and the __OCEANBASE_INNER_DRC_USER. You can create them as needed.
OceanBase Database user (required): This user is required for data migration or data synchronization between the source and target.
DRC user (optional): This user is optional and is used to read incremental log data and database object structure information from OceanBase Database.
If you need to perform schema migration, schema synchronization, or incremental synchronization as the source, create a DRC user under the source
systenant. If you need to perform reverse incremental synchronization as the target, create a DRC user under the targetsystenant.Note
In the OceanBase public cloud data source scenario, you need to create users under the sys tenant to configure the sys tenant username.
__OCEANBASE_INNER_DRC_USERuser (optional): This user is optional and is created only when migrating tables without unique keys.
Create an OceanBase Database user
When performing data migration or data synchronization between the source and target, you need to create an OceanBase Database user. This user is used when filling in the Database Username for creating a new OceanBase data source (including physical data sources, logical data sources, and public cloud data sources). For example, you can fill in the database username as OMSTEST.
Log in to OceanBase Database as the system administrator.
Create a user under the source business tenant for data migration or data synchronization.
CREATE USER '<user_name>' IDENTIFIED BY <password>;Grant privileges to the created database user using the
GRANTstatement. For details, see User privileges.
(Optional) Create a DRC user
When using an OceanBase data source as the source for schema migration, schema synchronization, or incremental synchronization, and when using an OceanBase data source as the target for reverse incremental synchronization, in addition to creating an OceanBase Database user, you also need to create a DRC user under the business cluster's sys tenant to read incremental log data and database object structure information from OceanBase Database.
This user is used to fill in the DRC Username field in the Advanced Options section when creating a new OceanBase data source (including physical and logical data sources). For example, you can enter user01 as the DRC username.
CREATE USER <drc_user> IDENTIFIED BY '<drc_password>';
GRANT SELECT ON *.* TO <drc_user>;
When you create an OceanBase Cloud data source and the OceanBase cluster version is earlier than V4.2.0, if you use this data source as the source for schema migration, you must create a user under the sys tenant in addition to creating the OceanBase database user, to read the structure information of OceanBase database objects.
This user is used to fill in the sys Tenant Username field in the Advanced Options section. For example, you can enter user02 as the sys tenant username.
CREATE USER <drc_user> IDENTIFIED BY '<drc_password>';
GRANT SELECT ON *.* TO <drc_user>;
(Optional) Create the __OCEANBASE_INNER_DRC_USER user
When you need to migrate tables without unique keys from OceanBase Database in Oracle compatible mode to the target, in addition to creating an OceanBase database user, you also need to create the __OCEANBASE_INNER_DRC_USER user under the source business tenant. This user is used when filling in the __OCEANBASE_INNER_DRC_USER password for creating a new OceanBase data source with a Tenant Type of Oracle.
Create a user
CREATE USER '__OCEANBASE_INNER_DRC_USER' IDENTIFIED BY <your_password>;Grant privileges
OceanBase Database versionPrivilege statementVersions earlier than V2.2.77 GRANT CREATE SESSION TO '__OCEANBASE_INNER_DRC_USER';
GRANT SELECT ON *.* TO '__OCEANBASE_INNER_DRC_USER';V2.2.77 and later versions GRANT CREATE SESSION TO '__OCEANBASE_INNER_DRC_USER';GRANT SELECT ANY DICTIONARY TO '__OCEANBASE_INNER_DRC_USER';
For theSELECTprivilege on migrated tables, the following two methods are supported:- Grant system privileges
GRANT SELECT ANY TABLE TO '__OCEANBASE_INNER_DRC_USER'; - Grant object privileges (only applicable to specific database table objects)
GRANT SELECT ON <schema>.<table> TO '__OCEANBASE_INNER_DRC_USER';
- Grant system privileges
When performing data migration between an Oracle database and OceanBase Database, or synchronizing data from an Oracle database to DataHub, you need to create an Oracle database user. This user is used when filling in the Database Username for creating a new Oracle data source.
Log in to the Oracle database.
Create a user in the Oracle database for data migration or data synchronization.
CREATE USER <user_name> IDENTIFIED BY "<password>";Use the
GRANTstatement to grant privileges to the created database user. For details, see User privileges.
When performing data migration between a MySQL database and OceanBase Database, or synchronizing data from a MySQL database to DataHub, you need to create a MySQL database user. This user is used when filling in the Database Username for creating a new MySQL data source.
Log in to the MySQL database.
Use the
CREATE USERstatement to create a new user.CREATE USER '<user_name>'@'<host_name>' IDENTIFIED BY '<user_password>';ParameterDescriptionuser_name The name of the user to be created. host_name The host that is allowed to log in to the database for this user. To allow the user to log in from any host, use the percent sign (%). user_password The password for the user to be created. For example, create a user named
testwho can log in to the MySQL database from any host, with the login password set topassword.CREATE USER 'test'@'%' IDENTIFIED BY 'password';Use the
GRANTstatement to grant privileges to the created database user. For more information, see User privileges.
When you migrate data from a PostgreSQL database to the MySQL-compatible mode of OceanBase Database, you must create a PostgreSQL database user. This user is used to fill in the Database Username field when creating a new PostgreSQL data source.
Log in to the PostgreSQL database.
Create a user in the PostgreSQL database for data migration or data synchronization.
CREATE USER <user_name> ENCRYPTED PASSWORD '<password>';Use the
GRANTstatement to grant privileges to the created database user. For more information, see User privileges.
When you perform data migration between a DB2 LUW database and OceanBase Database, you need to create a DB2 LUW database user. This user is used to fill in the Database Username field when creating a new DB2 LUW data source.
In DB2 LUW (Linux/UNIX/Windows), the database system itself does not support creating database users directly through SQL statements. If you need to create a DB2 LUW database user, you must first create a system user or group and then grant privileges to it.
Create a user group in the operating system.
groupadd <user_group_name>Create a system user and assign it to the created group.
useradd -g <user_group_name> <user_name>Set a login password for the new user.
passwd <user_name>Grant privileges to the created database user. For more information, see User privileges.
When you migrate data from a TiDB database to the MySQL-compatible mode of OceanBase Database, you need to create a TiDB database user. This user is used to fill in the Database Username field when creating a new TiDB data source.
Log in to the TiDB database.
Create a user in the TiDB database for data migration or data synchronization.
CREATE USER '<user_name>'@'<host_name>' IDENTIFIED BY '<password>';ParameterDescriptionuser_name The name of the user to be created. host_name The host from which the account is allowed to log in to the database. To allow the account to log in to the database from any host, use a percent sign (%). password The password for the user to be created. Use the
GRANTstatement to grant privileges to the created database user. For more information, see User privileges.
When you migrate data from an SQL Server database to an OceanBase database in MySQL or Oracle compatible mode, you need to create an SQL Server database user. This user is used to fill in the Database Username field when creating a new SQL Server data source.
Log in to the SQL Server database.
Create a server-level login in the SQL Server database and create a corresponding database user in the database to be migrated.
-- Create Server-Level Login Name CREATE LOGIN <user_name> WITH PASSWORD = '<password>'; GO -- Create the corresponding database user in the source database. USE <database_name>; GO CREATE USER <user_name> FOR LOGIN <user_name>; GOParameterDescriptionuser_name The name of the login account and database user to be created. password The password for the login account to be created. database_name The name of the database containing the data to be migrated. You cannot select master,msdb,model,tempdb, orresource.Grant role permissions and corresponding privileges to the created database user. For details, see User privileges.
USE <database_name>; GO -- For SQL Server 2008 and 2008 R2, use sp_addrolemember instead. For more information, see User Privileges. ALTER ROLE db_owner ADD MEMBER <user_name>; GO
When migrating data from a PolarDB-X 1.0 database to the MySQL-compatible mode of OceanBase Database, you need to create a PolarDB-X 1.0 database user. This user is used to fill in the Account field when creating a new PolarDB-X 1.0 data source.
Log in to the Apsara Private Cloud console.
In the top menu bar, click Products > Databases > PolarDB-X 1.0.
On the Instances page under the target organization, click the name of the PolarDB-X 1.0 instance to go to its basic information page.
In the left navigation pane, click Configuration and Management > Account Management.
Note
After a database is created, an advanced account is created by default. Its password is the same as the database password. You can use this account directly or create a regular account based on actual needs.
On the Account Management page, click Create Account.
In the Create Account dialog box, configure the parameters.
ParameterDescriptionDatabase Account Must be 4 to 20 characters long, start with a letter, end with a letter or number, and contain uppercase letters, lowercase letters, digits, or underscores. New Password Recommended length: 8 to 32 characters. Should consist of three types of characters: uppercase letters, lowercase letters, digits, or special characters (!@#$%^&*()_+-=). Confirm New Password Enter the new password again for confirmation. Authorize Database In the Database List area, select the name of the database to authorize, click Authorize, and add it to the Authorized Databases area for permission settings. Note
A regular account for a PolarDB-X 1.0 instance must have at least read-only privileges in all stages of data migration.
Click OK.
When migrating data from a DM database to an OceanBase database, you need to create a DM database user. This user is used to fill in the Database Username field when creating a new DM data source.
Log in to the DM database as SYSDBA.
Create a user in the DM database for data migration.
CREATE USER "<user_name>" IDENTIFIED BY "<password>";Grant privileges to the created database user. For details, see User privileges.