Home > Archive > PostgreSQL Discussion > March 2005 > Restore to a database with another name?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Restore to a database with another name?
phil campaigne

2005-03-30, 7:04 pm

Hi All,
I want to move my development database (7.2.3) to my production server
but the production server database has a different name.
What is the procedure for restoring a database pg_dump to another
machine with a different database name?
Thanks in advance,
Phil


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

Scott Marlowe

2005-03-30, 7:04 pm

On Wed, 2005-03-30 at 14:28, phil campaigne wrote:
> Hi All,
> I want to move my development database (7.2.3) to my production server
> but the production server database has a different name.
> What is the procedure for restoring a database pg_dump to another
> machine with a different database name?


pg_dump -h source_host source_dbname |psql -h dest_host dest_dbname

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

phil campaigne

2005-03-30, 7:04 pm

Scott Marlowe wrote:

>On Wed, 2005-03-30 at 14:28, phil campaigne wrote:
>
>
>
>pg_dump -h source_host source_dbname |psql -h dest_host dest_dbname
>
>
>

Hi Scott,
Unfortunately my production machine is remote and I must transfer it via
FTP. How would that change your suggestion?
Thanks,
Phil



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

Lonni J Friedman

2005-03-30, 7:04 pm

On Wed, 30 Mar 2005 15:58:02 -0500, phil campaigne
<pcampaigne@charter.net> wrote:
> Scott Marlowe wrote:
>
> Hi Scott,
> Unfortunately my production machine is remote and I must transfer it via
> FTP. How would that change your suggestion?


You break it into two separate commands at the pipe, and use
pg_restore to import it back in on the target box.


--
~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~
L. Friedman netllama@gmail.com
LlamaLand http://netllama.linux-sxs.org

---------------------------(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

phil campaigne

2005-03-30, 7:04 pm

Lonni J Friedman wrote:

>On Wed, 30 Mar 2005 15:58:02 -0500, phil campaigne
><pcampaigne@charter.net> wrote:
>
>
>
>You break it into two separate commands at the pipe, and use
>pg_restore to import it back in on the target box.
>
>
>
>

Lonni,
Before I try that, I should tell you that I used pg_dump to create the
backup. I read in the manual that psql client restores text files from
pg_dump. Should I still try pg_restore?
thanks,
Phil




---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Lonni J Friedman

2005-03-30, 7:04 pm

On Wed, 30 Mar 2005 16:24:54 -0500, phil campaigne
<pcampaigne@charter.net> wrote:
> Lonni J Friedman wrote:
>
> Lonni,
> Before I try that, I should tell you that I used pg_dump to create the
> backup. I read in the manual that psql client restores text files from
> pg_dump. Should I still try pg_restore?


I believe that either will work for text file dumps. I've just always
used pg_restore.


--
~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~
L. Friedman netllama@gmail.com
LlamaLand http://netllama.linux-sxs.org

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql
.org

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com