Обсуждение: dumping and restoring user information.

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

dumping and restoring user information.

От
Pritesh Shah
Дата:
hi,

I'm trying to make some hardware upgrades (increasing disk capacity)
to the machine where the database server is running. So, I've backed
up all the existing databases using the following command:

pg_dump -f <location_for_dump> -Fc -v <dbname>

I want to restore these databases on a different machine. I've got the
postmaster installed and running (version same as on old one). To
restore the databases i tried the following command:

pg_restore -v -d <dbname> <dump_location>

to which i got the following error:

pg_restore: connecting to database for restore
pg_restore: [archiver (db)] connection to database "abc" failed: FATAL:  datab
ase "abc" does not exist
pg_restore: *** aborted because of error

Realizing my mistake i used the following command:

pg_restore -v -C -d template1 <dump_location>

to which i got the following error:

pg_restore: connecting to database for restore
pg_restore: creating DATABASE abc
pg_restore: [archiver] could not set session user to "abc": ERROR:
user "abc" does not exist
pg_restore: *** aborted because of error

So, seeing this i first made the user, using 'createuser' and then
created a database using 'createdb'. Now, since i have many users do i
have to everytime createuser and createdb for each user and database.
Is there any way of copying/dumping/restoring the user and group
information and permissions from the old machine to the new one so
that i do not have to do a createuser everytime??

Could somebody help me out with this please. Thanks in advance.

Cheers,
Pritesh

Re: dumping and restoring user information.

От
Michael Fuhr
Дата:
On Tue, Feb 01, 2005 at 12:11:06AM -0700, Pritesh Shah wrote:
>
> Is there any way of copying/dumping/restoring the user and group
> information and permissions from the old machine to the new one so
> that i do not have to do a createuser everytime??

You can dump just users and groups with "pg_dumpall --globals-only"
(or -g).

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

Re: dumping and restoring user information.

От
Pritesh Shah
Дата:
Thanks, it worked.


On Tue, 1 Feb 2005 00:30:31 -0700, Michael Fuhr <mike@fuhr.org> wrote:
> On Tue, Feb 01, 2005 at 12:11:06AM -0700, Pritesh Shah wrote:
> >
> > Is there any way of copying/dumping/restoring the user and group
> > information and permissions from the old machine to the new one so
> > that i do not have to do a createuser everytime??
>
> You can dump just users and groups with "pg_dumpall --globals-only"
> (or -g).
>
> --
> Michael Fuhr
> http://www.fuhr.org/~mfuhr/
>