File geodatabases and locking

If you are the sole user working with a dataset in a file geodatabase and are accessing it via one process only, you are able to freely edit or modify its properties. You are also able to delete, compress, or decompress the dataset.

However, if another process is already accessing the data, whether it be a process on your computer or another user's, ArcGIS prevents you from performing any of these operations until the other process has terminated. For example, if you have a feature class displayed in ArcMap and attempt to delete it from the Catalog tree, you will get the following message:

Failed to delete selected object(s)
Cannot acquire a schema lock because of an existing lock.

If you then close ArcMap and try again, you can delete the feature class, provided there are no other processes accessing the data.

When a process accesses a dataset, it locks the dataset, preventing other processes from modifying it. Accessing a dataset also locks additional related datasets as follows:

To keep track of locked datasets, ArcGIS places *.lock files in the file geodatabase folder. When a process terminates, the .lock files associated with it are automatically deleted. In some cases, however, such as when a process ends prematurely, .lock files may be left behind in the geodatabase folder. These .lock files are eventually removed by ArcGIS in future sessions as new locks are taken. They are also removed whenever you run the geoprocessing Compact tool or copy and paste the data in the Catalog tree. In the meantime, these .lock files do not continue to lock data.

Locks are critical for file and process management. However, sometimes it can seem like they get in the way. If you are ever prevented from editing a dataset or its properties or from deleting, compressing, or decompressing, it is because one of the following is happening:

NoteNote:

Just like when you work with other types of files, it is a good idea to regularly back up your file geodatabase in case something goes wrong.


11/18/2013