Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2009

    Unanswered: restore migrated database


    I have been successful in exporting database 'accounts' to a text file with pg_dump command...

    What I need to do is to import this database to a different postgres server. This server doesn't have any database called 'accounts' defined...

    How do i create this database, its tables and import the data from the dumped text file ?

    Any help will be highly appreciated. Thanks.

  2. #2
    Join Date
    May 2008
    Did you just do a data dump? It should include all the table definitions, functions, triggers, etc. by default. However, it does not create the database for you; you need to create a new (blank) one yourself to restore the dump. Something like:
    createdb -T template0 accounts
    psql -f <dump file> accounts
    pg_dump does have an option (--create or -C) to create the database and connect to it before restoring the dump.
    Last edited by futurity; 11-03-09 at 10:42.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts