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 1oMMuO-0005uO-TG for pgsql-admin@arkaria.postgresql.org; Fri, 12 Aug 2022 05:08:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oMMuM-0000Ew-TE for pgsql-admin@arkaria.postgresql.org; Fri, 12 Aug 2022 05:08:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oMMuM-0000Ek-GE for pgsql-admin@lists.postgresql.org; Fri, 12 Aug 2022 05:08:30 +0000 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oMMuF-0003Dr-TB for pgsql-admin@lists.postgresql.org; Fri, 12 Aug 2022 05:08:29 +0000 Received: by mail-ot1-x331.google.com with SMTP id y10-20020a9d634a000000b006167f7ce0c5so14123531otk.0 for ; Thu, 11 Aug 2022 22:08:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:from:to:cc; bh=SWaOMDtDo2UmtPRn300cX8yrI/D1vJJp3+eP3pcaVA4=; b=B0qPWoDNdHSJHn+X72rQ3ZsPQAQd4M+fPRAlSsieH0ozhs7pIOAah9bKc3uLcjXDsg 2R1fsDkb+6WQ0uBvFev39BdCYDnMaO6Sq45C9swGNosw1POf8N28UURf6vTk4nm3Znga RjWTzgtuVFKdTMREAPrZ3B25lGCToecKlFsgyFur2c5s6pp7Mjgx2LLT/dJl4PTArMqI E/YhDAmmUIPB6/Avb8ybyiR6ByRMQUKwnr2EVi54gw/nRBkMsr8FG8LuWEkg5WHToM8Q kvTSE98qdllkN04hafSWMfJz85bRNCI767SLRYXAWKOz/Ce39c9Qo7u8xEAw8dbqQ2Jv 885A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc; bh=SWaOMDtDo2UmtPRn300cX8yrI/D1vJJp3+eP3pcaVA4=; b=P9UZgZwnEQU3J18JVN+MuGwCGohHtyyvCSV9NK28Rp69w96ZJmQiUC4K4xTxNmZ15P tSpT4ZR9S5ki3V9j+8Gub+mf86yxIY3WLJHCdWTQHNND6PasDnONm9qZjC74eaaOkM1U FzEoubuIry/hZbbGmPl9R8uzOv9d+Q5gH92BuSQ3wOIaQ6Dq9iBl84Rmy/JsJmUnrXJw Srn3SL74cIXuX7+6GpK+xvdSeusdpapSL3dwnxu/UZl8tVTBVj6HP4NmWW9EVSrEFjOb CMA/JgUl6edQqfoYLaNBHPagEhH8K1aTAaVbuU3A8IptMMocB4PZKkvncKk9sShlBqXl H8qg== X-Gm-Message-State: ACgBeo1RKnQEEVTjEMtBDxTNh1Dr9y3gyO1ft/Y+LTGxkFZrQHgzqxPZ SaFsXPDLpN9NajDbzynWNYwgwrI9O+U= X-Google-Smtp-Source: AA6agR5dLwM73RmC/8oyVIPoOcsaK7HanOes4NCobix50Pj+KlYGvn1X9tnnPvd+WySthIrLdAwKTw== X-Received: by 2002:a05:6830:16d9:b0:637:2e86:68a8 with SMTP id l25-20020a05683016d900b006372e8668a8mr789639otr.334.1660280902861; Thu, 11 Aug 2022 22:08:22 -0700 (PDT) Received: from [192.168.88.10] (ip68-11-68-85.no.no.cox.net. [68.11.68.85]) by smtp.googlemail.com with ESMTPSA id h14-20020a4aa9ce000000b00435b646f160sm192560oon.5.2022.08.11.22.08.22 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 11 Aug 2022 22:08:22 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------vn30C3TjzGooqeN30OBtIT70" Message-ID: <0834f1ba-c66f-5c5a-c55a-f02fde5e20c7@gmail.com> Date: Fri, 12 Aug 2022 00:08:20 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: a question about Point-in-Time Recovery (PITR) Content-Language: en-US To: pgsql-admin@lists.postgresql.org References: From: Ron In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------vn30C3TjzGooqeN30OBtIT70 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 8/11/22 17:15, jian xu wrote: > > Hello, > >          I am creating an automation script which can do PITR restore. For > example if users specify the timestamp, I can retore the db to that point. > All backup files are on other place, the restore procedure includes > > 1. Download full backup file generated from pg_basebackup > 2. Download all wal archive files generated since the full backup file to > the timestamp users specified. > > However, the problem is how I can read the begin and end transaction > timestamp in each wal archive file? > > Without knowing the transaction timestamp, I am not able know which wal > archive file I need to download. > > I tried pg_waldump, but it doesn’t have transaction timestamp. > > Does anyone know the solution? Thanks! > If you run Linux, then pgBackRest is (almost certainly) what you want. Download it from https://pgbackrest.org/ or get it from your distro's https://www.postgresql.org/download/ repository. -- Angular momentum makes the world go 'round. --------------vn30C3TjzGooqeN30OBtIT70 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit On 8/11/22 17:15, jian xu wrote:

Hello,

         I am creating an automation script which can do PITR restore. For example if users specify the timestamp, I can retore the db to that point. All backup files are on other place, the restore procedure includes

  1. Download full backup file generated from pg_basebackup
  2. Download all wal archive files generated since the full backup file to the timestamp users specified.

However, the problem is how I can read the begin and end transaction timestamp in each wal archive file?

Without knowing the transaction timestamp, I am not able know which wal archive file I need to download.

I tried pg_waldump, but it doesn’t have transaction timestamp.

Does anyone know the solution? Thanks!


If you run Linux, then pgBackRest is (almost certainly) what you want. 

Download it from https://pgbackrest.org/ or get it from your distro's https://www.postgresql.org/download/ repository.

--
Angular momentum makes the world go 'round.
--------------vn30C3TjzGooqeN30OBtIT70--