MS SQL® Server Installation
Proceed as follows to install an MS SQL® Server on your operating system:
- Download and install the MS SQL® Server. For the supported server version, see chapter Software Requirements .
- install the [MS SQL® Server Management Studio]: https://docs.microsoft.com/en-US/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-ver15 for managing the database server.
Note: Consider the MS SQL memory management - see https://learn.microsoft.com/en-us/sql/relational-databases/memory-management-architecture-guide?view=sql-server-ver15#dynamic-memory-management.
During the MS SQL® Server installation:
- In the Feature Selection tab check the following options:
- Database Engine Services.
- SQL Server replication.
- Client Tools Connectivity.
- Click on next until the Database Engine Configuration window is opened. Set the server authentication type to Mixed Mode (SQL Server and Windows Authentication mode).
- Specify the password for the SQL Server system administrator (sa) account (see above).
sa
user must be
specified. Otherwise the sa
user will be disabled.- Specify the the adminPassword and the winccoaPassword - see Database Passwords (DB Admin & WinCC OA DB User)
- Restart your computer. When a WinCC OA project and an MS SQL® Server are located on
separated servers, you must perform an MS SQL client installation.
- Windows:
- Download and install Microsoft ODBC Driver 17 for SQL Server.
- Download and install Microsoft Command Line Utilities 15 for SQL Server.
- Linux:
- Install the Microsoft ODBC driver for the target OS.
- Install the command-line tools for the target OS.
-
Create a symbolic link for the bcp utility:
ln -s /opt/mssql-tools/bin/bcp /usr/local/bin/bcp
This allows the MS SQL® backend to use the
bcp
tool for making backups.
- Windows:
Enable TCP/IP
-
The MS SQL® Server must be able to use the TCP/IP protocol. To enable a TCP\IP connection, follow these steps:
- Open the SQL Server Configuration Manager via the Start menu.
- Select the SQL Server Network Configuration.
- Double-click on protocols for your
instance name.
- If not enabled already, right-click on TCP/IP and
choose
Enable
(See the figure SQL Server Network Configuration below).
- Double-click on the TCP/IP entry.
- Click on the IP Addresses tab and navigate to IPAll.
- Specify the TCP port, type the port number you want use for MS SQL® Server, and then click on OK - See the figure TCP Port Configuration below.
- Restart the SQL Server service via Services ( ).
DB schema creation
- For example, here the "D:/mssql" directory is used for Windows as the main directory for storing the WinCC OA database.
- Create the database directories:
D:/mssql/db
D:/mssql/backups
Create a DB schema
Navigate to wincc_oa\data\NGA\MSSQLServer\Sql
- Set the database parameters in
db.windows.config
for Windows or indb.linux.config
for Linux. The available parameters including the default values are shown below.CAUTION: Only letters and numbers ([a-zA-Z0-9]) can be used for the content of the db.windows.config file.# DB connection settings dbServer=localhost # Server name. port=1433 # Server port. adminUsername=sa # Database administrator user. The database that will be created will belong to the associated user. adminPassword=password # Database administrator user password. winccoaLogin=winccoa # Database server login. The login will be created if it does not exists. winccoaUsername=winccoa # Database user. The user will be created if it does not exists. The user will get minimum permission to work with the backend. winccoaPassword=password # Database user password. dbName=winccoa # Name of DB instance to create. # DB specific options sqlscriprtpath=schema.sql # The path to the SQL file to create the schema. numberType=DOUBLE PRECISION # Colum type of float values. Possible values are: DOUBLE PRECISION and NUMERIC dbInitSize=8MB # Specifies the initial size of the data file. The kilobyte (KB), megabyte (MB), gigabyte (GB), or terabyte (TB) suffixes can be used. Examples: 2KB, 2MB, 2GB, 2TB. dbFileGrowth=64MB # Specifies the automatic growth increment of the data file. The kilobyte (KB), megabyte (MB), gigabyte (GB), or terabyte (TB) suffixes can be used. Examples: 2KB, 2MB, 2GB, 2TB. logInitSize=8MB # Specifies the initial size of the log file. The kilobyte (KB), megabyte (MB), gigabyte (GB), or terabyte (TB) suffixes can be used. Examples: 2KB, 2MB, 2GB, 2TB. logFileGrowth=64MB # Specifies the automatic growth increment of the log file. The kilobyte (KB), megabyte (MB), gigabyte (GB), or terabyte (TB) suffixes can be used. Examples: 2KB, 2MB, 2GB, 2TB. logMaxSize=2097152MB # Specifies the maximum size to which the log file can grow. The kilobyte (KB), megabyte (MB), gigabyte (GB), or terabyte (TB) suffixes can be used. Exam-ples: 2KB, 2MB, 2GB, 2TB. # DB directories dbPath="d:\mssql\db" # Path to DB schema files. dbBackupPath="d:\mssql\backups" # Path to backed up segment files.
- In the
wincc_oa\data\NGA\MSSQLServer\Sql
directory, runcreate_database_windows.ps1
for Windows orcreate_database_linux.sh
for Linux to create a DB schema. - You can also use command line parameters for
create_database_windows.ps1
andcreate_database_linux.sh
instead of using the config file. For the command line parameters, see chapter Database settings .
Note: The backup folder must be accessible for users under which the WinCC OA is running. - In the
WinCC OA and MS SQL® Server on separate servers
For a WinCC OA project to work with an MS SQL® Server Backend, you need to perform the following steps:
On the database server
- Install the MS SQL® Server (see the setup of the MS SQL® Server DB).
On the WinCC OA server:
Windows:
- Specify the database connection parameters. See chapter Basic Configuration.
- Install the MS SQL® Server client packages:
- Download and install the Microsoft ODBC Driver 17 for SQL Server.
- Download and install the Microsoft Command Line Utilities 15 for SQL Server.
Linux:
- Specify the DB parameters. See chapter Basic configuration.
- Install the MS SQL® Server client packages:
- Install the Microsoft ODBC driver (Install the Microsoft ODBC driver for SQL Server (Linux)) for the target operating system.
- Install the command-line tools (Install sqlcmd and bcp the SQL Server command-line tools on Linux) for the target operating system.
- For backups to work, create a symbolic link for the bcp utility:
ln -s /opt/mssql-tools/bin/bcp /usr/local/bin/bcp