{"id":2015,"date":"2016-06-14T08:57:09","date_gmt":"2016-06-14T05:57:09","guid":{"rendered":"http:\/\/www.fatihacar.com\/blog\/?p=2015"},"modified":"2017-01-23T10:58:41","modified_gmt":"2017-01-23T07:58:41","slug":"error-database-database_name-is-being-accessed-by-other-users-in-postgresql","status":"publish","type":"post","link":"https:\/\/www.fatihacar.com\/blog\/error-database-database_name-is-being-accessed-by-other-users-in-postgresql\/","title":{"rendered":"ERROR:  database &#8220;database_name&#8221; is being accessed by other users in PostgreSQL"},"content":{"rendered":"<p><strong>Error<\/strong><\/p>\n<blockquote><p>When you execute drop database command, database get an error like ERROR:  database &#8220;database_name&#8221; is being accessed by other users.><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.fatihacar.com\/blog\/resimler\/droppostgresqldatabase1.jpg\" alt=\"droppostgresqldatabase1\" width=\"699\" height=\"181\" class=\"aligncenter size-full wp-image-2016\" srcset=\"https:\/\/www.fatihacar.com\/blog\/resimler\/droppostgresqldatabase1.jpg 699w, https:\/\/www.fatihacar.com\/blog\/resimler\/droppostgresqldatabase1-300x78.jpg 300w\" sizes=\"auto, (max-width: 699px) 100vw, 699px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.fatihacar.com\/blog\/resimler\/droppostgresqldatabase2.jpg\" alt=\"droppostgresqldatabase2\" width=\"694\" height=\"52\" class=\"aligncenter size-full wp-image-2017\" srcset=\"https:\/\/www.fatihacar.com\/blog\/resimler\/droppostgresqldatabase2.jpg 694w, https:\/\/www.fatihacar.com\/blog\/resimler\/droppostgresqldatabase2-300x22.jpg 300w\" sizes=\"auto, (max-width: 694px) 100vw, 694px\" \/><br \/>\n<\/blockquote\n\n<strong>Solution<\/strong><br \/>\n<!--more--><\/p>\n<blockquote><p>\nYou have to kill backend process. Firstly, you have fecth backend process.<br \/>\nSelect<br \/>\nSQL> SELECT pid,datname FROM pg_stat_activity where pid <> pg_backend_pid();<br \/>\nKill<br \/>\nSQL> SELECT pg_terminate_backend($pid);<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.fatihacar.com\/blog\/resimler\/droppostgresqldatabase3.jpg\" alt=\"droppostgresqldatabase3\" width=\"682\" height=\"179\" class=\"aligncenter size-full wp-image-2018\" srcset=\"https:\/\/www.fatihacar.com\/blog\/resimler\/droppostgresqldatabase3.jpg 682w, https:\/\/www.fatihacar.com\/blog\/resimler\/droppostgresqldatabase3-300x79.jpg 300w\" sizes=\"auto, (max-width: 682px) 100vw, 682px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.fatihacar.com\/blog\/resimler\/droppostgresqldatabase4.jpg\" alt=\"droppostgresqldatabase4\" width=\"696\" height=\"225\" class=\"aligncenter size-full wp-image-2019\" srcset=\"https:\/\/www.fatihacar.com\/blog\/resimler\/droppostgresqldatabase4.jpg 696w, https:\/\/www.fatihacar.com\/blog\/resimler\/droppostgresqldatabase4-300x97.jpg 300w\" sizes=\"auto, (max-width: 696px) 100vw, 696px\" \/><\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Error When you execute drop database command, database get an error like ERROR: database &#8220;database_name&#8221; is being accessed by other users.> Solution<\/p>\n","protected":false},"author":37,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[10,113],"tags":[93,88],"class_list":["post-2015","post","type-post","status-publish","format-standard","hentry","category-administration-postgresql","category-errors-and-solutions-postgresql","tag-postgresql","tag-postgresql-administration"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p39NFI-wv","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/posts\/2015","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/users\/37"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/comments?post=2015"}],"version-history":[{"count":2,"href":"https:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/posts\/2015\/revisions"}],"predecessor-version":[{"id":2180,"href":"https:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/posts\/2015\/revisions\/2180"}],"wp:attachment":[{"href":"https:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/media?parent=2015"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/categories?post=2015"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/tags?post=2015"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}