Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tMBJE-002Ryb-1h for pgsql-general@arkaria.postgresql.org; Fri, 13 Dec 2024 19:26:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tMBJB-00BLDf-5N for pgsql-general@arkaria.postgresql.org; Fri, 13 Dec 2024 19:26:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tMBGE-00BE4s-S1 for pgsql-general@lists.postgresql.org; Fri, 13 Dec 2024 19:23:40 +0000 Received: from fout-b3-smtp.messagingengine.com ([202.12.124.146]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tMBGC-002h29-OD for pgsql-general@postgresql.org; Fri, 13 Dec 2024 19:23:39 +0000 Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfout.stl.internal (Postfix) with ESMTP id 9F1DE11401D2; Fri, 13 Dec 2024 14:23:35 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Fri, 13 Dec 2024 14:23:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1734117815; x=1734204215; bh=eiipp6Kc6/N/Euvrk6VvS3ViiKBKvUsKaQ8me28ZdGY=; b= oXdbQhZ1FO4eAMvpXN+RIdE7+wIJLXvAhOHFiFpjD6/N8m3vNf8bIszpzca9A3N1 7z+Fe0wkhZNUMb3xxsjGyL6CN2ve9S7Jc8sHKTcfrtbm5LPT7yhFIxiuG7cBZQ86 FiFZqdpK0I7UlVow3O0tn00ihIeChGjNu9ANI1dB7eOpfVPjYZHgPMoc7jvHFu7Q XGUD2B8uUNSpU4hAzSWDkQRqj48A4WHgblkjOD9m6cgC0yKMNomkc5AbSzEDGvUN ARYR0fxoKSOGMsdwI7z7HFB7lXbWT5Ki4l3hklnPWWjctabuuz3Mtjpsll0XCh/5 n+8t71gHfOcRnci9Xlcdyw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1734117815; x=1734204215; bh=e iipp6Kc6/N/Euvrk6VvS3ViiKBKvUsKaQ8me28ZdGY=; b=teiUurnpJYm7MZxdA RtGb6rpCKsxg99HbsCwBKqB9u85dHBdGOD704P4PfFlXIckwLmXE5t7QcfYHyI6f 6BjzmS0N3qJcAF3j0HKfvfmZVwiMQWJOzNeJJfGe39NqGJJGGtl1Ykpa6jhinegI jjk5pQJQa6tjRBndsE/+xahU3FtOSDnrZ+uvwvjBXuhRK6jyKMDI3Q97aG7WlIZU fv8QS7tXsFMTksxhzOZqX6GvswtkcLxUUC7cv7EhD3zCRo32EThgIHs9fGxVohw6 B2KkKAs0rZo2m3GHM3X+33n3UGT6F1VBIxJPKTYvl4gsRjpqV6APA4CbZ3NYLuBh cwCKA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrkeejgdduvdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepkfffgggfuffvfhfhjggtgfesthejredttddvjeen ucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrse grkhhlrghvvghrrdgtohhmqeenucggtffrrghtthgvrhhnpeekfeehuddvjeeigfeifeej tdduudffledvfeelheeftdeiffeugfdvkeelgedtvdenucffohhmrghinhepphhoshhtgh hrvghsqhhlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghi lhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhdpnhgspg hrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoheprhhshhgvphgr rhgusegrphhplhdqvggtohhshihsrdgtohhmpdhrtghpthhtohepphhgshhqlhdqghgvnh gvrhgrlhesphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 13 Dec 2024 14:23:34 -0500 (EST) Message-ID: Date: Fri, 13 Dec 2024 11:23:31 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Restoring database from backup To: Rich Shepard , pgsql-general@postgresql.org References: <3745bd88-413f-4fa5-90a1-d374852d10a9@aklaver.com> Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 12/13/24 11:18 AM, Rich Shepard wrote: > On Fri, 13 Dec 2024, Adrian Klaver wrote: > >> This needs more information: >> >> 1) Have you backed up your database at the current state? > > Adrian, > > No, the current state is FUBAR'd. The cron backup script runs each night at > 11:15 p.m. > >> 2) What command did you use to create bustrac-2024-12-12.sql? > > !/usr/bin/bash > # > # This script pg_dump to save the database w/date stamp > > cd /data1/database-backups/ > pg_dump -d bustrac -c -f bustrac-$(date +%Y-%m-%d).sql cd Alright, from here: https://www.postgresql.org/docs/current/app-pgdump.html "-c --clean Output commands to DROP all the dumped database objects prior to outputting the commands for creating them. This option is useful when the restore is to overwrite an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported during restore, unless --if-exists is also specified. This option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call pg_restore. " This means when you run the script with: psql -d bustrac -f bustrac-2024-12-12.sql it will clean out the current corrupted objects and replace them with those in the backup file. > > Thanks, > > Rich > > -- Adrian Klaver adrian.klaver@aklaver.com