Golfreeze.packetlove.com: Life style of Golfreeze Canon400D Family kammtan.com Jazz Freebsd Unix Linux System Admin guitar Music

All about unix linux freebsd and FAQ for Packetlove.com Web hosting , Mail hosting , VoIP + IP PBX server => all application on unix knowledges by golfreeze => Topic started by: golfreeze on กรกฎาคม 12, 2021, 01:29:43 PM

Title: force drop database on postgres cli command line
Post by: golfreeze on กรกฎาคม 12, 2021, 01:29:43 PM
=== postgres force drop database
If found error :
 database "boss_v2" is being accessed by other users
 DETAIL:  There are 2 other sessions using the database.

==fixed by force drop
REVOKE CONNECT ON DATABASE boss_v2 FROM public;
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'bot’;
==and drop again
drop database boss_v2;

===when create found problem try to template0
CREATE DATABASE dbname TEMPLATE template1;
=If template1 is not available or corrupted, you can use template0 as last resort:
CREATE DATABASE dbname TEMPLATE template0;

ลองกันดูนะครับผม  8)