Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postgres Command Line tool for Import/Exporting data/ddl

For Postgres is there any sort of command line utilities that allow a database to be "dumped to a file" and that allow that same database dump to be imported?

I know this can be done through PGAdmin, but I need to be able to do this on the cmd line.

like image 969
mainstringargs Avatar asked Feb 22 '10 20:02

mainstringargs


2 Answers

Yeah, take a look into pg_dump and pg_restore

http://www.postgresql.org/docs/current/static/app-pgdump.html

http://www.postgresql.org/docs/current/static/app-pgrestore.html

like image 74
Kenaniah Avatar answered Nov 10 '22 15:11

Kenaniah


Correct, the way to do this is the pg_dump, pg_dumpall and pg_restore commands. In fact, I think pg_admin actually calls those commands itself. It doesn't actually have backup/restore built in but is just a wrapper.

like image 30
Joshua D. Drake Avatar answered Nov 10 '22 15:11

Joshua D. Drake