Search Postgresql Archives

Re: Creating new database - SOLVED

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 finally everything is normal.

you can clean up template 1 2 ways...

   A) drop all the objects in it as shown by \d  in psql
or
   B) drop template1 and recreate it using template0 which is sacrosanct.

to do this latter, while logged on as user postgres, do something like...
   $ psql postgres
   postgres=# drop database template1;
   postgres=# create database template1 with template=template0;

to copy your database without data, I'd use something like......

   $ createdb --owner=someuser newdb
   $ pg_dump --schema-only olddb | psql newdb




--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux