Upgrade a geodatabase in SAP HANA

Available with Standard or Advanced license.

The goal of upgrading an enterprise geodatabase is to update the geodatabase system tables, stored procedures, types, and functions to take advantage of new functionality and bug fixes.

Install a new version of ArcGIS Pro or ArcGIS Server and upgrade the geodatabase.

Complete the steps needed prior to upgrading, then upgrade your geodatabase using the Upgrade Geodatabase geoprocessing tool or a Python script.

Before you upgrade

When you upgrade any enterprise system, including a geodatabase, plan ahead. Test the new version on a development or test server to ensure that it works with all your client applications.

When you have determined that the new system works the way you expected, schedule the upgrade; be sure the necessary staff are available to perform the upgrade and that they have the permissions necessary to complete their assigned tasks.

Be aware that there is no formal mechanism to downgrade a geodatabase to a previous version. If, after upgrading to a newer version, you want to downgrade the geodatabase, you must restore the old database from a backup file.

The following is a checklist of steps to complete before you upgrade your geodatabase:

  1. Read the SAP HANA database requirements for ArcGIS to confirm that Esri supports the SAP HANA and ArcGIS version combination you want to use.
  2. Check to see if your geodatabase can be upgraded. To do this, install the ArcGIS Pro or ArcGIS Server version you want to move to onto one machine.
    • To check from ArcGIS Pro, connect to the geodatabase in the Catalog pane and open Database Properties. A message appears under Upgrade Status indicating whether an upgrade is possible.
    • To check from ArcGIS Server, use the ArcPy Describe function to determine if you can upgrade the geodatabase. The following is an example of creating a connection to the geodatabase and checking if the geodatabase can be upgraded. Note that you must connect as the sde user to run this.
      # Open Python.
      cd /arcgis/server/tools
      ./python
      
      # Create a connection to the geodatabase.
      arcpy.CreateDatabaseConnection_management("/usr/tmp/",
                                                "egdb_connection.sde",
                                                "SAP HANA",
                                                sys.argv[1],
                                                "DATABASE_AUTH",
                                                "sde",
                                                sys.argv[2],
                                                "SAVE_USERNAME")
      
      # Import ArcPy and check the geodatabase release.
      import arcpy
      
      isCurrent = arcpy.Describe('/usr/tmp/egdb_connection.sde').currentRelease
      
      print isCurrent
      If False is returned, you can upgrade the geodatabase. Proceed with the remaining steps. If True is returned, you do not need to upgrade. Do not proceed with subsequent steps.
  3. Confirm the sde user has catalog read privileges in the database.
  4. Create a backup of the database.
  5. Remove any custom functionality you may have added to the geodatabase system tables outside ArcGIS.

    The upgrade procedure cannot accommodate customizations you make to the system tables. If such customizations prevent the alteration of a system table's schema, the upgrade will fail.

  6. Confirm there are no other connections to the geodatabase you are upgrading.

You can now upgrade your geodatabase.

Upgrade the geodatabase

You can use the Upgrade Geodatabase tool in ArcGIS Pro or a Python script run on an ArcGIS Pro or ArcGIS Server machine to upgrade your geodatabase.

Use the Upgrade Geodatabase tool

Open the Upgrade Geodatabase geoprocessing tool from one of the following:

  • The Geodatabase Administration toolset in the Data Management toolbox
  • The Run Upgrade button on the General tab of the Database Properties dialog box in ArcGIS Pro

If you open the tool from Database Properties, the Input geodatabase text box is prepopulated with the geodatabase connection information.

Esri recommends that you leave both the Pre-requisites check and Upgrade geodatabase options checked. That way, the tool checks to see if the prerequisites to upgrade have been met before continuing with the geodatabase upgrade.

You must connect to the geodatabase as the sde user to run the prerequisite check and upgrade the geodatabase.

The prerequisite check detects other active connections to the geodatabase, determines whether you connected as the sde user, and confirms that the sde user has sufficient privileges to upgrade the geodatabase (catalog read). If any prerequisites are not met, the tool terminates. You must correct any problems before you run the upgrade procedure again.

The results of this check are reported on the geoprocessing tool dialog box. If the check (or upgrade) fails, results are also written to the GDBUpgrade.log file in the c:\Users\<user name>\AppData\Local\ESRI\<ArcGIS product> folder.

If all checks are passed, the tool proceeds with the upgrade. The status for the prerequisites check and the upgrade are shown on the geoprocessing tool progress dialog box. If the upgrade fails, information is written to the GDBUpgrade.log file. Additional information is written to the sde_setup.log file in the system TEMP directory.

Run a script

To upgrade the geodatabase, copy the following script, paste it into a text file, and save it. You can then run the script with site-specific information at the command line.

"""
Name: upgrade_gdb_for_sap_hana.py
Type upgrade_gdb_for_sap_hana.py -h or upgrade_gdb_sap_hana.py --help for usage
Author: Esri
"""

