//断开链接
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'xxx'
AND pid <> pg_backend_pid();
//删库
drop database xxx;
导出数据库:
./pg_dump -h 10.20.31.100 -U postgres em > em.sql
导入数据库:
./psql -h 10.20.31.31 -U postgres -d em -f em.sql > out.txt