1
I am creating . bat files to backup and restore a database in Postgresql using windows 10 and pg 9.4
I perform the following command to perform the backup
set PGUSER=postgres
set PGPASSWORD=postgres123
"C:/Program Files/PostgreSQL/9.4/bin\"pg_dump.exe --host localhost --port 5432 --format custom --blobs --verbose --file "D:\bkp.sql" "dbsibcom"
it works perfectly.
And to perform the Store I have the following command
set PGUSER=postgres
set PGPASSWORD=postgres123
"C:/Program Files/PostgreSQL/9.4/bin\pg_restore.exe -i -h localhost -p 5432 -c -d "testrestore" -v " D:\bkp.sql"
I create the bat file and try to restore, it just opens and closes the dos screen quickly and doesn’t work.
There is something wrong or another method of doing Restore ?
I have to give some permission for pg to have access to my backup file or something like that?
Editing
I also tried these commands to try to perform Restore and it doesn’t work
set PGUSER=postgres
set PGPASSWORD=postgres123
C:/Program Files/PostgreSQL/9.4/bin\pg_restore.exe --host localhost --port 5432 --username "postgres" --dbname "testrestore" --verbose "D:\bkp.sql"
is printing some error ? because it has a backslash ai /, try all in the same direction, the way is right ?
– user28266
try this way with the quotes "C:/Program Files/Postgresql/9.4/bin pg_restore.exe"
– user28266
Hello, do not print any error, just blink dos screen and finish without performing anything
– Bruno Silva