# Import system modules
import arcpy, os, optparse, sys


# Define usage and version
parser = optparse.OptionParser(usage = "usage: %prog [Options]", version="%prog 1.0 for " + arcpy.GetInstallInfo()['Version'] )

#Define help and options
parser.add_option ("-i", dest="data_source", type="string", default="", help="SAP HANA ODBC data source name")
parser.add_option ("-u", dest="User", type="string", default="", help="Geodatabase administrator user name")
parser.add_option ("-p", dest="Password", type="string", default="", help="Geodatabase administrator password")
parser.add_option ("--upgrade", dest="Upgrade", type="choice", choices=['TRUE', 'FALSE'], default="FALSE", help="Upgrade Options (case-sensitive):  TRUE=Perform Pre-requisite check and upgrade geodatabase, FALSE=Perform Pre-requisite check only.  Default=FALSE")                   


# Check if value entered for option
try:
	(options, args) = parser.parse_args()

	
#Check if no system arguments (options) entered
	if len(sys.argv) == 1:
		print ("%s: error: %s\n" % (sys.argv[0], "No command options given"))
		parser.print_help()
		sys.exit(3)

	#Usage parameters for spatial database connection to upgrade
	account_authentication = "DATABASE_AUTH"
	username = options.User.lower() 
	password = options.Password	
	do_upgrade = options.Upgrade
	database = ""
	database_type = "SAP HANA"
	instance = options.data_source
	
	
	# Get the current product license
	product_license=arcpy.ProductInfo()
	
	# Checks required license level to upgrade
	if product_license.upper() == "ARCVIEW" or product_license.upper() == 'ENGINE':
		print ("\n" + product_license + " license found!" + "  Enterprise geodatabase upgrade requires an ArcGIS for Desktop Standard or Advanced, ArcGIS Engine with the Geodatabase Update extension, or ArcGIS for Server license.")
		sys.exit("Re-authorize ArcGIS before upgrading.")
	else:
		print ("\n" + product_license + " license available!  Continuing to upgrade...")
		arcpy.AddMessage("+++++++++")
	
	# Local variables
	Conn_File_NameT = instance + "_" + database + "_" + username     
	
	if os.environ.get("TEMP") == None:
		temp = "c:\\temp"	
	else:
		temp = os.environ.get("TEMP")
	
	if os.environ.get("TMP") == None:
		temp = "/usr/tmp"		
	else:
		temp = os.environ.get("TMP")  
	
	Connection_File_Name = Conn_File_NameT + ".sde"
	Connection_File_Name_full_path = temp + os.sep + Conn_File_NameT + ".sde"
	
	# Check for the .sde file and delete it if present
	arcpy.env.overwriteOutput=True
	if os.path.exists(Connection_File_Name_full_path):
		os.remove(Connection_File_Name_full_path)
	
	print ("\nCreating Database Connection File...\n")	
	# Process: Create Database Connection File...
	# Usage:  out_file_location, out_file_name, DBMS_TYPE, instnace, database, account_authentication, username, password, save_username_password(must be true)
	arcpy.CreateDatabaseConnection_management(out_folder_path=temp, out_name=Connection_File_Name, database_platform=database_type, instance=instance, database=database, account_authentication=account_authentication, username=username, password=password, save_user_pass="TRUE")
        			

	# Process: Upgrade geodatabase...
	try:
		if do_upgrade.lower() == "true":
			print ("Upgrading Geodatabase...\n")
			arcpy.UpgradeGDB_management(input_workspace=Connection_File_Name_full_path, input_prerequisite_check="PREREQUISITE_CHECK", input_upgradegdb_check="UPGRADE")
			for i in range(arcpy.GetMessageCount()):
				arcpy.AddReturnMessage(i)
			arcpy.AddMessage("+++++++++\n")
	
		else:
			print ("Running Pre-Requisite Check...\n")
			arcpy.UpgradeGDB_management(input_workspace=Connection_File_Name_full_path, input_prerequisite_check="PREREQUISITE_CHECK", input_upgradegdb_check="NO_UPGRADE")
			for i in range(arcpy.GetMessageCount()):
				arcpy.AddReturnMessage(i)
			arcpy.AddMessage("+++++++++\n")
		
	        
	except:
		for i in range(arcpy.GetMessageCount()):
			arcpy.AddReturnMessage(i)
		
	if os.path.exists(Connection_File_Name_full_path):
		os.remove(Connection_File_Name_full_path)
	
#Check if no value entered for option	
except SystemExit as e:
	if e.code == 2:
		parser.usage = ""
		print ("\n")
		parser.print_help()
		parser.exit(2)

For example, if you saved the text file as gdbupgrade, your SAP HANA data source is named mydata, and your sde password is mysdepassword, type the following at a command prompt:

gdbupgrade --DBMS SAP HANA -i mydata -u sde -p mysdepassword --upgrade TRUE