Re: No aswer WAS: Droping a database even if someone is - Mailing list pgsql-general

From Csaba Nagy
Subject Re: No aswer WAS: Droping a database even if someone is
Date
Msg-id 1047653178.31011.21.camel@coppola.ecircle.de
Whole thread Raw
In response to No aswer WAS: Droping a database even if someone is con nected  (Eric Audet <eaudet@scc.ca>)
Responses Re: No aswer WAS: Droping a database even if someone is  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
List pgsql-general
I can't answer your original question (i.e. if it's possible to drop a
DB while somebody is connected to it), but I think it's possible to
forced close down all connections. Take a look at:
http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=app-pg-ctl.html
You might find a way to restart the server so it is accepting
connections only from the replication script, and then restart it again
to accept connections from the outside world.
You could also import the data in a temporary DB (while the old data is
still online), restart, drop the old database, recreate it using as a
template the temporary DB with the new data, restart online, drop the
temporary DB.

HTH,
Csaba.


On Fri, 2003-03-14 at 15:16, Eric Audet wrote:
> I guess I won't get any anwers for this. And after many searches, it seems
> not possible.
>
>
>
> Maybe some can help me. I am in a situation where someone designed
> something, and now I was put in charge of making sure it is working.
>
>
>
> 1)       we have a database inside our firewall.
>
> 2)       Updates are done inside the firewall during the day
>
> 3)       At night, there is a job dumping the database and ftping the dump
> on an external server
>
> 4)       On the external server, I have a job droping the database, creating
> the database and restoring the database that was ftped.
>
>
>
> There are so many places where this could fail: 1) while dumping, 2) while
> ftping, 3) cronjob synchronization on 2 different machines, 4) user
> connected to database so drop/create database don't work, etc
>
>
>
> What we want is to replicate the inside the firewall database to outside the
> firewall database.
>
> Or we could simplify this: we want to replicate a database into a different
> machine.
>
>
>
> Any help?
>
>
>
> Eric
>
>
>
> -----Original Message-----
> From: Eric Audet [mailto:eaudet@scc.ca]
> Sent: March 13, 2003 2:20 PM
> To: pgsql-general
> Subject: [GENERAL] Droping a database even if someone is connected
>
>
>
> Is there a way to drop a database even if someone is connected to it?
>
> I use a perl script that
> 1) drop the database, (dropdb)
> 2) create a new database, (createdb)
> 3) restore a database from a dump (psql databasename <dumpfile)
>
> When the drop does not work, everything else fails!
>
> Thanks in advance
> Eric
>
>
>



pgsql-general by date:

Previous
From: Olleg Samojlov
Date:
Subject: Automake
Next
From: Charles Lewis
Date:
Subject: Where is the 7.3.2 Windows binary? (N/T)