IMD SolutionComputing LibraryShop main store

Troubleshooting

Historian gaps after copying history blocks between servers

Edge computing and IIoT Published 6 min read

Short answer

When every tag loses the same whole 24-hour intervals after a block copy, the data is almost always present and the destination index is stale. Count the destination's blocks against the days covered; if the count matches, rebuild the historian index per the documented procedure before you drop and recreate the database.

On this page
  1. Read the gap pattern first
  2. Prove the gap is in retrieval, not the display
  3. Counting blocks for a June-to-December 2024 copy
  4. Rebuild the index before you rebuild the database
  5. When to drop and recreate the destination database
  6. What to do, in order
  7. Questions asked

Rebuild the destination historian's index. Whole-day gaps that line up across every tag after a block copy are a retrieval fault, not lost data: the block files hold the raw samples, the source still trends the same intervals, and the destination's internal index has not registered what was copied. In the reported case the blocks were visible in SMC/OCMC while queries returned NULL for the affected days, and rebuilding the index restored them. Count the destination's blocks first; if coverage is complete, rebuild the index before you touch the database. If the end goal is one server holding blocks from two historians, the rules for combining them are covered in merging two historian servers' history blocks without tiering; this article is about why copied blocks that are visible still return nothing.

Read the gap pattern first #

A trend depends on the tag binding, the historical query, the historian's tag metadata and block index, and the stored samples. The shape of the missing data picks the layer:

What you see Where the fault sits What settles it
One tag missing, others complete Tag selection, binding, or per-tag history Query that one tag directly for the same interval
Several tags lose the same whole-day intervals Shared block retrieval or indexing Compare gap boundaries with block boundaries and the block inventory
The gap fills in below a 12 h window Display sampling or aggregation Query the shorter interval directly
The gap persists at 12 h or less Missing query results Continue to the block and index checks
Blocks listed in SMC/OCMC, queries return NULL Index not reflecting the copied blocks Rebuild the index

In the reported case the gaps were exactly one block long — 24 hours in that installation — and aligned across every tag. No binding or metadata fault produces synchronized day-shaped holes in every trace at once; a shared block-access layer does. A migration reported between 2023 R2 P01 and 2023 SP1 produced the same signature and was fixed by re-indexing alone.

Keep live collection out of this diagnosis: current values arrive through the driver, historical values come from the blocks. A block or index repair will not fix missing live values, so treat that separately. A different signature — overnight holes after a restart rather than after a copy — is a different fault, covered in fixing AVEVA Historian overnight data gaps after restart.

Prove the gap is in retrieval, not the display #

  1. Pick one missing day and the adjacent good day on the destination trend. Record the server, tag name, start time, end time, and retrieval mode, and check the client's time-zone setting so both servers are compared over the same interval.
  2. Zoom to a window of 12 h or less inside the gap. The reported gaps stayed visible at that scale, which rules out wide-range display sampling.
  3. Query historical values directly on the destination for a period inside the gap. Valid samples, NULL values, and no returned rows are three different outcomes — record which one you get.
  4. Run the identical query on the source and keep the result as the reference for the repair.
  5. Repeat with two or three more tags and with the good day, and note whether the missing start and end times align across tags.
  6. Compare those boundaries with the destination's block inventory. A boundary that lands on a block edge, on every tag, is the indexing pattern.

If the source returns values and the destination returns NULL or nothing over a block-sized interval, the fault is in the destination's block access — continue below. If direct destination queries return valid samples while the trend stays blank, stop: the problem is in the viewer's binding or retrieval settings, and no historian repair will change it.

Counting blocks for a June-to-December 2024 copy #

Inputs: the copy window is 1 June 2024 through 31 December 2024 (the reported transfer); each history block in this installation covers 24 h (the gaps measured exactly one block, 24 hours); the second batch was described as about 150 blocks (the transfer notes). Blocks are subfolders of the storage location — the circular location here — in a proprietary file format holding the raw tag data.

The rule: expected blocks = days in the window x 1 block per day.

30 + 31 + 31 + 30 + 31 + 30 + 31 = 214 days in the window. 214 days x 1 block/day = 214 blocks for full coverage.

The described 150 is 64 blocks short of that. Either the description is approximate or part of the window never arrived — the inventory decides, not the transfer notes. For scale, January 2025 has 31 days, so the first batch's 30 blocks was already one light on paper.

Decision: count the destination's storage location for the window. At 214 covering blocks with whole-day gaps persisting, the data is present and the fault is retrieval — rebuild the index. Below 214, finish the copy first: a shortfall of one block is one missing day, and an index rebuilt over an incomplete set is rebuilt incomplete.

Rebuild the index before you rebuild the database #

The internal index is what locates historical data inside the blocks. The rebuild procedure is documented in the Historian Administration Guide, 2023 release, pages 172-173, and the same procedure is described in InSource technical note TN1286. Run it in a maintenance window with the full block set already in place, because the rebuild regenerates the index from the blocks that are present.

The order, by what each step changes:

  1. Verify coverage — the count above. It separates an incomplete transfer from an access fault before you change anything.
  2. Rebuild the index. It is the documented repair for blocks that are visible but return NULL, it was the confirmed fix in the reported migration, and it touches neither the database nor the tag configuration.
  3. Drop and recreate the database only if retrieval is still wrong after the rebuild, as a planned recovery with the full block set imported in one pass.

One safety note before any database work: keep a verified copy of every block file and an export of the tag configuration — the drop discards the tag database along with everything else in it.

When to drop and recreate the destination database #

Two conditions justify it: the index rebuild has completed and covered blocks still return NULL, or a clean migration was scheduled anyway. The reported recovery moved the full block set out of the circular storage location, dropped the database, recreated it, and brought a few years of blocks back in a single pass — gap-free. That recovery changed two things at once, database state and import sequencing, so its success does not say which one mattered; that is why it ranks behind the index rebuild, which changes one thing.

Sequence it as: stop the historian, stage the complete block set, drop and recreate the database, restore or re-add the tags, import the full set in one pass, then verify the previously missing day against the saved source query. A vendor support case on blocks copied from 2017 U3 to 2023 turned on the same reindex behavior, so a cross-release copy does not change this order.

What to do, in order #

  1. Every tag loses the same whole days, the source trends them, the destination returns NULL — rebuild the destination index per the Administration Guide, 2023 release, pp. 172-173.
  2. The destination's block count is short of the day count — finish the copy, recount, then rebuild the index if gaps persist.
  3. The rebuild ran and retrieval is still wrong — planned database recreation with the full block set in one pass, tags restored, verified against the source query.
  4. Only some tags gap, or the gaps close below a 12 h window — fix bindings and display settings; this is not a block fault.

Questions asked

Does copying fewer blocks per transfer prevent the gaps?

No batch-size limit is documented for this fault, and none emerged in practice: the historian was stopped while each batch was added, and the gaps still appeared. The recovery that ended gap-free imported a few years of blocks in a single pass. Control the index state, not the batch size.

Where is the index rebuild documented?

The Historian Administration Guide, 2023 release, documents the rebuild on pages 172-173, and InSource technical note TN1286, Rebuilding Historian Index, describes the same procedure. Run it against the destination once the block count checks out, with a verified copy of the block set in hand.

Why do blocks show in SMC or OCMC but return NULL?

The console listing proves the historian recognizes the block files; retrieval still has to resolve each sample through the internal index that locates data inside those blocks. When the index does not reflect what was copied, covered days return NULL. A reported migration between 2023 R2 P01 and 2023 SP1 showed exactly this and was fixed by the rebuild.

Will dropping the database lose anything besides the blocks?

Yes: the destination database carries the tag configuration the historian resolves queries against. Export that configuration and keep a verified copy of every block file before the drop; after recreating the database, restore or re-add the tags, then bring the full block set in during a single stopped-historian window.

Do the source and destination versions need to match?

Not the deciding factor here. The re-index fix was confirmed on a move between 2023 R2 P01 and 2023 SP1, and a vendor support case describes the same reindex problem on blocks copied from 2017 U3 to 2023. Cross-release or same-release, the repair order holds: verify coverage, rebuild the index, rebuild the database last.

Keep reading

  • How-to

    Merge two historian servers' history blocks without tiering

    Yes — consolidate the two archives on one server by copying every history block that exists on only one server into the other's archive, repairing internal TagID lookup with the source taginfo.dat where names match but history stays missing, and moving any day both servers cover through CSV export and import. The destination should run the same historian release as the source or newer, 2017 or later.

    Edge computing and IIoT

  • How-to

    Move an Ignition historian database with pre-copied partitions

    Yes, the drop-and-restore plan works, but the safer route pre-copies the whole database to the new server and moves only the sqlth_* metadata and the partitions still being written at cutover. Store-and-forward buffers history writes through the switch, so downtime is a delta copy and the history never has a hole.

    Edge computing and IIoT

  • Troubleshooting

    Fix AVEVA Historian overnight data gaps after restart

    Overnight trend gaps that fill after a restart are delayed snapshot merges, reported on AVEVA Historian 2023 P01 through P04, not lost data. Create the DWORD UseFileCacheForRetrieval, set it to 0 under HKEY_LOCAL_MACHINE\SOFTWARE\ArchestrA\Historian\Programs\aahStorage, restart the Historian server once, and the window stays populated.

    Edge computing and IIoT