开发者

How do I change the maintenance database for Postgres?

I'm running PostgreSQL version 9.0 on OSX version 10.6.6. Somehow one of my development databases has become the maintenance db, not postgres (this db also exists). I can't find any docu开发者_StackOverflow社区mentation on how to change/set the maintenance db back to postgres.

I can't drop my development database because of this issue...


You can change maintenance db from pgAdmin but you have to be disconnected from the database engine to be able to do that.

First disconnect:

How do I change the maintenance database for Postgres?

Then in the database server properties:

How do I change the maintenance database for Postgres?

Choose the desired maintenance database:

How do I change the maintenance database for Postgres?


You're not entirely clear on this, but do you mean the "Maintenance DB" selection in pgAdmin III?

Select the server in your "object browser" pane; right click -> Properties

The fifth field is "Maintenance DB"


How do I change the maintenance database for Postgres?

Maintenance db field is read-only , you can't change it.So you should keep your server properties somewhere and create new server with these properties and set maintenance db "postgres". Now you are able to drop database.


The command line option is :

psql -U intelison -c "UPDATE pg_database SET datistemplate=false, datallowconn=true WHERE datname = '<your_database_name>'"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