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';

转载于:https://www.cnblogs.com/haoge92/p/9284581.html

你可能感兴趣的:(数据库)