Re: Restoring the DB from others user DB Backup.

From: Jim Nasby <decibel(at)decibel(dot)org>
To: "Mavinakuli, Prasanna (STSD)" <prasanna(dot)b-m(at)hp(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Restoring the DB from others user DB Backup.
Date: 2007-07-13 15:31:54
Message-ID: 266F3A15-BE70-4C6A-8B09-C855156BE9BF@decibel.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Jul 4, 2007, at 5:22 AM, Mavinakuli, Prasanna (STSD) wrote:
> We have 2 altogether databases owned by two different users.The
> requirement is ,by using a back up dump of a database owned by some
> other user,We will need to restore the other DB which is owned
> completely by other user.
>
> The problem what we are facing is,if we try to use pg_restore
> command,then it cribbs saying the user doesn't exist.So could you
> please
> direct me for a way to achieve this.Unfortunately I have to use
> postgreSQL 7.4.2 version where there is no support for -O option.

pg_restore will just send SQL commands to STDOUT if you don't give it
a database to connect to. You can then use something like 'grep -v'
to strip out all the ownership commands for the affected user.
--
Jim Nasby jim(at)nasby(dot)net
EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2007-07-13 15:34:00 Re: Accent-insensitive search
Previous Message Alexander Staubo 2007-07-13 14:48:29 Re: Updates/Changes to a database