create db from a template

Поиск
Список
Период
Сортировка
От Marc Fromm
Тема create db from a template
Дата
Msg-id 81FEAB8CDDC62B42B6E8AA258228BC8804E925FF@EVS2.univ.dir.wwu.edu
обсуждение исходный текст
Ответы Re: create db from a template  (Shane Ambler <pgsql@Sheeky.Biz>)
Список pgsql-admin
Is there a better way to create a database from the schema of another
database, to have a copy of a database without the data?

1.) I get the schema from a database
pg_dump -s -U postgres -O databasename > /tmp/template_name

2.) I create a new database.
createdb -U postgres newdb

3.) I restore the schema to the newdb.
psql -U postgres newdb < /tmp/template_name

4.) I create a database, using the newdb as a TEMPLATE
CREATE DATABASE databasename2 TEMPLATE newdb;


Marc


В списке pgsql-admin по дате отправления:

Предыдущее
От: Vishal Arora
Дата:
Сообщение: Re: Postgres Performance
Следующее
От: "Marc Fromm"
Дата:
Сообщение: exceeds max_fsm_pages