postgresql/src/bin/pg_dump
2000-07-04 16:57:49 +00:00
..
common.c pg_dump patch from Philip Warner 2000-07-04 14:25:28 +00:00
Makefile pg_dump patch from Philip Warner 2000-07-04 14:25:28 +00:00
pg_backup_archiver.c pg_dump patch from Philip Warner 2000-07-04 14:25:28 +00:00
pg_backup_archiver.h pg_dump patch from Philip Warner 2000-07-04 14:25:28 +00:00
pg_backup_custom.c pg_dump patch from Philip Warner 2000-07-04 14:25:28 +00:00
pg_backup_files.c pg_dump patch from Philip Warner 2000-07-04 14:25:28 +00:00
pg_backup_plain_text.c pg_dump patch from Philip Warner 2000-07-04 14:25:28 +00:00
pg_backup.h pg_dump patch from Philip Warner 2000-07-04 14:25:28 +00:00
pg_dump.c make TEMP -> TEMPORARY 2000-07-04 16:57:49 +00:00
pg_dump.h pg_dump patch from Philip Warner 2000-07-04 14:25:28 +00:00
pg_dumpall.sh Fix thinko in my last pg_dumpall change 2000-07-04 16:29:59 +00:00
pg_restore.c pg_dump patch from Philip Warner 2000-07-04 14:25:28 +00:00
pg_upgrade Accept pg_group as well as pg_shadow data from dumpall script. 2000-05-05 03:08:20 +00:00
README pg_dump patch from Philip Warner 2000-07-04 14:25:28 +00:00

Notes on pg_dump
================

pg_dump, by default, still outputs text files.

pg_dumpall forces all pg_dump output to be text, since it also outputs text into the same output stream.

The plain text output format can not be used as input into pg_restore.


To dump a database into the next custom format, type:

    pg_dump <db-name> -Fc > <backup-file>

To restore, try
 
   To list contents:

       pg_restore -l <backup-file> | less

   or to list tables:

       pg_restore <backup-file> --table | less

   or to list in a differnet orderL

       pg_restore <backup-file> -l --oid --rearrange | less

Once you are happy with the list, just remove the '-l', and an SQL script will be output.


You can also dump a listing:

       pg_restore -l <backup-file> > toc.lis
  or
       pg_restore -l <backup-file> -f toc.lis

edit it, and rearrange the lines (or delete some):

    vi toc.lis

then use it to restore selected items:

    pg_restore <backup-file> --use=toc.lis -l | less

When you like the list, type

    pg_restore backup.bck --use=toc.lis > script.sql

or, simply:

    createdb newdbname
    pg_restore backup.bck --use=toc.lis | psql newdbname


Philip Warner, 3-Jul-2000
pjw@rhyme.com.au