pg_restore error: input file appears to be a text format dump

Viewed 19

I am trying to test restore database from my scheduled backup which is created using the below batch script:

pg_dump -h "localhost" -U "postgres" -f "D:\\Database\\Backup\\db_backup_%date:~10,4%%date:~4,2%%date:~7,2%_%time:~0,2%%time:~3,2%%time:~6,2%.psql" "database_options"

The file saved with the following filename:

db_backup_20220919_150117.psql

But when I attempted to restore the backup using pgAdmin, I get the error:

pg_restore: error: input file appears to be a text format dump. Please use psql.

While the running command is displayed as:

C:\Program Files\PostgreSQL\14\bin\pg_restore.exe --host "localhost" --port "xxxx" --username "postgres" --no-password --dbname "test_restore" --verbose "D:\\Database\\Backup\\db_backup_20220919_150117.psql"

How do i backup in .psql format correctly to resolve this error and correctly be able to backup?

Edit: I checked in the suggested solutions however none of the solutions worked for me.

I have a feeling I am incorrectly writing this part : -f "D:\\Database\\Backup\\db_backup_%date:~10,4%%date:~4,2%%date:~7,2%_%time:~0,2%%time:~3,2%%time:~6,2%.psql" "database_options"

0 Answers
Related