PostgreSQL force rename database

Table of Contents

PostgreSQL force rename database

PostgreSQL ép đổi tên Database

-- Tắt hết connect đến DB
SELECT
    pg_terminate_backend (pid)
FROM
    pg_stat_activity
WHERE
    datname = 'nongnghiepdongnai2';

-- Đổi tên DB
ALTER DATABASE nongnghiepdongnai2 RENAME TO nongnghiepdongnai;

https://www.geeksforgeeks.org/postgresql-rename-database/

Leave a Reply

Your email address will not be published. Required fields are marked *