<?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 Delete my PostgreSQL Database in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/delete-my-postgresql-database/m-p/318306#M5307</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I can't delete my PostgreSQL Database, can you tell the steps to follow to do so?&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;</description>
    <pubDate>Wed, 23 Mar 2016 14:30:09 GMT</pubDate>
    <dc:creator>Manon_Lumeau</dc:creator>
    <dc:date>2016-03-23T14:30:09Z</dc:date>
    <item>
      <title>Delete my PostgreSQL Database</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/delete-my-postgresql-database/m-p/318306#M5307</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I can't delete my PostgreSQL Database, can you tell the steps to follow to do so?&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2016 14:30:09 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/delete-my-postgresql-database/m-p/318306#M5307</guid>
      <dc:creator>Manon_Lumeau</dc:creator>
      <dc:date>2016-03-23T14:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: Delete my PostgreSQL Database</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/delete-my-postgresql-database/m-p/318307#M5308</link>
      <description>&lt;P&gt;Hi Manon,&lt;/P&gt;
&lt;P&gt;When you try to delete your PostgreSQL database you may get an error:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;postgres=# DROP DATABASE nuxeo;
ERROR:  database "nuxeo" is being accessed by other users
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you're sure there's no other user connected, then it may be because PostgreSQL has a pending prepared transaction that's never been committed or rolled back, which should never happen except if the database is shut down in an unclean manner (machine crash). To check for this:&lt;/P&gt;
&lt;P&gt;1.Run:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;SELECT database, gid FROM pg_prepared_xacts;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;2.Depending on the number of results, follow one of the steps below.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;If you get a result, then for each transaction gid you must execute a &lt;CODE&gt;ROLLBACK&lt;/CODE&gt; from the database having the problem:&lt;/LI&gt;
&lt;/UL&gt;
&lt;PRE&gt;&lt;CODE&gt;ROLLBACK PREPARED 'the_gid';
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For instance:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;nuxeo=# SELECT database, gid FROM pg_prepared_xacts;
 database | gid
----------+-----
 nuxeo | 131075_MS03ZjAwMDEzYTo0YTg5MjA5NzoxMDczMg==
(1 row)
nuxeo=# ROLLBACK PREPARED '131075_MS03ZjAwMDEzYTo0YTg5MjA5NzoxMDczMg==';
ROLLBACK PREPARED
  
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;UL&gt;
&lt;LI&gt;If you have lots of transactions you can run this psql scripts:&lt;/LI&gt;
&lt;/UL&gt;
&lt;PRE&gt;&lt;CODE&gt;\t
\a
\o /tmp/remove-transactions.sql
SELECT 'ROLLBACK PREPARED ''' || gid || ''';'  AS cmd
  FROM pg_prepared_xacts
  WHERE database=current_database();
\o
\i /tmp/remove-transactions.sql

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2016 14:37:20 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/delete-my-postgresql-database/m-p/318307#M5308</guid>
      <dc:creator>Manon_Lumeau</dc:creator>
      <dc:date>2016-03-23T14:37:20Z</dc:date>
    </item>
  </channel>
</rss>

