db 数据库重命名
SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity
WHERE datname='db_name' AND pid<>pg_backend_pid();
ALTER DATABASE db_name RENAME TO db_name_bak;
SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity
WHERE datname='bms' AND pid<>pg_backend_pid();
ALTER DATABASE bms RENAME TO bms_dev;
SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity
WHERE datname='bms' AND pid<>pg_backend_pid();
ALTER DATABASE bms RENAME TO bms_uat;