When upgrading my portal from 10.5.1 on a Windows 2008 R2 server, I am getting an error message at the step where I click the Continue Portal Upgrade button on https://machinename.domain.com:7443/arcgis/home/createadmin.html.
There was an error when attempting to upgrade the existing portal.
Upgrade failed. Failed to import data to the database correctly. Failed to execute SQL file ' C:\Program Files\ArcGIS\Portal\framework\template\sql\10.5.1_to_10.6.0\livingatlasdiff.sql'. UPDATE 0 DELETE 0 INSERT 0 1 INSERT 0 1 INSERT 0 1 psql:C:/Program Files/ArcGIS/Portal/framework/template/sql/10.5.1_to_10.6.0/livingatlasdiff.sql:9: ERROR: insert or update on table "gw_groups_users" violates foreign key constraint "gw_groups_users_ibfk_2" DETAIL: Key (username)=(esri_livingatlas) is not present in table "gw_users". psql:
....
I restarted the Portal service and attempted the installation again, with the same error.
I tried the workaround in this related issue: Upgrade Portal from 10.5.1 to 10.6 fails (giving the service account full access to the C:\Program Files\ArcGIS\Portal). That did not work either.
It was probably a nuclear option, but we:
In retrospect, it was likely related to a portal database locking issue (the new database was having trouble pulling data from the old database). It would be interesting to check the portal Postgres logs to see if a connection attempt is failing. If so, you could probably add a line to the conf file to accept the connection.
In my case when I was trying to upgrade the ArcGIS Enterprise from 10.6.1 to 10.7.1. I was stuck exactly with the same issue and the error was " Failed to execute SQL file C:\Program Files\ArcGIS\Portal\framework\template\sql\10.7.0_to_10.7.1\livingatlasdiff.sql "
Since in my case case it is a disconnected environment and I am not using internet in my machine and also I am not using livingatlas; so for the time being to troubleshoot the issue, I removed the "livingatlasdiff.sql" file from its original location (although kept it as a backup) and tried to upgrade the Portal which eventually upgraded successfully from 10.6.1 to 10.7.1
Just for reference and visibility, same issue found on the blog below: Again, this is a known defect: BUG-000119769: Deleting Living Atlas content from Portal for ArcGIS 10.6 causes an upgrade failure w...(also seen when upgrading to 10.7.1)
*This issue has been fixed in version 10.8
as mentioned, "For those of you who are encountering this defect, do not remove the "livingatlasdiff.sql" This fix is more like a band-aid than a permanent solution. You'll be able to successfully upgrade this time but any subsequent upgrades will fail. With this in mind, please contact Esri Tech Supportif you haven't already done so, in order to resolve this issue."