Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== pg_dump ====== ===== Tips ===== * you may need to specify the -i flag, to ignore differences in the database version and pg_dump executable; if this is done, it might be best to use a plain text format for the dump to be safe * the -d flag does not specify a database, but rather specifies that you want INSERT statements instead of COPY statements ===== Examples ===== **Dump all tables, with acl/permissions, with create table scripts, to a plain text file (note that -d means to use INSERT statements instead of COPY statements, not to specify a db) with sql commands:** <code> pg_dump --file=/path/to/output/file.sql --no-owner --format=p \ --disable-triggers -h hostname -d database </code> **Dump a single table, without create table script, without ownerships, to a compressed format suitable for pg_restore:** <code> pg_dump --data-only --file=/path/to/output/file.sql --no-owner --format=t \ --table=sometable --no-privileges --disable-triggers -h hostname database </code> ** Dump database schema, without owners or permissions: ** <code> pg_dump --schema-only --no-owner --no-privileges -h hostname -U username databasename > dumpfile.sql </code> docs/postgres/pg_dump.txt Last modified: 2009/04/16 11:51by billh