This parameter can be omitted for file based output formats, in which case the standard output is used. (Another way to get the same result is to set the PGCLIENTENCODING environment variable to the desired dump encoding.) -f file By default, the dump is created in the database encoding. E encodingĬreate the dump in the specified character set encoding.
DUMP LOG FILES PGADMIN 4 ARCHIVE
For the archive formats, you can specify the option when you call pg_restore. This option is ignored when emitting an archive (non-text) output file. Access privileges for the database itself are also dumped, unless -no-acl is specified. With -create, the output also includes the database's comment if any, and any configuration variable settings that are specific to this database, that is, any ALTER DATABASE. (With a script of this form, it doesn't matter which database in the destination installation you connect to before running the script.) If -clean is also specified, the script drops and recreates the target database before reconnecting to it. Cīegin the output with a command to create the database itself and reconnect to the created database. (Unless -if-exists is also specified, restore might generate some harmless error messages, if any objects were not present in the destination database.) Output commands to clean (drop) database objects prior to outputting the commands for creating them. When both -b and -B are given, the behavior is to output large objects, when data is being dumped, see the -b documentation. Note that blobs are considered data and therefore will be included when -data-only is used, but not when -schema-only is. The -b switch is therefore only useful to add large objects to dumps where a specific schema or table has been requested. This is the default behavior except when -schema, -table, or -schema-only is specified. This option is similar to, but for historical reasons not identical to, specifying -section=data. Table data, large objects, and sequence values are dumped. aĭump only the data, not the schema (data definitions). If that is not set, the user name specified for the connection is used.
If this is not specified, the environment variable PGDATABASE is used. Specifies the name of the database to be dumped.
While running pg_dump, one should examine the output for any warnings (printed on standard error), especially in light of the limitations listed below. The “ directory” format is the only format that supports parallel dumps. They allow for selection and reordering of all archived items, support parallel restoration, and are compressed by default. The most flexible output file formats are the “ custom” format ( -Fc) and the “ directory” format ( -Fd). pg_dump can be used to backup an entire database, then pg_restore can be used to examine the archive and/or select which parts of the database are to be restored. When used with one of the archive file formats and combined with pg_restore, pg_dump provides a flexible archival and transfer mechanism.
DUMP LOG FILES PGADMIN 4 PORTABLE
The archive file formats are designed to be portable across architectures. They allow pg_restore to be selective about what is restored, or even to reorder the items prior to being restored. The alternative archive file formats must be used with pg_restore to rebuild the database.
Script files can be used to reconstruct the database even on other machines and other architectures with some modifications, even on other SQL database products. To restore from such a script, feed it to psql. Script dumps are plain-text files containing the SQL commands required to reconstruct the database to the state it was in at the time it was saved. To back up an entire cluster, or to back up global objects that are common to all databases in a cluster (such as roles and tablespaces), use pg_dumpall.ĭumps can be output in script or archive file formats. pg_dump does not block other users accessing the database (readers or writers). It makes consistent backups even if the database is being used concurrently. Pg_dump is a utility for backing up a PostgreSQL database.