Managing file geodatabases, including copying, renaming, and deleting data, should always be performed with ArcGIS and not with Windows Explorer. The tools in ArcGIS ensure that no data loss or other problems occur.
Since file geodatabases appear as a folder of files in Windows Explorer, people sometimes attempt to use the commands available in Windows Explorer with file geodatabases. Other than setting permissions on the folder to control access, Esri does not recommend you use these Windows Explorer commands. This topic provides some background as to why you shouldn't rename, delete, or copy file geodatabases and their contents or remove lock files using Windows Explorer.
File geodatabase files in Windows Explorer
A file geodatabase is stored as a folder of files. When you view the folder with Windows Explorer, apart from the .gdb extension, it looks like any other folder, and you can view its contents. The folder contains cryptically named files that hold geographic data, attribute data, index files, lock files, and a signature file, as well as other files. Each feature class or table in the geodatabase is stored in two or more files. By design, it is difficult, if not impossible, to tell which files make up any given dataset.
File geodatabases do not have authentication or authorization capabilities. You cannot control access to individual datasets by modifying the permissions of individual files within a file geodatabase folder.
However, you can share a file geodatabase folder as read-only with Windows Explorer. In this case, the read-only user can display and query but not edit the data. Also, users with write access can modify the data while others are reading it. When those reading the data refresh their map display, any changes saved by other users are updated in the ArcGIS client session of the reading user. Refresh never brings in unsaved edits, so it is not possible for a user to read changes made by another user that have not been saved. If you want to prevent other users from accessing data while you are editing it, unshare the folder before modifying the data.
Rename and delete
In file geodatabases, it is not possible to use Windows Explorer to perform an operation on an individual dataset. Renaming and deleting individual files in a file geodatabase folder and copying files to another location cause data loss and can render the geodatabase unusable. For example, if you use Windows Explorer to move files to another geodatabase folder, you won't be able to access the data. The contents of a file geodatabase folder are given cryptic names by design to discourage such operations. Operations on individual datasets can only be performed through ArcGIS.
Operations at the geodatabase level should also be performed solely through ArcGIS. However, it is possible to rename or delete the file geodatabase folder except in the following cases:
- You cannot rename or delete the geodatabase folder at the same time another user is accessing the data from any client.
- Do not rename or delete a file geodatabase folder if the file geodatabase is saved in any ArcGIS Pro project.
Just like when you work with other types of files, it is a good idea to regularly make a backup copy of your file geodatabase in case something goes wrong.
Although not recommended, it is possible to copy a file geodatabase to another location by copying the folder to another location. Only copy a file geodatabase with Windows Explorer when you are certain there are no other processes accessing the data. The problem is that it can be difficult to tell whether other processes are accessing the data. You might think there are no other processes; however, a process on your computer or another one could be accessing it. If you happen to copy the folder when another process is accessing the data, the data may not copy properly. An improper copy operation is often not apparent—you might not notice any problems until you access a certain part of the new copy a few days later.
Due to this uncertainty and the potential to corrupt the file geodatabase, Esri recommends you do not use Windows Explorer to copy a file geodatabase.
Remove lock files
ArcGIS ensures data integrity by preventing multiple processes from simultaneously accessing data in conflicting ways. ArcGIS keeps track of processes by placing *.lock files in the file geodatabase folder each time a process accesses a dataset. When the process terminates, its *.lock files are automatically deleted.
When a process ends prematurely or crashes, lock files may be temporarily left behind in the geodatabase folder. ArcGIS eventually removes these files in future sessions as new locks are taken. In the meantime, such files do not continue to lock data, and as they take up no disk space, removing them provides no benefit.
The Compact geoprocessing tool and the copy and paste operations also delete unused .lock files. The Compact tool removes all inactive lock files as part of the compacting process. Copying and pasting a file geodatabase removes all inactive lock files from the source geodatabase before copying data to the new geodatabase.