File: postgresql-dump.8

package info (click to toggle)
postgresql 6.5.3-27
  • links: PTS
  • area: main
  • in suites: potato
  • size: 28,360 kB
  • ctags: 20,905
  • sloc: ansic: 204,608; yacc: 10,718; sql: 9,387; sh: 9,379; java: 8,835; tcl: 7,709; makefile: 3,376; lex: 1,642; perl: 1,034; python: 959; cpp: 847; asm: 70; pascal: 42; awk: 10; sed: 8
file content (131 lines) | stat: -rw-r--r-- 4,859 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
129
130
131
.TH POSTGRESQL-DUMP 1 
.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] [-f] [-i] [-l] [-p directory] -t target_file [-u] [-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,
unless the -u option is used.
.TP
.I "-f"
Fix pg_dump output 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.
This option also changes the create database lines to use encoding='SQL_ASCII'
instead of encoding=''.
.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 "-u"
Use the pg_upgrade command to do the upgrade.  This involves writing a dumpfile
that contains only the database structure, but not the data itself.  The old
database files are moved to 
.B $PGDATA.old
(if necessary) and the old data is read from them to populate the
tables in the new database.
Use of this option forces -l, and cancels -d, even if it has been specified.
This option is recommended for upgrades to 6.4 and above, except for
those that cross the boundary between 6.4.2 and 6.5.
.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.
.PP
The -u option cannot be used to upgrade from versions earlier than 6.5 to
version 6.5 or later.  This is because of a change in the way
rows are stored in the database tables.
.SH AUTHOR
postgresql-dump was written for Debian GNU/Linux by Oliver Elphick 
<Oliver.Elphick@lfix.co.uk>.