Re: Automating pg_Dump on Windows 2016 Server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Simon White schrieb am 14.11.2018 um 20:49:
Automating pg_dump seems to be unnecessarily difficult from Windows
Server 2016.  I have tried using the PGPASSWORD environment variable
and the PGPASSFILE environment variable all to no avail.  The result
is that I am always prompted for a password.  Could you not create a
option to pass the password on the command line or the location of a
password file to be used. That certainly would make things simpler.

Since I was using the "postgres" user I tried setting the password
under the "postgres" user in pgAdmin4 but that did not help either.


I have no problems setting the variable inside a batch file:

  setlocal
  set PGPASSWORD=verysecret
  pg_dump -U myuser -D ....

By default Postgres uses the "Local System" account to run the service. I don't think that is a Windows user for which you can define environment variables. So you would need to define the environment variable as a global one.

If you don't want to use a batch file, you could create a dedicated Windows user where you set the environment variables and then use that user to run the service. But make sure you adjust the privilege on the data directory. Using a batch file for pg_dump is most probably a lot easier.




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux