刪除數據庫
更新時間 2025-02-14 10:21:28
最近更新時間: 2025-02-14 10:21:28
分享文章
本文為您介紹如何刪除數據庫。
-- 刪除數據庫teledb_db_new
teledb=# drop database teledb_db_new;
-- 仍有會話連接數據庫時,會報錯
ERROR: database "teledb_db_new" is being accessed by other users
DETAIL: There is 1 other session using the database.
-- 停止該數據庫的所有連接,后重新刪除數據庫
teledb=# select pg_terminate_backend(pid) from pg_stat_activity where datname='teledb_db_new';
pg_terminate_backend
----------------------
t
(1 row)
teledb=# drop database teledb_db_new;
DROP DATABASE