Re: Restoring a database as another user

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David Garamond" <davidgaramond(at)gmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Restoring a database as another user
Date: 2006-04-28 14:25:30
Message-ID: 688.1146234330@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

"David Garamond" <davidgaramond(at)gmail(dot)com> writes:
> My goal is to restore someone's (e.g. Jim's) database by the superuser to be
> owned by a new user (e.g. Bob). Jim and Bob connects using password and I
> (the superuser) do not know their passwords.

I think you'd need a two-step process:

pg_restore --no-owner mydb.dump >mydb.script

psql -U superuser template1
psql=> create database foo owner bob;
psql=> \c foo
psql=> set session authorization bob;
psql=> \i mydb.script

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Benjamin Krajmalnik 2006-04-28 14:35:52 Re: New system recommendations
Previous Message Ben K. 2006-04-28 14:03:22 Re: Is there an efficient way to check whether a particular