PostgreSQL® Server Installation

PostgreSQL® Server Installation for remote DB

Note: The manual installation is only required if you do not install PostgreSQL® using the WinCC OA install wizard - see chapter PostgreSQL® Database Overview. With the install wizard, PostgreSQL® is automatically installed with the WinCC OA.
This chapter describes the manual server installation. If you have a remote database, i.e the database is located on another server than your WinCC OA installation, then you must install the PostgreSQL® database manually.

In case of Linux, use the PostgreSQL® server version package provided by ETM.

PostgreSQL® Server Installation Steps

To create a database instance of the PostgreSQL®, proceed as follows. Consider also the notes in the chapter Troubleshooting PostgreSQL® :

  • Install PostgreSQL® (PostgreSQL® can be downloaded under https://www.postgresql.org/download/ ). Make sure the check box to install pgAdmin is checked. This tool is very useful to browse the database. For supported operating systems for PostgreSQL® Server, see chapter Software requirements -Supported PostgreSQL Version for NGA .
    CAUTION: If you want to use PostgreSQL®, install the PostgreSQL client on all computers on which a PostgreSQL® backend is running or "Direct Read" is used via PostgreSQL® backends. You must also install the PostgreSQL® server on the computers on which the NGA Manager is running.
  • Change the database user name and password in the winccoa_path/data/NGA/PostgreSQL/sql/config.sql file.
    CAUTION: Only letters and numbers ([a-zA-Z0-9]) can be used for the content of the winccoa_path/data/NGA/PostgreSQL/sql/config.sql file.
Note: The workflow for creating PostgreSQL® schema.sql cannot process uppercase letters in the database name. Only use lower case letters in the database name and in the database schema name (In the config.sql file in the directory winccoa_path/data/NGA/PostgreSQL/sql.
  • If you change the winccoaPassword (initially defined in: winccoa_path/data/NGA/PostgreSQL/sql/config.sql), the password must also be changed in NGA via System Management > Database > Database - Configuration > Backend > General settings > Basic configuration:
    Figure 1. Change the password
  • Execute the following command:
    psql -f schema.sql postgresql://[admin_user]:[admin_password]@[database_host]:[database_port]
    Note: For the PostgreSQL® schema upgrade scripts and restore and backup commands, see chapter PostgreSQL® Database Maintenance.
Note:

You can use the following command on a remote host to check if you can access the database: psql -h <host> -p <port> -U <db user name> -c "SELECT pg_is_in_recovery();"

If the database is available, the result of the SELECT query is shown. Otherwise an error message is shown.

  • Start the WinCC OA project and NGA via System Management > Runtime Engineering.
Note: PostgreSQL® creates one log file per day. The log file is created with the name of the day of the week (Monday, Tuesday, etc.). It is overwritten with new logs every week. The log files are stored for 7 days.
Tip: It is recommended to adapt the number of reading/writing threads for the PostgreSQL® backend to the number of CPU cores available on the machine where the PostgreSQL® database runs, since for each open connection a PostgreSQL® fork process is created.