FortiAnalyzer
FortiAnalyzer can receive logs and Windows host events directly from endpoints connected to EMS, and you can use FortiAnalyzer to analyze the logs and run reports.
Pedro_FTNT
Staff
Staff
Article Id 281765
Description This article describes how to solve the error  'Failed to connect to database' to all SQL Database ADOMs.
Scope FortiAnalyzer.
Solution

There are many possible symptoms of the message, 'Failed to connect to database', such as problems viewing logs, problems viewing information in FortiView or Log View, incorrect information from Devices. This behavior could affect all ADOM's.

 

  • Running 'execute tac report' or diagnose commands one by one:

 

diagnose sql process list

Failed to connect to database.

 

diagnose sql hcache status all

auto-cache order: oldest-first

 

ADOM: FortiAnalyzer (FAZADOM108)
========================================

Hcache Statistics
--------------------------
Failed to connect to database.
Hcache Tbl Size | 0.0KB


ADOM: FortiAuthenticator (FACADOM124)
========================================

Hcache Statistics
--------------------------
Failed to connect to database.
Hcache Tbl Size | 0.0KB


ADOM: FortiCache (FCHADOM112)
========================================

Hcache Statistics
--------------------------
Failed to connect to database.
Hcache Tbl Size | 0.0KB

 

diagnose sql hcache status all-summary

 

auto-cache order: oldest-first

All ADOM Summary
========================================

Hcache Statistics
--------------------------
Failed to connect to database.
Hcache Tbl Size | 53.4GB

 

  • A quick and normally unique solution is Disk Revision and Database Rebuild in this sequence.
  • Remember, before any change: Backup FortiAnalyzer Configuration and Backup Logs

 

  • To Disk Revision:

diagnose system fsck harddisk  <----- Require restart.

 

  • To Rebuild database:

execute sql-local rebuild-db   <----- Require restart.

  

  • After completing both process it is possible to review the correct Database Information:

 

137.png

 

  • If after performance this procedure continues with issues, create a Ticket to the Fortinet TAC Support Team
  • Attach into the Ticket: Backup configuration file and diagnose command 'exe tac report'.

 

Related documents:

Saving Diagnose Commands.

FortiAnalyzer Rebuild Database.

Backup and restore of FortiAnalyzer settings, logs and reports 

Contributors