zoukankan      html  css  js  c++  java
  • [Postgres] drop database , but the database is being accessed by other users

    1.

    postgres=# drop database otmstest;
    ERROR:  database "otmstest" is being accessed by other users
    DETAIL:  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 databases
    postgres-#     AND datname = 'database_name'
    postgres-#     ;

    2. maybe restart postgres .

    sudo service postgresql restart

  • 相关阅读:
    php数组
    php运算符
    PHP数据类型
    面向对象3和继承
    面向对象2
    面向对象1
    语法整理php
    语法整理
    ajax
    数据库4
  • 原文地址:https://www.cnblogs.com/Uncho/p/4935216.html
Copyright © 2011-2022 走看看