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 GaussDB(DWS).
Procedure
- Connect to the default database postgres as a database administrator through the database client tool provided by DWS.
For example, use the gsql client to connect to the database by running the following command:
1
gsql -d postgres -h 192.168.2.30 -U dbadmin -p 8000 -r
Enter your password as prompted.
- Run gs_dumpall to export global tablespaces.
gs_dumpall -W Bigdata@123 -U omm -f /home/dbadmin/backup/MPPDB_tablespace.sql -p 8000 -t
Table 1 Common parameters Parameter
Description
Example Value
-U
User name for database connection. The user must be a cluster administrator.
-U omm
-W
User password for database connection.
- This parameter is not required for database administrators if the trust policy is used for authentication.
- If you connect to the database without specifying this parameter and you are not a database administrator, you will be prompted to enter the password.
-W Bigdata@123
-f
Folder to store exported files. If this parameter is not specified, the exported files are stored in the standard output.
-f /home/dbadmin/backup/MPPDB_tablespace.sql
-p
TCP port or the local Unix-domain socket file extension on which the server is listening for connections.
-p 8000
-t
Dumps only tablespaces. You can also use --tablespaces-only alternatively.
-
For details about other parameters, see gs_dumpall.
Examples
Example 1: Run gs_dumpall as a cluster administrator omm to export global tablespaces and users in a cluster. The exported files are in text format.
gs_dumpall -W Bigdata@123 -U omm -f /home/dbadmin/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 to export global tablespaces in a cluster, encrypt the exported files, and store them in text format as a cluster administrator omm.
gs_dumpall -W Bigdata@123 -U omm -f /home/dbadmin/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 a cluster administrator omm to export global users in a cluster. The exported files are in text format.
gs_dumpall -W Bigdata@123 -U omm -f /home/dbadmin/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
Last Article: Exporting All Databases
Next Article: Data Export By a User Without Required Permissions
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.