PostgreSQL: Temporarily disable connections

后端 未结 5 1820
我在风中等你
我在风中等你 2020-12-14 00:50

I have a script in PostgreSQL which restores test database from dump every night. The database is accessed by app servers and processes with connection pool which keeps a fe

5条回答
  •  渐次进展
    2020-12-14 01:07

    After you have terminated the current active connections you can also issue this command that will only allow super users to login. This assumes you are ok with all super users having access still. Hopefully you don't hand out super user rights to just anyone.

    ALTER DATABASE your_db CONNECTION LIMIT 0;
    

提交回复
热议问题