Re: How to remove the current database and populate the database with new data?

Поиск
Список
Период
Сортировка
От Joshua D. Drake
Тема Re: How to remove the current database and populate the database with new data?
Дата
Msg-id 1275606565.27752.72.camel@jd-desktop.unknown.charter.com
обсуждение исходный текст
Ответ на How to remove the current database and populate the database with new data?  ("Wang, Mary Y" <mary.y.wang@boeing.com>)
Список pgsql-general
On Thu, 2010-06-03 at 16:05 -0700, Wang, Mary Y wrote:
> Hi,
>
> I've some test data in a database and would like to delete that database and clean everything that is associated with
thatdatabase.  Then I'd like to populate the same database with different data. 
> My plan is to:
> (1) Remove the /usr/local/pgsql/data directory
> (2) psql -e mydatabase -f /tmp/indumpfile.txt & > /tmp/outdumpfile.txt (/tmp/indumpfile.txt has all the sql
statementsto restore the database) 
> (3) Restart the postgres server
>
> Not sure if I need to run the VACCUM command, because I know Postgres 8.3.8 has the auto-vacuum daemon on to perform
VACCUMswhen it's necessary.  Did I miss any other steps for cleaning up? 

How about:

psql -U postgres template1 -c "drop database <foo>";
psql -U postgres <foo> < inputfile.txt
psql -U postgres <foo> -c "ANALYZE VERBOSE"

What you have above won't work anyway as you need to stop postgres,
initdb, recreate your users etc...

Joshua D. Drake


--
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 503.667.4564
Consulting, Training, Support, Custom Development, Engineering

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

Предыдущее
От: "Wang, Mary Y"
Дата:
Сообщение: How to remove the current database and populate the database with new data?
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: How to remove the current database and populate the database with new data?