[GENERAL] Creating new database

2009-11-18 Thread Malcolm Warren
Dear All, I've been using a single database for many years. I'd now like to create a new separate database with most of the same tables, so that I don't have to re-write my code, I'd like to just use a different Tomcat datasource to access it. I had imagined this would be as simple as : 1)

Re: [GENERAL] Creating new database

2009-11-18 Thread Raymond O'Donnell
On 18/11/2009 11:48, Malcolm Warren wrote: Let's say the old database is called database1, and I've created a new database2. When I import the pg_dump into database2, it tells me that the tables already exist (obviously it's talking about the tables in database1). But I surely I've created

Re: [GENERAL] Creating new database

2009-11-18 Thread Vidhya Bondre
can you specify the exact commands and the sequence. With this set up it should work. how do you import the data. Vidhya On Wed, Nov 18, 2009 at 5:18 PM, Malcolm Warren malc...@villeinitalia.comwrote: Dear All, I've been using a single database for many years. I'd now like to create a new

Re: [GENERAL] Creating new database

2009-11-18 Thread Joao Ferreira gmail
I'dd suggest: pgdumpall --clean dump.sql edit the dump.sql file by hand replacing database name and owners and so... then reload into the new DB with psql -f dump.sql postgres this does all the work except creation of users and databases should give you an exact replica with all data inside

[Fwd: Re: [GENERAL] Creating new database]

2009-11-18 Thread Malcolm Warren
---BeginMessage--- Thank you very much for your replies. It's clear to me from your replies that something very odd is going on, not least because I now see that if I connect with: psql template1 I see everything in database1, including data, whereas template1 should be empty. Luckily

Re: [GENERAL] Creating new database

2009-11-18 Thread Scott Marlowe
On Wed, Nov 18, 2009 at 8:12 AM, Joao Ferreira gmail joao.miguel.c.ferre...@gmail.com wrote: I'dd suggest: pgdumpall --clean dump.sql I'd think he'd be much better off with pg_dump, not pg_dumpall. pg_dump srcdb | psql destdb you can add -s as a pg_dump switch if all you want is the schema.

Re: [GENERAL] Creating new database

2009-11-18 Thread Joao Ferreira gmail
On Wed, 2009-11-18 at 08:39 -0700, Scott Marlowe wrote: On Wed, Nov 18, 2009 at 8:12 AM, Joao Ferreira gmail joao.miguel.c.ferre...@gmail.com wrote: I'dd suggest: pgdumpall --clean dump.sql I'd think he'd be much better off with pg_dump, not pg_dumpall. yes, agree. sorry. joao

Re: [GENERAL] Creating new database - SOLVED

2009-11-18 Thread Malcolm Warren
Dear All, Thank you for your emails which were very helpful. I've finally solved it. template1 was full of data, presumably somehow from a badly-run dump and restore. So when I created the new database, that too was full of data from the template. I ran a clean pg_dump on template1 from my

Re: [GENERAL] Creating new database - SOLVED

2009-11-18 Thread John R Pierce
Malcolm Warren wrote: template1 was full of data, presumably somehow from a badly-run dump and restore. So when I created the new database, that too was full of data from the template. I ran a clean pg_dump on template1 from my production database and restored it on my test machine, and

Re: [Fwd: Re: [GENERAL] Creating new database]

2009-11-18 Thread Skylar Saveland
pg_dumpall dumps a cluster of databases. Malcolm Warren wrote: -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To