This project uses the pg_dump.exe tool to back up the PostgreSQL database. The previous command is as follows:
Pg_dump -- Host localhost -- Port 5432 -- username
"S" -- format custom -- blobs -- verbose -- file "C: \ 20111209pm-xfserver.backup" Pipeline
However, during the test, it is found that the command line needs to enter password: to continue the execution, so that automatic backup cannot be achieved, and the parameter is not like setting username -- password, this parameter is not provided for security purposes.
Later, after reading the information, I found a method by adding a line before the command:
Set pgpassword = <password>
You can.
In this way, the command is executed in a batch file, and the entire file looks like this:
@ Echo off
Set pgpassword = xxxxxx
Pg_dump -- Host localhost -- Port 5432 -- username
"S" -- format custom -- blobs -- verbose -- file "C: \ 20111209pm-xfserver.backup" Pipeline
Pause
Read the full text
Category:Study Notes/comments