I need to run pg_restore on my PC with Windows CMD to restore a dump to a remote DB. I need to save the running report of the pg_restore into a file, to make sure the restoration ran as expected. Below is the pg_restore command I ran.
pg_restore.exe --host=10.10.10.2 --port=5432 --username=postgres --dbname=mytargetdb --verbose --single-transaction "AT5.DUMP"
It turned out that:
> report.txtin the end of the pg_restore command does not render error, but nothing got written to the textfile.
- Using the
--file=report.txtthrows "error: options -d/--dbname and -f/--file cannot be used together"
The restoration was actually successful. But copy-paste from the cmd windows is not an option as the resulting report was long enough so the cmd only shows some hundreds of the last line of the report, and not the most from earlier lines.
So how should I do that?
- My PC: pg_restore version 12.2 on Windows 10 Pro
- Target server: PostgreSQL 9.6 on Windows Server 2008 R2 Data Center