I want to dump a database.
I have three tables:
table1 table2 table3
From table1 i want the schema plus data.
From table2 and table3 i just want开发者_如何学运维 the schema.
How do i do that?
To get data from just a few tables:
pg_dump myDatabase --inserts -a -t table1 -t table2 > backup.sql;
pg_dump myDatabase --inserts -a -t seq1 -t seq2 > backupSequences.sql;
Parameters descriptions:
-a, --data-only dump only the data, not the schema
-t, --table=TABLE dump the named table(s) only
--inserts dump data as INSERT commands, rather than COPY
This is what i wanted :)
Thanks all!
Use pg_dump, which has both schema-only and schema + data output.
精彩评论