Oĭo not output commands to set ownership of objects to match the original database. This can be combined with the -t option to restore just a specific table. Multiple schemas may be specified with multiple -n switches. Restore only objects that are in the named schema. Lines can be moved or removed, and can also be commented out by placing a semicolon ( ) at the start of the line. List-file is normally created by editing the output of a previous -l operation. Note that if filtering switches such as -n or -t are used with -L, they will further restrict the items restored. Postgres app command line archive#Restore only those archive elements that are listed in list-file, and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -l, they will restrict the items listed. The output of this operation can be used as input to the -L option. Also, multiple jobs cannot be used together with the option -single-transaction. This option is ignored when emitting a script rather than connecting directly to a database server. The input must be a regular file or directory (not, for example, a pipe). Only the custom and directory archive formats are supported with this option. Of course, values that are too high will lead to decreased performance because of thrashing. A good place to start is the number of CPU cores on the server, but values larger than that can also lead to faster restore times in many cases. Factors include the number of CPU cores and the disk setup. The optimal value for this option depends on the hardware setup of the server, of the client, and of the network. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine.Įach job is one process or one thread, depending on the operating system, and uses a separate connection to the server. Run the most time-consuming parts of pg_restore - those which load data, create indexes, or create constraints - using multiple concurrent jobs. Multiple indexes may be specified with multiple -I switches. dĪ deprecated option that is now ignored. The archive is in the custom format of pg_dump. If specified, it can be one of the following: It is not necessary to specify the format, since pg_restore will determine the format automatically. Specify output file for generated script, or for the listing when used with -l. The default is to continue and to display a count of errors at the end of the restoration. eĮxit if an error is encountered while sending SQL commands to the database. d dbnameĬonnect to database dbname and restore directly into the database. All data is restored into the database name that appears in the archive. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. If -clean is also specified, drop and recreate the target database before connecting to it. (Unless -if-exists is used, this might generate some harmless error messages, if any objects were not present in the destination database.) -CĬreate the database before restoring into it. cĬlean (drop) database objects before recreating them. This option is similar to, but for historical reasons not identical to, specifying -section=data. Table data, large objects, and sequence values are restored, if present in the archive. Restore only the data, not the schema (data definitions). If not specified, the standard input is used. Specifies the location of the archive file (or directory, for a directory-format archive) to be restored. For instance, if the archive was made using the "dump data as INSERT commands" option, pg_restore will not be able to load the data using COPY statements. Obviously, pg_restore cannot restore information that is not present in the archive file. Some of the options controlling the output are therefore analogous to pg_dump options. This script output is equivalent to the plain text output format of pg_dump. Otherwise, a script containing the SQL commands necessary to rebuild the database is created and written to a file or standard output. If a database name is specified, pg_restore connects to that database and restores archive contents directly into the database. Postgres app command line portable#The archive files are designed to be portable across architectures. The archive files also allow pg_restore to be selective about what is restored, or even to reorder the items prior to being restored. It will issue the commands necessary to reconstruct the database to the state it was in at the time it was saved. Pg_restore is a utility for restoring a PostgreSQL database from an archive created by pg_dump in one of the non-plain-text formats.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |