Upgrading geodatabases in PostgreSQL in ArcGIS Server for Amazon Web Services

The following sections describe three geodatabase upgrade scenarios:

Moving data from an ArcGIS 10 for Amazon Web Services EGDB instance to an ArcGIS Server 10.1 for Amazon Web Services 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.1, the ArcGIS Server 10.1 (Linux) with PostgreSQL AMI runs Ubuntu Linux and can optionally contain a PostgreSQL 9.0.5 database cluster. You cannot move directly from a PostgreSQL database on Windows to one on Linux. Therefore, when you migrate to ArcGIS Server 10.1 for Amazon Web Services, you must move or reload your data. See the section "Options for transferring data to the cloud" in Strategies for data transfer to Amazon Web Services.

Applying service packs or patches and upgrading geodatabases on the ArcGIS Server EC2 instance (SITEHOST)

Your geodatabases in PostgreSQL in Amazon Web Services (AWS) instances often must be upgraded after you apply a service pack or patch to the software on your AWS instance. The steps in this section tell you how 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. You should have already installed the service pack or patch to ArcGIS for Server on your AWS instance.

    See Applying a service pack to a single-machine site or Applying a service pack to a 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 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. 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 -
      
    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.

    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","POSTGRESSQL","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.

    If the upgrade fails, information is written to the GDBUpgrade.log in /arcgis/server/framework/runtime/.wine/drive_c/users/arcgis/LocalAppData/ESRI/Server10.1.

  10. To be sure your geodatabase is upgraded, run the following in Python, 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 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 13 on Applying a service pack to an Ubuntu multiple-machine site.

Applying service packs or patches and upgrading geodatabases on EGDBHOST

The steps in this section tell you how to upgrade geodatabases in PostgreSQL that reside on their own, dedicated Amazon EC2 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, then 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","POSTGRESSQL","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/Server10.1.

  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 13 on Applying a service pack to an Ubuntu multiple-machine site.

12/10/2013