Restore Postgre .BAT

0

Hello, good afternoon!

I am doing a .bat for Backup and Restore of a database in PostegreSQL, the Backup .bat works perfectly but the Restore of the problem by the bank owning data, would have some way to when starting the .bat it delete all the tables and just leave the DB to not give error?

chdir C:\Program Files\PostgreSQL.4\bin

ECHO "C:\Program Files\PostgreSQL.4\bin"
ECHO.
SET caminho=C:\
SET database=DATABASE
SET PGPASSWORD=1234

FOR /F "TOKENS=1-4 delims=/ " %%I IN ('DATE /t') DO SET data=%%I-%%J-%%K
FOR /F "TOKENS=1-2* delims=: " %%A IN ('TIME /t') DO SET hora=%%Ah%%Bm

ECHO ***********************************************
ECHO Aguarde, realizando o Restore do Banco de Dados
ECHO ***********************************************
ECHO.

pg_restore -U postgres -d %database% -1 %caminho%%database%_%data%.backup

PAUSE
    
asked by anonymous 19.07.2018 / 20:43

0 answers