Thread: Failed to restore/recreate database (one more piece of info)

Failed to restore/recreate database (one more piece of info)

From
Tena Sakai
Date:
Hi,

I mentioned in the previous posting that the file 20091114.6.gz
was made by:
 pg_dumpall | gzip > 20091114.6.gz

At which point, there was only one databasae (named canon) and
no database named musket existed.

Now that I am thinking, maybe the file made by pg_dumpall has
"canon" encoded and therefore what I did logically did not copy
any canon tables into musket?  Could this be the case?

If so, how would I duplicate an existing database and call it
with a different name?

Regards,

Tena Sakai
tsakai@gallo.ucsf.edu


Re: Failed to restore/recreate database (one more piece of info)

From
Tom Lane
Date:
Tena Sakai <tsakai@gallo.ucsf.edu> writes:
> Now that I am thinking, maybe the file made by pg_dumpall has
> "canon" encoded and therefore what I did logically did not copy
> any canon tables into musket?  Could this be the case?

Yup, exactly.  It would have created canon and restored into that.

> If so, how would I duplicate an existing database and call it
> with a different name?

Use pg_dump not pg_dumpall.

            regards, tom lane

Re: Failed to restore/recreate database (one more piece of info)

From
Tena Sakai
Date:
Hi Tom,

Many thanks for your assistance.

I am on my way.  Here’s what I am doing:

  dropdb musket
  createdb musket
  pg_dump canon > canon.dump
  psql –d musket –f canon.dump

I am on the 4th step.  But I could achieve the same with:

  dropdb musket
  createdb musket
  pg_dump canon | psql –d musket –f -

can’t I?  Aside from styling, there is no functional difference
between two procedures, is there?

Thank you.

Regards,

Tena Sakai
tsakai@gallo.ucsf.edu


On 11/16/09 10:42 AM, "Tom Lane" <tgl@sss.pgh.pa.us> wrote:

Tena Sakai <tsakai@gallo.ucsf.edu> writes:
> Now that I am thinking, maybe the file made by pg_dumpall has
> "canon" encoded and therefore what I did logically did not copy
> any canon tables into musket?  Could this be the case?

Yup, exactly.  It would have created canon and restored into that.

> If so, how would I duplicate an existing database and call it
> with a different name?

Use pg_dump not pg_dumpall.

                        regards, tom lane


Re: Failed to restore/recreate database (one more piece of info)

From
Guillaume Lelarge
Date:
Le mardi 17 novembre 2009 à 07:57:41, Tena Sakai a écrit :
> Hi Tom,
>
> Many thanks for your assistance.
>
> I am on my way.  Here's what I am doing:
>
>   dropdb musket
>   createdb musket
>   pg_dump canon > canon.dump
>   psql -d musket -f canon.dump
>
> I am on the 4th step.  But I could achieve the same with:
>
>   dropdb musket
>   createdb musket
>   pg_dump canon | psql -d musket -f -
>
> can't I?

You can do it this way.

> Aside from styling, there is no functional difference
> between two procedures, is there?
>

You're right, there are no functional differences.


--
Guillaume.
 http://www.postgresqlfr.org
 http://dalibo.com.

Re: Failed to restore/recreate database (one more piece of info)

From
Tena Sakai
Date:
Thank you, Guillaume.

Tena Sakai
tsakai@gallo.ucsf.edu


On 11/17/09 9:25 AM, "Guillaume Lelarge" <guillaume@lelarge.info> wrote:

Guillaume