Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
app-pg-dumpall.html364 linesDownload Raw Back to html
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>pg_dumpall</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="app-pgdump.html" title="pg_dump" /><link rel="next" href="app-pg-isready.html" title="pg_isready" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center"><span class="application">pg_dumpall</span></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="app-pgdump.html" title="pg_dump">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="reference-client.html" title="PostgreSQL Client Applications">Up</a></td><th width="60%" align="center">PostgreSQL Client Applications</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="app-pg-isready.html" title="pg_isready">Next</a></td></tr></table><hr /></div><div class="refentry" id="APP-PG-DUMPALL"><div class="titlepage"></div><a id="id-1.9.4.14.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle"><span class="application">pg_dumpall</span></span></h2><p>pg_dumpall — extract a <span class="productname">PostgreSQL</span> database cluster into a script file</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p id="id-1.9.4.14.4.1"><code class="command">pg_dumpall</code> [<em class="replaceable"><code>connection-option</code></em>...] [<em class="replaceable"><code>option</code></em>...]</p></div></div><div class="refsect1" id="APP-PG-DUMPALL-DESCRIPTION"><h2>Description</h2><p>3   <span class="application">pg_dumpall</span> is a utility for writing out4   (<span class="quote">“<span class="quote">dumping</span>”</span>) all <span class="productname">PostgreSQL</span> databases5   of a cluster into one script file.  The script file contains6   <acronym class="acronym">SQL</acronym> commands that can be used as input to <a class="xref" href="app-psql.html" title="psql"><span class="refentrytitle"><span class="application">psql</span></span></a> to restore the databases.  It does this by7   calling <a class="xref" href="app-pgdump.html" title="pg_dump"><span class="refentrytitle"><span class="application">pg_dump</span></span></a> for each database in the cluster.8   <span class="application">pg_dumpall</span> also dumps global objects9   that are common to all databases, namely database roles, tablespaces,10   and privilege grants for configuration parameters.11   (<span class="application">pg_dump</span> does not save these objects.)12  </p><p>13   Since <span class="application">pg_dumpall</span> reads tables from all14   databases you will most likely have to connect as a database15   superuser in order to produce a complete dump.  Also you will need16   superuser privileges to execute the saved script in order to be17   allowed to add roles and create databases.18  </p><p>19   The SQL script will be written to the standard output.  Use the20   <code class="option">-f</code>/<code class="option">--file</code> option or shell operators to21   redirect it into a file.22  </p><p>23  <span class="application">pg_dumpall</span> needs to connect several24  times to the <span class="productname">PostgreSQL</span> server (once per25  database).  If you use password authentication it will ask for26  a password each time. It is convenient to have a27  <code class="filename">~/.pgpass</code> file in such cases. See <a class="xref" href="libpq-pgpass.html" title="34.16. The Password File">Section 34.16</a> for more information.28  </p></div><div class="refsect1" id="id-1.9.4.14.6"><h2>Options</h2><p>29    The following command-line options control the content and30    format of the output.31 32    </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">-a</code><br /></span><span class="term"><code class="option">--data-only</code></span></dt><dd><p>33        Dump only the data, not the schema (data definitions).34       </p></dd><dt><span class="term"><code class="option">-c</code><br /></span><span class="term"><code class="option">--clean</code></span></dt><dd><p>35        Emit SQL commands to <code class="command">DROP</code> all the dumped36        databases, roles, and tablespaces before recreating them.37        This option is useful when the restore is to overwrite an existing38        cluster.  If any of the objects do not exist in the destination39        cluster, ignorable error messages will be reported during40        restore, unless <code class="option">--if-exists</code> is also specified.41       </p></dd><dt><span class="term"><code class="option">-E <em class="replaceable"><code>encoding</code></em></code><br /></span><span class="term"><code class="option">--encoding=<em class="replaceable"><code>encoding</code></em></code></span></dt><dd><p>42        Create the dump in the specified character set encoding. By default,43        the dump is created in the database encoding.  (Another way to get the44        same result is to set the <code class="envar">PGCLIENTENCODING</code> environment45        variable to the desired dump encoding.)46       </p></dd><dt><span class="term"><code class="option">-f <em class="replaceable"><code>filename</code></em></code><br /></span><span class="term"><code class="option">--file=<em class="replaceable"><code>filename</code></em></code></span></dt><dd><p>47        Send output to the specified file.  If this is omitted, the48        standard output is used.49       </p></dd><dt><span class="term"><code class="option">-g</code><br /></span><span class="term"><code class="option">--globals-only</code></span></dt><dd><p>50        Dump only global objects (roles and tablespaces), no databases.51       </p></dd><dt><span class="term"><code class="option">-O</code><br /></span><span class="term"><code class="option">--no-owner</code></span></dt><dd><p>52        Do not output commands to set53        ownership of objects to match the original database.54        By default, <span class="application">pg_dumpall</span> issues55        <code class="command">ALTER OWNER</code> or56        <code class="command">SET SESSION AUTHORIZATION</code>57        statements to set ownership of created schema elements.58        These statements59        will fail when the script is run unless it is started by a superuser60        (or the same user that owns all of the objects in the script).61        To make a script that can be restored by any user, but will give62        that user ownership of all the objects, specify <code class="option">-O</code>.63       </p></dd><dt><span class="term"><code class="option">-r</code><br /></span><span class="term"><code class="option">--roles-only</code></span></dt><dd><p>64        Dump only roles, no databases or tablespaces.65       </p></dd><dt><span class="term"><code class="option">-s</code><br /></span><span class="term"><code class="option">--schema-only</code></span></dt><dd><p>66        Dump only the object definitions (schema), not data.67       </p></dd><dt><span class="term"><code class="option">-S <em class="replaceable"><code>username</code></em></code><br /></span><span class="term"><code class="option">--superuser=<em class="replaceable"><code>username</code></em></code></span></dt><dd><p>68        Specify the superuser user name to use when disabling triggers.69        This is relevant only if <code class="option">--disable-triggers</code> is used.70        (Usually, it's better to leave this out, and instead start the71        resulting script as superuser.)72       </p></dd><dt><span class="term"><code class="option">-t</code><br /></span><span class="term"><code class="option">--tablespaces-only</code></span></dt><dd><p>73        Dump only tablespaces, no databases or roles.74       </p></dd><dt><span class="term"><code class="option">-v</code><br /></span><span class="term"><code class="option">--verbose</code></span></dt><dd><p>75        Specifies verbose mode.  This will cause76        <span class="application">pg_dumpall</span> to output start/stop77        times to the dump file, and progress messages to standard error.78        Repeating the option causes additional debug-level messages79        to appear on standard error.80        The option is also passed down to <span class="application">pg_dump</span>.81       </p></dd><dt><span class="term"><code class="option">-V</code><br /></span><span class="term"><code class="option">--version</code></span></dt><dd><p>82       Print the <span class="application">pg_dumpall</span> version and exit.83       </p></dd><dt><span class="term"><code class="option">-x</code><br /></span><span class="term"><code class="option">--no-privileges</code><br /></span><span class="term"><code class="option">--no-acl</code></span></dt><dd><p>84        Prevent dumping of access privileges (grant/revoke commands).85       </p></dd><dt><span class="term"><code class="option">--binary-upgrade</code></span></dt><dd><p>86        This option is for use by in-place upgrade utilities.  Its use87        for other purposes is not recommended or supported.  The88        behavior of the option may change in future releases without89        notice.90       </p></dd><dt><span class="term"><code class="option">--column-inserts</code><br /></span><span class="term"><code class="option">--attribute-inserts</code></span></dt><dd><p>91        Dump data as <code class="command">INSERT</code> commands with explicit92        column names (<code class="literal">INSERT INTO93        <em class="replaceable"><code>table</code></em>94        (<em class="replaceable"><code>column</code></em>, ...) VALUES95        ...</code>).  This will make restoration very slow; it is mainly96        useful for making dumps that can be loaded into97        non-<span class="productname">PostgreSQL</span> databases.98       </p></dd><dt><span class="term"><code class="option">--disable-dollar-quoting</code></span></dt><dd><p>99        This option disables the use of dollar quoting for function bodies,100        and forces them to be quoted using SQL standard string syntax.101       </p></dd><dt><span class="term"><code class="option">--disable-triggers</code></span></dt><dd><p>102        This option is relevant only when creating a data-only dump.103        It instructs <span class="application">pg_dumpall</span> to include commands104        to temporarily disable triggers on the target tables while105        the data is restored.  Use this if you have referential106        integrity checks or other triggers on the tables that you107        do not want to invoke during data restore.108       </p><p>109        Presently, the commands emitted for <code class="option">--disable-triggers</code>110        must be done as superuser.  So, you should also specify111        a superuser name with <code class="option">-S</code>, or preferably be careful to112        start the resulting script as a superuser.113       </p></dd><dt><span class="term"><code class="option">--exclude-database=<em class="replaceable"><code>pattern</code></em></code></span></dt><dd><p>114        Do not dump databases whose name matches115        <em class="replaceable"><code>pattern</code></em>.116        Multiple patterns can be excluded by writing multiple117        <code class="option">--exclude-database</code> switches.  The118        <em class="replaceable"><code>pattern</code></em> parameter is119        interpreted as a pattern according to the same rules used by120        <span class="application">psql</span>'s <code class="literal">\d</code>121        commands (see <a class="xref" href="app-psql.html#APP-PSQL-PATTERNS" title="Patterns">Patterns</a>),122        so multiple databases can also be excluded by writing wildcard123        characters in the pattern.  When using wildcards, be careful to124        quote the pattern if needed to prevent shell wildcard expansion.125       </p></dd><dt><span class="term"><code class="option">--extra-float-digits=<em class="replaceable"><code>ndigits</code></em></code></span></dt><dd><p>126        Use the specified value of extra_float_digits when dumping127        floating-point data, instead of the maximum available precision.128        Routine dumps made for backup purposes should not use this option.129       </p></dd><dt><span class="term"><code class="option">--if-exists</code></span></dt><dd><p>130        Use <code class="literal">DROP ... IF EXISTS</code> commands to drop objects131        in <code class="option">--clean</code> mode.  This suppresses <span class="quote">“<span class="quote">does not132        exist</span>”</span> errors that might otherwise be reported.  This133        option is not valid unless <code class="option">--clean</code> is also134        specified.135       </p></dd><dt><span class="term"><code class="option">--inserts</code></span></dt><dd><p>136        Dump data as <code class="command">INSERT</code> commands (rather137        than <code class="command">COPY</code>).  This will make restoration very slow;138        it is mainly useful for making dumps that can be loaded into139        non-<span class="productname">PostgreSQL</span> databases.  Note that140        the restore might fail altogether if you have rearranged column order.141        The <code class="option">--column-inserts</code> option is safer, though even142        slower.143       </p></dd><dt><span class="term"><code class="option">--load-via-partition-root</code></span></dt><dd><p>144        When dumping data for a table partition, make145        the <code class="command">COPY</code> or <code class="command">INSERT</code> statements146        target the root of the partitioning hierarchy that contains it, rather147        than the partition itself.  This causes the appropriate partition to148        be re-determined for each row when the data is loaded.  This may be149        useful when restoring data on a server where rows do not always fall150        into the same partitions as they did on the original server.  That151        could happen, for example, if the partitioning column is of type text152        and the two systems have different definitions of the collation used153        to sort the partitioning column.154       </p></dd><dt><span class="term"><code class="option">--lock-wait-timeout=<em class="replaceable"><code>timeout</code></em></code></span></dt><dd><p>155        Do not wait forever to acquire shared table locks at the beginning of156        the dump. Instead, fail if unable to lock a table within the specified157        <em class="replaceable"><code>timeout</code></em>. The timeout may be158        specified in any of the formats accepted by <code class="command">SET159        statement_timeout</code>.160       </p></dd><dt><span class="term"><code class="option">--no-comments</code></span></dt><dd><p>161        Do not dump comments.162       </p></dd><dt><span class="term"><code class="option">--no-publications</code></span></dt><dd><p>163        Do not dump publications.164       </p></dd><dt><span class="term"><code class="option">--no-role-passwords</code></span></dt><dd><p>165        Do not dump passwords for roles.  When restored, roles will have a166        null password, and password authentication will always fail until the167        password is set.  Since password values aren't needed when this option168        is specified, the role information is read from the catalog169        view <code class="structname">pg_roles</code> instead170        of <code class="structname">pg_authid</code>.  Therefore, this option also171        helps if access to <code class="structname">pg_authid</code> is restricted by172        some security policy.173       </p></dd><dt><span class="term"><code class="option">--no-security-labels</code></span></dt><dd><p>174        Do not dump security labels.175       </p></dd><dt><span class="term"><code class="option">--no-subscriptions</code></span></dt><dd><p>176        Do not dump subscriptions.177       </p></dd><dt><span class="term"><code class="option">--no-sync</code></span></dt><dd><p>178        By default, <code class="command">pg_dumpall</code> will wait for all files179        to be written safely to disk.  This option causes180        <code class="command">pg_dumpall</code> to return without waiting, which is181        faster, but means that a subsequent operating system crash can leave182        the dump corrupt.  Generally, this option is useful for testing183        but should not be used when dumping data from production installation.184       </p></dd><dt><span class="term"><code class="option">--no-table-access-method</code></span></dt><dd><p>185        Do not output commands to select table access methods.186        With this option, all objects will be created with whichever187        table access method is the default during restore.188       </p></dd><dt><span class="term"><code class="option">--no-tablespaces</code></span></dt><dd><p>189        Do not output commands to create tablespaces nor select tablespaces190        for objects.191        With this option, all objects will be created in whichever192        tablespace is the default during restore.193       </p></dd><dt><span class="term"><code class="option">--no-toast-compression</code></span></dt><dd><p>194        Do not output commands to set <acronym class="acronym">TOAST</acronym> compression195        methods.196        With this option, all columns will be restored with the default197        compression setting.198       </p></dd><dt><span class="term"><code class="option">--no-unlogged-table-data</code></span></dt><dd><p>199        Do not dump the contents of unlogged tables.  This option has no200        effect on whether or not the table definitions (schema) are dumped;201        it only suppresses dumping the table data.202       </p></dd><dt><span class="term"><code class="option">--on-conflict-do-nothing</code></span></dt><dd><p>203        Add <code class="literal">ON CONFLICT DO NOTHING</code> to204        <code class="command">INSERT</code> commands.205        This option is not valid unless <code class="option">--inserts</code> or206        <code class="option">--column-inserts</code> is also specified.207       </p></dd><dt><span class="term"><code class="option">--quote-all-identifiers</code></span></dt><dd><p>208        Force quoting of all identifiers.  This option is recommended when209        dumping a database from a server whose <span class="productname">PostgreSQL</span>210        major version is different from <span class="application">pg_dumpall</span>'s, or when211        the output is intended to be loaded into a server of a different212        major version.  By default, <span class="application">pg_dumpall</span> quotes only213        identifiers that are reserved words in its own major version.214        This sometimes results in compatibility issues when dealing with215        servers of other versions that may have slightly different sets216        of reserved words.  Using <code class="option">--quote-all-identifiers</code> prevents217        such issues, at the price of a harder-to-read dump script.218       </p></dd><dt><span class="term"><code class="option">--rows-per-insert=<em class="replaceable"><code>nrows</code></em></code></span></dt><dd><p>219        Dump data as <code class="command">INSERT</code> commands (rather than220        <code class="command">COPY</code>).  Controls the maximum number of rows per221        <code class="command">INSERT</code> command. The value specified must be a222        number greater than zero.  Any error during restoring will cause only223        rows that are part of the problematic <code class="command">INSERT</code> to be224        lost, rather than the entire table contents.225       </p></dd><dt><span class="term"><code class="option">--use-set-session-authorization</code></span></dt><dd><p>226        Output SQL-standard <code class="command">SET SESSION AUTHORIZATION</code> commands227        instead of <code class="command">ALTER OWNER</code> commands to determine object228        ownership.  This makes the dump more standards compatible, but229        depending on the history of the objects in the dump, might not restore230        properly.231       </p></dd><dt><span class="term"><code class="option">-?</code><br /></span><span class="term"><code class="option">--help</code></span></dt><dd><p>232       Show help about <span class="application">pg_dumpall</span> command line233       arguments, and exit.234       </p></dd></dl></div><p>235   </p><p>236   The following command-line options control the database connection parameters.237 238   </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">-d <em class="replaceable"><code>connstr</code></em></code><br /></span><span class="term"><code class="option">--dbname=<em class="replaceable"><code>connstr</code></em></code></span></dt><dd><p>239        Specifies parameters used to connect to the server, as a <a class="link" href="libpq-connect.html#LIBPQ-CONNSTRING" title="34.1.1. Connection Strings">connection string</a>;  these240        will override any conflicting command line options.241       </p><p>242        The option is called <code class="literal">--dbname</code> for consistency with other243        client applications, but because <span class="application">pg_dumpall</span>244        needs to connect to many databases, the database name in the245        connection string will be ignored.  Use the <code class="literal">-l</code>246        option to specify the name of the database used for the initial247        connection, which will dump global objects and discover what other248        databases should be dumped.249       </p></dd><dt><span class="term"><code class="option">-h <em class="replaceable"><code>host</code></em></code><br /></span><span class="term"><code class="option">--host=<em class="replaceable"><code>host</code></em></code></span></dt><dd><p>250        Specifies the host name of the machine on which the database251        server is running.  If the value begins with a slash, it is252        used as the directory for the Unix domain socket.  The default253        is taken from the <code class="envar">PGHOST</code> environment variable,254        if set, else a Unix domain socket connection is attempted.255       </p></dd><dt><span class="term"><code class="option">-l <em class="replaceable"><code>dbname</code></em></code><br /></span><span class="term"><code class="option">--database=<em class="replaceable"><code>dbname</code></em></code></span></dt><dd><p>256         Specifies the name of the database to connect to for dumping global257         objects and discovering what other databases should be dumped. If258         not specified, the <code class="literal">postgres</code> database will be used,259         and if that does not exist, <code class="literal">template1</code> will be used.260       </p></dd><dt><span class="term"><code class="option">-p <em class="replaceable"><code>port</code></em></code><br /></span><span class="term"><code class="option">--port=<em class="replaceable"><code>port</code></em></code></span></dt><dd><p>261        Specifies the TCP port or local Unix domain socket file262        extension on which the server is listening for connections.263        Defaults to the <code class="envar">PGPORT</code> environment variable, if264        set, or a compiled-in default.265       </p></dd><dt><span class="term"><code class="option">-U <em class="replaceable"><code>username</code></em></code><br /></span><span class="term"><code class="option">--username=<em class="replaceable"><code>username</code></em></code></span></dt><dd><p>266        User name to connect as.267       </p></dd><dt><span class="term"><code class="option">-w</code><br /></span><span class="term"><code class="option">--no-password</code></span></dt><dd><p>268        Never issue a password prompt.  If the server requires269        password authentication and a password is not available by270        other means such as a <code class="filename">.pgpass</code> file, the271        connection attempt will fail.  This option can be useful in272        batch jobs and scripts where no user is present to enter a273        password.274       </p></dd><dt><span class="term"><code class="option">-W</code><br /></span><span class="term"><code class="option">--password</code></span></dt><dd><p>275        Force <span class="application">pg_dumpall</span> to prompt for a276        password before connecting to a database.277       </p><p>278        This option is never essential, since279        <span class="application">pg_dumpall</span> will automatically prompt280        for a password if the server demands password authentication.281        However, <span class="application">pg_dumpall</span> will waste a282        connection attempt finding out that the server wants a password.283        In some cases it is worth typing <code class="option">-W</code> to avoid the extra284        connection attempt.285       </p><p>286        Note that the password prompt will occur again for each database287        to be dumped.  Usually, it's better to set up a288        <code class="filename">~/.pgpass</code> file than to rely on manual password entry.289       </p></dd><dt><span class="term"><code class="option">--role=<em class="replaceable"><code>rolename</code></em></code></span></dt><dd><p>290        Specifies a role name to be used to create the dump.291        This option causes <span class="application">pg_dumpall</span> to issue a292        <code class="command">SET ROLE</code> <em class="replaceable"><code>rolename</code></em>293        command after connecting to the database. It is useful when the294        authenticated user (specified by <code class="option">-U</code>) lacks privileges295        needed by <span class="application">pg_dumpall</span>, but can switch to a role with296        the required rights.  Some installations have a policy against297        logging in directly as a superuser, and use of this option allows298        dumps to be made without violating the policy.299       </p></dd></dl></div><p>300  </p></div><div class="refsect1" id="id-1.9.4.14.7"><h2>Environment</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="envar">PGHOST</code><br /></span><span class="term"><code class="envar">PGOPTIONS</code><br /></span><span class="term"><code class="envar">PGPORT</code><br /></span><span class="term"><code class="envar">PGUSER</code></span></dt><dd><p>301      Default connection parameters302     </p></dd><dt><span class="term"><code class="envar">PG_COLOR</code></span></dt><dd><p>303      Specifies whether to use color in diagnostic messages. Possible values304      are <code class="literal">always</code>, <code class="literal">auto</code> and305      <code class="literal">never</code>.306     </p></dd></dl></div><p>307   This utility, like most other <span class="productname">PostgreSQL</span> utilities,308   also uses the environment variables supported by <span class="application">libpq</span>309   (see <a class="xref" href="libpq-envars.html" title="34.15. Environment Variables">Section 34.15</a>).310  </p></div><div class="refsect1" id="id-1.9.4.14.8"><h2>Notes</h2><p>311   Since <span class="application">pg_dumpall</span> calls312   <span class="application">pg_dump</span> internally, some diagnostic313   messages will refer to <span class="application">pg_dump</span>.314  </p><p>315   The <code class="option">--clean</code> option can be useful even when your316   intention is to restore the dump script into a fresh cluster.  Use of317   <code class="option">--clean</code> authorizes the script to drop and re-create the318   built-in <code class="literal">postgres</code> and <code class="literal">template1</code>319   databases, ensuring that those databases will retain the same properties320   (for instance, locale and encoding) that they had in the source cluster.321   Without the option, those databases will retain their existing322   database-level properties, as well as any pre-existing contents.323  </p><p>324   Once restored, it is wise to run <code class="command">ANALYZE</code> on each325   database so the optimizer has useful statistics. You326   can also run <code class="command">vacuumdb -a -z</code> to analyze all327   databases.328  </p><p>329   The dump script should not be expected to run completely without errors.330   In particular, because the script will issue <code class="command">CREATE ROLE</code>331   for every role existing in the source cluster, it is certain to get a332   <span class="quote">“<span class="quote">role already exists</span>”</span> error for the bootstrap superuser,333   unless the destination cluster was initialized with a different bootstrap334   superuser name.  This error is harmless and should be ignored.  Use of335   the <code class="option">--clean</code> option is likely to produce additional336   harmless error messages about non-existent objects, although you can337   minimize those by adding <code class="option">--if-exists</code>.338  </p><p>339   <span class="application">pg_dumpall</span> requires all needed340   tablespace directories to exist before the restore;  otherwise,341   database creation will fail for databases in non-default342   locations.343  </p></div><div class="refsect1" id="APP-PG-DUMPALL-EX"><h2>Examples</h2><p>344   To dump all databases:345 346</p><pre class="screen">347<code class="prompt">$</code> <strong class="userinput"><code>pg_dumpall &gt; db.out</code></strong>348</pre><p>349  </p><p>350   To restore database(s) from this file, you can use:351</p><pre class="screen">352<code class="prompt">$</code> <strong class="userinput"><code>psql -f db.out postgres</code></strong>353</pre><p>354   It is not important to which database you connect here since the355   script file created by <span class="application">pg_dumpall</span> will356   contain the appropriate commands to create and connect to the saved357   databases.  An exception is that if you specified <code class="option">--clean</code>,358   you must connect to the <code class="literal">postgres</code> database initially;359   the script will attempt to drop other databases immediately, and that360   will fail for the database you are connected to.361  </p></div><div class="refsect1" id="id-1.9.4.14.10"><h2>See Also</h2><p>362    Check <a class="xref" href="app-pgdump.html" title="pg_dump"><span class="refentrytitle"><span class="application">pg_dump</span></span></a> for details on possible363    error conditions.364  </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="app-pgdump.html" title="pg_dump">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-client.html" title="PostgreSQL Client Applications">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="app-pg-isready.html" title="pg_isready">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="application">pg_dump</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="40%" align="right" valign="top"> <span class="application">pg_isready</span></td></tr></table></div></body></html>
codekingpro/portable-devtools · Team Ai