Error: Failed to alter spatial reference. The dataset already has a projection defined.
Defining the spatial reference of a raster dataset, not already defined, using the Define Projection tool returns the error:
"Failed to alter spatial reference. The dataset already has a projection defined. Failed to execute."
The image is being used by ArcMap. An AUX file is created for an image when it is added to ArcMap. The Define Projection tool reads the AUX file and returns the error even though the AUX file does not contain a projection definition.
Solution or Workaround
There are six options to work around this issue.
Use the ArcToolbox Define Projection tool when the image is not being used by ArcMap.
Use the ArcToolbox Define Projection tool in ArcCatalog.
Use the ArcToolbox Define Projection tool, but instead of selecting the input dataset from the drop-down list, use the Browse button on the tool to navigate to the file.
Use ArcCatalog to open up the layer properties and edit the spatial reference of the file.
If errors are received during the execution of a geoprocessing script make sure the file is not in use by ArcMap/ArcCatalog.