Integrating Visual TD To A Database Server
Integrating Visual TD To A Database Server
MN914021EN, version 6
MN914021EN, version 6
(Template: EAS-SA QF-MKT-02 Rev.04)
MN914021EN, version 6
Contents
1 Introduction 1
1.1 Getting Assistance .................................................................................................1
1.2 Related Documentation .........................................................................................1
ii ● Contents
MN914021EN, version 6
Figures
Figure 1 Simplified functional dataflow – data historization ...................................................... 4
Figure 2 Simplified functional dataflow – historical query ........................................................ 5
Figure 3 Database monitoring - load indicators ....................................................................... 30
Tables
Table 1 MS SQL - Time estimation to fill disk space (no compression) ................................... 9
Table 1 PostgresSQL - Time estimation to fill disk space (no compression) .......................... 10
Table 2 PostgreSQL memory parameters ................................................................................ 26
Table 3 PostgreSQL vacuum parameters................................................................................. 26
Table 4 Example – Monitoring writing performances of the database .................................... 37
Table 5 Number of table partitions of the Visual T&D database ............................................ 38
1 Introduction
This document presents all necessary instructions to integrate Visual T&D to a database server as
well as the technical aspects to consider for a successful integration.
Email: eas-support@eaton.com
Phone: +1.877.834-0009 or +1.800.815-2258
Business hours are from 8 a.m. and 5 p.m. CST, Monday to Friday.
The Visual T&D server can record data on a continuous basis in a database called the Visual T&D
Datalog.
Visual T&D is often used as a critical system or as a part of a critical system, as such, its
deployment should be planed carefully to avoid functional disruption. All recorded data is time-
stamped and tagged for quality. The datalog allows you to reconstruct the sequence of events and
to see the data point transitions, using the Historical Data display.
More specifically, the Visual T&D Datalog records the following data items:
All events
All transitions (binary point state changes and sampled analog point values) on data
points for which the Need Log setting is selected
Note: By default, the Need Log setting is selected for all binary points added to a site
configuration; this is not the case for newly added analog points, which can generate a large
amount of transitions.
The Visual T&D server components and the Visual T&D datalog database can be installed on the
same computer. However, it is recommended to install them on different computers or, at least, on
different drives.
Visual T&D will operate normally when the database server is unavailable but will raise an alarm
to inform the users.
Visual T&D server connects to the database server at startup, or upon restart. Any change to the
database server affecting the connection parameters requires a mandatory restart of Visual T&D,
leading to a temporary loss of functionality.
Visual T&D server will buffer data to be written to the database when the database server is
temporarily unavailable. However, the buffered data size being limited there is no guarantee that
data will not be loss. Visual T&D will actively try to reconnect to the database server and save
buffered data. After reconnection, the buffered data will be written in block, which size can be
adjusted to optimize write performance. See section Adjusting the bulk size to optimize data
writing performance, page 35.
The diagram below shows a simplified functional dataflow picturing data sources, acquisition
filtering, active site configuration, transitions, alarms and events recording into the historian
database of the loaded site.
All Postgres deployments should use version 10.7 (or later minor versions of version 10) with
SHA256 authentication encryption. PostgreSQL 10.7 is supported with Visual T&D from Visual
T&D 5.0R1 upwards. The default MD5 encryption need to be changed to SHA256, the related
instructions are provided at section Enforcing SHA256 hashing on PostgreSQL, page E-1.
Note: Before enforcing SHA256 hashing in PostgreSQL, upgrading to PostgreSQL 10.7 from an
earlier version (typically 9.2) need to be performed. Refer to section Migrating PostgreSQL 9 to
10, page D-1, for details.
It is the responsibility of the customer or its integrator to ensure a secure database deployment
within a customer-specific infrastructure.
Regardless of the database engine used, please ensure to apply the principle of least priviledge,
immediately after the first functional tests. For PostgreSQL, refer to section Using minimal
privileges, page23, for details.
Note: When determining the amount of disk space required by the Visual T&D Datalog
database, consider that the new data model takes four (using Microsoft SQL database) to
eight times (using PostgreSQL database) as much disk space as the proprietary data
model used by version 3.7 or earlier.
Before proceeding with the installation of a new Visual T&D server, or the migration of an
existing Visual T&D server to version 4.0 or later, verify the availability of existing corporate
Microsoft SQL Server or PostgreSQL database servers with your IT department. Please ensure
that periodic backup of the database is in place, especially if the historic data is critical for
operations or needed by law or internal business rules.
The disk space can be planned using the following approximations:
One recorded transition (either analog or binary) requires about 40 bytes of logic space.
In Microsoft SQL Server, 40 bytes of logic space in the current Visual T&D database
structure requires approximately 160 bytes of physical drive space (4 times logic space).
In PostgreSQL, 40 bytes of logic space in the current Visual T&D database structure
requires approximately 320 bytes of physical drive space (8 times logic space).
The drive space (bytes) for one year of recording can be approximated by:
𝑆𝑦𝑒𝑎𝑟 = 𝐾𝑠𝑝𝑎𝑐𝑒 × 𝑁𝑡𝑠 × 40 × 31 536 000
Where:
Syear: drive bytes for a year.
Kspace : approximately 4 for Microsoft SQL Server and 8 for PostgreSQL. It will depend
on the number of points, number of partitions, efficiency of the vacuum process to
recover space when transitions are deleted, and how frequently the vacuum process is
allowed to run.
Nts: number of transition per second for all points.
For example, 1000 points recorded at 1s frequency on Microsoft SQL Server would give:
Nts of 1000
Kspace of 4
Resulting S of 4.6 TB of drive space for one year
Several other factors need to be considered when using the formula stated above, such as:
Bytes per sector on the partition holding data
Compression at the file system level (such as NTFS compression)
Compression at database engine level
EATON does not recommend using compression at database level. Generally, compression at file
system level can be used if the CPU has at least four logical cores on Intel i5 Gen 8 (or later) or on
equivalent processing power on AMD. In such case, compression’s extra CPU processing is being
offset by reduced reads and writes. This general assumption is to be verified by the customer in his
own environment before using compression. The raw data stored for Visual T&D transitions can
generally be compressed at NTFS level by as much as 50%; that is reduced by half.
The following tables show an estimation of the expected time to fill disk space when no
compression is used at file system level or database level.
avail. space
Number of recorded
Number of recorded
50 GB 1.72E+08 284 64 5 3 1 1
When a new site is created, Visual T&D server will automatically create the historian database, if
it has the right to do so using provided credentials.
Important note: The following procedure only applies to version 5.0 and earlier of Visual
T&D.
To manually initiate and create the historian database, use the .SQL script files located at:
C:\Program Files (x86)\Cooper Power Systems\Visual T&D\Server\Bin
Use:
Create Database SQL Server.sql for SQL Server
Create Database PostgreSQL.sql for PostgreSQL
Before executing the script, you may want to adjust the database partitioning; refer to section
Adjusting the number of table partitions of the Visual T&D database, page 38, for details.
The database name must be the same as the Visual T&D site name, with prefix identical as the one
configured on the Visual T&D Server. Refer to section Connecting Visual T&D to the database,
page 20.
Optimize SQL Server performance and memory usage by consulting section Database
performance optimization, page 35.
Where:
- pg_ctl.exe is the PostgreSQL service executable for your PostgreSQL installation
- -N “Visual_TD_Database” specifies the name of the service
- -D "C:/Dev/Visual TD Datalog" specifies the path of the data files
Where:
C:\vtd_historian_data" is the folder where the data will reside
Note: If the PostgreSQL database was installed using the Visual T&D installer (version 4.1
to 4.4), the default data folder is C:\Visual TD Datalog\.
2. At the end of the file, add a record for each Visual T&D server computer that
requires access to this database server.
Note: Refer to the content of the pg_hba.conf file and PostgreSQL documentation for
complete record syntax. To authenticate with the database using a PostgreSQL account, use
the md5 or scram-sha256 keyword for the authentication method; otherwise, to
authenticate using a Windows account, use the sspi keyword. EATON recommends using
SHA256. Refer to section Securing authentication with SHA256, page E-1,for details.
For example, the following record provides remote access from a Visual T&D server at
address 10.106.121.73, using a local PostgreSQL account:
The following record provides remote access to the same Visual T&D server, at the same
address IP, but using a Windows account:
Restrictions:
As specified in the PostgreSQL documentation, the first record with a matching
connection type, client address, requested database, and user name is used to perform
authentication. There is no "fall-through" or "backup": if one record is chosen and the
authentication fails, subsequent records are not considered. If no record matches,
access is denied.
If you want to keep the access to pgAdmin with the initial superuser PostgreSQL
account, thus using md5 method, use field USER to precise usernames for sspi, md5
and scram-sha256. That way, you won’t fall into the trap described in the previous
point. The md5 entry should be removed once scram-sha256 is configured. See
section Securing authentication with SHA256 for details.
3. Save and close the pg_hba.conf file.
4. Restart the PostgreSQL database service to apply the configuration changes.
Important note: PgAdminIII has the option to save your password. DO NOT
ACTIVATE THIS OPTION as it saves it in clear text in the user profile files. Consider
updating to PgAdmin4 for enhanced security.
Then, proceed to configure Visual T&D Datalog connection within Visual T&D Server
Configuration tool. See section Connecting Visual T&D to the database, page 20, for details.
To optimize PostgreSQL performance and memory usage, refer section Database performance
optimization, page 35.
When upgrading a Visual T&D server from version 3.7 or earlier, Visual T&D system
administrators must transfer the content of the existing datalog to the selected database server.
Visual T&D Server Configuration provides access to a tool that can perform this data migration
operation.
Visual T&D version 4.2R2 offers new deadband settings for analog points to reduce the amount of
data recorded. The percentage of analog points with deadbands is displayed on the access tool
window for importing datalog files.
Note: Migrated content may take up to eight times the disk space used by the existing
data on a PostgreSQL database, and up to four times on a Microsoft SQL database.
For example, a 1.25 GB Visual T&D 3.7 datalog will approximately use 10 GB of disk space
in a Visual T&D 4 PostgreSQL database, and approximately 5 GB of disk space on a
Microsoft SQL database. Therefore, using the deadband settings for both real-time
acquisition and data migration is strongly recommended
The Visual T&D Datalog Import Tool is available from the Visual T&D Server Configuration.
1. Start Visual T&D Server Configuration.
2. Select the Data Logging tab.
3. Click Import Data Log Files.
4. Decide if the percentage of Analog points with deadband corresponds to the
desired level of filtering. If it’s not the case:
a. Close Visual T&D Server Configuration.
b. Open Visual T&D Explorer and load the site to import.
c. Modify the deadband settings (raw, percentage and/or time) for the displayed
analog points as required to suit your needs.
d. Update the configuration to the server.
e. Re-open Visual T&D Server Configuration.
5. Under Data Logging, click Import data log files
6. Under Source, set the oldest date you want your imported data to start from.
7. Under Upon import completion action, select what you want to do with the legacy
datalog files following the import process (either leave the data source unchanged,
copy the legacy data source to a new subdirectory or simply delete it).
8. Click Start Import.
Data will be imported in reverse chronological order, which means that the most
recent data will be imported first.
Note: Be patient, as the process can take a long time, depending on the size of the legacy datalog.
Note: If the database folder differs from the default value (C:\Program Files (x86)\Cooper Power
Systems\Visual T&D\Server\Param\<SITE NAME>\Datalog\), you can create the string registry
key DataLog Path under :
\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Cybectec\Visual Substation
Server\DataLog\
Note: During the migration process, the size of the database will increase significantly: make sure
there is enough free space on the database server.
Note: The name of the datalog database is made of the computer name of the Visual T&D
server, followed by the “Visual T&D Server” text and the site name, all separated by backslashes
characters (‘\’).
EXECUTE [dbo].[sp_RestoreTransitionV001]
Note: The name of the datalog database is made of the computer name of the Visual T&D server,
followed by the “Visual T&D Server” text and the site name, all separated by backslashes
characters (‘\’).
Upon completion of the migration operation, data will be available again and the legacy database
tables should no longer exist in the database.
Note: Be patient, as the process can take a long time, depending on the size of the legacy datalog.
Note: If you migrating data to a version 5.1 of Visual T&D, proceed with the same steps
presented in this current section however, use the following application (run as VTD user) :
C:\Program Files (x86)\Cooper Power Systems\Visual T&D\Engine\VTD.DatabaseMigrations.Tool.exe
Note: The database name can be found in a previous version of the Visual T&D Server
Configuration application, under the Data Logging tab, in the Database Name Prefix
section. Typically, il is set to <servername>\Visual T&D\<sitename>.
Note that the migration is not allowed if the destination datalog type is Microsoft
SQL LocalDB because of the database size limitation.
5. Select the Visual T&D site to migrate. There is also the possibility to manually
select the .MDB file from the site to migrate. Repeat the same process for all
Visual T&D sites to migrate.
Note that the site selection is only required for informational purposes. Only points
present in the .MDB file will be migrated to the destination datalog.
6. Start the migration process by clicking Start. The migration process can be
interrupted by clicking Stop. If the migration process is restarted, it will restart at
the point from which it was interrupted.
7. When you are executing the migration process, a visual log displays the details of
each migration steps and errors. A log is also be available under:
C:\ProgramData\Eaton\Visual T&D\Logs
Note: Be patient, as the process can take a long time, depending on the size of the legacy datalog.
Refer to section The Visual T&D Datalog of Visual T&D Installation Guide to configure the
database connection.
While being simple and efficient, using Visual T&D Server Configuration tool has the following
limitations:
Only for version 5.0 and earlier of Visual T&D, the datalog database name needs to be
the same as the Visual T&D site name.
All the sites need to be on the same database server, unless the server database
connection configuration is manually changed when another site is loaded.
All the sites need to have the same database connection credentials, unless the server
database connection configuration is manually changed when another site is loaded.
Important note: The following procedure only applies to version 5.0 and earlier of Visual
T&D.
You may need to manually create and edit a connection string to bypass those limitations; in doing
so, a registry key needs to be created under:
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Cybectec\Visual Substation
Server\DataLog\<SITE NAME>]
Here, <SITE NAME> is the Visual T&D site name for which the connection string will be used.
Several sites can have their specific connection strings.
The string to create must be named ”connectionstring” (without quotes).
The string value must be <SERVER NAME>@<DATABASE NAME>. See next section for more
details.
An example of the .reg file content (replace highlights with your values):
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Cybectec\Visual Substation
Server\DataLog\<SITE NAME>]
"connectionstring"="<MS SQL SERVER NAME>@<DATABASE NAME>"
When a string is specified for a site, the configuration from the graphical interface is ignored.
When no username and password is provided, Visual T&D Server will use Windows integrated
security to authenticate. This identity is the one running the Visual T&D Server service.
Important note: PgAdminIII has the option to save your password. DO NOT
ACTIVATE THIS OPTION as it saves it in clear text in the user profile files. Consider
updating to PgAdmin4 for enhanced security.
6. Select the Definition tab and set the login role a password. Verify that the Account
expires box is unchecked. Click OK.
7. Select the Role privileges tab, verify that the following role privileges boxes are checked:
a. Can login
b. Can create database
c. Inherits rights from parent role
8. Select the Role membership tab, add the following group roles to the Member list:
d. VTDDataReaders
e. VTDDataWriters
Important note: PgAdminIII has the option to save your password. DO NOT ACTIVATE
THIS OPTION as it saves it in clear text in the user profile files. Consider updating to
PgAdmin4 for enhanced security.
You can also use the pg_dump and pg_restore command-line programs to respectively back up
and restore a Visual T&D datalog PostgreSQL database.
Database management is out of the scope of this document. The information provided in this
section is intended for Visual T&D system administrators who are not very familiar with
databases.
Backup and restore operations can also be performed using the pgAdmin utility program.
To back up the database:
1. Open a command window.
2. At the command prompt, type the pg_dump command as follows to back up the database:
pg_dump -h <host> -p <port> -U <username> -W -Fc "<databaseName>" >
<backupName>.dump
Where:
<host>: is the host name of the computer running the PostgreSQL server (use localhost
if you execute the command from the server).
<port>: is the TCP port on which the PostgreSQL server is listening for connections
(default port for a Visual T&D installation is 5433).
<username>: is the user name of the PostgreSQL account that will be used by the
command to connect to the server (you will be prompted for the password at the
command execution).
<databaseName>: is the name of the of the PostgreSQL database of a specific site,
including the name of the PostgreSQL server. The character “&” in the database name
can cause pg_dump command to fail. The database can be renamed to remove this
character before performing the pg_dump command.
<backupName>: is the name of the backup file.
Make sure to stop the Visual T&D server service before proceeding with the database
deletion to prevent Visual T&D from recreating the database automatically.
If you restore the database in a brand new PostgreSQL server installation, make sure
that the Visual T&D server has connected at least once with the PostgreSQL server in
order to create the required users and roles.
all binary points added to a site configuration; this is not the case for newly added analog points,
which can generate a large amount of transitions.
It is recommended to keep these default Need Log setting values as much as possible, and to
activate data logging only on specific points, as required.
The list of the system points is detailed in the Visual T&D Explorer User Manual, at Appendix A;
System Data Points. Active monitoring is particulary useful on load indicators, notably:
_vss__logWriteLoad, _vss__logReadLoad and _vss__logMaintenanceLoad.
The following figure shows an example of usefull database monitoring using database load
indicators, on a 10 minutes timeframe in Visual T&D Explorer real-time window.
For any load indicator, value should not exceed 25% over a sustained amount of time. It is
normal to have peaks during events or queries. If needed, adjust deadbands and database
dedicated working memory. Refer to section Database performance optimization, page 35,
for details.
8.2.6 Limiting the size of the transaction log file for a Microsoft
SQL Server database
The transaction log file for a Microsoft SQL database can grow unexpectedly large. In such a
situation you need to shrink the file size.
To limit the size of the transaction log file:
1. Start Microsoft SQL Server Management Studio.
2. Using appropriate credentials, connect to the Microsoft SQL Server configured to host the
datalog.
3. Right click on the datalog database that you want to shrink and select Tasks > Shrink > Files.
4. Select Log as the File type.
5. Select the option Release unused space.
6. Click OK.
After changing a data point source in Visual T&D, the old historical data for this point will no
longer be accessible. This is caused by the unique relation between the point and its historical data.
Running the following SQL scripts will take the previous (oldest) historical data that is bound to
the old point coming from the previous source and copy it to the new point. After the script is
successfully executed, the historical data of the old point will be shown as historical data of the
new point. This is basically the action of copying of the data from the old point to the new point.
This approach has the advantages:
- It does not alter the generic product schema and remains compatible with future Visual T&D
upgrades or downgrades.
- It allows to revert to previous site configuration or to a previous source for the points data to
be merged. Old data is still present.
However, you have to consider the following factors:
- Depending on how much data you will migrate, this will increase the size of the database.
You can eventually delete the old irrelevant data once the migration has been verified.
- The scripts are only copying historical data for analog points.
The scripts can be found in C:\Program Files (x86)\Eaton\Visual T&D\Server\Bin\
Note: For Visual T&D version prior to 5.3R1, the scripts can be found in C:\Program Files
(x86)\Cooper Power Systems\Visual T&D\Server\Bin\.
Manage Database - 2 - SetAnalogPoints.sql This script defines the analog point list to
migrate.
Manage Database - 3 - Migration.sql This script migrates from historical tables the
analog transitions that have been made orphan
by removing/moving their point from Visual
T&D configuration.
It iterates through the table named
points_migration_table that must have been
populated before.
Historical transitions of old_point_name will be
attributed to new_point_name.
How to prepare:
1. Go through the four (4) scripts and replace the following generic tags:
Name Instructions
have the same name if the point name itself did not change in the configuration but only their
source changed, which changed their prefix displayed in Visual T&D. Do not use prefix when
specifying the point name, just the name as specified in the Visual T&D site configuration.
How to execute:
1. Run the script Manage Database - 1 - CreateProceduresAndTypes.sql. This
creates required stored procedures and types. Make sure there are no errors during the
execution of the script.
2. Run the script Manage Database - 2 - SetAnalogPoints.sql. This creates the table
points_migration_table that includes all the points defined in the script. Make sure there are
no errors during the execution of the script.
3. Run the script Manage Database - 3 - Migration.sql. Look at the SQL output
messages and save it for points processed. This will show the errors, if any, and the KeyTags
IDs for further operations (eventual deletion, etc.). For example, an output should look like:
9 Database performance
optimization
Important note: This section is only applicable for datalogs managed by versions 5.0
and earlier of Visual T&D.
The Visual T&D datalog has been designed to operate efficiently both in terms of reading and
writing operations. Many factors influence the performance of the database, among other things:
Hardware environment (e.g. hard drive; CPU and RAM; disk partitioning; etc.)
Visual T&D data (e.g. quantity of tags; quantity of data transitions per period of time;
data query size and frequency; etc.)
Visual T&D software (e.g. database tables design; real-time data reading and writing
strategies; etc.)
Recommended Visual T&D hardware requirements and default Visual T&D settings should be
sufficient for most of our customers’ sites requirements.
If necessary, to improve database performance, the following optimization operations can be
performed:
Deploy the Visual T&D database on a dedicated server, or at least a dedicated drive.
Contact your IT department to ensure the database server host machine is optimized in
terms of hardware parts and server environment settings.
Keep the Visual T&D datalog small in size according to your requirements, by keeping
only the last X days of historical data. To learn how to do so, refer to the section Setting
up the Visual T&D Datalog of the Visual T&D Installation Guide.
You can also adjust the bulk size writes and number of table partitions per your
requirements, as described in sections Adjusting the bulk size to optimize data writing
performance, page 35, and Adjusting the number of table partitions of the Visual T&D
database, page 38.
size”. The bulk size’s default value is hardcoded and overridable. However, the maximum amount
of time Visual T&D server shall wait before writing data to the database is harcoded and
definitive.
Since writing performances depend on incoming real-time transitions per second, the bulk size
value is defined according to three factors:
The anticipated number of transitions per second from data sources characteristics,
denoted T. (e.g. 10,000 transitions per second)
The number of transitions per second that Visual T&D server can write on the database,
considering the database capabilities on the hardware where it is installed and also
according to the T value.
The period of time, in seconds, it takes to write the maximum bulk size of data transitions
on the database system.
On a fresh system installation, the bulk size’s default value is defined as a Visual T&D server
parameters, in the registry, and is set to 5000 transitions. This value is considered as an optimal
value for a PostgreSQL database. A Microsoft SQL database can gain better performances when
the bulk size value increases.
To determine the best bulk size value for your system, using Microsoft MS SQL:
1. Install Visual T&D with the target site activated, and ensure MS SQL is the active database.
Data sources should be connected and producing data.
2. Let the system run for a few hours.
3. Execute a graphical query on the system point _vss___logCacheSize.
4. Analyze the historical data:
a. If the cache is always at zero or the cache regularly returns to 0, you don’t need to modify
your system.
b. If usage of the cache is sustained or doesn’t stop increasing, change the bulk size for a
higher value.
As an example, we provided some data to help better understand the numbers explained
previously. The data was taken from an internal test bench.
Please note that many factors can influence database writing performances, like hard disk
controllers, firmware versions, whole system RAM, database number of client/connections, etc…
System specifications used for the example:
Windows 7, 64 bit, I5-3340M @ 2.7 Ghz, 4Gb Ram
SSD Hard Drive, rated 150Mb/sec
Default
Bulk Size 1000 5000 10000 15000
Rate(tr/sec) 4526 3930 2626 1114
PostgreSQL Typical delay to write the
0,2 1,4 4,4 13,7
bulk(s)
Microsoft Rate(tr/sec) 1461 1447 2700 4191
SQL Typical delay write the bulk(s) 0,7 3,4 4,4 5,2
Please test your new settings in a laboratory environment; then, contact our technical assistance
team in order to validate these settings before proceeding with the reconfiguration of the actual
database.
b. Open the Create Database SQL Server.sql script in a text editor (or Create
Database PostgreSQL.sql, if you are using a PostgreSQL database).
c. In the “CREATE OR REPLACE FUNCTION PartitionCount() RETURNS integer AS
$$” method, locate the “Return 900” command and replace “900” by a new value
determined in function of your requirements per read and write operations, and based on
the limits presented in the table below:
Note: The number of transitions included in a single database write operation can also be adjusted.
For additional information, contact our Technical Assistance team.
Note: If the PostgreSQL database (md5 method) was installed using the Visual
T&D installer, the default data folder is \Visual TD Datalog\.
b. For the local IPv4 connection (localhost address), replace the md5 or scram-
sha-256 authentication method by trust.
c. Save and close the pg_hba.conf file.
d. Restart the PostgreSQL database service to apply the configuration changes.
2. Start pgAdmin and connect to the database; note that no password is required, as the
database is currently into trust authentication mode.
Important note: PgAdminIII has the option to save your password. DO NOT
ACTIVATE THIS OPTION as it saves it in clear text in the user profile files. Consider
updating to PgAdmin4 for enhanced security.
3. Under the Login Roles branch, select the postgres branch; then, from the Edit
menu, click Properties
4. Type the new password in the Password and Password (again) boxes, and then
click OK; close the pgAdmin application.
In the pg_hba.conf file, change back the authentication method of the local connection to md5 or
scram-sha-256 (as it was), then restart the PostgreSQL service.
Important note: The following procedure only applies to the default PostgreSQL
database that has been deployed by the Visual T&D installer from version 4.1 to 4.4.
When applicable, the database appears in the database list as “Visual T&D”.
4. Type the path and name of the destination folder on the disk drive where the
database must be moved, or use the corresponding Browse button to locate and
select that folder.
Note: The destination folder must not exist prior to the move operation: it will be
created automatically by the Visual T&D Server Configuration application.
5. Click Finish.
Refer to document Visual TD Historian Database Data Dictionary for detailed information about
database schema. You may use the AnalogTransitions and BinaryTransitions views to
perform SQL delete statements, given you have resolved the points keys from the
DataPointDetail table.
For binary transitions. This example deletes transitions for october 6th 2019 at GMT.
To delete a specific point, you may use:
DELETE
FROM "AnalogTransition"
USING "DataPointDetail"
WHERE
"DataPointDetail"."KeyTag" = "AnalogTransition"."KeyTag" AND
"DataPointDetail"."Name" = 'L226.AA' AND
"AnalogTransition"."Timestamp" BETWEEN
TIMESTAMP '2020-01-31 15:00:00.000-05' AND
TIMESTAMP '2020-01-31 16:00:00.000-05';
The above example deletes transitions for point 'L226.AA' between 15:00 and 16:00 for
January 31st 2020 in GMT-5 time zone.
Similar delete statement can be used on binary transitions by replacing AnalogTransition with
BinaryTransition.
Before performing the migration, prepare the roles in PostgreSQL 9.2 (or any version prior to 10).
Some Unicode characters in role descriptions are not properly processed, perform following steps
in order to redo those roles based on existing ones:
1. Open a pgsql command prompt, or a PgAdmin command window. For pgsql, the command
should look like:
psql (9.2.19)
Type "help" for help.
postgres=#
2. On this postgres=# prompt, enter the following commands to create new temporary roles
(omit to type the “postgres=#” part:
a. postgres=# CREATE ROLE "VTDAdministrators2" SUPERUSER CREATEDB
CREATEROLE INHERIT NOLOGIN REPLICATION VALID UNTIL 'infinity'
b. postgres=# COMMENT ON ROLE "VTDAdministrators2" IS 'Members are
owners of all objects in the VT&D Server database'
c. postgres=# CREATE ROLE "VTDBackupOperators2" NOSUPERUSER CREATEDB
CREATEROLE NOINHERIT NOLOGIN NOREPLICATION VALID UNTIL 'infinity'
d. postgres=# COMMENT ON ROLE "VTDBackupOperators2" IS 'Members have
access to backup/restore privileges and other maintenance
operations'
e. CREATE ROLE "VTDDataReaders2" NOSUPERUSER NOCREATEDB NOCREATEROLE
NOINHERIT NOLOGIN NOREPLICATION VALID UNTIL 'infinity'
f. COMMENT ON ROLE "VTDDataReaders2" IS 'Members can read data'
g. CREATE ROLE "VTDDataWriters2" NOSUPERUSER NOCREATEDB NOCREATEROLE
NOINHERIT NOLOGIN NOREPLICATION VALID UNTIL 'infinity'
h. COMMENT ON ROLE "VTDDataWriters2" IS 'Members can write data'
i. CREATE ROLE "VTDSecurityAdmins2" NOSUPERUSER NOCREATEDB CREATEROLE
NOINHERIT NOLOGIN NOREPLICATION VALID UNTIL 'infinity'
j. COMMENT ON ROLE "VTDSecurityAdmins2" IS 'Members can modify data
access privileges to other groups/roles'
3. Then reassign current roles to new temporary ones with the following commands:
a. REASSIGN OWNED BY "VTDAdministrators" TO "VTDAdministrators2"
b. DROP OWNED BY "VTDAdministrators"
c. REASSIGN OWNED BY "VTDBackupOperators" TO "VTDBackupOperators2"
d. DROP OWNED BY "VTDBackupOperators"
e. REASSIGN OWNED BY "VTDDataReaders" TO "VTDDataReaders2"
f. DROP OWNED BY "VTDDataReaders"
g. REASSIGN OWNED BY "VTDDataWriters" TO "VTDDataWriters2"
h. DROP OWNED BY "VTDDataWriters"
4. Set the names of new temporary roles to previous ones with the
following commands:
a. ALTER ROLE "VTDAdministrators2" rename TO "VTDAdministrators"
b. ALTER ROLE "VTDBackupOperators2" rename TO "VTDBackupOperators"
c. ALTER ROLE "VTDDataReaders2" rename TO "VTDDataReaders"
d. ALTER ROLE "VTDDataWriters2" rename TO "VTDDataWriters"
10. Supposing PostgreSQL 9 data files are located in C:\Visual TD Datalog and PostgreSQL
10 data files in C:\Program Files (x86)\PostgreSQL\10\data, begin data migration
by executing:
pg_upgrade.exe --old-datadir "C:\Visual TD Datalog" --new-datadir
"C:\Program Files (x86)\PostgreSQL\10\data" --old-bindir "C:\Program
Files (x86)\PostgreSQL\9.2\bin" --new-bindir "C:\Program Files
(x86)\PostgreSQL\10\bin" --verbose
11. Configure Visual T&D to make it connect to the new database. The connection parameters in
Visual T&D will typically be the same as before, but using the new PostgreSQL 10 port. You
may keep the PostgreSQL 9 settings, but reactivating them only in case of problem with
PostgreSQL 10.
12. Start the newly installed PostgreSQL 10 service.
13. Start Visual T&D Server service to verify proper connection with the database.
Now that the historian data have been migrated, proceed to secure the database with the
following steps:
14. Stop Visual T&D Server service
15. Proceed to section Securing authentication with SHA256, page E-1.
For saving the user passwords, PostgreSQL uses the hashing system provided by the
“password_encryption” parameter of the postgresql.conf file. When a new password
encryption is specified, this parameter is enforced only after a restart of PostgreSQL service. Then,
only the new passwords will be hashed using the specified method.
ii. Restart the PostgreSQL service. If the service was installed by Visual
T&D, this service name is Visual T&D Datalog, otherwise it is most
likely called PostgreSQL.
2. Change the authentication method to fit the new stored passwords hashing system:
a. Now that the password is stored using SHA256, change the md5 values of the
pg_hba.conf file to scram-sha-256 in order to be able to authenticate.
b. There is no need to restart the PostgreSQL service to enforce the new settings.
c. To verify the new settings, restart Visual T&D Server service. It should now
connect to the database using the SHA256 hashing system.