I am creating .bat files to perform the backup and restore of a database in PostgreSQL I use windows 10 and pg 9.4
I execute 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 restore 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, it just opens and closes the screen quickly and does not work.
Is there something wrong or another method to restore?
Do I have to give some permission for pg to have access to my backup file or something?
Issue
I also tried these commands to try to perform the restore and it does not 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"