postgresql 删除数据库报错 DETAIL: There are 6 other sessions using the database.
postgresql 删除数据库报错
postgres=# drop database testdb;
ERROR: database "testdb" is being accessed by other users
DETAIL: There are 6 other sessions using the database.
解决办法:输入下面的命令,断开连接
SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE datname='testdb' AND pid<>pg_backend_pid();
再删除数据库即可
postgres=# drop database testdb;
DROP DATABASE
参考链接:https://www.cnblogs.com/hellojesson/p/10037315.html
职称
浙公网安备 33010602011771号