Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > c87b2b497674629a1400410f06a9ef63 > files > 16

postgresql-docs-7.3.2-5mdk.ppc.rpm

<HTML
><HEAD
><TITLE
>pg_dumpall</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.73
"><LINK
REV="MADE"
HREF="mailto:pgsql-docs@postgresql.org"><LINK
REL="HOME"
TITLE="PostgreSQL 7.3.2 Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="PostgreSQL Client Applications"
HREF="reference-client.html"><LINK
REL="PREVIOUS"
TITLE="pg_dump"
HREF="app-pgdump.html"><LINK
REL="NEXT"
TITLE="pg_restore"
HREF="app-pgrestore.html"><LINK
REL="STYLESHEET"
TYPE="text/css"
HREF="stylesheet.css"><META
NAME="creation"
CONTENT="2003-02-03T20:17:34"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PostgreSQL 7.3.2 Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="app-pgdump.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="app-pgrestore.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="APP-PG-DUMPALL"
><SPAN
CLASS="APPLICATION"
>pg_dumpall</SPAN
></A
></H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN48313"
></A
><H2
>Name</H2
>pg_dumpall&nbsp;--&nbsp;extract a <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> database cluster into a script file</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN48317"
></A
><H2
>Synopsis</H2
><P
><TT
CLASS="COMMAND"
>pg_dumpall</TT
> [<TT
CLASS="REPLACEABLE"
><I
>options</I
></TT
>...]</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="APP-PG-DUMPALL-DESCRIPTION"
></A
><H2
>Description</H2
><P
>   <SPAN
CLASS="APPLICATION"
>pg_dumpall</SPAN
> is a utility for writing out
   (<SPAN
CLASS="QUOTE"
>"dumping"</SPAN
>) all PostgreSQL databases of a cluster into
   one script file.  The script file contains SQL commands that can be
   used as input to <A
HREF="app-psql.html"
><SPAN
CLASS="APPLICATION"
>psql</SPAN
></A
>
   to restore the databases.  It does this by calling <A
HREF="app-pgdump.html"
>pg_dump</A
> for each database
   in a cluster.  <SPAN
CLASS="APPLICATION"
>pg_dumpall</SPAN
> also dumps
   global objects that are common to all databases.
   (<SPAN
CLASS="APPLICATION"
>pg_dump</SPAN
> does not save these objects.)
   This currently includes the information about database users and
   groups.
  </P
><P
>   Thus, <SPAN
CLASS="APPLICATION"
>pg_dumpall</SPAN
> is an integrated
   solution for backing up your databases.  But note a limitation:
   it cannot dump <SPAN
CLASS="QUOTE"
>"large objects"</SPAN
>, since
   <SPAN
CLASS="APPLICATION"
>pg_dump</SPAN
> cannot dump such objects into
   text files.  If you have databases containing large objects,
   they should be dumped using one of <SPAN
CLASS="APPLICATION"
>pg_dump</SPAN
>'s
   non-text output modes.
  </P
><P
>   Since <SPAN
CLASS="APPLICATION"
>pg_dumpall</SPAN
> reads tables from all
   databases you will most likely have to connect as a database
   superuser in order to produce a complete dump.  Also you will need
   superuser privileges to execute the saved script in order to be
   allowed to add users and groups, and to create databases.
  </P
><P
>   The SQL script will be written to the standard output.  Shell
   operators should be used to redirect it into a file.
  </P
><P
>  <SPAN
CLASS="APPLICATION"
>pg_dumpall</SPAN
> might need to connect several
  times to the <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> server, asking for
  a password each time. It is convenient to have a
  <TT
CLASS="FILENAME"
>$HOME/.pgpass</TT
> file in such cases.
  </P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN48343"
></A
><H2
>Options</H2
><P
>    The following command-line options are used to control the output format.

    <P
></P
></P><DIV
CLASS="VARIABLELIST"
><DL
><DT
><TT
CLASS="OPTION"
>-c</TT
><BR><TT
CLASS="OPTION"
>--clean</TT
></DT
><DD
><P
>	Include SQL commands to clean (drop) the databases before
	recreating them.
       </P
></DD
><DT
><TT
CLASS="OPTION"
>-d</TT
><BR><TT
CLASS="OPTION"
>--inserts</TT
></DT
><DD
><P
>	Dump data as <TT
CLASS="COMMAND"
>INSERT</TT
> commands (rather
	than <TT
CLASS="COMMAND"
>COPY</TT
>). This will make restoration very
	slow, but it makes the output more portable to other RDBMS
	packages.
       </P
></DD
><DT
><TT
CLASS="OPTION"
>-D</TT
><BR><TT
CLASS="OPTION"
>--column-inserts</TT
><BR><TT
CLASS="OPTION"
>--attribute-inserts</TT
></DT
><DD
><P
>	Dump data as <TT
CLASS="COMMAND"
>INSERT</TT
> commands with explicit
	column names (<TT
CLASS="LITERAL"
>INSERT INTO
	<TT
CLASS="REPLACEABLE"
><I
>table</I
></TT
>
	(<TT
CLASS="REPLACEABLE"
><I
>column</I
></TT
>, ...) VALUES
	...</TT
>).  This will make restoration very slow,
	but it is necessary if you desire to rearrange column ordering.
       </P
></DD
><DT
><TT
CLASS="OPTION"
>-g</TT
><BR><TT
CLASS="OPTION"
>--globals-only</TT
></DT
><DD
><P
>	Dump only global objects (users and groups), no databases.
       </P
></DD
><DT
><TT
CLASS="OPTION"
>-i</TT
><BR><TT
CLASS="OPTION"
>--ignore-version</TT
></DT
><DD
><P
>        Ignore version mismatch between
        <SPAN
CLASS="APPLICATION"
>pg_dumpall</SPAN
> and the database server.
       </P
><P
>        <SPAN
CLASS="APPLICATION"
>pg_dumpall</SPAN
> can handle databases
        from previous releases of PostgreSQL, but very old versions
        are not supported anymore (currently prior to 7.0).  Use this
        option if you need to override the version check (and if
        <SPAN
CLASS="APPLICATION"
>pg_dumpall</SPAN
> then fails, don't say
        you weren't warned).
       </P
></DD
><DT
><TT
CLASS="OPTION"
>-o</TT
><BR><TT
CLASS="OPTION"
>--oids</TT
></DT
><DD
><P
>	Dump object identifiers (<SPAN
CLASS="ACRONYM"
>OID</SPAN
>s) for every
	table.  Use this option if your application references the OID
	columns in some way (e.g., in a foreign key constraint).
	Otherwise, this option should not be used.
       </P
></DD
><DT
><TT
CLASS="OPTION"
>-v</TT
><BR><TT
CLASS="OPTION"
>--verbose</TT
></DT
><DD
><P
>	Specifies verbose mode.  This will cause
	<SPAN
CLASS="APPLICATION"
>pg_dumpall</SPAN
> to print progress
	messages to standard error.
       </P
></DD
></DL
></DIV
><P>
   </P
><P
>   The following command-line options control the database connection parameters.

   <P
></P
></P><DIV
CLASS="VARIABLELIST"
><DL
><DT
>-h <TT
CLASS="REPLACEABLE"
><I
>host</I
></TT
></DT
><DD
><P
>	Specifies the host name of the machine on which the database
	server is running.  If host begins with a slash, it is used as
	the directory for the Unix domain socket.  The default is
	taken from the <TT
CLASS="ENVAR"
>PGHOST</TT
> environment variable, if
	set, else a Unix domain socket connection is attempted.
       </P
></DD
><DT
>-p <TT
CLASS="REPLACEABLE"
><I
>port</I
></TT
></DT
><DD
><P
>        The port number on which the server is listening.  Defaults to
        the <TT
CLASS="ENVAR"
>PGPORT</TT
> environment variable, if set, or a
        compiled-in default.
       </P
></DD
><DT
>-U <TT
CLASS="REPLACEABLE"
><I
>username</I
></TT
></DT
><DD
><P
>        Connect as the given user.
       </P
></DD
><DT
>-W</DT
><DD
><P
>        Force a password prompt.  This should happen automatically if
        the server requires password authentication.
       </P
></DD
></DL
></DIV
><P>
  </P
><P
>   Long options are only available on some platforms.
  </P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN48434"
></A
><H2
>Environment</H2
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
><TT
CLASS="ENVAR"
>PGHOST</TT
><BR><TT
CLASS="ENVAR"
>PGPORT</TT
><BR><TT
CLASS="ENVAR"
>PGUSER</TT
></DT
><DD
><P
>      Default connection parameters.
     </P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN48446"
></A
><H2
>Notes</H2
><P
>   Since <SPAN
CLASS="APPLICATION"
>pg_dumpall</SPAN
> calls
   <SPAN
CLASS="APPLICATION"
>pg_dump</SPAN
> internally, some diagnostic
   messages will refer to <SPAN
CLASS="APPLICATION"
>pg_dump</SPAN
>.
  </P
><P
>   <SPAN
CLASS="APPLICATION"
>pg_dumpall</SPAN
> will need to connect several
   times to the <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> server.  If password
   authentication is configured, it will ask for a password each time. In
   that case it would be convenient to set up a password file.
  </P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="APP-PG-DUMPALL-EX"
></A
><H2
>Examples</H2
><P
>   To dump all databases:

</P><PRE
CLASS="SCREEN"
><TT
CLASS="PROMPT"
>$</TT
> <TT
CLASS="USERINPUT"
><B
>pg_dumpall &gt; db.out</B
></TT
></PRE
><P>
  </P
><P
>   To reload this database use, for example:
</P><PRE
CLASS="SCREEN"
><TT
CLASS="PROMPT"
>$</TT
> <TT
CLASS="USERINPUT"
><B
>psql -f db.out template1</B
></TT
></PRE
><P>
   (It is not important to which database you connect here since the
   script file created by <SPAN
CLASS="APPLICATION"
>pg_dumpall</SPAN
> will
   contain the appropriate commands to create and connect to the saved
   databases.)
  </P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN48467"
></A
><H2
>See Also</H2
><P
>    <A
HREF="app-pgdump.html"
>pg_dump</A
>, <A
HREF="app-psql.html"
><SPAN
CLASS="APPLICATION"
>psql</SPAN
></A
>.  Check
    there for details on possible error conditions.
  </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="app-pgdump.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="app-pgrestore.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>pg_dump</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="reference-client.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>pg_restore</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>