Home Explore Blog CI



postgresql

3rd chunk of `doc/src/sgml/ref/pg_restore.sgml`
7892e60da9f30ac8280f0bda52ee857b151aa6e049d5f6e50000000100000fa5
 <term><option>-d <replaceable class="parameter">dbname</replaceable></option></term>
      <term><option>--dbname=<replaceable class="parameter">dbname</replaceable></option></term>
      <listitem>
       <para>
        Connect to database <replaceable
        class="parameter">dbname</replaceable> and restore directly
        into the database.  The <replaceable>dbname</replaceable> can
        be a <link linkend="libpq-connstring">connection string</link>.
        If so, connection string parameters will override any conflicting
        command line options.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-e</option></term>
      <term><option>--exit-on-error</option></term>
      <listitem>
       <para>
        Exit if an error is encountered while sending SQL commands to
        the database. The default is to continue and to display a count of
        errors at the end of the restoration.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-f <replaceable>filename</replaceable></option></term>
      <term><option>--file=<replaceable>filename</replaceable></option></term>
      <listitem>
       <para>
        Specify output file for generated script, or for the listing
        when used with <option>-l</option>. Use <literal>-</literal>
        for <systemitem>stdout</systemitem>.
       </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 format of the archive.  It is not necessary to specify
        the format, since <application>pg_restore</application> will
        determine the format automatically. If specified, it can be
        one of the following:

       <variablelist>
        <varlistentry>
         <term><literal>c</literal></term>
         <term><literal>custom</literal></term>
         <listitem>
          <para>
           The archive is in the custom format of
           <application>pg_dump</application>.
          </para>
         </listitem>
        </varlistentry>

        <varlistentry>
         <term><literal>d</literal></term>
         <term><literal>directory</literal></term>
         <listitem>
          <para>
           The archive is a directory archive.
          </para>
         </listitem>
        </varlistentry>

        <varlistentry>
         <term><literal>t</literal></term>
         <term><literal>tar</literal></term>
         <listitem>
          <para>
           The archive is a <command>tar</command> archive.
          </para>
         </listitem>
        </varlistentry>
       </variablelist></para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-g</option></term>
      <term><option>--globals-only</option></term>
      <listitem>
       <para>
        Restore only global objects (roles and tablespaces), no databases.
       </para>
       <para>
        This option is only relevant when restoring from an archive made using <application>pg_dumpall</application>.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-I <replaceable class="parameter">index</replaceable></option></term>
      <term><option>--index=<replaceable class="parameter">index</replaceable></option></term>
      <listitem>
       <para>
        Restore definition of named index only.  Multiple indexes
        may be specified with multiple <option>-I</option> switches.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-j <replaceable class="parameter">number-of-jobs</replaceable></option></term>
      <term><option>--jobs=<replaceable class="parameter">number-of-jobs</replaceable></option></term>
      <listitem>
       <para>
        Run the most time-consuming

Title: pg_restore Options: Connecting to Database, Error Handling, Output File, Archive Format, and Global Objects
Summary
This section details more command-line options for pg_restore, including connecting to a specified database, exiting on errors, specifying an output file for the generated script, selecting the archive format (custom, directory, or tar), and restoring only global objects like roles and tablespaces.