Upgrading geodatabases in PostgreSQL in ArcGIS Server for Amazon Web Services

To upgrade geodatabase functionality, you can either create an ArcGIS Server 10.2.2 for Amazon Web Services (AWS) instance, move your data to the new geodatabase, and republish services, or you can update the ArcGIS software on your existing AWS instance and upgrade the geodatabase.

NoteNote:

No geodatabase upgrade is needed between ArcGIS 10.2.1 and 10.2.2; therefore, if you want to use ArcGIS Server 10.2.2 on Amazon Web Services, you should apply the ArcGIS Server update to your existing 10.2.1 AWS instance.

The following sections describe methods for getting your geodatabase to the latest possible state, and when you would use each method.

Create an ArcGIS 10.2.2 for AWS instance and move your data from an older instance

The easiest way to get all the latest versions of ArcGIS and PostgreSQL is to create an ArcGIS Server for AWS instance from the latest AMI, move your data, and republish services. See The ArcGIS Server AMIs for information on what software and operating system versions are present in the latest ArcGIS Server AMIs.

For information on moving data, see the section "Options for transferring data to the cloud" in Strategies for data transfer to Amazon Web Services.

If you are using an ArcGIS Server 10 AWS instance with data in PostgreSQL, you must use this method to upgrade your geodatabase.

Move from a 10 instance to a 10.2.2 instance

At ArcGIS 10, there was a separate enterprise geodatabase Amazon Machine Image (AMI) that contained a PostgreSQL 8.3.8 database cluster on Windows. At ArcGIS 10.2.2, the ArcGIS Server (Linux) with PostgreSQL AMI runs Ubuntu Linux and can optionally contain a PostgreSQL 9.2.4 database cluster. You cannot move directly from a PostgreSQL database on Windows to one on Linux; therefore, when you migrate to ArcGIS Server 10.2.2 for AWS, you must move or reload your data.

Move from a 10.1 or 10.2 instance to a 10.2.2 instance

At ArcGIS 10.1 and 10.2, the ArcGIS Server (Linux) with PostgreSQL AMI contained PostgreSQL 9.05 and 9.0.13, respectively. If you want to use PostgreSQL 9.2.4, you can move your data to ArcGIS Server 10.2.2 for AWS.

Update the ArcGIS software on your existing AWS instance and upgrade the geodatabase

You can install the latest version of ArcGIS Server on your existing instance, upgrade your geodatabase (if needed), and continue using your existing data and services. Be aware, though, that this means the operating system and all other software on the instance remain at the version they were when you created your instance. For example, if you created your instance from an ArcGIS Server 10.1 for AWS AMI, you will continue to use a PostgreSQL 9.0.5 database on an Ubuntu 10.04 operating system.

This is the recommended method for moving from ArcGIS 10.2.1 to 10.2.2 for the following reasons:

The next two sections explain how to upgrade a geodatabase in PostgreSQL on an existing ArcGIS Server 10.1 or 10.2 AWS instance.

Update ArcGIS Server on an existing ArcGIS Server for AWS instance and upgrade geodatabases on SITEHOST

If you want to update an ArcGIS Server 10.1 or 10.2 for AWS instance, follow the steps in this section to upgrade geodatabases in PostgreSQL that reside on the same instance as ArcGIS Server (SITEHOST).

Update ArcGIS for Server, move the new st_geometry.so file to the PostgreSQL lib directory, stop ArcGIS Server, run a Python script to upgrade each geodatabase, then restart ArcGIS Server.

Steps:
  1. Install the latest version of ArcGIS for Server on your AWS instance.

    See Applying an ArcGIS update to a single-machine site or Applying an ArcGIS update to an Ubuntu multiple-machine site for instructions if you have not already installed the software.

  2. Before you upgrade your geodatabases, make backup copies of them. The easiest way to do that is to make a Cloud Builder backup of your site (if you created your site using Cloud Builder), or make a snapshot of the EBS volume that contains your data. If you want to make a snapshot of the EBS volume, see Amazon Web Services documentation for instructions.
  3. Also, before upgrading, you must copy the st_geometry.so file from /arcgis/server/DatabaseSupport/PostgreSQL/Linux64 to /usr/lib/postgresql/9.0/lib.
    1. The st_geometry.so file is owned by root; therefore, after connecting to the Amazon Web Services SITEHOST instance as ubuntu, switch users to root:
      sudo su -
      
      NoteNote:

      Be aware that you cannot connect as the arcgis user and switch to the root user.

    2. Before you copy the new file, rename the old one.
      mv /usr/lib/postgresql/9.0/lib/st_geometry.so /usr/lib/postgresql/9.0/lib/st_geometryOLD.so
      
    3. Copy the new st_geometry.so file.
      cp /arcgis/server/DatabaseSupport/PostgreSQL/Linux64/st_geometry.so /usr/lib/postgresql/9.0/lib
      
    4. Change permissions on the st_geometry.so file to allow other users to read and execute it.
      chmod 755 /usr/lib/postgresql/9.0/lib/st_geometry.so
      
  4. Switch to the arcgis user.
    su - arcgis
    
  5. Open a text editor to create the upgrade Python script.

    vi upgrade.py
    

  6. Copy the following script into a text editor.

    Alter the script to use information specific to your site, including the instance name, sde password, connection file name and location, and database name.

    #Import arcpy module
    import arcpy
    
    # Create connection file
    arcpy.CreateDatabaseConnection_management("/tmp","egdb_connection.sde","POSTGRESQL","ec2-123-456-789-100.compute-1.amazonaws.com","DATABASE_AUTH", "sde", "E$ri3774", "SAVE_USERNAME", "egdb")
    # Upgrade geodatabase
    arcpy.UpgradeGDB_management("/tmp/egdb_connection.sde", "PREREQUISITE_CHECK", "UPGRADE")
    

    See Create Database Connection and Upgrade Geodatabase for more information on tool syntax.

  7. Save the file and close the text editor.
  8. Stop ArcGIS Server.
    /arcgis/server/stopserver.sh
    
  9. Run the script in Python.

    /arcgis/server/tools/python <path to the file>/upgrade.py
    

    You will likely see multiple notices about type references. You can ignore these; they do not indicate the upgrade failed.

    Information is written to the GDBUpgrade.log in /arcgis/server/framework/runtime/.wine/drive_c/users/arcgis/LocalAppData/ESRI/Server<#> if the upgrade does fail.

  10. Run the following in Python to be sure your geodatabase is upgraded. Replace /tmp/egdb_connection.sde with your connection file location and name.

    First, open an arcpy prompt.

    cd /arcgis/server/tools
    ./python
    

    Use isCurrent to determine if the geodatabase is upgraded to the current release.

    import arcpy
    
    isCurrent = arcpy.Describe('/tmp/egdb_connection.sde').currentRelease
    
    print isCurrent
    

    If print isCurrent returns True, your geodatabase is upgraded.

  11. To exit the arcpy prompt, type quit().
  12. Alter the script and run it again for each geodatabase you need to upgrade.
  13. Once all geodatabases are upgraded, restart ArcGIS Server.

    /arcgis/server/startserver.sh
    

If you have a multiple-machine site, proceed with step 14 in Applying an ArcGIS update to an Ubuntu multiple-machine site.

Update ArcGIS Server on an existing ArcGIS Server for AWS instance and upgrade geodatabases that are on their own AWS instance (EGDBHOST)

If you want to update an ArcGIS Server 10.1 or 10.2 for AWS instance, follow the steps in this section to upgrade geodatabases in PostgreSQL that are on their own, dedicated AWS instance (EGDBHOST).

Update ArcGIS for Server on the SITEHOST, move the new st_geometry.so file from SITEHOST to the PostgreSQL lib directory on EGDBHOST, stop ArcGIS Server, run a Python script from SITEHOST to upgrade each geodatabase, then restart ArcGIS Server.

