Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fak8u-0002XA-0P for pgsql-general@arkaria.postgresql.org; Wed, 04 Jul 2018 15:56:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fak8r-0004Mi-UD for pgsql-general@arkaria.postgresql.org; Wed, 04 Jul 2018 15:56:29 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fak8q-0004Mb-4i for pgsql-general@lists.postgresql.org; Wed, 04 Jul 2018 15:56:29 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fak8l-0002J6-0p for pgsql-general@postgresql.org; Wed, 04 Jul 2018 15:56:26 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id F06DD21CF0; Wed, 4 Jul 2018 11:56:21 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 04 Jul 2018 11:56:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=+i9HlGLMY9bbt7QDtqC/Eyy89qXlE 4NhKG4E13Fb29A=; b=YzFqfOREEik/S8WKB79clXikmUJcSl3TUrya4wihOmJRu Dkng6cgfnSbf0FvzIiGrMLoFbzoo/YA3Zk11aTiXpn5s4K5epxIx49VdbbJ9eNi5 OPtMlrCz0YJ7Gt6xhyPr33Y/mnnDBXuDkxrGLEFij2EEXfrW9RCaRHBj4zVA9XvT DOB8JArjmLNuJ0cERvKC89p4dHK2USp5/1Wpt3WkYA1XK401KWm+uQL3ODY5uzJy Kd7uRDuN6VRdZArXebwiCiXHi4koJ0+Nn34tu4X4oZtRek+24hJhVXzyif7xu5ft iWP9G6oUulnnHKkSqgy5BG/IQo8eaQ6R/xneLiZhA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=+i9HlG LMY9bbt7QDtqC/Eyy89qXlE4NhKG4E13Fb29A=; b=U1bHmeFgPCRyi0Omet9ndd QxqSjjMyANgZE53ZlEroPJUqUBcBUiyg5HPl+mrlTXAw4OiOOoLd3N5zRERLGuhp RDcOVz5TiBS56sauKPYS34QPu2ehsBZs2xz/NkD7+ZpYujksIqSOuW0mOB+LN7V0 yZ44OIUf9h5wQD9XnR0FA0vdaNjHrJ24fCabKUH4Ayg7xL1YP0IurIBFqOoo5Ad1 mcoJRcLsxU/AmjvnFYBxAFfDodout5b9zI+Ay51o/bC5rs1UdrIB5FvIcTcbo8cP 67UC+7mpQeyOejlvvNX0YmaN+Tmrxn7UZ9PS45Gd442Y2i4Jf5/3HHr112j++uZg == X-ME-Proxy: X-ME-Sender: Received: from [192.168.1.3] (unknown [71.212.134.181]) by mail.messagingengine.com (Postfix) with ESMTPA id 08A7110269; Wed, 4 Jul 2018 11:56:20 -0400 (EDT) Subject: Re: Unable to Connect to DB Instance To: Boblitz John , "pgsql-general@postgresql.org" References: <5c594ba9d5c94a9eb595c710df2d7735@bertschi.com> From: Adrian Klaver Message-ID: <9e42f409-2e90-636a-772d-9ea6ca34d25a@aklaver.com> Date: Wed, 4 Jul 2018 08:56:20 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <5c594ba9d5c94a9eb595c710df2d7735@bertschi.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 07/04/2018 04:08 AM, Boblitz John wrote: > > Good Morning, > > Beginning yesterday morning, users have been unable to fully connect > to our DB Instance. > > 1.At the time of the initial report – I was connected to the DB via > pgAdmin and could perform queries without problem. > > 2.Users reported messages similar to “could not open file > "global/11801": No such file or directory” > > 3.At that time, connection logging was turned off and there were no > messages in the log files. > > 4.As this is a development environment, I turned logging on in the > config and restarted the DB > > 5.After restart, neither I, nor the Users could fully reconnect. > > 6.I have performed a SYS Level backup (tar of the whole postgres > directory tree) > > 7.I cannot perform a DB level Backup (same errors occur) > > System Details > >                 Linux Debian      7.11 > >                 Postgres              9.1 (9.1.24lts-0+d) > > It appears that we can connect to the DB Server itself as I get > “connection received” and “connection authorized” – but when trying > to access the DB itself, several errors are raised (see below). > > I am assuming that some internals are no longer consistent – the > file “global/11801” for instance really does not exist on the system. > > Questions: > > 1.Is there any way to recover from this (backup is unfortunately > rather old) > > 2.What are possible causes?  I’d like to prevent this from happening > on my production servers. Looks like something/someone deleted files from portions of the $DATA directory. In particular from ~/global and ~/pg_tblspc. Without those files you can't really proceed. Can you recover by creating a new instance and restoring from a dump of the production server? As to exact cause the only thing I can think of is to to look at the system logs at the time of the initial failure and see if there is anything there that would shed light. > > ** I am aware that we are on older releases, and yes, we plan to > migrate to more current releases “soon” ™ … > > Thanks in advance. > > John Boblitz > > Exceprt from Log: > > 2018-07-04 09:15:13 CEST 192.168.250.50(28559) [unknown]LOG: > connection received: host=192.168.250.50 port=28559 > > 2018-07-04 09:15:14 CEST 192.168.250.50(28559) postgresLOG: > connection authorized: user=dbadmin database=postgres > > 2018-07-04 09:15:14 CEST 192.168.250.50(28559) postgresERROR:  could > not open file "global/11801": No such file or directory > > 2018-07-04 09:15:14 CEST 192.168.250.50(28559) postgresSTATEMENT: > SELECT usecreatedb, usesuper, CASE WHEN usesuper THEN > pg_postmaster_start_time() ELSE NULL END as upsince, CASE WHEN > usesuper THEN pg_conf_load_time() ELSE NULL END as confloadedsince, > CASE WHEN usesuper THEN pg_is_in_recovery() ELSE NULL END as > inrecovery, CASE WHEN usesuper THEN pg_last_xlog_receive_location() > ELSE NULL END as receiveloc, CASE WHEN usesuper THEN > pg_last_xlog_replay_location() ELSE NULL END as replayloc, CASE WHEN > usesuper THEN pg_last_xact_replay_timestamp() ELSE NULL END as > replay_timestamp, CASE WHEN usesuper AND pg_is_in_recovery() THEN > pg_is_xlog_replay_paused() ELSE NULL END as isreplaypaused > >                   FROM pg_user WHERE usename=current_user > > 2018-07-04 09:15:19 CEST 192.168.250.50(28559) postgresERROR:  could > not open file "global/11801": No such file or directory > > 2018-07-04 09:15:19 CEST 192.168.250.50(28559) postgresSTATEMENT: > SELECT rolcreaterole, rolcreatedb FROM pg_roles WHERE rolname = > current_user; > > 2018-07-04 09:15:22 CEST 192.168.250.50(28561) [unknown]LOG: > connection received: host=192.168.250.50 port=28561 > > 2018-07-04 09:15:22 CEST 192.168.250.50(28561) g11BaseLOG: > connection authorized: user=dbadmin database=g11Base > > 2018-07-04 09:15:23 CEST 192.168.250.50(28561) g11BaseERROR:  could > not open file "pg_tblspc/24579/PG_9.1_201105231/24580/11866": No > such file or directory > > 2018-07-04 09:15:23 CEST 192.168.250.50(28561) g11BaseSTATEMENT: > SELECT CASE WHEN nspname LIKE E'pg\\_temp\\_%' THEN 1 > >                             WHEN (nspname LIKE E'pg\\_%') THEN 0 > >                             ELSE 3 END AS nsptyp, > >                        nsp.nspname, nsp.oid, > pg_get_userbyid(nspowner) AS namespaceowner, nspacl, > description,       has_schema_privilege(nsp.oid, 'CREATE') as cancreate, > >                 (SELECT array_agg(label) FROM pg_seclabels sl1 > WHERE sl1.objoid=nsp.oid) AS labels, > >                 (SELECT array_agg(provider) FROM pg_seclabels sl2 > WHERE sl2.objoid=nsp.oid) AS providers > >                   FROM pg_namespace nsp > >                   LEFT OUTER JOIN pg_description des ON > (des.objoid=nsp.oid AND des.classoid='pg_namespace'::regclass) > >                 WHERE NOT ((nspname = 'pg_catalog' AND EXISTS > (SELECT 1 FROM pg_class WHERE relname = 'pg_class' AND relnamespace > = nsp.oid LIMIT 1)) OR > >                 (nspname = 'pgagent' AND EXISTS (SELECT 1 FROM > pg_class WHERE relname = 'pga_job' AND relnamespace = nsp.oid LIMIT > 1)) OR > >                 (nspname = 'information_schema' AND EXISTS (SELECT > 1 FROM pg_class WHERE relname = 'tables' AND relnamespace = nsp.oid > LIMIT 1)) OR > >                 (nspname LIKE '_%' AND EXISTS (SELECT 1 FROM > pg_proc WHERE proname='slonyversion' AND pronamespace = nsp.oid > LIMIT 1)) > >                 )  AND nspname NOT LIKE E'pg\\_temp\\_%'AND nspname > NOT LIKE E'pg\\_toast_temp\\_%' ORDER BY 1, nspname > -- Adrian Klaver adrian.klaver@aklaver.com