<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic PostgreSQL - Important Backup Info in ArcGIS Enterprise Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-questions/postgresql-important-backup-info/m-p/259769#M10036</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;PostgreSQL 9.5 installed on Linux Ubuntu 16.04, using ST_Geometry spatial type. I had a cron job scheduled to backup all databases nightly using pg_dump cmd, backup output was set to plain-text SQL (.sql) file. &lt;STRONG&gt;THIS IS NOT ADVISED&lt;/STRONG&gt;. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before you read anything else, switch your pg_dump command right now to use either "custom" or "tar" backup formats, see the doc here: &lt;A class="link-titled" href="https://www.postgresql.org/docs/9.6/app-pgdump.html" title="https://www.postgresql.org/docs/9.6/app-pgdump.html"&gt;PostgreSQL: Documentation: 9.6: pg_dump&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why is this so important? Because when using ST_Geometry spatial type, certain schemas have to be restored &lt;STRONG&gt;before&lt;/STRONG&gt; others. When you have a plain text .sql dump as I did, you are unable to hand-pick what schemas are restored, it's an "all or nothing" restore using psql. Take a look at the ESRI postgre restore doc here: &lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/manage-data/gdbs-in-postgresql/restore-geodatabase-postgresql.htm" title="http://desktop.arcgis.com/en/arcmap/latest/manage-data/gdbs-in-postgresql/restore-geodatabase-postgresql.htm"&gt;Restore a geodatabase to PostgreSQL—Help | ArcGIS Desktop&lt;/A&gt;. Restoring the entire .sql file resulted in tons of errors and ultimately a blank geodatabase. Schema seemed OK, but data was missing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Everything in the above ESRI doc says to use pg_restore, but that cmd only takes "custom" or "tar" backup files as input, &lt;STRONG&gt;NOT&lt;/STRONG&gt; plain text .sql.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I ended up getting everything restored by searching for "schema: public" in the .sql dump, then running those sql queries first, then restoring the entire .sql dump with psql. Painful lesson, be advised.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Feb 2019 14:41:07 GMT</pubDate>
    <dc:creator>danbecker</dc:creator>
    <dc:date>2019-02-06T14:41:07Z</dc:date>
    <item>
      <title>PostgreSQL - Important Backup Info</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/postgresql-important-backup-info/m-p/259769#M10036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;PostgreSQL 9.5 installed on Linux Ubuntu 16.04, using ST_Geometry spatial type. I had a cron job scheduled to backup all databases nightly using pg_dump cmd, backup output was set to plain-text SQL (.sql) file. &lt;STRONG&gt;THIS IS NOT ADVISED&lt;/STRONG&gt;. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before you read anything else, switch your pg_dump command right now to use either "custom" or "tar" backup formats, see the doc here: &lt;A class="link-titled" href="https://www.postgresql.org/docs/9.6/app-pgdump.html" title="https://www.postgresql.org/docs/9.6/app-pgdump.html"&gt;PostgreSQL: Documentation: 9.6: pg_dump&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why is this so important? Because when using ST_Geometry spatial type, certain schemas have to be restored &lt;STRONG&gt;before&lt;/STRONG&gt; others. When you have a plain text .sql dump as I did, you are unable to hand-pick what schemas are restored, it's an "all or nothing" restore using psql. Take a look at the ESRI postgre restore doc here: &lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/manage-data/gdbs-in-postgresql/restore-geodatabase-postgresql.htm" title="http://desktop.arcgis.com/en/arcmap/latest/manage-data/gdbs-in-postgresql/restore-geodatabase-postgresql.htm"&gt;Restore a geodatabase to PostgreSQL—Help | ArcGIS Desktop&lt;/A&gt;. Restoring the entire .sql file resulted in tons of errors and ultimately a blank geodatabase. Schema seemed OK, but data was missing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Everything in the above ESRI doc says to use pg_restore, but that cmd only takes "custom" or "tar" backup files as input, &lt;STRONG&gt;NOT&lt;/STRONG&gt; plain text .sql.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I ended up getting everything restored by searching for "schema: public" in the .sql dump, then running those sql queries first, then restoring the entire .sql dump with psql. Painful lesson, be advised.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Feb 2019 14:41:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/postgresql-important-backup-info/m-p/259769#M10036</guid>
      <dc:creator>danbecker</dc:creator>
      <dc:date>2019-02-06T14:41:07Z</dc:date>
    </item>
  </channel>
</rss>

