Remote Storage of Archives
Historian can store current and backup archive files on remote storage devices. These remote storage devices can consist of network shares, Storage Area Networks (SAN), or Network Attached Storage (NAS) devices. You can also employ a hybrid approach, by storing your current archive on the local disk and writing a script using the Historian SDK to migrate older archives to a remote storage device.
A SAN is a dedicated network apart from a LAN, specifically configured to allow servers to communicate with large storage arrays, usually over fibre-optic cables. The SAN is directly accessible as a disk device to Windows and does not operate through the slower network layer. NAS devices are similar to a SAN, but are directly attached to the LAN, appearing as a server.
If the Data Archiver service is not working, view the Messages page. Messages like these indicate that Historian is trying to use mapped drives: "Path N:\ not found." "Mapped drives unsupported as archive or backup file location" "UNC paths inaccessible when running as LocalSystem, configure other logon account for DataArchiver service".
If these messages appear, find and change mapped drives to UNC paths.
Example: Migrating Non-Current Archives to a Remote Location
The following sample VBScript code will migrate non-current archive to a remote location by accessing the Historian SDK. This script could be run at specific intervals to migrate data from a local disk to a network share.
Dim FileSystem
set FileSystem = CreateObject("Scripting.FileSystemObject") Dim remoteLocation
remoteLocation = "\\StorageServer\Historian\Archives"
If InStrRev(remoteLocation, "\") Len(remoteLocation) Then remoteLocation = remoteLocation & "\"
' make sure we can access the remote storage before proceeding
Dim TestFile
set TestFile = FileSystem.OpenTextFile(remoteLocation & "Test.txt", 2, True, 0) If TestFile is Nothing Then
err.Raise 1, , "Unable to access remote storage location" End If
TestFile.Close
FileSystem.DeleteFile remoteLocation & "Test.txt" Dim Server
set Server = CreateObject("iHistorian_SDK.Server") If Server is Nothing Then
err.Raise 1, , "Unable to create iHistorian_SDK.Server object" End If
Dim archivesToMigrate(), i
If Server.Connect() Then
With Server.Archives
Dim backupPath
backupPath = .ArchivingOptions("ArchiveBackupPath")
If InStrRev(backupPath, "\") Len(backupPath) Then backupPath = backupPath & "\" ReDim archivesToMigrate(.Item.Count, 2)
For Each archive in .Item
If Not archive.IsCurrent Then
If UCase(Left(archive.FileName, InStrRev(archive.Filename, "\"))) UCase(remoteLocation) Then i = i + 1
archivesToMigrate(i, 0) = archive.Name
archivesToMigrate(i, 1) = backupPath & "Offline\" & cstr(archive.Name) & ".zip" archivesToMigrate(i, 2) = archive.FileSizeTarget
End If
End If
Next
Dim j
For j = 1 To i
If .Delete(cstr(archivesToMigrate(j, 0))) Then FileSystem.MoveFile archivesToMigrate(j, 1), remoteLocation Dim archive
set archive = .Add(cstr(archivesToMigrate(j, 0)), cstr("%%inplace%%" & remoteLocation & archivesToMigrat
If Not (archive Is Nothing) Then
FileSystem.DeleteFile remoteLocation & archivesToMigrate(j, 0) & ".zip" End If
End If
Next End With Server.Disconnect
Else
err.Raise 1, , "Failed connecting to server"
End If