English

How To: Salvage a damaged ArcView project file

Summary

Instructions provided describe how to salvage a damaged ArcView project file. A project file may get corrupted by system crashes, or by operations that yield one of these errors: Segmentation Violation, Floating Point Exception, Invalid Operation, or Invalid Page Fault. The causes for such situations are varied and are beyond the scope of this document.

Procedure

Given that the extent of the damage to the project file is unknown, as it varies from case to case, there are various options that may pursued to attempt recovering a damaged project file.
 

Before attempting the recovery process:

Warning:
Make a copy of the damaged .apr file under a different name. This backup copy may be needed to revert to if some of the recovery options do not work.

Keep in mind that an .apr file is a type of ODB file (object data base), and so it can be opened and changed using a such as Notepad, WordPad in Windows, and textedit or vi in UNIX.

Basic recovery:

Import damaged project into a new project.
  1. Select Import from the Project menu; if it opens, the task is complete.
  2. Save this project to a different file name.

Data-oriented project repair:

If the basic recovery process does not work, it may be that the project file has corrupt data or wrong data definitions. It is necessary to identify and replace any corrupt data or wrong data definitions.
  1. Open the .apr file in a text editor.
  2. Use the editor's Find and Replace option to change the drive letter of all the data sources in the project.
For example, if all the data is on drive c:\ and a network is on drive f:\, replace c:\ and f:\ with a non-defined letter (z:\).
  1. Open the .apr file in ArcView.
If ArcView cannot find a dataset, it prompts the user find it. Click Cancel All at that point.

If the project opens, some of the data sets or the references to the data sets are corrupt. It is necessary to use a process of elimination to determine which data set is corrupt:
  1. Open the .apr file in a text editor and search for the string 'Path:'.
Each object referenced by this string is a FileName object, which provides the source name for the data file. When searching for all occurrences of 'Path:', the text lines appear as such:
 (FN.958
Path: "c:/ /sample.shp"
  1. Use a textfile, or a piece of paper, to create a list of all data sources, skipping duplicate definitions.
  2. Do a project repair on each data source to determine which data ArcView is unable to find (refer to page 46 in "Using ArcView GIS" book).
For example, assume that the project file contains the following data paths:
c:/gisdata/pop_90.dbf
c:/gisdata/county.shp
c:/gisdata/images/backgrnd.tif
Find and replace the pop_90.dbf string with something like 'testing'. When ArcView reads the FileName object referring to 'testing', it pauses and asks the user to find 'c:/gisdata/testing'.
  1. Click Cancel if ArcView displays a prompt to find the data source.
  • If the .apr file opens successfully, there is something wrong with that data set or a reference to that data set. Save the project without the corrupt data set.
  • If the project still does not open, test each data set until the set or sets are found that are keeping the project from opening.

Document-oriented project repair:

If, after removing all the data sets from the project, it still does not open, it is likely that there is a corrupt document object. To determine if there is a bad reference in the document list, again, it is necessary to use the process of elimination.
  1. Restore the .apr file from the backup copy you made earlier.
  2. Open it in a text editor. The top of your .apr file should look like this:
/3.0
	(ODB.1
	FirstRootClassName: "Project"
	Roots: 2
	Version: 30
	)
	
	(Project.2
	Name: "proj1.apr"
	CreationDate: "Thursday, June 12, 1997 07:10:01"
	GUIName: "Project"
	Win: 3
	CSMgr: 4
	VisGUIWidth: 70
	Doc: 5
	Doc: 177
	Doc: 143
	Doc: 187
	Doc: 39
	ActiveDoc: 187
	Buttons: 378
	Buttons: 379
	Buttons: 380
	Dependencies: 381
	Scripts: 382
	WorkDir: 1178
	WinX: 11
	WinY: 4
	WinW: 852
	WinH: 594
	SerialNumber: "#######"
	SelColor: 1179
	GUINames: 1180
	GUINames: 1181
	GUINames: 1182
	GUINames: 1183
	GUINames: 1184
	GUINames: 1185
	GUINames: 1186
The object of interest is 'Project.2,' which contains this list of document objects:
Doc: 5
Doc: 177
Doc: 143
Doc: 187
Doc: 39
ActiveDoc: 187
  1. Delete all but one of the document references. It is recommended that you keep the very first document in the list. If you have an Active Document, you need to delete that one as well.
  2. Save the project.
  3. Open it in ArcView.
    • If the project opens, you will most likely be able to salvage most of the project.
    • If it does not open, use a process of elimination on groups of documents to indentify the documents that are causing the project to crash.¬†Take notes so you do not lose track of the documents you will be eliminating. When you remove a group of documents and the project opens, you will know that one or more of these documents that you eliminated are corrupt. If the project does not open, then you can assume one of the documents you left in the .apr file is causing it to crash. Use the editor's Undo function to restore the document references that were previously deleted, or restore the entire .apr file from the backup made earlier. Select a group of documents to eliminate and continue testing documents until you are certain that none of them are corrupting your project.
Once the corrupt documents are found, remove them, save the project, reopen it, and re-create those documents.

Miscellaneous recommendations:

It is possible to keep the .apr file open in the text editor while running the above tests. If using a Windows platform, and unfamiliar with text editor, memorize these key sequences: After recovering the project, whether completely or partially, it is highly recommended that the user makes and maintains a backup copy of it during the normal course of work. It may be necessary to revert to it in the eventuality that the main file becomes corrupt again.
  • Ctrl+Z will Undo the last edit
  • Ctrl+F is the shortcut to Find (except in Notepad)
  • Ctrl+H is the shortcut to Find and Replace (except in Notepad)
  • Esc dismisses a window

Related Information