InfluxDB® Database Maintenance
Full DB Backup and Restore
The NGA Database Backup feature is an operation to backup (and if required, restore) the complete database(s) used by NGA and is therefore specific to the DB used -InfluxDB® and SQLServer®.
There is no WinCC OA panel to perform the backup / restore operation and instead sample scripts (cmd or shell scripts) are provided for this purpose. It is recommended to include these backup scripts in the scheduler / crontab entries of your operating system. See the description below.
- To backup or restore a full database, use the appropriate backup or restore script for your database type and platform..
- Create a scheduled task (windows) / cronjob (linux) that executes the backup scripts regularly as follows:
- Create a task via the Windows Task Scheduler. In the Windows Start menu type in "Task" and open the Windows Task Scheduler.
- Use the scripts from <WinCC OA_path>/data/NGA/<Database Type>/sql for a task.
These are scripts that do a full backup of the current state of the database that can be used if there is a major malfunction that requires that the whole database is restored. For a detailed description of the backup and restore commands, see chapters InfluxDB® Database Maintenance and MS SQL® Database Maintenance.
Other WinCC OA Backup Options
- The WinCC OA "Online Backup" feature is to recreate a WinCC OA project in case of data loss or other fatal situations (hardware fault, unwanted manual deletion of data, ...). The online backup is a complete backup of a WinCC OA project. Note that this backup does not include the history database.
- The Segment backup integrated in the NGA (see Extended Settings - Database-specific Configuration) can be used for restoration of historic data which has already been deleted due to retention settings ("lifetime" of data).
.
InfluxDB® Commands
The backup commands are available for InfluxDB®. The command can be used for cmd and sh. This chapter describes the InfluxDB® commands.
InfluxDB®: backupInfluxDB.cmd [<command> <argument>] <backupPath>
Command | Description |
---|---|
--database | --database The name of the database (default is "winccoa"). |
--host | Host and port of the database (default is "127.0.0.1:8088"). |
--maxBackupCount | Number of backups kept (default is 3). |
InfluxDB®: restoreInfluxDB.cmd [<command> <argument>] <WinCC OA-project-name> <InfluxDB-backup-path>
Command | Description |
---|---|
--database | The name of the database (default is "winccoa"). |
--host | Host and port of the database (default is "127.0.0.1:8088"). |
--backup | The backup folder name (e.g. 20211021-133236) inside <InfluxDB-backup-path> (default is the newest backup). |
--password | The password for the InfluxDB authentication, no further password prompt is shown. Only ASCII characters are allowed in passwords when using this command. |
--username | The username for the InfluxDB authentication, no further username input prompt is shown. Only ASCII characters are allowed in username when using this command. |
--silent | The user will not be asked to confirm that the current database will be overwritten. This command is a switch and does not require a parameter. |
EXAMPLES:
backupInfluxDB.cmd C:\InfluxDB_Backups
restoreInfluxDB.cmd <ProjName> C:\InfluxDB_Backups