Обсуждение: restored over postgres database
Hello:
On a newly installed PostgreSQL server I made the mistake of restoring over the postgres database.
Which I made me feel very silly and brought up a couple of questions.
a) What is the postgres database used for?
b) How can I restore the postgres database to a pristine state?
Regarding restoring postgres databse to a pristine state I attempted to restore, from within PGAdmin, the
postgres for a different server but that did not work.
Attempted to do a DROP DATABASE from within psql, but that did not work either. The database did not drop and no error message was produced.
Strange.
Any suggestions.
Thanks in advance for your kind assistance.
Kevin Duffy
On Wed, Dec 3, 2008 at 9:38 AM, Kevin Duffy <KD@wrinvestments.com> wrote: > Hello: > > > > On a newly installed PostgreSQL server I made the mistake of restoring over > the postgres database. > > Which I made me feel very silly and brought up a couple of questions. > > > > a) What is the postgres database used for? By default, nothing usually. Whatever you're using it for is usually it. > b) How can I restore the postgres database to a pristine state? shut down postgres delete everything in the $PGDATA directory (or whatever comes after -D when it starts up) run initdb start postgres All should now be clean and fresh.
In response to "Scott Marlowe" <scott.marlowe@gmail.com>: > On Wed, Dec 3, 2008 at 9:38 AM, Kevin Duffy <KD@wrinvestments.com> wrote: > > Hello: > > > > On a newly installed PostgreSQL server I made the mistake of restoring over > > the postgres database. > > > > Which I made me feel very silly and brought up a couple of questions. > > > > a) What is the postgres database used for? > > By default, nothing usually. Whatever you're using it for is usually it. If he's talking about the _database_ called postgres, it's in the cluster to provide an unused database that applications can connection to by default. > > b) How can I restore the postgres database to a pristine state? > > shut down postgres > delete everything in the $PGDATA directory (or whatever comes after -D > when it starts up) > run initdb > start postgres > > All should now be clean and fresh. Assuming he meant the entire cluster and not just the postgres database. If the latter, a DROP/CREATE will return it to the normal state. -- Bill Moran Collaborative Fusion Inc. http://people.collaborativefusion.com/~wmoran/ wmoran@collaborativefusion.com Phone: 412-422-3463x4023