2016-06-02 08:05:46 -05:00
|
|
|
|
.. _backup_dialog:
|
|
|
|
|
|
2018-06-15 03:14:12 -05:00
|
|
|
|
**********************
|
|
|
|
|
`Backup Dialog`:index:
|
|
|
|
|
**********************
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2020-11-04 06:01:21 -06:00
|
|
|
|
*pgAdmin* uses the *pg_dump* utility to provide an easy way to create a backup
|
2019-03-08 09:29:05 -06:00
|
|
|
|
in a plain-text or archived format. You can then use a client application (like
|
|
|
|
|
*psql* or the *Query Tool*) to restore a plain-text backup file, or use the
|
|
|
|
|
Postgres *pg_restore* utility to restore an archived backup. The *pg_dump*
|
|
|
|
|
utility must have read access to all database objects that you want to back up.
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
|
You can backup a single table, a schema, or a complete database. Select the name
|
|
|
|
|
of the backup source in the *pgAdmin* tree control, right click to open the
|
|
|
|
|
context menu, and select *Backup...* to open the *Backup* dialog. The name of
|
|
|
|
|
the object selected will appear in the dialog title bar.
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
|
|
|
|
.. image:: images/backup_general.png
|
2018-01-11 10:58:30 -06:00
|
|
|
|
:alt: Backup dialog general tab
|
2019-03-08 09:29:05 -06:00
|
|
|
|
:align: center
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
|
|
|
|
Use the fields in the *General* tab to specify parameters for the backup:
|
|
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
|
* Enter the name of the backup file in the *Filename* field. Optionally, select
|
|
|
|
|
the *Browser* icon (...) to the right to navigate into a directory and select
|
|
|
|
|
a file that will contain the archive.
|
|
|
|
|
|
|
|
|
|
* Use the drop-down listbox in the *Format* field to select the format that is
|
|
|
|
|
best suited for your application. Each format has advantages and
|
|
|
|
|
disadvantages:
|
|
|
|
|
|
|
|
|
|
* Select *Custom* to create a custom archive file that you can use with
|
|
|
|
|
*pg_restore* to create a copy of a database. Custom archive file formats
|
|
|
|
|
must be restored with *pg_restore*. This format offers the opportunity to
|
|
|
|
|
select which database objects to restore from the backup file. *Custom*
|
|
|
|
|
archive format is recommended for medium to large databases as it is
|
|
|
|
|
compressed by default.
|
|
|
|
|
|
|
|
|
|
* Select *Tar* to generate a tar archive file that you can restore with
|
|
|
|
|
*pg_restore*. The tar format does not support compression.
|
|
|
|
|
|
|
|
|
|
* Select *Plain* to create a plain-text script file. A plain-text script file
|
|
|
|
|
contains SQL statements and commands that you can execute at the *psql*
|
|
|
|
|
command line to recreate the database objects and load the table data. A
|
|
|
|
|
plain-text backup file can be edited in a text editor, if desired, before
|
|
|
|
|
using the *psql* program to restore database objects. *Plain* format is
|
|
|
|
|
normally recommended for smaller databases; script dumps are not
|
|
|
|
|
recommended for blobs. The SQL commands within the script will reconstruct
|
|
|
|
|
the database to the last saved state of the database. A plain-text script
|
|
|
|
|
can be used to reconstruct the database on another machine, or (with
|
|
|
|
|
modifications) on other architectures.
|
|
|
|
|
|
|
|
|
|
* Select *Directory* to generate a directory-format archive suitable for use
|
|
|
|
|
with *pg_restore*. This file format creates a directory with one file for
|
|
|
|
|
each table and blob being dumped, plus a *Table of Contents* file
|
|
|
|
|
describing the dumped objects in a machine-readable format that
|
|
|
|
|
*pg_restore* can read. This format is compressed by default.
|
|
|
|
|
|
|
|
|
|
* Use the *Compression Ratio* field to select a compression level for the
|
|
|
|
|
backup. Specify a value of zero to mean use no compression; specify a maximum
|
|
|
|
|
compression value of 9. Please note that tar archives do not support
|
|
|
|
|
compression.
|
|
|
|
|
* Use the *Encoding* drop-down listbox to select the character encoding method
|
|
|
|
|
that should be used for the archive.
|
|
|
|
|
* Use the *Number of Jobs* field (when applicable) to specify the number of
|
|
|
|
|
tables that will be dumped simultaneously in a parallel backup.
|
|
|
|
|
* Use the dropdown listbox next to *Rolename* to specify the role that owns the
|
|
|
|
|
backup.
|
|
|
|
|
|
2022-01-07 00:05:40 -06:00
|
|
|
|
Click the *Data/Objects* tab to continue. Use the fields in the *Data/Objects*
|
|
|
|
|
tab to provide options related to data or pgAdmin objects that correspond to *pg_dump*.
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
|
|
|
|
.. image:: images/backup_sections.png
|
2018-01-11 10:58:30 -06:00
|
|
|
|
:alt: Sections option on backup dialog
|
2019-03-08 09:29:05 -06:00
|
|
|
|
:align: center
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
|
* Move switches in the **Sections** field box to select a portion of the object
|
|
|
|
|
that will be backed up.
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2022-01-07 00:05:40 -06:00
|
|
|
|
* Move the switch next to *Pre-data* towards right position to include all
|
2019-03-08 09:29:05 -06:00
|
|
|
|
data definition items not included in the data or post-data item lists.
|
2018-01-11 10:58:30 -06:00
|
|
|
|
|
2022-01-07 00:05:40 -06:00
|
|
|
|
* Move the switch next to *Data* towards right position to backup actual table
|
2019-03-08 09:29:05 -06:00
|
|
|
|
data, large-object contents, and sequence values.
|
2018-01-11 10:58:30 -06:00
|
|
|
|
|
2022-01-07 00:05:40 -06:00
|
|
|
|
* Move the switch next to *Post-data* towards right position to include
|
2019-03-08 09:29:05 -06:00
|
|
|
|
definitions of indexes, triggers, rules, and constraints other than
|
|
|
|
|
validated check constraints.
|
2018-01-11 10:58:30 -06:00
|
|
|
|
|
|
|
|
|
.. image:: images/backup_objects.png
|
|
|
|
|
:alt: Type of objects option on backup dialog
|
2019-03-08 09:29:05 -06:00
|
|
|
|
:align: center
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
|
* Move switches in the **Type of objects** field box to specify details about
|
|
|
|
|
the type of objects that will be backed up.
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2022-01-07 00:05:40 -06:00
|
|
|
|
* Move the switch next to *Only data* towards right position to limit the back
|
2019-03-08 09:29:05 -06:00
|
|
|
|
up to data.
|
2018-01-11 10:58:30 -06:00
|
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
|
* Move the switch next to *Only schema* to limit the back up to schema-level
|
|
|
|
|
database objects.
|
2018-01-11 10:58:30 -06:00
|
|
|
|
|
2022-01-07 00:05:40 -06:00
|
|
|
|
* Move the switch next to *Blobs* towards left position to exclude large
|
2019-03-08 09:29:05 -06:00
|
|
|
|
objects in the backup.
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
|
|
|
|
.. image:: images/backup_do_not_save.png
|
2018-01-11 10:58:30 -06:00
|
|
|
|
:alt: Do not save option on backup dialog
|
2019-03-08 09:29:05 -06:00
|
|
|
|
:align: center
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
|
* Move switches in the **Do not save** field box to select the objects that will
|
|
|
|
|
not be included in the backup.
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2022-01-07 00:05:40 -06:00
|
|
|
|
* Move the switch next to *Owner* towards right position to exclude commands
|
2019-03-08 09:29:05 -06:00
|
|
|
|
that set object ownership.
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2022-01-07 00:05:40 -06:00
|
|
|
|
* Move the switch next to *Privilege* towards right position to exclude
|
2019-03-08 09:29:05 -06:00
|
|
|
|
commands that create access privileges.
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2022-01-07 00:05:40 -06:00
|
|
|
|
* Move the switch next to *Tablespace* towards right position to exclude
|
2019-03-08 09:29:05 -06:00
|
|
|
|
tablespaces.
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2022-01-07 00:05:40 -06:00
|
|
|
|
* Move the switch next to *Unlogged table data* towards right position to
|
2019-03-08 09:29:05 -06:00
|
|
|
|
exclude the contents of unlogged tables.
|
2018-08-22 01:47:50 -05:00
|
|
|
|
|
2022-01-07 00:05:40 -06:00
|
|
|
|
* Move the switch next to *Comments* towards right position to exclude
|
2019-03-08 09:29:05 -06:00
|
|
|
|
commands that set the comments. **Note:** This option is visible only for
|
|
|
|
|
database server greater than or equal to 11.
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2022-01-07 00:05:40 -06:00
|
|
|
|
Click the *Options* tab to continue. Use these additional fields to specify
|
|
|
|
|
options like including ddl statements, verbose message or using set session
|
|
|
|
|
authorization corresponding to *pg_dump* options.
|
|
|
|
|
|
2016-06-02 08:05:46 -05:00
|
|
|
|
.. image:: images/backup_queries.png
|
2018-01-11 10:58:30 -06:00
|
|
|
|
:alt: Queries option on backup dialog
|
2019-03-08 09:29:05 -06:00
|
|
|
|
:align: center
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
|
* Move switches in the **Queries** field box to specify the type of statements
|
|
|
|
|
that should be included in the backup.
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2022-01-07 00:05:40 -06:00
|
|
|
|
* Move the switch next to *Use Column Inserts* towards right position to dump
|
2019-03-08 09:29:05 -06:00
|
|
|
|
the data in the form of INSERT statements and include explicit column
|
|
|
|
|
names. Please note: this may make restoration from backup slow.
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2022-01-07 00:05:40 -06:00
|
|
|
|
* Move the switch next to *Use Insert commands* towards right position to
|
2019-03-08 09:29:05 -06:00
|
|
|
|
dump the data in the form of INSERT statements rather than using a COPY
|
|
|
|
|
command. Please note: this may make restoration from backup slow.
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2022-01-07 00:05:40 -06:00
|
|
|
|
* Move the switch next to *Include CREATE DATABASE statement* towards right
|
2019-03-08 09:29:05 -06:00
|
|
|
|
position to include a command in the backup that creates a new database
|
|
|
|
|
when restoring the backup.
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2022-01-07 00:05:40 -06:00
|
|
|
|
* Move the switch next to *Include DROP DATABASE statement* towards right
|
2019-03-08 09:29:05 -06:00
|
|
|
|
position to include a command in the backup that will drop any existing
|
|
|
|
|
database object with the same name before recreating the object during a
|
|
|
|
|
backup.
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2022-01-07 00:05:40 -06:00
|
|
|
|
* Move the switch next to *Load Via Partition Root* towards right position,
|
2019-03-08 09:29:05 -06:00
|
|
|
|
so when dumping a COPY or INSERT statement for a partitioned table, target
|
|
|
|
|
the root of the partitioning hierarchy which contains it rather than the
|
|
|
|
|
partition itself. **Note:** This option is visible only for database server
|
|
|
|
|
greater than or equal to 11.
|
2018-08-22 01:47:50 -05:00
|
|
|
|
|
2016-06-02 08:05:46 -05:00
|
|
|
|
.. image:: images/backup_disable.png
|
2018-01-11 10:58:30 -06:00
|
|
|
|
:alt: Disable option on backup dialog
|
2019-03-08 09:29:05 -06:00
|
|
|
|
:align: center
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
|
* Move switches in the **Disable** field box to specify the type of statements
|
|
|
|
|
that should be excluded from the backup.
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
|
* Move the switch next to *Trigger* (active when creating a data-only backup)
|
2022-01-07 00:05:40 -06:00
|
|
|
|
towards right position to include commands that will disable triggers on the
|
2019-03-08 09:29:05 -06:00
|
|
|
|
target table while the data is being loaded.
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2022-01-07 00:05:40 -06:00
|
|
|
|
* Move the switch next to *$ quoting* towards right position to enable dollar
|
2019-03-08 09:29:05 -06:00
|
|
|
|
quoting within function bodies; if disabled, the function body will be
|
|
|
|
|
quoted using SQL standard string syntax.
|
2018-01-11 10:58:30 -06:00
|
|
|
|
|
2016-06-02 08:05:46 -05:00
|
|
|
|
.. image:: images/backup_miscellaneous.png
|
2018-01-11 10:58:30 -06:00
|
|
|
|
:alt: Miscellaneous option on backup dialog
|
2019-03-08 09:29:05 -06:00
|
|
|
|
:align: center
|
|
|
|
|
|
|
|
|
|
* Move switches in the **Miscellaneous** field box to specify miscellaneous
|
|
|
|
|
backup options.
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2022-01-07 00:05:40 -06:00
|
|
|
|
* Move the switch next to *With OIDs* towards right position to include object
|
2019-03-08 09:29:05 -06:00
|
|
|
|
identifiers as part of the table data for each table.
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2022-01-07 00:05:40 -06:00
|
|
|
|
* Move the switch next to *Verbose messages* towards left position to instruct
|
2019-03-08 09:29:05 -06:00
|
|
|
|
*pg_dump* to exclude verbose messages.
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2022-01-07 00:05:40 -06:00
|
|
|
|
* Move the switch next to *Force double quotes on identifiers* towards right
|
2019-03-08 09:29:05 -06:00
|
|
|
|
position to force the quoting of all identifiers.
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2022-01-07 00:05:40 -06:00
|
|
|
|
* Move the switch next to *Use SET SESSION AUTHORIZATION* towards right
|
2019-03-08 09:29:05 -06:00
|
|
|
|
position to include a statement that will use a SET SESSION AUTHORIZATION
|
|
|
|
|
command to determine object ownership (instead of an ALTER OWNER command).
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
|
When you’ve specified the details that will be incorporated into the pg_dump
|
|
|
|
|
command:
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
|
* Click the *Backup* button to build and execute a command that builds a backup
|
|
|
|
|
based on your selections on the *Backup* dialog.
|
2016-06-02 08:05:46 -05:00
|
|
|
|
|
|
|
|
|
* Click the *Cancel* button to exit without saving work.
|
|
|
|
|
|
2022-08-11 00:19:45 -05:00
|
|
|
|
pgAdmin will run the backup process in background. You can view all the background
|
|
|
|
|
process with there running status and logs on the :ref:`Processes <processes>`
|
|
|
|
|
tab
|