Technical Tip: How to fix malformed device database when pragma integrity_check fails
| 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: 19 failed: 1 This indicates corruption in the device database associated with a specific device ID (for example, 195).
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.
There are a few supported options to resolve device database corruption.
Option 1: Reload device configuration (recommended). Reloading the device configuration rebuilds the device database without requiring device removal.
Steps:
Example: /var/pm2/devdb195 → Device ID = 195.
FMG # diagnose test deploymanager reloadconf <device_id>
FMG # diagnose test deploymanager reloadconf 195
FMG # diagnose pm2 check-integrity all
Result: If no errors are reported, the device DB has been successfully repaired. No further action is required.
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:
FMG # diagnose dvm device list
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:
Notes:
|
