Backup & Restore

This section describes the Backup & Restore feature of ABB Ability™ History database

Backing up the ABB Ability™ History database

When History is running most of the database files are usually kept open by the software, you cannot back up a running History database with just Windows Backup. For backing up ABB Ability™ History, the following methods are available:

  • Offline database backup
  • Scheduled Online backup
  • Using a snapshot backup technology

Note:- This document assumes that the backup is performed on a same machine where the database folder or drive is corrupted beyond recovery.

There may be some instances where you need to deploy a new machine (Like OS Drive crash, hardware failure etc.,). This document still holds good to restore the backup during such scenario if the new machine is configured to match the original machine as closely as possible as a prerequisite before proceeding with the restoration.

  • Hostname: Must be identical to the original machine.
  • User Accounts: Same usernames and permissions.
  • Hard Disks: Same number of partitions and drive letters.
  • RTDB Installation: Install RTDB using exact same parameters as used on the original machine.

After installing follow any one of the below method which suits your requirement to restore, after copying corresponding folder from original machine to new machine.

Offline database backup

It is done by shutting down RTDB and taking a copy of the database directory %APP_DATAPATH% and the application folder %APP_ROOT% using any backup tool or the user’s favorite method. The benefits of offline backup are easy-to-execute and independent from the History product.

Refer Offline database restoration procedure

Scheduled Online database backup

Scheduled Online backup is a History software mechanism that is automatically scheduled to run every day to backup all data from the database directory to the backup disk specified during the installation phase. It is recommended to have a dedicated drive for backup. By default, the online backup is only configured to run in main nodes, and not in data collectors. This is because the purpose of the data collectors is only to buffer data for a short time period. The content of the online copy reflects the latest data in the database directory.

The automatic scheduled backup considers different folders for different backups

  • Onlinecopy (For data tables)
  • Essential backup (For configuration)
  • Application backup (For Application)

Onlinecopy folder contains a copy of all tables stored in RTDB database. The table backups are stored on the backup disk in the folder %APP_BACKUP_ROOT%\onlinecopy

Essential backup contains a copy of those RTDB database tables that contain configuration information (it does not include history data or logs). Essential backups are stored on the backup disk in the folder: %APP_BACKUP_ROOT%\EssentialBackup It is, by default, scheduled to run daily, but unlike online backup, it is running both in data collector and main nodes.

Different from online backup, there are several versions of essential backup available:

  • Backup from each day for the last 7 days
  • Backup from each week during the last 4 weeks
  • Backup from each month during the last 12 months
  • Backup from each year when RTDB has been running The above is achieved by re-using subfolder names. For example, a backup directory %APP_BACKUP_ROOT%\EssentialBackup\WeekDay2 would be re-used next Monday, unless it is time to take a weekly, monthly, or yearly backup. In addition to the table files, the essential backup contains all other files from the database directory and its subdirectories. E.g. the content of the ‘diag’ subdirectory is copied, which may be valuable when searching what kind of diagnostics various services have been producing in the past. Essential backups can be especially valuable in cases when, due to some invalid user interaction, the configuration has become invalid. Having multiple versions of backups spanning a longer time period makes it possible to return back to a valid version anytime. If RTDB is upgraded to a newer version, the RTDB software upgrade creates essential backups to the same directory, before running the upgrade.

Application backup is an RTDB mechanism to backup the files in the folder %APP_ROOT%. The backup is stored in %APP_BACKUP_ROOT% \Backup. This folder contains e.g. calculations if such have been created. Application backup is different from the other backups in the sense that old versions of the application files from the backup are never automatically deleted. The backup appends the modification timestamp of the file to the target file name. As a result, all old versions from the end of the day will be found in the application backup directory.

Using a snapshot backup technology

In large systems, taking the online backup may take very long time and it may be difficult to schedule a tape backup between executions of the online backup. For these systems, a snapshot backup style may be a better alternative. This means that you utilize special functions in the virtual system or the Windows operating system that you take a backup from the live database data on the fly so that the resulting backup reflects the single instant time of the disk. The pitfall of this solution is that when the data is restored, RTDB must execute an extensive database check operation because the situation is identical to a case when the system has suffered from a sudden power loss. However, the recovery can still be quite fast because RTDB remembers which tables were open for writing since the last flush to the disk.

