Copy the database..

Started by Abandonedover 18 years ago11 messagesgeneral
Jump to latest
#1Abandoned
besturk@gmail.com

Hi..
I want to copy my database..
I have a database which is name db01 and i want to copy it as name
db01copy ?
How can i do this ?
This database is very big 200GB so i want to the fastest way. Also if
you suggest pg_dump how can i remove the dump data after copying ?
Note: I have a root account with ssh if it is necessary i use ssh.
I'm sorry for my bad english.
Kind regards...

#2Sascha Bohnenkamp
asbohnenkamp@gmx.de
In reply to: Abandoned (#1)
Re: Copy the database..

maybe pg_dump | pg_undump could work?

I mean pg_dump with the appropriate parameters and undump directly to
the other database?

This may one of the fastest ways to do it I think.

Abandoned schrieb:

Show quoted text

Hi..
I want to copy my database..
I have a database which is name db01 and i want to copy it as name
db01copy ?
How can i do this ?
This database is very big 200GB so i want to the fastest way. Also if
you suggest pg_dump how can i remove the dump data after copying ?
Note: I have a root account with ssh if it is necessary i use ssh.
I'm sorry for my bad english.
Kind regards...

#3Abandoned
besturk@gmail.com
In reply to: Sascha Bohnenkamp (#2)
Re: Copy the database..

On Nov 2, 3:49 pm, Sascha Bohnenkamp <asbohnenk...@gmx.de> wrote:

maybe pg_dump | pg_undump could work?

I mean pg_dump with the appropriate parameters and undump directly to
the other database?

This may one of the fastest ways to do it I think.

Abandoned schrieb:

Hi..
I want to copy my database..
I have a database which is name db01 and i want to copy it as name
db01copy ?
How can i do this ?
This database is very big 200GB so i want to the fastest way. Also if
you suggest pg_dump how can i remove the dump data after copying ?
Note: I have a root account with ssh if it is necessary i use ssh.
I'm sorry for my bad english.
Kind regards...

Thank you..
Are there any way to copy database without dump or any temp files ?
(If there is a temp my harddisk not enough for this operation :( )

#4Sascha Bohnenkamp
asbohnenkamp@gmx.de
In reply to: Abandoned (#3)
Re: Copy the database..

if you dump/undump using a pipe there is no temp file ...

Abandoned schrieb:

Show quoted text

On Nov 2, 3:49 pm, Sascha Bohnenkamp <asbohnenk...@gmx.de> wrote:

maybe pg_dump | pg_undump could work?

I mean pg_dump with the appropriate parameters and undump directly to
the other database?

This may one of the fastest ways to do it I think.

Abandoned schrieb:

Hi..
I want to copy my database..
I have a database which is name db01 and i want to copy it as name
db01copy ?
How can i do this ?
This database is very big 200GB so i want to the fastest way. Also if
you suggest pg_dump how can i remove the dump data after copying ?
Note: I have a root account with ssh if it is necessary i use ssh.
I'm sorry for my bad english.
Kind regards...

Thank you..
Are there any way to copy database without dump or any temp files ?
(If there is a temp my harddisk not enough for this operation :( )

#5Abandoned
besturk@gmail.com
In reply to: Sascha Bohnenkamp (#4)
Re: Copy the database..

On Nov 2, 5:30 pm, Sascha Bohnenkamp <asbohnenk...@gmx.de> wrote:

if you dump/undump using a pipe there is no temp file ...

Abandoned schrieb:

On Nov 2, 3:49 pm, Sascha Bohnenkamp <asbohnenk...@gmx.de> wrote:

maybe pg_dump | pg_undump could work?

I mean pg_dump with the appropriate parameters and undump directly to
the other database?

This may one of the fastest ways to do it I think.

Abandoned schrieb:

Hi..
I want to copy my database..
I have a database which is name db01 and i want to copy it as name
db01copy ?
How can i do this ?
This database is very big 200GB so i want to the fastest way. Also if
you suggest pg_dump how can i remove the dump data after copying ?
Note: I have a root account with ssh if it is necessary i use ssh.
I'm sorry for my bad english.
Kind regards...

Thank you..
Are there any way to copy database without dump or any temp files ?
(If there is a temp my harddisk not enough for this operation :( )- Hide quoted text -

- Show quoted text -

I tryed pg_dump but it is very slowly. Are there any faster way to
copy database?

#6Rainer Bauer
usenet@munnin.com
In reply to: Abandoned (#1)
Re: Copy the database..

Abandoned wrote:

I tryed pg_dump but it is very slowly. Are there any faster way to
copy database?

Actually, I was looking for something along the same line.

I often want to test some functionality in my program based on the same
dataset. However, dump/restore takes too long to be of any use.

Wouldn't it be possible to copy the database folder and somehow instruct the
postmaster to include the copied data after a restart?

Rainer

#7Tom Lane
tgl@sss.pgh.pa.us
In reply to: Rainer Bauer (#6)
Re: Copy the database..

Rainer Bauer <usenet@munnin.com> writes:

Wouldn't it be possible to copy the database folder and somehow instruct the
postmaster to include the copied data after a restart?

See CREATE DATABASE's TEMPLATE option. It's a bit crude but I think
it'll help.

regards, tom lane

#8Julio Cesar Sánchez González
knowhow@sistemasyconectividad.com.mx
In reply to: Rainer Bauer (#6)
Re: Copy the database..

El dom, 04-11-2007 a las 02:16 +0100, Rainer Bauer escribió:

Abandoned wrote:

I tryed pg_dump but it is very slowly. Are there any faster way to
copy database?

Actually, I was looking for something along the same line.

I often want to test some functionality in my program based on the same
dataset. However, dump/restore takes too long to be of any use.

Wouldn't it be possible to copy the database folder and somehow instruct the
postmaster to include the copied data after a restart?

Rainer

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Hi for all,

Try with de PITR
(http://www.postgresql.org/docs/8.1/static/backup-online.html), should
be help you...

--
Regards,

Julio Cesar Sánchez González.

--
Ahora me he convertido en la muerte, destructora de mundos.
Soy la Muerte que se lleva todo, la fuente de las cosas que vendran.

www.sistemasyconectividad.com.mx http://darkavngr.blogspot.com/

#9Rainer Bauer
usenet@munnin.com
In reply to: Abandoned (#1)
Re: Copy the database..

Tom Lane wrote:

Rainer Bauer <usenet@munnin.com> writes:

Wouldn't it be possible to copy the database folder and somehow instruct the
postmaster to include the copied data after a restart?

See CREATE DATABASE's TEMPLATE option. It's a bit crude but I think
it'll help.

Thanks, Tom. Works like a charm.

Rainer

#10Martijn van Oosterhout
kleptog@svana.org
In reply to: Abandoned (#5)
Re: Copy the database..

On Sat, Nov 03, 2007 at 01:42:09PM -0000, Abandoned wrote:

I tryed pg_dump but it is very slowly. Are there any faster way to
copy database?

Have you tried CREATE DATABASE .. TEMPLATE ? (See amual for syntax)

Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/

Show quoted text

Those who make peaceful revolution impossible will make violent revolution inevitable.
-- John F Kennedy

#11Scott Marlowe
scott.marlowe@gmail.com
In reply to: Abandoned (#5)
Re: Copy the database..

On 11/3/07, Abandoned <besturk@gmail.com> wrote:

I tryed pg_dump but it is very slowly. Are there any faster way to
copy database?

Assuming it's all happening on the same db server, yes:

psql template1
create database newdb template olddb