Files
chill_notes/数据库知识库/POSTGRESQL/postgresql删除还有活动连接的数据库.md
2026-04-16 00:28:41 +08:00

7 lines
246 B
Markdown
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
```sql
select `pg_terminate_backend(pid)` from `pg_stat_activity` where `datname`='testdb' and `pid`<>`pg_backend_pid();`
```
==上面sql表示的是关闭数据库testdb的活动连接接下来就可以用==
```sql
drop database `testdb;`
```