Skip to content

Instantly share code, notes, and snippets.

@fabriciocolombo
Created August 20, 2012 16:58
Show Gist options
  • Save fabriciocolombo/3405794 to your computer and use it in GitHub Desktop.
Save fabriciocolombo/3405794 to your computer and use it in GitHub Desktop.
PostgreSQL Backup/Restore
pg_dump.exe --host $host --port 5432 --username $userName --format plain --create --verbose --file $fileName $databaseName
To restore backup done with plain format
psql -a -h $host -p 5432 -U $user -d $database -f $fileName -o restore.log
To restore backup done with other format
pg_restore -h $host -U $user --verbose -d $databaseName -C $backupFileName [2> restore.log]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment