Thursday, February 10, 2011

PostgreSQL Dump Database

PostgreSQL Dump Database and Move Database from one server to another server.

for exporting the database to dump from localhost use the below query
pg_dump -h localhost -p 5432 -U madhavan Source_DB > db.Export.dump

for importing database into server
psql -h 192.168.1.7 -p 5432 -U postgres Source_DB < db.Export.dump

here
-h : Host to copy from
-p : Port
-U : Username of the database
after enter the query it will ask for password for the data base