Connecting Tech Pros Worldwide Forums | Help | Site Map

Duplicate a DB

Newbie
 
Join Date: Aug 2007
Posts: 1
#1: Aug 27 '07
Hello, I am new to postgreSQL and am trying to duplicate a DB.

I found this old discussion but can no longer comment on it so am starting a new one.

http://www.thescripts.com/forum/thread173311.html

I am using the pgadmin application (Mac OSX version) but can not see any way to duplicate the DB.

Can any one explain to me how to do it, via the admin app or a php script?

Thanks
Moderator
 
Join Date: Nov 2006
Location: Boston, USA
Posts: 505
#2: Aug 30 '07

re: Duplicate a DB


If you want to have a copy of your database on the same server you can use the createdb command at the OS prompt:
createdb -T old-db new-db

See these docs for more information:
http://www.postgresql.org/docs/8.1/s...-createdb.html
http://www.postgresql.org/docs/8.1/s...-createdb.html

If you want to migrate this db from one server to another you can use the pg_dump utility.

Let us know if you have any problems with either approach.
Newbie
 
Join Date: Sep 2007
Posts: 15
#3: Sep 6 '07

re: Duplicate a DB


Quote:

Originally Posted by michaelb

If you want to have a copy of your database on the same server you can use the createdb command at the OS prompt:
createdb -T old-db new-db

See these docs for more information:
http://www.postgresql.org/docs/8.1/s...-createdb.html
http://www.postgresql.org/docs/8.1/s...-createdb.html

If you want to migrate this db from one server to another you can use the pg_dump utility.

Let us know if you have any problems with either approach.



but the initdb command ,
how can use the initdb ,can i use the initdb to create the db
then how to write the command .
Reply