This article provides command-line examples for the experienced user. If you would prefer to learn how to restore databases using the GUI tool pgAdmin, you can find those examples in another document.
This article provides command-line examples for the experienced user. Or click here to learn how to restore databases using the GUI tool pgAdmin.
Command line examples (Linux, OSX, unix-like OS):
Info: The following examples all use the user name "admin". This is the default name created when installing xTuple ERP software starting with version 3. Earlier versions used the user name "mfgadmin" as the default user and it is possible that the databases can be configured with a different name. You should use the appropriate privileged username in place of "admin" for your system.
Create a database container i.e. mynewdb
createdb -U admin pilotdb
createdb -U admin -p 5433 -h mypgdata.mydomain.com pilotdb
Check your sql file with the tail command. (Linux, OSX, unix-like OS)
The tail command should return "-- PostgreSQL backup complete." or something to that affect. If this is not present, you have an incomplete backup.
With the backup created in the article Backing up the Database handy:
psql -U admin databasename < backup.sql 2>&1 | tee restore.log
The ' | tee restore.log ' part of the command pipes standard output (terminal display) to the 'tee' command to a file called restore.log, which can be parsed for error conditions in the data. For additional information, please see Backing up the Database.
Using pgAdmin to Restore Databases
Click here for information about how to use the GUI tool pgAdmin to load (i.e., restore) backup files into a database.