Created
November 22, 2012 16:22
-
-
Save lucasdavila/4131950 to your computer and use it in GitHub Desktop.
Force postgresql dropdb without restarting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# first get the ids from the process that still connected to db | |
$ psql -d db_name -c "select procpid from pg_stat_activity where datname='db_name' and waiting is not false;" | |
# after, kill the process that still connected to db | |
$ kill procpid_returned_from_query | |
$ dropdb db_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment