Exporting Global Objects
You can use gs_dumpall to export global objects, including database users, user groups, tablespaces, and attributes (for example, global access permissions), from openGauss.
Procedure
Log in as the OS user omm to the primary node of the database.
Run gs_dumpall to export global tablespaces.
gs_dumpall -W Bigdata@123 -U omm -f /home/omm/backup/MPPDB_tablespace.sql -p 8000 -t
Table 1 Common parameters
For details about other parameters, see “Server Tools > gs_dumpall” in the Tool Reference.
Examples
Example 1: Run gs_dumpall as the cluster administrator omm to export global tablespaces and users of all databases. The exported files are in text format.
gs_dumpall -W Bigdata@123 -U omm -f /home/omm/backup/MPPDB_globals.sql -p 8000 -g
gs_dumpall[port='8000'][2018-11-14 19:06:24]: dumpall operation successful
gs_dumpall[port='8000'][2018-11-14 19:06:24]: total time: 1150 ms
Example 2: Run gs_dumpall as the cluster administrator omm to export global tablespaces of all databases, encrypt the exported files, and store them in text format.
gs_dumpall -W Bigdata@123 -U omm -f /home/omm/backup/MPPDB_tablespace.sql -p 8000 -t --with-encryption AES128 --with-key 1212121212121212
gs_dumpall[port='8000'][2018-11-14 19:00:58]: dumpall operation successful
gs_dumpall[port='8000'][2018-11-14 19:00:58]: total time: 186 ms
Example 3: Run gs_dumpall as the cluster administrator omm to export global users of all databases. The exported files are in text format.
gs_dumpall -W Bigdata@123 -U omm -f /home/omm/backup/MPPDB_user.sql -p 8000 -r
gs_dumpall[port='8000'][2018-11-14 19:03:18]: dumpall operation successful
gs_dumpall[port='8000'][2018-11-14 19:03:18]: total time: 162 ms