Exporting All Databases
You can use gs_dumpall to export full information of all databases in openGauss, including information about each database and global objects. You can specify the information to export as follows:
Export full information of all databases, including information about each database and global objects (such as roles and tablespaces).
You can use the exported information to create a host environment containing the same databases, global objects, and data as the current one.
Export data of all databases, excluding all object definitions and global objects.
Export all object definitions of all databases, including the definitions of tablespaces, databases, functions, schemas, tables, indexes, and stored procedures.
You can use the exported object definitions to quickly create a host environment that is the same as the current one, containing the same databases and tablespaces but no data.
Procedure
Log in as the OS user omm to the primary node of the database.
Run gs_dumpall to export full information of all databases.
gs_dumpall -U omm -f /home/omm/backup/MPPDB_backup.sql -p 8000 Password:
The following table describes common parameters. For details about other parameters, see “Server Tools > gs_dumpall” in Tool Reference.
Table 1 Common parameters
Examples
Example 1: Run gs_dumpall as a cluster administrator omm to export full information of all databases in a cluster. After the command is executed, a large amount of output information will be displayed. total time will be displayed at the end of the information, indicating that the backup is successful. In this example, only relative output information is included.
gs_dumpall -U omm -f /home/omm/backup/MPPDB_backup.sql -p 8000 Password: gs_dumpall[port='8000'][2017-07-21 15:57:31]: dumpall operation successful gs_dumpall[port='8000'][2017-07-21 15:57:31]: total time: 9627 ms
Example 2: Run gs_dumpall as a cluster administrator omm to export object definitions of all databases in a cluster. The exported files are in text format. After the command is executed, a large amount of output information will be displayed. total time will be displayed at the end of the information, indicating that the backup is successful. In this example, only relative output information is included.
gs_dumpall -U omm -f /home/omm/backup/MPPDB_backup.sql -p 8000 -s Password: gs_dumpall[port='8000'][2018-11-14 11:28:14]: dumpall operation successful gs_dumpall[port='8000'][2018-11-14 11:28:14]: total time: 4147 ms
Example 3: Run gs_dumpall to export data of all databases in a cluster, encrypt the exported files, and store them in text format. After the command is executed, a large amount of output information will be displayed. total time will be displayed at the end of the information, indicating that the backup is successful. In this example, only relative output information is included.
gs_dumpall -f /home/omm/backup/MPPDB_backup.sql -p 8000 -a --with-encryption AES128 --with-key abcdefg_?1234567 gs_dumpall[port='8000'][2018-11-14 11:32:26]: dumpall operation successful gs_dumpall[port='8000'][2018-11-14 11:23:26]: total time: 4147 ms