If you work with Aspel COI and when trying to compact or repair the database you see an error message like “Error compacting the database”, “Cannot repair the database”, or the process stops without completing, this guide explains exactly why it happens and how to fix it without losing your accounting data.

The Error

The error when compacting or repairing the database in Aspel COI typically appears in these situations:

  • When accessing Tools > Database Maintenance > Compact or Repair
  • During the annual accounting period-close process
  • When the system has gone a long time without maintenance and the database is fragmented
  • When trying to recover system performance after noticing general slowness

The most common error messages users see are:

  • Error compacting the database. Verify that no users are connected.
  • Cannot complete the repair operation. Database in use.
  • Borland Database Engine error: access denied to .DB file
  • The process starts but stops at 30%, 50%, or 70% with no clear error message

In all these cases, the maintenance process does not complete and the database is left in an inconsistent state that can cause additional problems if not addressed.

Root Cause

The error when compacting or repairing the Aspel COI database can have several root causes:

Active users during the process. This is the most frequent cause. Compaction requires exclusive access to the database files. Any open session — even one running in the background or a forgotten terminal services session — will lock the files and prevent the process.

Insufficient disk space. During compaction, the Paradox engine (BDE) creates temporary files the same size as the original database. If the disk does not have enough space — at least twice the current size — the process fails halfway through.

Insufficient permissions on the data folder. If the Windows user running COI does not have full write permissions on the folder where the .DB files reside, the compaction process cannot create the necessary temporary files.

Corrupt .DB or .PX files. Prolonged fragmentation or an abrupt system shutdown (power outage, forced application close) can leave .PX index files or .DB data files in an inconsistent state. In these cases, a repair must be run before compaction.

Antivirus blocking real-time operations. Some antivirus programs intercept mass read/write operations on Paradox files and interrupt them as suspicious.

Database larger than 2 GB. Very large databases in Paradox format can exceed the BDE engine’s limits, causing errors during maintenance operations.

Step-by-Step Solution

Follow these steps in order. Do not skip the initial backup.

Step 1: Create a full backup before any operation.

Go to Tools > Backup inside Aspel COI and generate a complete copy. Save the file to an external location (USB drive, network share, cloud). If the repair process fails and damages the database, this backup is your only guarantee of recovery.

Step 2: Disconnect absolutely all users.

From COI as administrator, go to Tools > Connected Users to see who has active sessions. Ask all users to close COI on their workstations. If a machine is unresponsive, you can end the process from Windows Task Manager on that machine (look for the process COIW.EXE or COI.EXE).

If you use the network version, also verify on the server that no COI processes are running:

tasklist /fi "imagename eq COIW.EXE"

Step 3: Verify free disk space.

Navigate to the folder where COI files reside (typically C:\Program Files\Aspel\COI X.X\Data\ or C:\Aspel\COI\). Check the total size of the .DB files and ensure the disk has at least twice that amount of free space.

Step 4: Verify folder permissions.

Right-click on the COI data folder, select Properties > Security, and confirm that the Windows user running COI has Full Control permissions. In network environments, also verify the shared folder permissions.

Step 5: Temporarily disable the antivirus.

Before running maintenance, disable the antivirus or add the COI data folder as an exclusion. Remember to re-enable it immediately when done.

Step 6: Run Repair first, then Compact.

Open COI as administrator and go to Tools > Database Maintenance > Repair. Wait for the process to finish completely — it can take several minutes depending on the database size. Do not close the application or perform other operations during the process.

Once the repair completes successfully, go back to Tools > Database Maintenance > Compact and wait for the success confirmation.

Step 7: Verify data integrity.

When done, browse through some recent ledger entries and journal entries to confirm the information is correct. Then allow other users to log in.

Alternative Solution

If the steps above do not resolve the error, you can try the maintenance directly with Borland Database Desktop (included with the BDE engine):

  1. Completely close Aspel COI on all workstations
  2. Open Database Desktop (typically at C:\Program Files\Common Files\Borland Shared\Database Desktop\DBD32.EXE)
  3. Go to Tools > Utilities > Repair and select the .DB file that is causing the problem
  4. Repeat with Tools > Utilities > Restructure if the repair is not sufficient

This tool operates directly on the Paradox files without going through the COI interface, which can bypass some system-level locks.

If the database is severely damaged and no repair works, the last resort is to restore the most recent backup via Tools > Restore in COI, and then manually re-enter any journal entries made since the backup date.

Prevention

To prevent this error from recurring:

  • Compact monthly. Schedule a database compaction at the end of each accounting month when fewer users are active.
  • Automated daily backups. Configure an automated nightly backup using Windows Task Scheduler to run COI’s backup option.
  • Orderly system shutdown. Ensure all users close COI properly before shutting down the server. Abrupt shutdowns are one of the main causes of Paradox file corruption.
  • Monitor disk space. Always keep at least 20% free space on the disk where the database resides.
  • Exclude the COI folder from antivirus. Add the data folder as a permanent exclusion in your security software.
  • Update COI regularly. Newer versions of Aspel COI include improvements in database handling and stability fixes.

Connection error 503 in Aspel COI (EAccessViolation). If after the repair an access violation error appears when trying to connect, there may be a problem with the BDE server configuration files. See the guide on Connection Error 503 in Aspel COI.

Error closing the annual accounting period. A damaged database frequently also causes errors during the annual period-close process in COI. If the error occurs in that context, see the guide on Error Closing the Annual Accounting Period in Aspel COI.

BDE engine error in Aspel SAE. The same Borland Database Engine is used in SAE and can present similar errors. See Error Starting the Borland Database Engine in Aspel SAE.

Backup and restore error in Aspel SAE. If you also manage Aspel SAE and have similar backup issues, the guide on Backup and Restore Error in Aspel SAE covers equivalent cases with solutions applicable to COI.

Summary

  • The error compacting or repairing the Aspel COI database is mainly caused by active users, insufficient disk space, missing permissions, or corrupt Paradox files
  • Always perform a full backup before any maintenance operation
  • Disconnect all users before compacting or repairing — even a forgotten session locks the process
  • The correct order is: Repair first, Compact second
  • Temporarily disable the antivirus during the maintenance process
  • Compact the database at least once a month to maintain optimal performance
  • If the repair from within COI fails, Borland Database Desktop is a low-level alternative