File: postgresql-dump.8

package info (click to toggle)
postgresql 7.4.7-6sarge6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 11,168 kB
  • ctags: 27
  • sloc: sh: 1,903; makefile: 337; ansic: 204; perl: 69; sed: 6; tcl: 1
file content (128 lines) | stat: -rw-r--r-- 4,728 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
.TH POSTGRESQL-DUMP 8 
.SH NAME
postgresql-dump - a utility to dump and destroy a PostgreSQL database when
the database format becomes incompatible with a previous version.
.SH SYNOPSIS
.B /usr/lib/postgresql/bin/postgresql-dump [-b blocksize] [-c] [-d] [-e encoding] [-f] [-i] [-l] [-p directory] -t target_file [-v] [-x|-X]
.SH "DESCRIPTION"
.B postgreql-dump
is used to dump and reload the whole PostgreSQL database when the database
format has changed between releases and become incompatible. It tests for
this situation by reading the version file in the top-level directory of
the PostgreSQL database.
.PP
The trace of the program output is sent to standard output or standard error.
.PP
If there is an incompatibility between the database version of the current
PostgreSQL programs and that of the database itself, this program must be
used to dump the database to an ASCII file. (This may be a tape device.)
.PP
If the -d option is used, the entire contents of the database directory
are then deleted.  They may be preserved in another location, with the -p
option, should you have both the desire and the spare disk capacity.
.PP
.B Postgresql-dump
may only be run by the user 
.B postgres
(the postgresql superuser).
.SH "OPTIONS"
.TP
.I "-b blocksize "
Specify the blocksize for writing the dump to 
.I target.
This is only useful for output to a tape drive; it makes the script use
dd to write to the target, instead of redirecting standard output.
.TP
.I "-c"
After the dump has been written, copy it to screen through the
filter named in PAGER (or
.B more,
by default) and ask the user to give confirmation before deleting the
database files.
.TP
.I "-d"
Destroy the database files after dumping the database.  This option
must be used when a new, incompatible release of PostgreSQL is loaded.
.TP
.I "-e encoding"
Force the default encoding to be 
.I encoding
instead of its current value.  This will not affect the encoding of existing
databases, but will be used whenever a new database is created without a
specific encoding's being specified.
.TP
.I "-f"
Fix rules from earlier versions to the 6.5 (and later) standard. This
filters the dump file through "sed -e '/^CREATE RULE /s/current\./old./g'".
The keyword `current' in CREATE RULE, referring to the table being updated
was changed from `current' to `old' in version 6.5.  If this sed filter
is wrong for your data but your data needs conversion, you should dump the
data, edit it and then reload it rather than using this option.
.TP
.I "-n"
Fix rules from earlier versions to the 7.4 (and later) standard. This
filters the dump file through sed -e "s/DEFAULT 'now'/DEFAULT now()/ig".
From version 7.4 on DEFAULT 'now' always enters the date of the table creation
instead of the date of the row insertion. If this sed filter
is wrong for your data but your data needs conversion, you should dump the
data, edit it and then reload it rather than using this option.
.TP
.I "-F"
Force an upgrade, even though the database version number is apparently
up to date.  This may be needed between beta releases that require an
initdb even though the version number does not change.
.TP
.I "-i"
Create a new database with
.B initdb.
This requires the option 
.B -d.
.TP
.I "-l"
Load the dump into a new database.  This option requires the 
.B -i
option.
.TP
.I "-p directory"
This option can only be used with 
.BR -d .
Instead of destroying the database files, the program moves them under
.IR directory ,
creating it, if necessary.
.I Directory 
must not be the same directory as, or underneath the directory named in
the environment variable, PGDATA.
.TP
.I "-t target "
This option is always required. 
.I Target
is the file or tape to which the ASCII dump should be written.  It is
incorrect to name any physical device other than a tape.  It is not possible (or,
at least, meaningful) to use a tape with the -c option and also to start
the dump in the middle of the tape.
.I Target 
must not be the same directory as, or underneath the directory named in
the environment variable,
.B PGDATA.
.TP
.I "-v"
Print more information about what the script is doing.
.TP
.I "-X"
Prevents dumping the old database; use of this option overrides -x and -c.
It is intended for use by the Debian post-installation script.
.TP
.I "-x"
Prevents dumping the old database; use of this option forces -c.
.SH "SEE ALSO"
.IR "initdb, pg_dump, pg_dumpall, pg_upgrade"
.SH BUGS
The program does not check that a device is really a tape.  If you send
the dump to the screen, for instance, and also use
.B -d,
without
.B -c,
you will destroy your database irrecoverably.
.SH AUTHOR
postgresql-dump was written for Debian GNU/Linux by Oliver Elphick 
<Oliver.Elphick@lfix.co.uk>.