PostgreSQL数据库重命名
作者:互联网
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;
标签:重命名,stat,PostgreSQL,数据库,pid,bms,pg,activity,backend 来源: https://www.cnblogs.com/akxmhd/p/15375843.html