Help Center/ GaussDB/ User Guide/ Database Migration/ Overview of GaussDB Migration Solutions
Updated on 2024-11-11 GMT+08:00

Overview of GaussDB Migration Solutions

You can migrate data from MySQL, PostgreSQL, Oracle, DB2 for LUW, RDS for SQL Server, or Microsoft SQL Server databases to GaussDB, or from one GaussDB instance to another GaussDB instance.

Data migration tools include DRS, DAS, and gs_loader. You are advised to use DRS because it is easy to use and can complete a migration task in minutes. GaussDB migration service helps you reduce DBA labor costs, hardware costs, and data transmission costs.

Data migration tools include gs_dump, gs_dumpall, gs_restore, copy commands, and CopyManager.

Table 1 GaussDB migration solutions

Solution

Data Source

Description

Reference

Using DRS to import data to GaussDB

MySQL

Real-time data synchronization of DRS allows you to copy data from a data source to GaussDB to implement real-time data flow of key services. It focuses on the synchronous import of tables and data.

Using DRS to Migrate Data from MySQL Database to GaussDB

Oracle

Using DRS to Migrate Data from Oracle Database to GaussDB

GaussDB (distributed deployment)

GaussDB (centralized deployment)

DB2 for LUW

PostgreSQL

SQL Server

Using DAS to export and import data

SQL/CSV files

You can use DAS to export data from the source database first and then import the data from your local PC or OBS bucket to the destination database.

Migrating Data to GaussDB Using the Export and Import Functions of DAS

Using the copy to/from command to export and import data

CSV files

The gsql tool provides the \copy meta-command to import or export data. \copy applies only to small-scale data import in good format. It does not preprocess invalid characters or provide error tolerance. Therefore, \copy cannot be used in scenarios where abnormal data exists.

Using the copy to/from Command to Export and Import Data

Using CopyManager in JDBC to export and import data

Other files or databases

When you use Java to develop applications, the CopyManager interface of the JDBC driver is invoked to write data from files or other databases to GaussDB.

Using CopyManager in JDBC to Export and Import Data

Using gs_dump and gs_dumpall to export data

  • Plain-text archives
  • Custom-format archives
  • Directory-format archives
  • TAR-format archives

gs_dump can export a single database or its objects. gs_dumpall can export all databases or global objects in a cluster.

You can use a tool to import the exported metadata to a target database for database migration.

Using gs_dump and gs_dumpall to Export Data

Using gs_restore to import data

SQL/TMP/TAR files

During database migration, you can use gs_restore to import files exported by gs_dump to GaussDB. In this way, metadata, such as table definitions and database object definitions, can be imported. The imported data includes:

  • Object definitions of all databases
  • Object definitions of a single database
  • Definitions of a single schema
  • Definitions of a single table

Using gs_restore to Import Data

Using gs_loader to import data

CSV files

You can use gs_loader to import the files exported by using the copy to command. The gs_loader tool converts the syntax supported by control files into \copy syntax, then leverages the existing \copy function to import main data. At the same time, gs_loader logs the results of the \copy operations to a log file.

Using gs_loader to Import Data