How to Automatically Backup History Blocks of AVEVA Historian Server

Tech Note: ISS-TN024
Published Date: June 28, 2007
Primary Product: Historian Server
Revision Date: October 26, 2022

SUMMARY

This Tech Note details the procedure to backup history blocks of Historian Server. A history block is self-contained, containing all of the information necessary to retrieve data for the period represented by the history block. The default duration of a history block is one day and the minimum allowed duration is one hour. Historian Server automatically creates a new history block at system startup, at scheduled block changeover times, at request, or in response to certain dynamic configuration actions.

NOTE: Configuration data and event history are not stored in the history blocks; they are stored in the Runtime database file.

There are four types of storage locations for history blocks:

  • Circular – this is the main storage location and it has to be one of the local hard drives
  • Alternate – this is an overflow buffer
  • Buffer – this is a read-only storage location
  • Permanent – this is a storage location with Historian Server may write data but will never remove data

NOTE: History blocks may be automatically deleted to make room for new history blocks. Whether or not the blocks are deleted is determined by the minimum threshold and the maximum size and/or age specified for the storage location. If an alternate storage location exists, the older blocks will be removed there instead of being deleted. The alternate storage location functions exactly like the circular storage location. However, when the blocks exceed the set limits (minimum threshold, maximum size, or maximum age), the oldest blocks will be deleted from disk.

Recommended Historian Server Configuration

We recommend installing Historian Server on a computer that contains two physical hard drives:

  • System drive (usually C: drive)
  • Data drive (drive with a separate letter assigned, e.g. D:, E:)

Below is a sample storage architecture:

  • Drive C (capacity: usually 10-20 GB)
    • Windows Operating System is installed under C:\Windows
    • Microsoft SQL Server program files are installed under C:\Program Files\Microsoft SQL Server
    • AVEVA Historian Server program files installed under C:\Prgoram Files\Historian
  • Drive D (capacity: usually 100 GB or more)
    • Historian Runtime and Holding SQL databases installed for instance under D:\Historian\DB
    • Historian History Blocks installed for instance under D:\Historian\Data

Preferably both drivers should have RAID 1 (mirroring) or RAID 5 (stripping with mirroring) architecture. The configuration listed above can be achieved by specifying appropriate locations during the Historian Server installation.

Elements That Need to be Backed Up

Elements that will be included into our backup procedure are comprised of:

  • Two SQL Server databases added by the AVEVA Historian Server installation program to MS SQL Server:
    • Runtime – stores configuration, event, and summary data (database file name is Run90Dat.mdf, its associated log file is Run90log.ldf)
    • Holding – used to temporarily store tag definition during InTouch tag import (database file name is Holding90Dat.mdf, its associated log file is Holding90log.ldf)
  • SQL Server’s master database (it’s a database that stores information such as user login account information, security settings, server specific configuration information, etc.)
  • Historian History Blocks – these are special folders and files that contain all the information necessary to retrieve data for the period represented by the history block and store it to hard disk. Circular storage is used for the main historical data storage.

We recommend a 2 step backup procedure:

  • Step 1 – a local disk-to-disk backup procedure copies SQL Server databases and history blocks to a dedicated backup holding location
  • Step 2 – backup software backs up the holding location to tape or to a network storage location

NOTE: We do not recommend using enterprise class backup software (such as Veritas Backup Exec and similar) to directly backup Historian Server databases and/or history blocks over the network. Such software may forcibly remove file locks prior to copying files which in the case of Historian Server may lead to fatal runtime errors.

Applies to

  • AVEVA Historian Server

PROCEDURE

NOTE: The procedure described below applies to Historian Servers systems based on SQL Server. The circular storage location is used for the main historical data storage. A block of historical plant data is saved as a single sub-directory in the circular storage directory.

One of the methods for creating backups of Historian History Blocks is running VBScript (short for Visual Basic Scripting Edition) file.

VBScript is an Active Scripting language interpreted via Microsoft’s Windows Script Host. The language’s syntax reflects its pedigree as a variation of Microsoft’s Visual Basic programming language. When VBScript source code is contained in stand-alone file, it has the extension .vbs.

In our example, the file that contains VBScript code is the key to automated backup procedure (copying history blocks to a different location) and the “Scheduled Tasks” tool available in Windows will help run the procedure according to schedule.

NOTE: VBScript may not be the best way to copy large amounts of data over the network. Therefore this procedure assumes the VBScript would copy history blocks to a local backup holding location (disk-to-disk backup) and then a dedicated backup software (such as Windows Backup or Veritas Backup Exec) would copy the holding location to a tape or network storage.

  1. Determine location of Historian history blocks (by default it’s C:\Historian\Data\Circular, in our recommended architecture it’s assumed to be C:\Historian\Data\Circular)
  1. Create a local folder that will store backup copies of history blocks (in our example in C:\Historian_Backups\HistoryBlocks)
  1. Open Notepad, type or copy and paste the code shown below:
Set FSO = CreateObject(“Scripting.FileSystemObject”)
Set SourceFolder = FSO.GetFolder(“C:\Historian\Data\Circular”)

‘specify the target folder in the next line
TargetFolderName = “D:\Historian_Backup\HistoryBlocks”

‘comment: 1st pass – find the name of the current (most recent) folder based on DateCreated attribute

For Each MyFolder In SourceFolder.SubFolders
  If MyFolder.DateCreated > LatestTimeStamp Then
    LatestFolderName = MyFolder.Name
    LatestTimeStamp = MyFolder.DateCreated
  End If
Next

‘comment: 2nd pass – copy all folders but the most recent one

i = 0
For Each MyFolder In SourceFolder.SubFolders
  If MyFolder.Name <> LatestFolderName Then
    On Error Resume Next
    FSO.CopyFolder MyFolder.Path, TargetFolderName & “\” & MyFolder.Name, True
  If Err.Number <> 0 Then
    MsgBox “Error: ‘” & Err.Description & “‘ while copying ‘” & MyFolder.Name & “‘”, 48, “Copy Historian History Blocks”
  Else
    i = i + 1
  End If
    On Error Goto 0
  End If
Next

MsgBox i & ” history blocks copied at ” & Now, 64, “Copy Historian History Blocks”

In the code above the current history block is excluded from the backup procedure. It will be included when Historian adds new history block with the most current creation date.

NOTE: It is not recommended to copy the current history block because files contained in that history block may not be properly closed by Historian Server.

  1. Save the file as HistorianHistBlocksBackup.vbs in “My Documents” folder (the file needs to be saved with .vbs extension to work as a script)
  1. Next open All Programs > Accessories > System Tools > Scheduled Tasks tool
  1. Start the wizard and click “Browse” button. Go to the location where the script file is located (My Documents > HistorianHistBlocksBackup.vbs) and open it.

8. Review backups of history blocks by going to the location specified in batch file (in our example: D:\Historian_Backup\HistoryBlocks).

NOTE: It is advantageous to periodically test the validity of the backups. It is in your best interest to randomly select databases to restore onto test servers to ensure the restore functionality works properly and is meeting your expectations. The more frequently restoration testing is conducted, the better you will prepared for a real recovery.


All Industrial Software Solutions Tech Notes are provided "as is" without warranty of any kind.