Common Postgre Command

# Restore database from .sql
psql -d db_name -U userdb_name < dump.sql

# Dump database
pg_dump -U postgres -d -O db_name

# To dump a database:
$ pg_dump mydb > db.out

# To reload this database:
$ psql -d database -f db.out

# To dump a database called mydb that contains large objects to a tar file:
$ pg_dump -Ft -b mydb > db.tar

# To reload this database (with large objects) to an existing database called newdb:
$ pg_restore -d newdb db.tar

Similar Posts:

    None Found

Bookmark:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • description
  • LinkedIn
  • Slashdot
  • Technorati
  • TwitThis
  • Yahoo! Buzz

Leave a comment

Your comment

Spam Protection by WP-SpamFree