title: Migrate postgres dump to RDS
body: <p>I have a Django postgres db (v9.3.10) running on digital ocean and am trying to migrate it over to Amazon RDS (postgres v 9.4.5). The RDS is a db.m3.xlarge instance with 300GB. I've dumped the Digital Ocean db with: </p>
  
  <pre><code>sudo -u postgres pg_dump -Fc -o -f /home/&lt;user&gt;/db.sql &lt;dbname&gt;
  </code></pre>
  
  <p>And now I'm trying to migrate it over with:</p>
  
  <pre><code> pg_restore -h &lt;RDS endpoint&gt; --clean -Fc -v -d &lt;dbname&gt; -U &lt;RDS master user&gt; /home/&lt;user&gt;/db.sql
  </code></pre>
  
  <p>The only error I see is:</p>
  
  <pre><code>  pg_restore: [archiver (db)] Error from TOC entry 2516; 0 0 COMMENT EXTENSION plpgsql
    pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of extension plpgsql
    Command was: COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
  </code></pre>
  
  <p>Apart from that everything seems to be going fine and then it just grinds to a halt. The dumped file is ~550MB and there are a few tables with multiple indices, otherwise pretty standard. </p>
  
  <p>The Read and Write IOPS on the AWS interface are near 0, as is the CPU, memory, and storage. I'm very new to AWS and know that the parameter groups might need tweaking to do this better. Can anyone advise on this or a better way to migrate a Django db over to RDS?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>Looking at the db users the DO db looks like:</p>
  
  <pre><code>Role Name   Attr                                           Member Of
  &lt;user&gt;      Superuser                                      {}
  postgres    Superuser, Create role, Create DB, Replication {}
  </code></pre>
  
  <p>And the RDS one looks like:</p>
  
  <pre><code>Role Name      Attr                     Member Of
  &lt;user&gt;        Create role, Create DB    {rds_superuser}
  rds_superuser Cannot login              {}
  rdsadmin      ...                        ...
  </code></pre>
  
  <p>So it doesn't look like it's a permissions issue to me as &lt;user> has superuser permissions in each case.</p>
  
  <p><strong>Solution for anyone looking</strong>:</p>
  
  <p>I finally got this working using:</p>
  
  <pre><code>cat &lt;db.sql&gt; | sed -e '/^COMMENT ON EXTENSION plpgsql IS/d' &gt; edited.dump
  psql -h &lt;RDS endpoint&gt; -U &lt;user&gt; -e &lt;dname&gt; &lt; edited.dump
  </code></pre>
  
  <p>It's not ideal for a reliable backup/restore mechanism but given it is only a comment I guess I can do without. My only other observation is that running psql/pg_restore to a remote host is slow. Hopefully the new <a href="https://aws.amazon.com/dms/" rel="nofollow">database migration service</a> will add something.</p>