postgresql 删除库的时候报错database "temp_test_yang" is being accessed by other users

删除库的时候报错

ERROR: database "temp_test_yang" is being accessed by other users
DETAIL: There are 4 other sessions using the database.

 
说明该temp_test_yang库正在被人连接。解决方法是:
查询出连接该数据库的进程,并将其杀死(比较暴力)
select pg_terminate_backend(pid) from pg_stat_activity where DATNAME = 'temp_test_yang';
posted @ 2018-07-09 16:47  浩0x208哥  阅读(1543)  评论(0编辑  收藏  举报