Home Explore Blog CI



postgresql

2nd chunk of `doc/src/sgml/ref/pg_dumpall.sgml`
72aaaeeee33d2de6c35565a5742b44afa6ec3ac07084550b0000000100000fa0
 or statistics.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-c</option></term>
      <term><option>--clean</option></term>
      <listitem>
       <para>
        Emit SQL commands to <command>DROP</command> all the dumped
        databases, roles, and tablespaces before recreating them.
        This option is useful when the restore is to overwrite an existing
        cluster.  If any of the objects do not exist in the destination
        cluster, ignorable error messages will be reported during
        restore, unless <option>--if-exists</option> is also specified.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-E <replaceable class="parameter">encoding</replaceable></option></term>
      <term><option>--encoding=<replaceable class="parameter">encoding</replaceable></option></term>
      <listitem>
       <para>
        Create the dump in the specified character set encoding. By default,
        the dump is created in the database encoding.  (Another way to get the
        same result is to set the <envar>PGCLIENTENCODING</envar> environment
        variable to the desired dump encoding.)
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-f <replaceable class="parameter">filename</replaceable></option></term>
      <term><option>--file=<replaceable class="parameter">filename</replaceable></option></term>
      <listitem>
       <para>
        Send output to the specified file.  If this is omitted, the
        standard output is used.
        Note: This option can only be omitted when <option>--format</option> is plain
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-F <replaceable class="parameter">format</replaceable></option></term>
      <term><option>--format=<replaceable class="parameter">format</replaceable></option></term>
      <listitem>
       <para>
        Specify the format of dump files.  In plain format, all the dump data is
        sent in a single text stream. This is the default.

        In all other modes, <application>pg_dumpall</application> first creates two files:
        <filename>global.dat</filename> and <filename>map.dat</filename>, in the directory
        specified by <option>--file</option>.
        The first file contains global data, such as roles and tablespaces. The second
        contains a mapping between database oids and names. These files are used by
        <application>pg_restore</application>. Data for individual databases is placed in
        <filename>databases</filename> subdirectory, named using the database's <type>oid</type>.

       <variablelist>
        <varlistentry>
         <term><literal>d</literal></term>
         <term><literal>directory</literal></term>
         <listitem>
          <para>
           Output directory-format archives for each database,
           suitable for input into pg_restore. The directory
           will have database <type>oid</type> as its name.
          </para>
         </listitem>
        </varlistentry>

        <varlistentry>
         <term><literal>p</literal></term>
         <term><literal>plain</literal></term>
         <listitem>
          <para>
           Output a plain-text SQL script file (the default).
          </para>
         </listitem>
        </varlistentry>

        <varlistentry>
         <term><literal>c</literal></term>
         <term><literal>custom</literal></term>
         <listitem>
          <para>
           Output a custom-format archive for each database,
           suitable for input into pg_restore. The archive
           will be named <filename>dboid.dmp</filename> where <type>dboid</type> is the
           <type>oid</type> of the database.
          </para>
         </listitem>
        </varlistentry>

         <varlistentry>
         <term><literal>t</literal></term>
         <term><literal>tar</literal></term>
        

Title: pg_dumpall Options: Encoding, Output File, and Format
Summary
This section details the command-line options for pg_dumpall. It includes options for setting the character encoding of the dump (-E/--encoding), specifying the output file (-f/--file), and choosing the format of the dump files (-F/--format). The formats include plain text (default), directory, custom, and tar. For non-plain formats, pg_dumpall creates global.dat and map.dat files, and places individual database data in subdirectories or files named after the database's OID.