diff --git a/doc/src/sgml/ref/pg_restore.sgml b/doc/src/sgml/ref/pg_restore.sgml index edbbba808f5b0296ece5e67f60c56655fa0593c1..e7c4ee036e71e497fe78b2176d4554b56b70802b 100644 --- a/doc/src/sgml/ref/pg_restore.sgml +++ b/doc/src/sgml/ref/pg_restore.sgml @@ -1,4 +1,4 @@ - + @@ -580,34 +580,54 @@ CREATE DATABASE foo WITH TEMPLATE template0; Examples - To dump a database called mydb to a tar - file: + Assume we have dumped a database called mydb into a + custom-format dump file: -$ pg_dump -Ft mydb > db.tar +$ pg_dump -Fc mydb > db.dump - To reload this dump into an - existing database called newdb: + To drop the database and recreate it from the dump: -$ pg_restore -d newdb db.tar +$ dropdb mydb +$ pg_restore -C -d postgres db.dump + + The database named in the + + + To reload the dump into a new database called newdb: + + +$ createdb -T template0 newdb +$ pg_restore -d newdb db.dump + + + Notice we don't use To reorder database items, it is first necessary to dump the table of contents of the archive: -$ pg_restore -l archive.file > archive.list +$ pg_restore -l db.dump > db.list The listing file consists of a header and one line for each item, e.g., ; ; Archive created at Fri Jul 28 22:28:36 2000 -; dbname: birds +; dbname: mydb ; TOC Entries: 74 ; Compression: 0 ; Dump Version: 1.4-0 @@ -645,7 +665,7 @@ CREATE DATABASE foo WITH TEMPLATE template0; could be used as input to pg_restore and would only restore items 10 and 6, in that order: -$ pg_restore -L archive.list archive.file +$ pg_restore -L db.list db.dump