Database data migration to dream database (DM8) detailed steps, mysql migration problem solving (database connection failure, Communications link failure, TaskDispatcher Error, index duplicate name).

First of all, Dameng database and MySQL are two different relational database management systems, and they have the following differences:

  1. The development companies are different: Dameng database is developed by China Dameng Company, while MySQL is developed by Swedish MySQL AB.
  2. The database types are different: Dameng database is a commercial database, while MySQL is an open source database.
  3. The database functions are different: Dameng database has a good performance in data security, high availability, performance optimization, etc., while MySQL has an excellent performance in large-scale data processing and high concurrent access.
  4. Different database syntax: Dameng database and MySQL have some differences in SQL syntax, such as data types, functions, stored procedures, etc.
  5. Different database application scenarios: Dameng database is mainly used in finance, telecommunications, government and other fields, while MySQL is widely used in web applications, enterprise applications and other fields.

It should be noted that although there are some differences between Dameng database and MySQL, they are both mature database management systems, which can be selected and used according to specific needs.

Let’s not gossip, let’s start the steps of mysql data migration to Dameng database (other database data migration can be used as a reference):

1. useDM管理工具

After the Dameng database is installed, a shortcut to the tool will be created in the path shown in the figure below, and it will be found and opened DM管理工具.
insert image description here

2. Create the corresponding mode in the server connection that needs to be migrated

In Dameng database, a user corresponds to a schema, which is similar to the database in mysql.
insert image description here
You can also create a new user, which is used as a mode for testing migration. If you create a new user, the mode bound to it will be automatically created. Here I have created TEST, so I will not create it again.
insert image description here

3. useDM数据迁移工具

insert image description here

4. Create a migration project

4.1 Right click on the blank space on the left to create a new project, fill in the information and the project is created.

insert image description here

4.2 Create a migration and fill in the migration information

insert image description here

5. Data Migration

5.1 Click the migration item created on the left, and click Next

insert image description here

5.2 Select the migration method

Here we are migrating mysql to Dameng database, so choose mysql here.
insert image description here

5.3 Configure data source

Fill in the data source information, and then click Refresh to display all the databases connected. Select the database to be migrated and click Next, but here I click Refresh to report an error. The following is the solution.
insert image description here
When I click refresh, it prompts that the database connection failed, Communications link failure.
insert image description here
There are several possible reasons for this problem:

1. The port is not open.
Windows netstat -aon|findstr "端口号"checks whether it is open. If there is no output information, it means that it is not open. Generally speaking, you will not encounter the problem of not being open. I will not repeat it here.
insert image description here
2. SSL protocol problem
The solution steps are as follows:
2.1 Stop Dameng database-related services.
insert image description here2.2 Find dm.ini in the installation directory of Dameng database. The path I installed on the D disk is here D:\dmdbms\data\DAMENG\dm.ini. After opening, update COMPATIBLE_MODEthe property and change it to 4 to be compatible with the MYSQL database. After finishing writing, restart the service.
insert image description here
insert image description here
2.3 Custom connection driver
The driver path can be selected from the local driver jar package, check Use custom URL, the URL needs to be added at the end with &useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true, and the database name needs to be changed to the name of the database to be migrated.
insert image description here
Click OK and then click Refresh Test, if no error is reported, go to the next step.

5.4 Configure Dameng database information, migration strategy, and specify which mode to migrate to

insert image description here
insert image description here
insert image description here

5.5 Data Migration

Unselect all the tables, click Next, click Finish after reviewing, confirm that there is no error in the log, and the migration is complete. If there is no accident, I have an accident, and the log prompts a null pointer exception.
insert image description here
insert image description here
insert image description here
Solution:
You can re-enter the migration project by splitting the synchronization, and click Next until the page for selecting the migration object.

  1. Synchronize table structure.
    insert image description here
    insert image description here
  2. Synchronous Data.
    Note: If there is a view table here, it needs to be unchecked.
    insert image description here
    insert image description here
  3. Synchronize constraints, indexes, triggers, etc.
    insert image description here
    insert image description here
    At this point, the mysql data migration to Dameng Data has been completed, and in the sixth step, the problems encountered in the follow-up will be supplemented.

6. Other issues

6.1 Duplication of index names:

When using Dameng database, if two or more indexes are created and use the same name, Dameng database will report an error and refuse to create the second index. This is because index names must be unique in order to refer to them correctly in queries.
When encountering this kind of problem, you need to change the index name. If there are few indexes, you can change it manually. If there are many indexes, you can use the following sql. The statement given by this sql can update the index names in the database in batches. Generate an index
name in the format of table name + field name :

-- 批量更新索引名的sql
-- 查询出所有组合索引,并拼接修改索引名的语句
SELECT
	CONCAT( 'ALTER TABLE `', table_name, '` RENAME INDEX `', index_name, '` TO `', table_name, '_', GROUP_CONCAT( column_name ORDER BY seq_in_index SEPARATOR '_' ), '`;' ) AS RENAME_SQL 
FROM
	information_schema.statistics 
WHERE
	table_schema = 'asset_manage_local' 
	AND index_name != 'PRIMARY' 
GROUP BY
	table_name,
	index_name 
HAVING
	COUNT(*) > 1 -- 只处理组合索引
	UNION ALL
-- 查询出所有非组合索引,并拼接修改索引名的语句
SELECT
	CONCAT(
		'ALTER TABLE `',
		table_name,
		'` RENAME INDEX `',
		index_name,
		'` TO `',
		table_name,
		'_',
		column_name,
	IF
		( sub_part IS NOT NULL, CONCAT( '(', sub_part, ')' ), '' ),
		'`;' 
) AS RENAME_SQL 
FROM
	information_schema.statistics 
WHERE
	table_schema = 'asset_manage_local' 
	AND index_name != 'PRIMARY' 
	AND seq_in_index = 1 
	AND index_name NOT IN ( SELECT index_name FROM information_schema.statistics WHERE table_schema = 'asset_manage_local' GROUP BY table_name, index_name HAVING COUNT(*) > 1 -- 过滤掉组合索引
	);

Guess you like

Origin blog.csdn.net/TangBoBoa/article/details/130385418