You can use gs_dumpall to export global objects from GaussDB(DWS), including database users, user groups, tablespaces, and attributes (for example, global access permissions).
The user who uploads the client must have the full control permission on the target directory on the host to which the client is uploaded.
cd <Path_for_storing_the_client> unzip dws_client_8.1.x_redhat_x64.zip
Where,
source gsql_env.sh
If the following information is displayed, the GaussDB(DWS) client is successfully configured:
All things done.
gs_dumpall -W password -U dbadmin -f /home/dbadmin/backup/MPPDB_tablespace.sql -p 8000 -h 10.10.10.100 -t
Parameter |
Description |
Example Value |
---|---|---|
-U |
Username for database connection. The user must be a cluster administrator. |
-U dbadmin |
-W |
User password for database connection.
|
-W Password |
-f |
Folder to store exported files. If this parameter is not specified, the exported files are stored in the standard output. |
-f /home//backup/MPPDB_tablespace.sql |
-p |
Name extension of the TCP port on which the server is listening or the local Unix domain socket. This parameter is configured to ensure connections. |
-p 8000 |
-h |
Cluster address: If a public network address is used for connection, set this parameter to Public Network Address or Public Network Domain Name. If a private network address is used for connection, set this parameter to Private Network Address or Private Network Domain Name. |
-h 10.10.10.100 |
-t |
Dumps only tablespaces. You can also use --tablespaces-only alternatively. |
- |
For details about other parameters, see "gs_dumpall" in the Tool Guide.
Example 1: Use gs_dumpall to run the following command as the cluster administrator dbadmin to export information of global tablespaces and users in a cluster. The exported files are in text format.
gs_dumpall -W password -U dbadmin -f /home/dbadmin/backup/MPPDB_globals.sql -p 8000 -h 10.10.10.100 -g gs_dumpall[port=''][2018-11-14 19:06:24]: dumpall operation successful gs_dumpall[port=''][2018-11-14 19:06:24]: total time: 1150 ms
Example 2: Use gs_dumpall to run the following command as the cluster administrator dbadmin to export global tablespaces in a cluster, encrypt the exported files, and store them in text format.
gs_dumpall -W password -U dbadmin -f /home/dbadmin/backup/MPPDB_tablespace.sql -p 8000 -h 10.10.10.100 -t --with-encryption AES128 --with-key 1212121212121212 gs_dumpall[port=''][2018-11-14 19:00:58]: dumpall operation successful gs_dumpall[port=''][2018-11-14 19:00:58]: total time: 186 ms
Example 3: Use gs_dumpall to run the following command as the cluster administrator dbadmin to export information of global users in a cluster. The exported files are in text format.
gs_dumpall -W password -U dbadmin -f /home/dbadmin/backup/MPPDB_user.sql -p 8000 -h 10.10.10.100 -r gs_dumpall[port=''][2018-11-14 19:03:18]: dumpall operation successful gs_dumpall[port=''][2018-11-14 19:03:18]: total time: 162 ms