Обсуждение: Locking a database

Поиск
Список
Период
Сортировка

Locking a database

От
"Jose Norberto"
Дата:
Hello all!
I want to make a pg_dump of a database, but I must be sure that no one is
logged in. Which is the best way to do it?
Thanks in advance
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com


Re: Locking a database

От
Michelle Murrain
Дата:
On Monday 30 April 2001 02:37 pm, Jose Norberto wrote:
> Hello all!
> I want to make a pg_dump of a database, but I must be sure that no one is
> logged in. Which is the best way to do it?
> Thanks in advance

Change the permissions in the pg_hba.conf file
(/usr/local/pgsql/data/pg_hba.conf is the default placement)

The bottom of the file looks like:

# Put your actual configuration here
# ----------------------------------

# This default configuration allows any local user to connect as any
# PostgreSQL username, over either UNIX domain sockets or IP:

local        all                                           trust
host         all         127.0.0.1     255.255.255.255     trust

# If you want to allow non-local connections, you will need to add more
# "host" records (and don't forget to start the postmaster with "-i"!).

# CAUTION: if you are on a multiple-user machine, the above default
# configuration is probably too liberal for you --- change it to use
# something other than "trust" authentication.

Michelle
--
------------
Michelle Murrain, Ph.D.
President
Norwottuck Technology Resources
mpm@norwottuck.com
http://www.norwottuck.com

Re: Locking a database

От
Tom Lane
Дата:
"Jose Norberto" <nn_jose@hotmail.com> writes:
> I want to make a pg_dump of a database, but I must be sure that no one is
> logged in.

Why?

pg_dump will return a consistent state of the database even if other
transactions are proceeding meanwhile.

            regards, tom lane

Re: Locking a database

От
Lincoln Yeoh
Дата:
At 03:08 PM 4/30/01 -0400, Tom Lane wrote:
>"Jose Norberto" <nn_jose@hotmail.com> writes:
>> I want to make a pg_dump of a database, but I must be sure that no one is
>> logged in.
>
>Why?
>
>pg_dump will return a consistent state of the database even if other
>transactions are proceeding meanwhile.

Maybe it's a final dump before a db upgrade/swap.

The consistent database state must also be consistent with what the rest of
the world thinks.

e.g. no customers ordering stuff or users doing stuff that's left out in
the pg_dump.

Cheerio,
Link.