Troubleshooting PostgreSQL®

Virus Scanner

  • Check that the port used for the PostgreSQL® communication (by default 5432) is not blocked by the firewall.

PostgreSQL® in a Distributed System

If PostgreSQL® is used in a distributed system, the same database username must be used on each of these systems. When multiple distributed WinCC OA projects share a single database instance (DB schema), the projects must use the same database connection and the same database username.

  1. Specify the address of the host that needs to access the database in the pg_hba.conf file.
  2. For Windows: C:/Program Files/PostgreSQL/13/data/pg_hba.conf
  3. For Linux: /var/lib/pgsql/data/pg_hba.conf. Fore more information, see the C:/Program Files/PostgreSQL/16/data/pg_hba.conf file.
  4. Set the entry listen_addresses = '*' in the postgresql.conf file to enable connections from remote hosts to the PostgreSQL® database.
  5. For Windows: C:/Program Files/PostgreSQL/16/data/postgresql.conf
  6. For Linux: /var/lib/pgsql/data/postgresql.conf
    CAUTION: After changing the pg_hba.conf file, use the command pg_ctl reload in the command line to apply the changed configuration! After changing the entry listen_addresses in the postgresql.conf, restart the database.

Initialization of a PostgreSQL® DB Cluster

For some Windows versions this error might be shown: "The database cluster initialization failed" and when executing the "create_database_windows.bat" file, the error "psql: error: could not connect to server: Connection refused (0x0000274D/10061)".

  • In this case, add the path C:\Windows\system32 to the environment variable PATH.

Access to a Directory Denied

When running PostgreSQL® on Windows Server and executing the create_database_windows.bat, a "Permission Denied" error may be shown when PostgreSQL® tries to access directories.

You can solve this problem as follows:

  1. Open the services-program > Navigate to postgresql-x64… (the service name) > Then right-click and select properties/"Log On". > Select the "Local System account" and tick the check box "Allow service to interact with desktop"
  2. Otherwise the script would run under the account "Network Services", which does not have any rights on a Windows server to interact with such directories.

Multiple Versions of PostgreSQL®

If you have multiple versions of PostgreSQL®, note that the installation order impacts the order of the versions. The version 16 (C:\Program Files\PostgreSQL\16\bin) must be the first (at the top).