Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i5YV6-0000a4-Hn for pgsql-admin@arkaria.postgresql.org; Wed, 04 Sep 2019 16:51:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i5YV4-00008P-I7 for pgsql-admin@arkaria.postgresql.org; Wed, 04 Sep 2019 16:51:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i5YV3-00008I-SZ for pgsql-admin@lists.postgresql.org; Wed, 04 Sep 2019 16:51:18 +0000 Received: from mx32.harte-lyne.ca ([216.185.71.32]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i5YUx-0006hI-LC for pgsql-admin@lists.postgresql.org; Wed, 04 Sep 2019 16:51:15 +0000 Received: from mx32.harte-lyne.ca (localhost [127.0.32.1]) by mx32.harte-lyne.ca (Postfix) with ESMTP id 2C53A2CD6A for ; Wed, 4 Sep 2019 12:51:06 -0400 (EDT) X-Virus-Scanned: amavisd-new at harte-lyne.ca Received: from mx32.harte-lyne.ca ([127.0.32.1]) by mx32.harte-lyne.ca (mx32.harte-lyne.ca [127.0.32.1]) (amavisd-new, port 10024) with ESMTP id z3XHFb4v94we for ; Wed, 4 Sep 2019 12:51:04 -0400 (EDT) Received: from webmail.harte-lyne.ca (webmail.hamilton.harte-lyne.ca [216.185.71.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx32.harte-lyne.ca (Postfix) with ESMTPSA id 6AA042CD61 for ; Wed, 4 Sep 2019 12:51:04 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=harte-lyne.ca; s=dkim_hll; t=1567615864; bh=5vpSZEIPUOvo1fMM3mtc05P2c+KzKMXFMbp2px1TxEQ=; h=Date:Subject:From:To:Reply-To; b=0CE1RSB8ak20eOcnUNVWXe+1dAAh1BMydTUKQ46N5tveYhqsog3GOCCcSteTgtOrO DTdW1TItufj++blFAtYU06l48eJkaeR90b9vx1D5NuJwr3pc0LPZ+2+od376Onv9b2 Wsbwj4Hs6hpXoC9ZEhGmtOYPsL+xN6kH9cbSAzP07YF1hCAXR2lFYfiRV8qt8YMgot J+6TnqdUeVCpcdaGPVxkpFjdKqMqtKcPX/p37QXj7dalelJEhrEVo5jMPi7VrbEfnJ 9aFgKEQ8cJrMcWCDNFD+PKrTcVyRRKziHNWMYgJV3gVrEF9YYvPlYrTdjpkwa/wLei m8b9VAJaixreQ== Received: from 216.185.71.44 (SquirrelMail authenticated user byrnejb_hll) by webmail.harte-lyne.ca with HTTP; Wed, 4 Sep 2019 12:51:04 -0400 Message-ID: Date: Wed, 4 Sep 2019 12:51:04 -0400 Subject: overwrote THE 'postgres' database - how to recover From: "James B. Byrne" To: pgsql-admin@lists.postgresql.org Reply-To: byrnejb@harte-lyne.ca User-Agent: SquirrelMail/1.4.23 [SVN] MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I was experimenting with creating a copy of an existing database from a pg_dump sql backup file. I made an misake in failing to delimit an environment variable and in consequence I issued this command as user postgres: I should have used: gunzip < "$APP_DBNAME".pgsql.gz | pg_restore --create --clean --user=postgres --dbname="$APP_DBNAME"_copy && vacuumdb --user=postgres --full --analyze "$APP_DBNAME"_copy But, instead I did this: gunzip < $APP_DBNAME.pgsql.gz | pg_restore --create --clean --user=postgres --dbname=$APP_DBNAME_copy && vacuumdb --user=postgres --full --analyze $APP_DBNAME_copy which resulted in this: gunzip < hll_redmine.pgsql.gz | pg_restore --create --clean --user=postgres --dbname= && vacuumdb --user=postgres --full --analyze Which caused the postgres database to be overwritten with hll_redmine.pgsql.gz. Is there an easy way to get this back or do I have to reinitialise the whole thing? -- *** e-Mail is NOT a SECURE channel *** Do NOT transmit sensitive data via e-Mail Do NOT open attachments nor follow links sent by e-Mail James B. Byrne mailto:ByrneJB@Harte-Lyne.ca Harte & Lyne Limited http://www.harte-lyne.ca 9 Brockley Drive vox: +1 905 561 1241 Hamilton, Ontario fax: +1 905 561 0757 Canada L8E 3C3