Help Center> Data Replication Service> Troubleshooting> Solutions to Failed Check Items> Database User Permissions> Checking Whether the Destination Database User Has Sufficient Permissions
Updated on 2022-09-21 GMT+08:00

Checking Whether the Destination Database User Has Sufficient Permissions

MySQL Migration

Table 1 Checking whether the destination database user has sufficient permissions

Check Item

Whether the destination database user has sufficient permissions

Description

Check whether the destination database user permissions meet the migration requirements. If the permissions are insufficient, the migration will fail.

Failure Cause and Handling Suggestion

Failure cause: The destination database user must have the following permissions: SELECT, CREATE, DROP, DELETE, INSERT, UPDATE, INDEX, EVENT, CREATE VIEW, CREATE ROUTINE, TRIGGER, and WITH GRANT OPTION. If the destination database version is in the range from 8.0.14 to 8.0.18, the SESSION_VARIABLES_ADMIN permission is required.

Handling suggestion: Check whether the destination database user permissions meet the migration requirements.

Failure cause: Insufficient user permissions

Handling suggestion: Check whether the database user permissions meet the migration requirements.

Failure cause: An internal error occurs.

Handling suggestion: Contact Huawei technical support.

PostgreSQL Synchronization

Table 2 Checking whether the destination database user has sufficient permissions

Check Item

Whether the destination database user has sufficient permissions

Description

Different permissions are granted based on the scope of objects to be synchronized.

  • Database-level synchronization objects:

    The CREATEDB permission and the root user or a member of root are required (only in special scenarios). For details, see the following description.

  • Table-level synchronization object:

    To synchronize databases: The CREATEDB permission is required.

    To synchronize schemas, the CONNECT and CREATE permissions for the database that contains the schema are required.

    To synchronize objects in a schema: The CONNECT permission for the database that contains the schema, the USAGE permission for the schema that contains the object, and CREATE permission for the schema that contains the object are required.

  • Synchronization user: The CREATEROLE permission is required.
  • Permission to synchronize objects: The default privilege is the default value and cannot be modified. Otherwise, the object permissions of the destination database may be different from those of the source database.

Failure Cause and Handling Suggestion

Failure cause: The destination database user must have the CREATEDB permission.

Handling suggestion: Grant the destination database user the CREATEDB permission.

alter role username with createdb;

Failure cause: The user does not have the USAGE permission for schemas.

Handling suggestion: Grant the destination database user the CREATEDB permission.

grant usage on schema schemaname to username;

Failure cause: The user does not have the permission to create tales.

Handling suggestion: Grant the destination database user the permission to create tables.

grant create on schema schemaname to username;

Failure cause: The user does not have the permission to create schemas.

Handling suggestion: Grant the destination database user the permission to create schemas.

grant create on database to username;

MongoDB Migration

Table 3 Checking whether the destination database user has sufficient permissions

Check Item

Whether the destination database user has sufficient permissions

Description

Check whether the destination database user permissions meet the migration requirements. If the permissions are insufficient, the migration will fail.

Failure Cause and Handling Suggestion

Failure cause: This item cannot be checked because the destination database fails to be connected.

Handling suggestion: Check whether the destination database is connected.

Failure cause: The destination database user does not have the required permissions.

Handling suggestion: Check whether the destination database user permissions meet the migration requirements.

Failure cause: An internal error occurs.

Handling suggestion: Contact Huawei technical support.

Oracle -> MySQL/Oracle -> GaussDB(for MySQL) Synchronization

Table 4 Checking whether the destination database user has sufficient permissions

Check Item

Whether the destination database user has sufficient permissions

Description

Check whether the destination database user permissions meet the migration requirements. If the permissions are insufficient, the migration will fail.

Failure Cause and Handling Suggestion

Failure cause: The destination database user must have the following permissions: SELECT, CREATE, DROP, DELETE, INSERT, UPDATE, INDEX, EVENT, RELOAD, CREATE VIEW, CREATE ROUTINE, TRIGGER, and ALTER.

Handling suggestion: Check whether the destination database user permissions meet the migration requirements.

Oracle -> PostgreSQL Synchronization

Table 5 Checking whether the destination database user has sufficient permissions

Check Item

Whether the destination database user has sufficient permissions

Description

Check whether the destination database user permissions meet the migration requirements. If the permissions are insufficient, the migration will fail.

Failure Cause and Handling Suggestion

Failure cause: The destination database user does not have sufficient permissions.

Handling suggestions: Run the following command to grant the permissions of creating databases and tables on the destination database. Then, perform the check again.

ALTER ROLE targetUser WITH CREATEDB;

In the preceding command, targetUser indicates the current user of the destination database.

MySQL -> PostgreSQL Synchronization

Table 6 Checking whether the destination database user has sufficient permissions

Check Item

Whether the destination database user has sufficient permissions

Description

Check whether the destination database user permissions meet the requirements for MySQL to PostgreSQL synchronization. If the permissions are insufficient, the synchronization will fail.

Failure Cause and Handling Suggestion

Failure cause: Some tables in the destination database do not have the INSERT, SELECT, UPDATE, and DELETE permissions.

Handling suggestion: Add the required permissions for the tables and try again.

Example command:

GRANT INSERT,SELECT,UPDATE, DELETE ON db_name.table_name TO 'user'@'host';

PostgreSQL > PostgreSQL Synchronization

Table 7 Checking whether the destination database user has sufficient permissions

Check Item

Whether the destination database user has sufficient permissions

Description

Check whether the destination database user permissions meet the requirements for PostgreSQL to PostgreSQL synchronization. If the permissions are insufficient, the synchronization will fail.

Failure Cause and Handling Suggestion

Failure cause: The destination database user must have the CREATEDB permission.

Handling suggestion: Grant the destination database user the CREATEDB permission.

ALTER ROLE role_name WITH CREATEDB;

MySQL Disaster Recovery

Table 8 Checking whether the destination database user has sufficient permissions

Check Item

Whether the destination database user has sufficient permissions

Description

Check whether the destination database user permissions meet the migration requirements. If the permissions are insufficient, the disaster recovery will fail.

Failure Cause and Handling Suggestion

Failure cause: The source database user must have the GRANT permission.

Handling suggestion: Grant user the required permission.

GRANT SELECT, CREATE, DROP, DELETE, INSERT, UPDATE, SHOW VIEW, EVENT, LOCK TABLES, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'u1' WITH GRANT OPTION;

DDM -> Oracle Synchronization

Table 9 Checking whether the destination database user has sufficient permissions

Check Item

Whether the destination database user has sufficient permissions

Description

Check whether the destination database user permissions meet the requirements for DDM to Oracle synchronization. If the permissions are insufficient, the synchronization will fail.

Failure Cause and Handling Suggestion

Failure cause: The destination database user does not have sufficient permissions.

Handling suggestion: Use an account with the DBA permission, or grant required permissions to the user.

GaussDB(for openGauss) as the Destination

Table 10 Checking whether the source database user has sufficient permissions

Check Item

Whether the source database user has sufficient permissions

Description

Check whether the source database user permissions meet the migration requirements.

Failure Cause and Handling Suggestion

Failure cause: The source database user does not have sufficient permissions. The user needs the select permission for the schema.

Handling suggestion: Grant the missing permissions to the object owner or system administrator.