Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mg1uL-0002yB-VW for pgsql-admin@arkaria.postgresql.org; Thu, 28 Oct 2021 09:41:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mg1uK-00054H-KH for pgsql-admin@arkaria.postgresql.org; Thu, 28 Oct 2021 09:41:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mg1uK-000547-73 for pgsql-admin@lists.postgresql.org; Thu, 28 Oct 2021 09:41:12 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mg1uH-0004zD-1D for pgsql-admin@lists.postgresql.org; Thu, 28 Oct 2021 09:41:11 +0000 Received: by mail-wm1-x333.google.com with SMTP id b194-20020a1c1bcb000000b0032cd7b47853so3383603wmb.5 for ; Thu, 28 Oct 2021 02:41:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20210112.gappssmtp.com; s=20210112; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=8ylEA1tP57yVVDLMnsesvkzAeNwQ1ubWn6xnkAY6ELo=; b=Ea/oBWKf13ENpzjZAUjpfXWadxgGmDwdGWKqHGoKFATC+1Qxwe8yU0GSxC1dkl4BH4 W3vCJC/ZKAwoLPuyojhVkuYOsxP4ZLKgcnibA0bvNUTn+RSkGQGZyD0ypgGlxqxf4bg+ Lk2OMmp45KHxY9LG2cPajhs5Wrd+z//Cq6wan5q7vkPZUiI+mR0cr5scBizdQ53YuD0j kscmPirOFVF+dcWniba9vCJ9vF7D95NnTAn18qRUd6Yequm2LFDuBNjZDc87JgerO++n KNvjgLADnW2K/EfiITWVpviT6eESG4ITVgPV995M7+F6lAswJBe1AlpE18selafGll0F 2eeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=8ylEA1tP57yVVDLMnsesvkzAeNwQ1ubWn6xnkAY6ELo=; b=pBPKHdtLXQ1hcmuhHn+Mcm2HCTWHlQr8MTu2KZ1CLWSHvVFy7LR+iQebSt9EXjv6/y J8dSPVAMn5kyV+itXkd54z3JPdrc+mZ5OERxf/2xqJcIMXsp0Ohdo+pxPKvWsidGox2W XO7DLPmMcdYHKmlsx4wtznEhqSIgczjrZQYj/ffbzBMUIe0rDllU/0XaKwKnUy4dG+vi vR7WTzMds6X0Ai2RZ+C/d4VJ663gqRQjhW1rDLFC26FzHm13Sry7ZXm/A1Q0OK/1BYuN jRq/zUtYYabFqcfxBmBAE72MSTEkNx/kGXPsRPjtp13cHz9P3DDnyDSU4hEUW2f4jLmY QqRQ== X-Gm-Message-State: AOAM532Tfh6ki3XIkyfxL/ikb7Zq7EqX1PhDQJJvi9a0KxRFHWxOOnqE s6NdhKJv3nUCAgubDsCgbD+udFQOf/P6wg== X-Google-Smtp-Source: ABdhPJyzTvS6GAWoGd51djG4TcZON0tKXm5AWH/dFFZx49ckrd8zwSyaCGQdiGkH49QENTwTgfUEvQ== X-Received: by 2002:a1c:4d8:: with SMTP id 207mr5974526wme.2.1635414067913; Thu, 28 Oct 2021 02:41:07 -0700 (PDT) Received: from localhost.localdomain (dynamic-e2f49d8keiqkqhz9r-pd01.res.v6.highway.a1.net. [2001:871:5c:9ba8:2923:2bfa:12e2:16cf]) by smtp.gmail.com with ESMTPSA id n5sm5534015wme.6.2021.10.28.02.41.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 02:41:07 -0700 (PDT) Message-ID: Subject: Re: Activate a standby database and then revert to standby From: Laurenz Albe To: Massimo Ortensi , pgsql-admin@lists.postgresql.org Date: Thu, 28 Oct 2021 11:41:07 +0200 In-Reply-To: <1mg1SF-000Mdb-9e@unimaticaspa.it> References: <1mg1SF-000Mdb-9e@unimaticaspa.it> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.4 (3.40.4-2.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2021-10-28 at 11:12 +0200, Massimo Ortensi wrote: > I need to activate (open in read and write) a standby database, perform > some action and then revert it to the previous status of standby and > thus starting again loading wals from when it stopped. > > How should I proceed to be sure it's possible to get "back in time" to > the standby db ? > It's a huge DB and can't afford restarting sync from scratch Yes. For that, you have to enable "wal_log_hints" and set "wal_keep_size" high enough. Then you can use "pg_rewind" to restore the promoted standby to a state when it can be a standby again. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com