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. You may also need to upgrade the database if the version you use is no longer supported for the ArcGIS clients you use.

Install a new version of ArcGIS AllSource or ArcGIS Server or apply a service pack, patch, or hot fix to an existing installation and upgrade the geodatabase.

Note:

Even if you do not upgrade the geodatabase, the database version you use may no longer be supported with the current release of ArcGIS software. If the database version is no longer supported, you may need to upgrade the geodatabase. The longer you go between upgrades, the more involved the upgrade process becomes.

When you upgrade the geodatabase using ArcGIS AllSource 3.4, the upgraded geodatabase version is 11.4.0.x.

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

Before you upgrade

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

When you determine that the new system works the way you expect, 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.

There is no formal mechanism to downgrade a geodatabase to a previous version. If, after upgrading to a newer version, you need 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 the geodatabase:

  1. Read the ArcGIS requirements for SAP HANA to confirm that Esri supports the SAP HANA and ArcGIS version combination you want to use.

    You can upgrade directly from a 10.8.x or later geodatabase if the SAP HANA database release is supported for the ArcGIS version to which you upgrade. If the database release is not supported for the geodatabase version you're upgrading to, you must also upgrade the database.

  2. Confirm that your geodatabase can be upgraded. To do this, install the ArcGIS AllSource or ArcGIS Server version to which you want to move onto one machine.
    • To confirm from ArcGIS AllSource, 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 confirm from ArcGIS Server, use the ArcPy Describe function to determine whether you can upgrade the geodatabase. The following is an example of creating a connection to the geodatabase and checking whether the geodatabase can be upgraded:
      # Open Python.
      cd /arcgis/server/tools
      ./python
      
      # Create a connection to the geodatabase. You must connect as the sde user.
      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 that the sde user has the appropriate privileges in the database.
  4. Create a backup of the database.
  5. Remove any custom functionality you 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 the geodatabase.

Upgrade the geodatabase

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

Note:

If the geodatabase contains branch versioned data, additional postupgrade steps may be required. See How Upgrade Geodatabase works for instructions.

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 AllSource

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 the Pre-requisites check and Upgrade geodatabase options checked. That way, the tool confirms that 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 privileges to upgrade the geodatabase. 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 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 pass, 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 your user TEMP directory. If your user does not have a temp directory configured, the system TEMP directory is used.

Run a script

To upgrade the geodatabase using a Python script, copy the following code, 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.management.CreateDatabaseConnection(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.management.UpgradeGDB(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.management.UpgradeGDB(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