1. General Objective
This Firebird database maintenance tool performs a backup followed by a restore operation. This process optimizes the database by rebuilding indexes and cleaning obsolete records.
The program is designed to operate in two ways:
- An automatic mode that sequentially processes all profiles from an
.inifile. - A manual mode for targeted operations.
2. Execution Modes
The tool offers two distinct modes of operation:
Mode 1: Sequential Maintenance (.ini Logic) This is the main function. The program processes all profiles (e.g., CEPH, KITVIEW) defined in the BacRes.ini file. This mode can be launched in two ways:
- Via Graphical Interface (GUI): By clicking the button “Start All Maintenance”. The interface displays the list of profiles, progress, and a real-time log.
- Via Command Line (CLI): By running the program with the
cliargument. This silent mode is designed for automation (e.g., via Windows Task Scheduler).
Mode 2: Manual Task (GUI only) For specific operations, a “Manual Task…” button opens a dedicated window. This mode allows the user to:
- Manually select a database file (
.fdb) not listed in the INI. - Choose to perform a security backup (permanent, timestamped) before starting maintenance.
- Run the same full maintenance cycle (stop service, maintenance, restart service) on this single file.
3. Configuration via BacRes.ini File
The tool’s configuration relies on the BacRes.ini file, which must be located in the same folder as the executable.
- Profiles (e.g., [CEPH]): Each section is a profile to process and must contain
BDD_PATH(path to the.fdb) andBACKUP_PATH(folder where maintenance backups will be created). - [SETTINGS] (Optional): Allows defining the language (
language=froren). - [CLIENT] (Optional): Contains information (number,
id_licencia) used for error reports via email.
4. Maintenance Process Flow
Whether maintenance is launched for all profiles (Mode 1) or for a manual task (Mode 2), the process is as follows:
- Global Stop (Once): The script checks and stops the
KitviewProxyServiceorKitProxySrv.exeprocess to free database access. - Processing Each Database:
- Step A (Verification): Database state is checked with
gstat. If already in “maintenance” mode, the script skips the next step to avoid errors. - Step B (Disconnection): If the database is active,
gfixis used to switch it to maintenance mode and force disconnection of all network users. - Step C (Security Backup – Manual Mode only): If selected, a security backup (
.safety_DATE.fbk) is created in the database folder. - Step D (Maintenance): The
gbakcycle (temporary backup followed by restoregbak -c -rep) is executed. - Step E (Cleanup): The temporary backup file used for maintenance is deleted.
- Step A (Verification): Database state is checked with
- Global Restart (Once): Once all operations are complete, the service or process stopped in step 1 is restarted.
5. Logging and Error Reports
- Logging: All operations are recorded (in “append” mode to preserve history) in the
maintenance_log.logfile, located in the same folder. - Failure Notification: If a critical step fails (in GUI or CLI mode), the program automatically sends a notification email. This email, written in the defined language, includes the
[CLIENT]information and attaches the fullmaintenance_log.log(renamed as.txt) for immediate analysis.
6. Prerequisites
- Privileges: The program requires administrator rights to manage Windows services (
net stop/start). - Dependencies: The tool must be able to locate the executables
gbak.exe,gfix.exe, andgstat.exe. It automatically searches for them in the standard Firebird installation paths (v2.5, 3.0, 4.0).
Comments
0 comments
Please sign in to leave a comment.