Steps:
  1. Install the service pack or patch to ArcGIS for Server on your AWS instance.
  2. Before you upgrade your geodatabases, make backup copies of them. The easiest way to do that is to make a snapshot of the EBS volume that contains your data.
  3. Also, before upgrading, you must copy the st_geometry.so file from /arcgis/server/DatabaseSupport/PostgreSQL/Linux64 to /usr/lib/postgresql/9.0/lib.
    1. Before you copy the new file, rename the old one on EGDBHOST. Since the st_geometry.so file is owned by the root user, log in to EGDBHOST as ubuntu and switch to the root user.
      sudo su -
      
      mv /usr/lib/postgresql/9.0/lib/st_geometry.so /usr/lib/postgresql/9.0/lib/st_geometryOLD.so
      
    2. You must move the st_geometry.so file from /arcgis/server/DatabaseSupport/PostgreSQL/Linux64 on SITEHOST to /usr/lib/postgresql/9.0/lib on EGDBHOST.

      Since the two source and destination directories on the different instances are not accessible by the same user, log in to SITEHOST as the arcgis user and copy the file to the gisdata directory on EGDBHOST.

      cp /arcgis/server/DatabaseSupport/PostgreSQL/Linux64/st_geometry.so /net/EGDBHOST/gisdata/st_geometry.so
      
    3. Log in to EGDBHOST as ubuntu.
    4. Switch to the root user.
      sudo su -
      
    5. Copy the st_geometry.so file from gisdata to /usr/lib/postgresql/9.0/lib.
      cp /gisdata/st_geometry.so /usr/lib/postgresql/9.0/lib/st_geometry.so
      
    6. Change permissions on the st_geometry.so file to allow other users to read and execute it.
      chmod 755 /usr/lib/postgresql/9.0/lib/st_geometry.so
      
  4. Log in to SITEHOST as the arcgis user.
  5. Open a text editor to create the upgrade Python script.

    For example:

    vi upgrade.py
    

  6. Copy the following script into a text editor.

    Alter the script to use information specific to your site, including the instance name, sde password, connection file name and location, and database name.

    #Import arcpy module
    import arcpy
    
    # Create connection file
    arcpy.CreateDatabaseConnection_management("/tmp","egdb_connection.sde","POSTGRESQL","ec2-123-456-789-100.compute-1.amazonaws.com","DATABASE_AUTH", "sde", "E$ri3774", "SAVE_USERNAME", "egdb")
    # Upgrade geodatabase
    arcpy.UpgradeGDB_management("/tmp/egdb_connection.sde", "PREREQUISITE_CHECK", "UPGRADE")
    

    See Create Database Connection and Upgrade Geodatabase for more information on tool syntax.

  7. Save the file and close the text editor.
  8. Stop ArcGIS Server.
    /arcgis/server/stopserver.sh
    
  9. Run the script in Python.

    /arcgis/server/tools/python <path to the file>/upgrade.py
    

    You will likely see several notices about type references. You can ignore those messages.

    If the upgrade fails, information is written to the GDBUpgrade.log in /arcgis/server/framework/runtime/.wine/drive_c/users/arcgis/LocalAppData/ESRI/Server<#>.

  10. To be sure your geodatabase is upgraded, open Python and run the following, replacing /tmp/egdb_connection.sde with your connection file location and name.

    First, open an arcpy prompt.

    cd /arcgis/server/tools
    ./python
    

    Use isCurrent to determine if the geodatabase is upgraded to the current release.

    import arcpy
    
    isCurrent = arcpy.Describe('/tmp/egdb_connection.sde').currentRelease
    
    print isCurrent
    

    If print isCurrent returns True, your geodatabase is upgraded.

  11. To exit the arcpy prompt, type quit().
  12. Alter the upgrade.py script and run it again for each geodatabase you need to upgrade.
  13. Once all geodatabases are upgraded, restart ArcGIS Server.

    /arcgis/server/startserver.sh
    

If you have a multiple-machine site, proceed with step 14 in Applying an ArcGIS update to an Ubuntu multiple-machine site.

12/29/2014