Recover from accidental system time change
- Last UpdatedOct 02, 2024
- 3 minute read
Data Archive automatically handles all changes to system time. We recommend that you never manually change the system time. On Windows, always use the automatic option.
However, occasionally such changes are required and these change might lead to human errors. For example, instead of moving the clock to 2 a.m. it is moved to 2 p.m. Time synchronization software, designed to keep computer clocks accurate without error-prone human intervention, have also been implicated in moving system clocks erroneously. As a result, the events are recorded in the future. Usually this is discovered after many of these events were already stored in the archive.
-
Stop the PI System.
-
Correct the system time and the time on all connected nodes.
Note: If you are using PI Buffer Subsystem to buffer data from PI interfaces, see Recover from accidental time change at interface node that uses PI Buffer Subsystem.
-
Isolate the Data Archive server from interface nodes. The best technique is to disconnect the server from the network. During this time, allow the data to buffer until the system is verified up and running normally.
-
Rename the event queue file, pimapevq.dat, for later processing. The event queue may contain many future events. Rename the following files located in the dat directory:
-
pilastsnap.dat
-
pilasttot_T.dat
-
pilastalarm.dat
-
-
Create an empty archive file using PI SMT or the piarcreate utility.
-
Type pidiag -ar and register only the new empty archive.
-
There are two options for fixing the snapshot:
-
If the erroneous future data can be discarded, start PI Snapshot Subsystem with flag as described in Recover from future times in the snapshot.
-
Otherwise, keep the current file, and after the system startup, delete or edit individual values using the piconfig utility, as explained above.
-
-
Start the Data Archive server in base mode:
pisrvstart -base
This starts only the minimum required subsystems: PI Network Manager, PI Message Subsystem, PI License Manager, PI Update Manager, PI Snapshot Subsystem, PI Archive Subsystem, and PI Base Subsystem.
-
Register all the old archive files except for the previous primary, which contains future data.
-
Examine the unregistered archive file header to confirm the time boundaries of the various archives involved before using offline archive processing to merge archives:
-
To look at the header of an unregistered archive:
pidiag -ahd
-
To look at registered archives:
piartool -al
-
Create a new primary archive using the piartool -ac command.
-
Specify a start time before any events that might be coming in. Specify the end-time as *.
This instructs PI Archive Subsystem to register the new archive as primary archive. The start time specified must account for all buffered data. If you are unsure, set the start time well before the time the problem was first encountered.
-
If necessary, use offline archive processing later to merge this data with existing archives.
-
Verify that the PI System is running correctly. Reconnect the server to the network.
-
Reprocess the old primary archive using the offline tool to filter out the future data, or correct the archive's time by the required difference.
-
Reprocess the event queue into an archive file and correct time stamps as required.
-
If desired, combine two archives: the old primary and the result of the event queue.
-
Register the corrected archive file.