Обсуждение: Restore Database

Поиск
Список
Период
Сортировка

Restore Database

От
Parth Desai
Дата:
Hello,

I have my postgres SQL database on my server PC and i want to restore the database backup from my server PC to Client PC using Batch file.Please help me how can i create batch file in order to restore my postgres databse.
If possible please send me the example batch file to retore the database if i am having .BACKUP file with me.Looking forward towards the response.

Thanks in Advance

Warm Regards,
Parth Desai

Re: Restore Database

От
Raymond O'Donnell
Дата:
On 20/01/2015 18:37, Parth Desai wrote:
> Hello,
> 
> I have my postgres SQL database on my server PC and i want to restore
> the database backup from my server PC to Client PC using Batch
> file.Please help me how can i create batch file in order to restore my
> postgres databse.
> If possible please send me the example batch file to retore the database
> if i am having .BACKUP file with me.Looking forward towards the response.

What format is the backup file in - plain, custom, etc?

If it's plain, you can just pipe it directly to psql:
 psql -f <backup file> [...other options...] <database name>

If it's one of the others, you need to use pg_restore:
 http://www.postgresql.org/docs/9.4/static/app-pgrestore.html

Ray.

-- 
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie