pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Milen A. Radev <milen@radev.net>
To: pgsql-admin@postgresql.org
Subject: Re: Owner Issue When Migrating Database to New Server
Date: Wed, 15 Aug 2007 14:40:16 +0300
Message-ID: <f9uon1$v86$1@sea.gmane.org> (raw)
In-Reply-To: <A3AC4FA47DC0B1458C3E5396E685E63302395F6A@SAB-DC1.sab.uiuc.edu>
References: <A3AC4FA47DC0B1458C3E5396E685E63302395F6A@SAB-DC1.sab.uiuc.edu>

Campbell, Lance написа:
> PostgreSQL: 8.2.4
> 
> OS: Linux Red Hat 4.x 64 bit
> 
>  
> 
> I have a database running on serverA with postgres user userA.  I want
> to migrate the database to ServerB with a postgres user userB.  Notice
> the users are not the same.  I did the following to put the database on
> the new server:
> 
>  
> 
> 1)       I created the database on serverB with userB.
> 
> 2)       I then did pg_dump -h serverA -U userA dbname | psql -h serverB
> -U userB dbname
> 
>  
> 
> This of course failed.  The user userA was not in the database found on
> serverB.  I then did the following:
> 
>  
> 
> 1)       I created the database on serverB with userB.
> 
> 2)       On serverB I did pg_dump -h serverA -U userA dbname >
> postgreSQL.out
> 
> 3)       I then did a find and replace on userA with userB through NANO
> on the file postgreSQL.out
> 
> 4)       I then did psql -h serverB -U userB dbname -f postgreSQL.out
> 
>  
> 
> Is there a better way to do this? 
> 


Yes - use the "--no-owner" option for "pg_dump" when creating the dump file.

-- 
Milen A. Radev




view thread (2+ messages)

Message-ID: <f9uon1$v86$1@sea.gmane.org>
Permalink:  ../f9uon1$v86$1@sea.gmane.org/
Also on:    postgresql.org/message-id/f9uon1$v86$1@sea.gmane.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: milen@radev.net
  Subject: Re: Owner Issue When Migrating Database to New Server
  In-Reply-To: <f9uon1$v86$1@sea.gmane.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox