Skip to main content

Shrink the database

This maintenance compresses the database of the file. It writes the data of the tables again by a method you choose, then shrinks the database files to release the space they do not use. It does not change your data. This page explains how to run it. Every field and message is in Update files and shrink database.

Before you begin​

  • Take a backup of the file (Back up a company file). The wizard does not ask for a backup, and the list shows it inside the warning frame "This operation is dangerous …".
  • Ask the other users to leave the file. The program reserves the file for you alone while the Files Maintenance window is open (Run files maintenance).
  • You need the Files Maintenance permission, which guards the Files Maintenance window (Run files maintenance). The program checks no permission of its own for this operation when you run it from the window. Its desktop tile shows only for a user who has a permission of the same name on the Operations page of Users Management.
  • Allow a long time for a large file, because the window as it opens rebuilds every table before the shrink.

Steps​

  1. Click File, then Tools, then the large part of the Files Maintenance button. If a message asks you to close the open windows, click Yes.

  2. In the list, click Shrink Database, then click Run.

  3. Read the sizes table: Database Size, Free Space, Data Size, Index Size and Unused Space. The last line of the table gives the unit, megabytes or gigabytes.

  4. Decide what the program writes again before the shrink:

    • To shrink the files only, clear Modify Data Alignment Method. The Alignment method list is disabled.
    • To rebuild the tables with no data compression, leave the box ticked and the list on Without. This is the setting when the window opens, and it removes any earlier compression of the data.
    • To compress the data, choose Row or Page in the list, then clear the box and tick it again. The program reads the method when you click the box, not when you change the list.
  5. Click Start. The program does not ask for confirmation before it starts. Cancel is disabled during the run, so you cannot stop the operation.

  6. Wait for the message "Operation successfully completed" and click OK. A "New Sizes" window then shows the database, the space available, the sizes of the data and of the indexes, and the size available. Click Close Window.

  7. Click Close in the Files Maintenance window so that the program releases the file.

Result​

The database files shrink, so they take less space on the disk if they held unused space. If the box stayed ticked, the tables are rebuilt by the chosen method and today's date is recorded in the file as the date of the last shrink. Compare "New Sizes" with the sizes table you read in step 3: the values have two decimals and the same unit, and the unit is not written in the message.

If something goes wrong​

MessageWhy it appearsWhat to do
The files are in exclusive mode, you can't log on to the files now.Another user works on the same file in exclusive mode.Wait until that user finishes, then try again.
An error was encountered while performing the operation.The shrink command or the rebuild of the tables failed in SQL Server.Check that nobody else is working on the file, then try again. If the error repeats, contact technical support.
Operation successfully completedThe shrink finished.Click OK, then read "New Sizes".

This page applies to alameen ERP 10, version 10.1.79.764.