pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
backup server - how to disconnect
4+ messages / 3 participants
[nested] [flat]

* backup server - how to disconnect
@ 2008-10-15 14:11 Mark Steben <msteben@autorevenue.com>
  2008-10-15 20:10 ` Re: backup server - how to disconnect Emmanuel BERTHOULE <eberthoule@yahoo.fr>
  2008-10-15 21:25 ` Re: backup server - how to disconnect Fabrízio de Royes Mello <fmello@dbseller.com.br>
  0 siblings, 2 replies; 4+ messages in thread

From: Mark Steben @ 2008-10-15 14:11 UTC (permalink / raw)
  To: pgsql-admin

We have a server that backups and then recreates our production database on
a nightly basis

In order to drop and recreate the database we would stop and restart the
server - this would

Effectively kick off any straggling users so we could get our refresh done.
No problem.

Now we have more than one database and stopping and restarting the server to
clean up

The backup database would also kill any process going on in the new
database.

 

Is there a command in postgres to disconnect all users short of restarting

The server?  I looked at pg_ctl kill TERM but there I would need to

Specify specific PIDs.  Not something I want to do manually at 1 am every
morning.

 

We are at postgres 8.2.5.  Thanks for your help

 

 <mailto:autoenthusiasts@autorevenue.com?subject=Feedback> Committed to
Creating @utoEnthusiasts. Please provide us with your feedback. 

  _____  

Mark Steben│Database Administrator│  <http://www.autorevenue.com/;
@utoRevenueT
95 Ashley Ave. West Springfield, MA., 01089 
413-243-4800 x1512 (Phone) │ 413-732-1824 (Fax)

A Division of Dominion Enterprises

 

 

 

 

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: backup server - how to disconnect
  2008-10-15 14:11 backup server - how to disconnect Mark Steben <msteben@autorevenue.com>
@ 2008-10-15 20:10 ` Emmanuel BERTHOULE <eberthoule@yahoo.fr>
  1 sibling, 0 replies; 4+ messages in thread

From: Emmanuel BERTHOULE @ 2008-10-15 20:10 UTC (permalink / raw)
  To: Mark Steben <msteben@autorevenue.com>; +Cc: pgsql-admin

Hi,

you can use

pg_ctl stop -m fast
pg_ctl start

who kill client and abort current transaction
and if you have multiple database you can use the -D option for  
specify database directory


-manu


Le 15 oct. 08 à 16:11, Mark Steben a écrit :

> We have a server that backups and then recreates our production  
> database on a nightly basis
> In order to drop and recreate the database we would stop and restart  
> the server - this would
> Effectively kick off any straggling users so we could get our  
> refresh done.  No problem.
> Now we have more than one database and stopping and restarting the  
> server to clean up
> The backup database would also kill any process going on in the new  
> database.
>
> Is there a command in postgres to disconnect all users short of  
> restarting
> The server?  I looked at pg_ctl kill TERM but there I would need to
> Specify specific PIDs.  Not something I want to do manually at 1 am  
> every morning.
>
> We are at postgres 8.2.5.  Thanks for your help
>
> Committed to Creating @utoEnthusiasts. Please provide us with your  
> feedback.
> Mark Steben│Database Administrator│ @utoRevenue™
> 95 Ashley Ave. West Springfield, MA., 01089
> 413-243-4800 x1512 (Phone) │ 413-732-1824 (Fax)
> A Division of Dominion Enterprises
>
>
>
>

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: backup server - how to disconnect
  2008-10-15 14:11 backup server - how to disconnect Mark Steben <msteben@autorevenue.com>
@ 2008-10-15 21:25 ` Fabrízio de Royes Mello <fmello@dbseller.com.br>
  2008-10-15 21:48   ` Re: backup server - how to disconnect Fabrízio de Royes Mello <fmello@dbseller.com.br>
  1 sibling, 1 reply; 4+ messages in thread

From: Fabrízio de Royes Mello @ 2008-10-15 21:25 UTC (permalink / raw)
  To: pgsql-admin

Hello Mark,

I don't know a command in postgres to do that, but if you're running 
postgres on Linux try it on the command line:

for pid in `psql -A -t -c "select procpid from pg_stat_activity"`; do 
pg_ctl kill TERM $i; done


Best regards.

Ps: Sorry, but my english isn't so good.

-- 
Fabrízio de Royes Mello
Coordenador Desenvolvimento de Software
fmello@dbseller.com.br
DBSeller Informática Ltda. - http://www.dbseller.com.br
(51) 3076-5101



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: backup server - how to disconnect
  2008-10-15 14:11 backup server - how to disconnect Mark Steben <msteben@autorevenue.com>
  2008-10-15 21:25 ` Re: backup server - how to disconnect Fabrízio de Royes Mello <fmello@dbseller.com.br>
@ 2008-10-15 21:48   ` Fabrízio de Royes Mello <fmello@dbseller.com.br>
  0 siblings, 0 replies; 4+ messages in thread

From: Fabrízio de Royes Mello @ 2008-10-15 21:48 UTC (permalink / raw)
  To: ; +Cc: pgsql-admin

Hi all,

Sorry, but I found a little bug in the command line...

To solve just replace "$i" for "$pid":

for pid in `psql -A -t -c "select procpid from pg_stat_activity"`; do 
pg_ctl kill TERM $pid; done

Sorry... :-)

Fabrízio de Royes Mello escreveu:
> Hello Mark,
> 
> I don't know a command in postgres to do that, but if you're running 
> postgres on Linux try it on the command line:
> 
> for pid in `psql -A -t -c "select procpid from pg_stat_activity"`; do 
> pg_ctl kill TERM $i; done
> 
> 
> Best regards.
> 
> Ps: Sorry, but my english isn't so good.
> 

Cordialmente,

-- 
Fabrízio de Royes Mello
Coordenador Desenvolvimento de Software
fmello@dbseller.com.br
DBSeller Informática Ltda. - http://www.dbseller.com.br
(51) 3076-5101



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2008-10-15 21:48 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-10-15 14:11 backup server - how to disconnect Mark Steben <msteben@autorevenue.com>
2008-10-15 20:10 ` Emmanuel BERTHOULE <eberthoule@yahoo.fr>
2008-10-15 21:25 ` Fabrízio de Royes Mello <fmello@dbseller.com.br>
2008-10-15 21:48   ` Fabrízio de Royes Mello <fmello@dbseller.com.br>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox