Unable to register offline geodatabase with arcgis server/feature service

3631
4
Jump to solution
06-19-2014 04:06 PM
ShiminCai
Occasional Contributor III
Hi All,

When registering an offline geodatabase I received this error:

error registering the offline geodatabase: Error Domain=NSCocoaErrorDomain Code=404 "Unable to complete operation." UserInfo=0x1643eb70 {NSLocalizedFailureReason=Replica with GUID ({69487203-7E56-42F5-AEFE-05BF07B6BBD8}) does not exists on the server., NSLocalizedDescription=Unable to complete operation., responseJSON={
    error =     {
        code = 404;
        details =         (
            "Replica with GUID ({69487203-7E56-42F5-AEFE-05BF07B6BBD8}) does not exists on the server."
        );
        message = "Unable to complete operation.";
    };
}, NSURL=http://203.8.108.21/arcgis/rest/services/SPD/SiteBasedPlanning/FeatureServer/createReplica}

I checked the feature service/arcgis server and the replica with that GUID did not indeed exist.

I have two questions here:
    1. How could the replica has gone missing on server? What measures should I take to avoid this happening again?
    2. Besides register and sync offline geodatabase in code, is there any other way to get the data out of the offline geodatabase? Field data collection is very costly and we can't afford to do it again.

Thanks a lot for any help.

Shimin
0 Kudos
1 Solution

Accepted Solutions
DiveshGoyal
Esri Regular Contributor
To get the data out of a stranded gdb, you could write a python script. Something like this -

#. Using ArcGIS Desktop, create a new File Geodatabase (for eg output.gdb) on any location. #. Open the script in an editor and edit the path like the following example: input_gdb = r'C:\temp\input.geodatabase' output_gdb = r'C:\temp\output.gdb' #. Run Script:   #!/usr/bin/python   # Import sys, getopt, arceditor, arcpy modules import sys, getopt, arcpy   def main(argv):    input_gdb = r'C:\temp\input.geodatabase'    output_gdb = r'C:\temp\output.gdb'    try:       opts, args = getopt.getopt(argv,"hi:o:",["ifile=","ofile="])    except getopt.GetoptError:       print 'test.py -i <input_gdb> -o <input_gdb>'       sys.exit(2)    for opt, arg in opts:       if opt == '-h':          print 'test.py -i <input_gdb> -o <output_gdb>'          sys.exit()       elif opt in ("-i", "--ifile"):          input_gdb = arg       elif opt in ("-o", "--ofile"):          output_gdb = arg    print 'Input gdb is: "', input_gdb    print 'Output gdb is: "', output_gdb      Temp_xml = "temp.xml"      # Delete the xml workspace document if it exists.    arcpy.Delete_management(Temp_xml)      # Export XML Workspace Document    arcpy.ExportXMLWorkspaceDocument_management(input_gdb, Temp_xml, "DATA", "BINARY", "METADATA")      # Import XML Workspace Document. This assumes that the outputfile geodatabase is EMPTY.    arcpy.ImportXMLWorkspaceDocument_management(output_gdb, Temp_xml, "DATA", "")      # Delete the xml workspace document if it exists.    arcpy.Delete_management(Temp_xml)   if __name__ == "__main__":    main(sys.argv[1:])

View solution in original post

0 Kudos
4 Replies
DiveshGoyal
Esri Regular Contributor
Can you describe why you are registering the geodatabase?
If you generated the gdb from a sync enabled feature service, it is already registered. You can make edits to it and sync with the service, no need to register again. Only if you make copies of that geodatabase file and wish to sync each copy independently do you need to register the copies.

The server administrator can clear registered geodatabases.
See Unregistering a replica - http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r3000000rs000000#GUID-21969296-A5...
0 Kudos
ShiminCai
Occasional Contributor III
The app has multiple geodatabases and the one a user selects to work on is registered and synced. I tried syncing without registering and the syncGeodatabase method threw the same exception.

I think we figured out why the replica has gone missing on server. There were issues with our arcgis server and feature services and we had been republishing or overwriting the feature services or even might have rebuilt/reinstalled the arcgis server. The replica might have been taken earlier than that...

I'm seeking alternative ways of getting data out of the mobile geodatabase if the geodatabase can't be synced for any reason. In ArcMap a mobile geodatabase can be created via Share As Runtime content... It would be good if the other way around can be done...

Thanks,

Shimin
0 Kudos
DiveshGoyal
Esri Regular Contributor
To get the data out of a stranded gdb, you could write a python script. Something like this -

#. Using ArcGIS Desktop, create a new File Geodatabase (for eg output.gdb) on any location. #. Open the script in an editor and edit the path like the following example: input_gdb = r'C:\temp\input.geodatabase' output_gdb = r'C:\temp\output.gdb' #. Run Script:   #!/usr/bin/python   # Import sys, getopt, arceditor, arcpy modules import sys, getopt, arcpy   def main(argv):    input_gdb = r'C:\temp\input.geodatabase'    output_gdb = r'C:\temp\output.gdb'    try:       opts, args = getopt.getopt(argv,"hi:o:",["ifile=","ofile="])    except getopt.GetoptError:       print 'test.py -i <input_gdb> -o <input_gdb>'       sys.exit(2)    for opt, arg in opts:       if opt == '-h':          print 'test.py -i <input_gdb> -o <output_gdb>'          sys.exit()       elif opt in ("-i", "--ifile"):          input_gdb = arg       elif opt in ("-o", "--ofile"):          output_gdb = arg    print 'Input gdb is: "', input_gdb    print 'Output gdb is: "', output_gdb      Temp_xml = "temp.xml"      # Delete the xml workspace document if it exists.    arcpy.Delete_management(Temp_xml)      # Export XML Workspace Document    arcpy.ExportXMLWorkspaceDocument_management(input_gdb, Temp_xml, "DATA", "BINARY", "METADATA")      # Import XML Workspace Document. This assumes that the outputfile geodatabase is EMPTY.    arcpy.ImportXMLWorkspaceDocument_management(output_gdb, Temp_xml, "DATA", "")      # Delete the xml workspace document if it exists.    arcpy.Delete_management(Temp_xml)   if __name__ == "__main__":    main(sys.argv[1:])
0 Kudos
ShiminCai
Occasional Contributor III
Divesh,

Thank you very very much. Your script is exactly what I'm looking for and I successfully exported my stranded mobile geodatabase to a file geodatabase including all the feature classes, attachments and data. That is EXCELLENT!!!

Cheers,

Shimin
0 Kudos