Mostrando entradas con la etiqueta backup and restore database on postgresql. Mostrar todas las entradas
Mostrando entradas con la etiqueta backup and restore database on postgresql. Mostrar todas las entradas

sábado, 4 de julio de 2015

backup and restore PostgreSQL database

I am sure there are a lot of ways how to do this but I would like to show you this effective way

1. whether you want to backup a database the sintaxis is:

pg_dump -h -U -f

Example:
pg_dump -h localhost -U bob accounting -f accounting07042015.sql

2. whether you want to restore a database you may use this sintaxis:
 psql -H -U -d -f

Example:
psql -h localhost -U bob -d accounting -f accounting07042015.sql

pay attention whether you get some warning or error messages.

Cheers