Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
28e9e9a2
Commit
28e9e9a2
authored
Dec 19, 2000
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename --accounts-only to --globals-only, polish documentation.
parent
f824d4a3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
108 additions
and
268 deletions
+108
-268
doc/src/sgml/ref/pg_dumpall.sgml
doc/src/sgml/ref/pg_dumpall.sgml
+97
-257
src/bin/pg_dump/pg_dumpall.sh
src/bin/pg_dump/pg_dumpall.sh
+11
-11
No files found.
doc/src/sgml/ref/pg_dumpall.sgml
View file @
28e9e9a2
<!--
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.1
6 2000/11/30 23:20:50 tgl
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.1
7 2000/12/19 22:12:46 petere
Exp $
Postgres documentation
Postgres documentation
-->
-->
<refentry id="APP-PGDUMPALL">
<refentry id="APP-PG-DUMPALL">
<docinfo>
<date>2000-12-19</date>
</docinfo>
<refmeta>
<refmeta>
<refentrytitle id="APP-PGDUMPALL-TITLE">
<refentrytitle id="APP-PG-DUMPALL-TITLE"><application>pg_dumpall</application></refentrytitle>
<application>pg_dumpall</application>
<manvolnum>1</manvolnum>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
<refmiscinfo>Application</refmiscinfo>
</refmeta>
</refmeta>
<refnamediv>
<refnamediv>
<refname>
<refname>pg_dumpall</refname>
<application>pg_dumpall</application>
<refpurpose>Extract all databases into a script file</refpurpose>
</refname>
<refpurpose>
Extract all <productname>Postgres</productname> databases into a script file
</refpurpose>
</refnamediv>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ] [ -a ] [ -d ] [ -D ] [ -O ] [ -s ] [ -u ] [ -v ] [ -x ] [ --accounts-only ]
</synopsis>
<refsect2 id="R2-APP-PG-DUMPALL-1">
<refsect2info>
<date>1998-10-04</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<application>pg_dumpall</application> accepts the following command line arguments:
<variablelist>
<varlistentry>
<term>-a</term>
<listitem>
<para>
Dump out only the data, no schema (definitions).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-d</term>
<listitem>
<para>
Dump data as proper insert strings.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-D</term>
<listitem>
<para>
Dump data as inserts with attribute names
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-n</term>
<listitem>
<para>
Suppress double quotes around identifiers unless absolutely necessary.
This may cause trouble loading this dumped data if there are reserved words
used for identifiers.
</para>
</listitem>
</varlistentry>
<varlistentry>
<refsynopsisdiv>
<term>-o</term>
<cmdsynopsis>
<listitem>
<command>pg_dumpall</command>
<para>
<group><arg>-c</arg><arg>--clean</arg></group>
Dump object identifiers (<acronym>OID</acronym>s) for every table.
<arg>-h <replaceable>host</replaceable></arg>
</para>
<arg>-p <replaceable>port</replaceable></arg>
</listitem>
<arg>--globals-only</arg>
</varlistentry>
</cmdsynopsis>
</refsynopsisdiv>
<varlistentry>
<refsect1 id="app-pg-dumpall-description">
<term>-s</term>
<title>Description</title>
<listitem>
<para>
Dump out only the schema (definitions), no data.
</para>
</listitem>
</varlistentry>
<varlistentry>
<para>
<term>-u</term>
<application>pg_dumpall</application> is a utility for writing out
<listitem>
(<quote>dumping</quote>) all Postgres databases of a cluster into
<para>
one script file. The script file contains SQL commands that can be
Use password authentication. Prompts for username and password.
used as input to <xref linkend="app-psql" endterm="app-psql-title">
</para>
to restore the databases. It does this by calling <xref
</listitem>
linkend="app-pgdump" endterm="app-pgdump-title"> for each database
</varlistentry>
in a cluster. <application>pg_dumpall</application> also dumps
global objects that are common to all databases.
(<application>pg_dump</application> does not save these objects.)
This currently includes the information about database users and
groups.
</para>
<varlistentry>
<para>
<term>-v</term>
Thus, <application>pg_dumpall</application> is an integrated
<listitem>
solution for backing up your databases.
<para>
</para>
Specifies verbose mode.
</para>
</listitem>
</varlistentry>
<varlistentry>
<para>
<term>-x</term>
Since <application>pg_dumpall</application> reads tables from all
<listitem>
databases you will most likely have to connect as a database
<para>
superuser in order to produce a complete dump. Also you will need
Prevent dumping ACLs (grant/revoke commands) and table ownership information.
superuser priviledges to execute the saves script in order to be
</para>
allowed to add users and groups, and to create databases.
</listitem>
</para>
</varlistentry>
<varlistentry>
<para>
<term>--accounts-only</term>
The SQL script will be written to the standard ouput. Shell
<listitem>
operators should be used to redirect it into a file.
<para>
</para>
Only dump user and group information, nothing else.
</para>
</listitem>
</varlistentry>
</variablelist
>
<refsect2
>
<
/para
>
<
title>Options</title
>
<para>
<para>
<application>pg_dumpall</application> a
lso accepts
<application>pg_dumpall</application> a
ccepts the following
the following command line arguments for connection parameter
s:
command line argument
s:
<variablelist>
<variablelist>
<varlistentry>
<varlistentry>
<term>-h <replaceable
class="parameter"
>host</replaceable></term>
<term>-h <replaceable>host</replaceable></term>
<listitem>
<listitem>
<para>
<para>
Specifies the hostname of the machine on which the
Specifies the hostname of the machine on which the database
<application>postmaster</application>
server is running. If host begins with a slash, it is used as
is running. If host begins with a slash, it is used
the directory for the Unix domain socket. The default is
as the directory for the unix domain socket.
taken from the <envar>PGHOST</envar> environment variable, if
set, else a Unix domain socket connection is attempted.
</para>
</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
<varlistentry>
<varlistentry>
<term>-p <replaceable
class="parameter"
>port</replaceable></term>
<term>-p <replaceable>port</replaceable></term>
<listitem>
<listitem>
<para>
<para>
Specifies the Internet TCP/IP port or local Unix domain socket file
The port number on which the server is listening. Defaults to
extension on which the <application>postmaster</application>
the <envar>PGPORT</envar> environment variable, if set, or a
is listening for connections. The port number defaults to 5432,
compiled-in default.
or the value of the <envar>PGPORT</envar>
environment variable (if set).
</para>
</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
<varlistentry>
<varlistentry>
<term>-
u
</term>
<term>-
-globals-only
</term>
<listitem>
<listitem>
<para>
<para>
Use password authentication.
Only dump global objects (users and groups), no databases.
Prompts for
<replaceable class="parameter">username</replaceable>
and <replaceable class="parameter">password</replaceable>.
</para>
</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
</variablelist>
</variablelist>
</para>
</para>
</refsect2>
<refsect2 id="R2-APP-PG-DUMPALL-2">
<refsect2info>
<date>1998-10-04</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<para>
<application>pg_dumpall</application> will create a file or
Any other command line parameters are passed to the underlying
write to <filename>stdout</filename>.
<xref endterm="app-pgdump-title" linkend="app-pgdump-title">
calls. This is useful to control some aspects of the output
<variablelist>
format, but some options such as <option>-f</option>,
<varlistentry>
<option>-t</option>, and <replaceable
<term><computeroutput>
class="parameter">dbname</replaceable> should be avoided.
Connection to database 'template1' failed.
connectDBStart() -- connect() failed: No such file or directory
Is the postmaster running locally
and accepting connections on Unix socket '/tmp/.s.PGSQL.5432'?
</computeroutput></term>
<listitem>
<para>
<application>pg_dumpall</application> could not attach to the
<application>postmaster</application>
process on the specified host and port. If you see this message,
ensure that the <application>postmaster</application>
is running on the proper host and that you have specified the proper
port. If your site uses an authentication system, ensure that you
have obtained the required authentication credentials.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
Connection to database '<replaceable class="parameter">dbname</replaceable>' failed.
FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow'
</computeroutput></term>
<listitem>
<para>
You do not have a valid entry in the relation <literal>pg_shadow</literal>
and and will not be allowed to access <productname>Postgres</productname>.
Contact your <productname>Postgres</productname> administrator.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
dumpSequence(<replaceable class="parameter">table</replaceable>): SELECT failed
</computeroutput></term>
<listitem>
<para>
You do not have permission to read the database.
Contact your <productname>Postgres</productname> site administrator.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</para>
<note>
<para>
<application>pg_dumpall</application> internally executes
<command>SELECT</command> statements. If you have problems running
<application>pg_dumpall</application>,
make sure you are able to select information from the database using, for
example, <application>psql</application>.
</para>
</note>
</refsect2>
</refsect2>
</refs
ynopsisdiv
>
</refs
ect1
>
<refsect1 id="R1-APP-PG-DUMPALL-1">
<refsect1 id="app-pg-dumpall-usage">
<refsect1info>
<title>Usage</title>
<date>1998-10-04</date>
</refsect1info>
<title>
Description
</title>
<para>
<application>pg_dumpall</application>
is a utility for dumping out all Postgres databases into one file.
It also dumps the pg_shadow table, which is global to all databases.
<application>pg_dumpall</application> includes in this file the proper commands
to automatically create each dumped database before loading.
</para>
<para>
<para>
<application>pg_dumpall</application> takes all <application>pg_dump</application>
To dump all databases:
options, but <option>-f</option>, <option>-t</option> and
<replaceable class="parameter">dbname</replaceable>
<screen>
should be omitted.
<prompt>$</prompt> <userinput>pg_dumpall > db.out</userinput>
</screen>
</para>
</para>
<para>
<para>
Refer to
To reload this database use, for example:
<xref endterm="app-pgdump-title" linkend="app-pgdump-title">
<screen>
for more information on this capability.
<prompt>$</prompt> <userinput>psql -f db.out template1</userinput>
</screen>
(It is not important to which database you connect here since the
script file created by <application>pg_dumpall</application> will
contain the appropriate commands to create and connect to the saved
databases.
</para>
</para>
</refsect1>
</refsect1>
<refsect1 id="R1-APP-PG-DUMPALL-2">
<refsect1>
<refsect1info>
<title>See Also</title>
<date>1998-10-04</date>
</refsect1info>
<title>
Usage
</title>
<para>
To dump all databases:
<programlisting>
$ pg_dumpall > db.out
</programlisting>
<tip>
<para>
You can use most <application>pg_dump</application> options
for <application>pg_dumpall</application>.
</para>
</tip>
</para>
<para>
<para>
To reload this database:
<xref linkend="app-pgdump" endterm="app-pgdump-title">, <xref
linkend="app-psql" endterm="app-psql-title">. Check there for
<programlisting>
details on possible error conditions.
$ psql -e template1 < db.out
</programlisting>
</para>
</para>
<tip>
</refsect1>
<para>
You can use most <application>psql</application> options
when reloading.
</para>
</tip>
</refsect1>
</refentry>
</refentry>
<!-- Keep this comment at the end of the file
<!-- Keep this comment at the end of the file
...
...
src/bin/pg_dump/pg_dumpall.sh
View file @
28e9e9a2
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
# and "pg_group" tables, which belong to the whole installation rather
# and "pg_group" tables, which belong to the whole installation rather
# than any one individual database.
# than any one individual database.
#
#
# $Header: /cvsroot/pgsql/src/bin/pg_dump/Attic/pg_dumpall.sh,v 1.
8 2000/11/14 18:37:46 tgl
Exp $
# $Header: /cvsroot/pgsql/src/bin/pg_dump/Attic/pg_dumpall.sh,v 1.
9 2000/12/19 22:12:47 petere
Exp $
CMDNAME
=
`
basename
$0
`
CMDNAME
=
`
basename
$0
`
...
@@ -72,7 +72,7 @@ fi
...
@@ -72,7 +72,7 @@ fi
usage
=
usage
=
cleanschema
=
cleanschema
=
account
s_only
=
global
s_only
=
#
#
# Scan options. We're interested in the -h (host), -p (port), and -c (clean) options.
# Scan options. We're interested in the -h (host), -p (port), and -c (clean) options.
...
@@ -110,8 +110,8 @@ while [ $# -gt 0 ] ; do
...
@@ -110,8 +110,8 @@ while [ $# -gt 0 ] ; do
cleanschema
=
yes
cleanschema
=
yes
pgdumpextraopts
=
"
$pgdumpextraopts
-c"
pgdumpextraopts
=
"
$pgdumpextraopts
-c"
;;
;;
--
account
s-only
)
--
global
s-only
)
account
s_only
=
yes
global
s_only
=
yes
;;
;;
*
)
*
)
pgdumpextraopts
=
"
$pgdumpextraopts
$1
"
pgdumpextraopts
=
"
$pgdumpextraopts
$1
"
...
@@ -122,16 +122,16 @@ done
...
@@ -122,16 +122,16 @@ done
if
[
"
$usage
"
]
;
then
if
[
"
$usage
"
]
;
then
echo
"
$CMDNAME
dumps a PostgreSQL database cluster
."
echo
"
$CMDNAME
extracts a PostgreSQL database cluster into an SQL script file
."
echo
echo
echo
"Usage:"
echo
"Usage:"
echo
"
$CMDNAME
[ -c ] [ -h
host ] [ -p port ] [ --account
s-only ]"
echo
"
$CMDNAME
[ -c ] [ -h
HOSTNAME ] [ -p PORT ] [ --global
s-only ]"
echo
echo
echo
"Options:"
echo
"Options:"
echo
" -c, --clean
c
lean (drop) schema prior to create"
echo
" -c, --clean
C
lean (drop) schema prior to create"
echo
" -h, --host
<hostname> s
erver host name"
echo
" -h, --host
=HOSTNAME S
erver host name"
echo
" -p, --port
<port> s
erver port number"
echo
" -p, --port
=PORT S
erver port number"
echo
" --
accounts-only only dump users and group
s"
echo
" --
globals-only Only dump global objects, no database
s"
echo
"Any extra options will be passed to pg_dump."
echo
"Any extra options will be passed to pg_dump."
echo
echo
echo
"Report bugs to <pgsql-bugs@postgresql.org>."
echo
"Report bugs to <pgsql-bugs@postgresql.org>."
...
@@ -184,7 +184,7 @@ while read GRONAME GROSYSID GROLIST ; do
...
@@ -184,7 +184,7 @@ while read GRONAME GROSYSID GROLIST ; do
done
done
test
"
$
account
s_only
"
=
yes
&&
exit
0
test
"
$
global
s_only
"
=
yes
&&
exit
0
# For each database, run pg_dump to dump the contents of that database.
# For each database, run pg_dump to dump the contents of that database.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment