Skip to main content
mvlasak
Staff
Staff
March 12, 2026

Technical Tip: How to fix malformed device database when pragma integrity_check fails

  • March 12, 2026
  • 0 replies
  • 283 views
Description

This article describes how to resolve an issue where the FortiManager device database integrity check fails with a pragma integrity_check device db error, indicating device database corruption that may affect device visibility or management within FortiManager.

Scope FortiManager v7.4.x/v7.6.x.
Solution

Symptoms:

Running the following command reports a failure in the device database integrity check:

 

FMG # diagnose pm2 check-integrity all

Example output:

--- pragma integrity_check adom db ---
--- total: 18 ok.
--- pragma integrity_check device db ---


pragma integrity_check fails: /var/pm2/devdb195 -- Page 1811: never used

>>> total: 19 failed: 1
--- pragma integrity_check global db ---
--- total: 2 ok.
--- pragma integrity_check ips db ---
--- total: 10 ok.
--- pragma integrity_check task db ---
--- total: 1 ok.
--- pragma integrity_check ncmdb db ---
--- total: 21 ok.

This indicates corruption in the device database associated with a specific device ID (for example, 195).


Cause:

The device database file (/var/pm2/devdb<ID>) is malformed or corrupted, typically due to synchronization or configuration inconsistencies between FortiManager and the managed device.


Solution:

There are a few supported options to resolve device database corruption.
Proceed in order. Option 1 is recommended and sufficient in most cases.

 

Option 1: Reload device configuration (recommended).

Reloading the device configuration rebuilds the device database without requiring device removal.

 

Steps:

  1. Identify the device ID from the error output.

Example: /var/pm2/devdb195 → Device ID = 195.

 

  1. Reload the device configuration:

FMG # diagnose test deploymanager reloadconf <device_id>


Example:

 

FMG # diagnose test deploymanager reloadconf 195

 

  1. Verify database integrity:

 

FMG # diagnose pm2 check-integrity all

 

Result:

If no errors are reported, the device DB has been successfully repaired.

No further action is required.
The device does not need to be deleted and re-added.

 

Option 2: Delete and re-add the device (last resort).

Note: Use this option only if the above Options do not resolve the issue.

 

Steps:

  1. Identify the affected device using:

 

FMG # diagnose dvm device list

 

  1. In Device Manager, delete the affected device.

  2. Re-add the same device to FortiManager.

  3. Allow synchronization to complete.

  4. Verify database integrity:

     

FMG # diagnose pm2 check-integrity

 

Result:

The device database is recreated during re-addition, resolving the corruption.

 

Verification.

Run the following command to confirm all databases are healthy:

 

FMG # diagnose pm2 check-integrity

 

Expected result:

  • All pragma integrity_check entries report OK.
  • No failures are present.

 

Notes:

  • Reloading the device configuration is the preferred and least disruptive method.
  • Deleting and re-adding the device should only be used as a last resort.
  • Always confirm FortiManager is running a supported firmware version before proceeding.