When using a snapshot backups, the snapshot backup could be taken either from the online backup disk, or form the live database disk, but most probably it is more efficient to just take the backup from the live database disk, in which case the cyclic online backup could be disabled completely with the following SimpleConfig setting:

RTDB_Cmd dbc -datapath "%app_datapath%" -section OnlineBackup -key disablecyclic -strvalue 1 SetSimpleConfig

Restoring the History database from backup

Based on the database backup, an appropriate restoration procedure must be selected as explained below

Restoring offline backups or snapshot backups

To restore a backup that was taken while RTDB was shut down is straightforward:

  • Shut down RTDB using RTDB Control panel
  • Restore the backup save sets (RTDBData and Application folders) taken during the Offline backup stage to their original location i.e. database directory %APP_DATAPATH% and the application directory %APP_ROOT%
  • Start up RTDB using RTDB Control panel.

Restoring snapshot backups works the same way. However, the startup of RTDB will take longer because RTDB_ScanDB must execute extended checks for the database because the situation is identical to a case when the system has suffered from a sudden power loss. Notice that manual paranoid scanning is not necessary when restoring snapshot backups (it would be necessary if you would have taken backup from live backup directory with conventional copying tools).

Restoring RTDB Database Disk from Scheduled Online Backup Disk

Restoration of the complete database from the backup drive consists of a few steps

  • Restoring Application directory
  • Restoring RTDBData directory
    • Restoring EssentialBackup
    • Restoring Onlinecopy
❗️

Note

RTDB must be stopped before starting the below restoration procedure. STOP RTDB from RTDB Control panel

Restoring the Application directory The directory \Backup\Application contains backup versions of the \Application directory. The Application backup is organized so that it never deletes anything, but always keeps old versions of files in it. The modification time of the file is appended to the file name, resulting in file names such as APP_Install_Services_20110301_122543.bat (UTC time is used here). The backup script prepares a batch script that contains copy commands for restoring the particular version when the backup was taken. The batch script is saved to the backup disk as a file such as \Backup\Application\Misc\AppBackup\COPY_VER_BACK_20130205_191816.TXT. The extension .TXT is used so that the file cannot be accidentally executed.

To restore the Application directory, the procedure requires that the target subdirectories are already present. The following command can be used to create the target directories:

for /f "tokens=3*" %i in ('findstr /c:"Directory of" "DIR_LIST_20130205_191816.TXT"') do md "%i"

After this, you can copy and rename the COPY_VER_BACK_20130205_191816.TXT to copy_ver_back.bat and execute it.

Note: The script does not print any summary message of how the copying succeeded, so you should verify the output visually.

Note: If you actually want to revert to the version that was present before the latest upgrade, you can also simply copy the files from the directory such as e:\UpgradeBackup\ApplicationSoftware_SAVED_2013-01-18.

Restoring the RTDBData directory To restore the RTDBData directory from the scheduled online backup, restoring from both EssentialBackup folder and Onlinecopy folder is needed.

The directory \Onlinecopy only contains a backup of the table files. The database also contains other files, such as RTDB.ini and Tools\PostUpgrade.bat which are stored in the \Essentialbackup.

Restoring EssentialBackup Find the appropriate (the newest one, except if you know that an older one is better) essential backup directory. For example, \EssentialBackup\Day9 then restores its contents but EXCLUDE all table files. Use the following kind of robocopy command to do this:

robocopy E:\EssentialBackup\day9 "%app_datapath%" /e /copyall /xf *.table*

Restoring Onlinecopy To restore the Onlinecopy to RTDBData folder, run the following command

"%rtdbroot%\config\RTDB_RestoreFromOnlineBackup.bat" "%app_datapath%" /from_onlinebackup "%APP_BACKUP_ROOT%\Onlinecopy"