gs_dumpall

Background

gs_dumpall is a tool provided by GaussDB(DWS) to export all database information, including the data of the default postgres database, data of user-specified databases, and global objects of all databases in a cluster.

When gs_dumpall is used to export data, other users still can access the databases (readable or writable) in a cluster.

gs_dumpall can export complete, consistent data. For example, if gs_dumpall is started to export all databases from a cluster at T1, data of the databases at that time point will be exported, and modifications on the databases after that time point will not be exported.

To export all databases in a cluster:

Both of the preceding exported files are plain-text SQL scripts. Use gsql to execute them to restore databases.

Precautions

Syntax

gs_dumpall [OPTION]...

Parameter Description

Common parameters:

Dump parameters:

  • The -g/--globals-only and -r/--roles-only parameters do not coexist.
  • The -g/--globals-only and -t/--tablespaces-only parameters do not coexist.
  • The -r/--roles-only and -t/--tablespaces-only parameters do not coexist.
  • The -s/--schema-only and -a/--data-only parameters do not coexist.
  • The -r/--roles-only and -a/--data-only parameters do not coexist.
  • The -t/--tablespaces-only and -a/--data-only parameters do not coexist.
  • The -g/--globals-only and -a/--data-only parameters do not coexist.
  • --tablespaces-postfix must be used in conjunction with --binary-upgrade.
  • --parallel-jobs must be used in conjunction with -f/--file.

Connection parameters:

Description

The gs_dumpall internally invokes gs_dump. For details about the diagnosis information, see gs_dump.

Once gs_dumpall is restored, run ANALYZE on each database so that the optimizer can provide useful statistics.

gs_dumpall requires all needed tablespace directories to exit before the restoration. Otherwise, database creation will fail if the databases are in non-default locations.

Examples

Run gs_dumpall to export all databases from a cluster at a time.

gs_dumpall supports only plain-text format export. Therefore, only gsql can be used to restore a file exported using gs_dumpall.

gs_dumpall -f backup/bkp2.sql -p 37300
gs_dump[port='37300'][dbname='postgres'][2018-06-27 09:55:09]: The total objects number is 2371.
gs_dump[port='37300'][dbname='postgres'][2018-06-27 09:55:35]: [100.00%] 2371 objects have been dumped.
gs_dump[port='37300'][dbname='postgres'][2018-06-27 09:55:46]: dump database dbname='postgres' successfully
gs_dump[port='37300'][dbname='postgres'][2018-06-27 09:55:46]: total time: 55567  ms
gs_dumpall[port='37300'][2018-06-27 09:55:46]: dumpall operation successful
gs_dumpall[port='37300'][2018-06-27 09:55:46]: total time: 56088  ms

Helpful Links

gs_dump and gs_restore