Share this Page URL

Chapter 18. Maintaining an Access Databa... > Compacting and Repairing a Database - Pg. 618

Maintaining an Access Database 618 Compacting and Repairing a Database An Access database file becomes fragmented as you add and delete data and modify the design and number of database objects. ( A fragmented file is one that is not stored in adjacent blocks of computer memory, a situation that can be inefficient when retrieving the file from memory.) When a database file is fragmented, the database's records are not stored in a sequence that allows the data to be accessed most efficiently and the file's size increases as well. One step you can take to keep a database working smoothly is to compact the file as part of your standard maintenance routine (which should also include tasks such as backing up the database). Compacting a database addresses the loss of efficiency by reorganizing the records and storing the file in memory in a more optimal fashion. In addition to the problems that might arise from a fragmented file, a database and database objects can become corrupted. A database stored on a network server can become corrupted if the network experiences problems, for example. When Access opens a database file, it can often determine whether the file has been corrupted. Other times, if a file behaves unexpectedly, you can repair the file by using the Compact And Repair Database command. Problems with compacting and repairing When Access compacts a database file, it creates a temporary backup copy of the file. If you don't have enough space on the hard disk for both the original and the compacted version of the database, you'll see an error message. You need to create more disk space (by removing files you don't need, for example) and run Compact And Repair Database again. You might also experience problems compacting and repairing a database if you don't have the permissions you need. To compact a database, you need to have both Open/Run and Open Exclusive permissions for the database. You'll learn about levels of database permission in Chapter 19. If a database is being used by more than one person, all users of the database must close the database before it can be compacted. Also be sure that the database is not located on a read-only share on a network and that