File geodatabases and Windows Explorer
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.
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.
When you access the folder and its contents with Windows Explorer, several Windows commands are available. Although not recommended, some users attempt to use some of these commands. This topic discusses what operations can and cannot be performed safely with Windows Explorer.
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.
Copying, renaming, and deleting files
While a file geodatabase is analogous to a folder of shapefiles, there are some important differences regarding the use of Windows Explorer.
With shapefiles, it is possible to identify which files make up an individual feature class or table, since the names in Windows Explorer match the names of the datasets when viewed from ArcGIS. Although not recommended, it is possible to rename or delete a shapefile or copy it to another folder with Windows Explorer.
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 perform the following operations safely on a file geodatabase folder:
- Rename the geodatabase by renaming the folder.
- Delete the geodatabase by deleting the folder.
You cannot rename or delete the geodatabase folder at the same time another user is accessing the data.
Although not recommended, it is possible to copy a file geodatabase to another location by copying the folder to another location (if you are using a Windows Vista operating system, you also need to change the extension of the new folder to .gdb; otherwise, ArcGIS cannot recognize it as a file geodatabase). 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.
Removing .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. If you still want to remove them, you can delete them with Windows Explorer. However, exercise caution when doing so—accidental deletion of files other than .lock files can corrupt the data. If you notice that some files cannot be deleted, it is because they are still active—another process on your computer or another one is still accessing the data. You cannot remove these locks until the processes holding them terminate.
The geoprocessing Compact tool and the copy and paste operations, available in the Catalog tree, also delete unused .lock files. The geoprocessing Compact tool compacts the geodatabase, removing all inactive .lock files in the process. Copying and pasting a file geodatabase removes all inactive .lock files from the source geodatabase before copying data to the new geodatabase.
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 ArcMap display, any changes saved by other users are updated in the ArcMap 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.