728x90
반응형
postgresql에 커넥션이 걸리면, 끊을 수가 있다.
PostgreSQL 9.2 and above:
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'data_example' -- ← change this to your DB
AND pid <> pg_backend_pid()
and client_addr = '10.0.0.21'
PostgreSQL 9.1 and below:
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'TARGET_DB' -- ← change this to your DB
AND pid <> pg_backend_pid();
조회된 pid로 kill
728x90
반응형
'Storage > RDMS' 카테고리의 다른 글
Mariadb) import 후 mysql.user empty 현상 (0) | 2022.09.22 |
---|---|
PostgreSql) Centos7에 Psql 설치 후 설정 (0) | 2021.09.01 |