1.
postgres=# drop database otmstest;ERROR: database "otmstest" is being accessed by other usersDETAIL: There are 9 other sessions using the database.postgres=# SELECT postgres-# pg_terminate_backend(pid) postgres-# FROM postgres-# pg_stat_activity postgres-# WHERE postgres-# -- don't kill my own connection!postgres-# pid <> pg_backend_pid()postgres-# -- don't kill the connections to other databasespostgres-# AND datname = 'database_name'postgres-# ;
2. maybe restart postgres .
sudo service postgresql restart
转载于:https://www.cnblogs.com/Uncho/p/4935216.html