DEV Community

leo
leo

Posted on

openGauss:gs_dumpall

gs_dumpall
Background Information
gs_dumpall is a tool used by openGauss to export all database-related information. It can export all data of the openGauss database, including the data of the default database postgres, the data of the custom database, and the global objects common to all databases of openGauss.

The gs_dumpall utility is executed by the operating system user omm.

When the gs_dumpall tool is exporting data, other users can access the openGauss database (read or write).

The gs_dumpall tool supports exporting complete and consistent data. For example, start gs_dumpall at time T1 to export the openGauss database, then the exported data result will be the data status of the openGauss database at time T1, and the modification to openGauss after time T1 will not be exported.

Generated columns are not dumped during gs_dumpall.

gs_dumpall is divided into two parts when exporting all openGauss databases:

gs_dumpall itself exports global objects common to all databases, including information about database users and groups, tablespaces, and attributes such as access rights that apply to the database as a whole.
gs_dumpall completes the export of the SQL script file of each database in openGauss by calling gs_dump. The script file contains all the SQL statements required to restore the database to its saved state.
The results exported from the above two parts are SQL script files in plain text format, and the openGauss database can be restored by running the script file with gsql.

Precautions
It is forbidden to modify the exported files and content, otherwise the recovery may not be successful.
In order to ensure data consistency and integrity, gs_dumpall sets shared locks on the tables that need to be dumped. If a table has a shared lock set in another transaction, gs_dumpall will wait for the table lock to be released before locking the table. If a table cannot be locked within the specified time, the dump will fail. Users can customize the timeout period for waiting for locks by specifying the --lock-wait-timeout option.
Since gs_dumpall reads all tables in the database, you must connect as an openGauss administrator to export the full file. When using gsql to import script files, administrator privileges are also required to add users and groups and create databases.

Top comments (0)