Unix Technical Forum

Backing up users?

This is a discussion on Backing up users? within the pgsql Admins forums, part of the PostgreSQL category; --> Hi, This might be a stupid question as it is not covered in the 7.4.7 and probably obvious to ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Admins

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 01:46 AM
Mauri Sahlberg
 
Posts: n/a
Default Backing up users?

Hi,

This might be a stupid question as it is not covered in the 7.4.7 and
probably obvious to all others. Where do the system catalogs live? How
to back them up? Should I back them up?

The admin manual states that to restore a pg_dumped database you should
have those users created that will have permission related to objects
created by pg_restore but gives no clear instructions how to back the
users up and how to restore them before restoring the database.

According to the manual, pg_dumps are relative to template0 so all
modifications relative to it will be backed up as well. This gives me a
reason to believe that users could live in template0 but do they?

What if I just wish to move a single database with it's users to a new
machine? It would be a disaster to overwrite whole existing system
catalog on the target machine.

Is it sufficient to select rows from pg_shadow and pg_group that are
related to the database in question and insert them in the new
environment? (The rows to use could probably be deducted from other
catalog tables and views by queries...)

Regards,
Mauri Sahlberg

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 01:46 AM
Bruno Wolff III
 
Posts: n/a
Default Re: Backing up users?

On Sat, Apr 30, 2005 at 11:16:59 +0300,
Mauri Sahlberg <Mauri.Sahlberg@claymountain.com> wrote:
> Hi,
>
> This might be a stupid question as it is not covered in the 7.4.7 and
> probably obvious to all others. Where do the system catalogs live? How
> to back them up? Should I back them up?
>
> The admin manual states that to restore a pg_dumped database you should
> have those users created that will have permission related to objects
> created by pg_restore but gives no clear instructions how to back the
> users up and how to restore them before restoring the database.


You want to use pg_dumpall.

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-10-2008, 01:46 AM
Tom Lane
 
Posts: n/a
Default Re: Backing up users?

Mauri Sahlberg <Mauri.Sahlberg@claymountain.com> writes:
> What if I just wish to move a single database with it's users to a new
> machine? It would be a disaster to overwrite whole existing system
> catalog on the target machine.


Users (and groups) are global across each Postgres installation.
So what you'd need to do is something like this:

pg_dump the desired database, and do "pg_dumpall -g" to get a script
recreating all your users and groups. Edit out the non-pertinent
part of that script. Run the users/groups script and then the pg_dump
script on the target machine.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:20 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com