Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1V7mQL-0003Ut-EI for pgsql-general@arkaria.postgresql.org; Fri, 09 Aug 2013 13:08:09 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1V7mQK-0002gD-Ul for pgsql-general@arkaria.postgresql.org; Fri, 09 Aug 2013 13:08:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1V7mQJ-0002g5-U2 for pgsql-general@postgresql.org; Fri, 09 Aug 2013 13:08:08 +0000 Received: from mail-pa0-x229.google.com ([2607:f8b0:400e:c03::229]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1V7mQG-0002a5-To for pgsql-general@postgresql.org; Fri, 09 Aug 2013 13:08:07 +0000 Received: by mail-pa0-f41.google.com with SMTP id bj1so4942959pad.14 for ; Fri, 09 Aug 2013 06:08:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=GZoR1aXS/UH1wUYutvSaHfDjGP7rZecmrXZF3NXb5DA=; b=lqezzK+PstQ4kXmwXurt2pZivHbAjhIxwrZkSV5I5xkL7dGfz13TWCnHCZdhbvqtyp eTFuSmdeG9zsiKYrGxWCCjs+9CT4S4zGSnQ1xtqWluAp43LRaR2pf0R2sILnPGuZgorY y6VZHnLVrsm/UwD1iGyIcI7IBBvdcfht5OIgCTUoEabimNL0eTLr+ocpO1zyJlYDfB58 v0KtYWHcmSiPGL430ckI7Qb0hT4a4nqlKjlnPqoGxTN0Ga8tKS+WrCm85dyxC6Yh5yS3 b3PhGN9Ct6qUZcBS1FJpqGR/dWShN6u3hXcaSWi7drYHxkbadLcW7hpDKnM0wISfzG3Z pm6g== X-Received: by 10.68.143.131 with SMTP id se3mr11335706pbb.39.1376053683071; Fri, 09 Aug 2013 06:08:03 -0700 (PDT) Received: from [192.168.0.102] (014136185055.ctinets.com. [14.136.185.55]) by mx.google.com with ESMTPSA id w6sm16584446pbt.32.2013.08.09.06.08.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 09 Aug 2013 06:08:02 -0700 (PDT) Subject: Recovery.conf and PITR by recovery_target_time Mime-Version: 1.0 (Apple Message framework v1085) Content-Type: text/plain; charset=us-ascii From: "ascot.moss@gmail.com" In-Reply-To: Date: Fri, 9 Aug 2013 21:07:59 +0800 Cc: ascot.moss@gmail.com Content-Transfer-Encoding: quoted-printable Message-Id: <22CFCCDF-F7A3-4F5C-A3B5-5BBE01708AB8@gmail.com> References: <1375985902.2599.YahooMailNeo@web162904.mail.bf1.yahoo.com> To: PostgreSQL general X-Mailer: Apple Mail (2.1085) X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org Hi, I am trying another way to test PITR: by recovery_target_time. The test machine has the same PG version 9.2.4 and same O/S Ubuntu 12.04 64= bit. All archived WAL files are shipped and saved in /var/pgsql/data/ar= chive, the latest time stamp of them is "2013-08-09 19:30:01", the full hot= backup time is at '2013-08-09 16:47:12'.=20=20 Case 1) I want to recover PG to the state before 18:03:02 that there were 6= tables deleted=20 Case 2) Hope to recover PG to the point of time right before table TEST8 wa= s created Transactions in master: 16:45:01 (create 4 test tables : test1, test2, test3, test4) 16:47:12 (FULL HOT BACKUP) 17:50:22 postgres=3D# CREATE TABLE test5 (id INTEGER PRIMARY KEY); INSERT= INTO test5 VALUES (generate_series(1,4000000)); EXPLAIN ANALYZE SELECT CO= UNT(*) FROM test5; 17:57:13 postgres=3D# CREATE TABLE test6 (id INTEGER PRIMARY KEY); INSERT= INTO test6 VALUES (generate_series(1,1000000)); EXPLAIN ANALYZE SELECT CO= UNT(*) FROM test6; postgres=3D# \d List of relations Schema | Name | Type | Owner=20=20=20 --------+-------+-------+---------- public | test1 | table | postgres (created before full hot backup) public | test2 | table | postgres (created before full hot backup) public | test3 | table | postgres (created before full hot backup) public | test4 | table | postgres (created before full hot backup) public | test5 | table | postgres public | test6 | table | postgres 18:03:02 postgres=3D# drop table test1; DROP TABLE=20 postgres=3D# drop table test2; DROP TABLE=20 postgres=3D# drop table test3; DROP TABLE=20 postgres=3D# drop table test4; DROP TABLE=20 postgres=3D# drop table test5; DROP TABLE=20 postgres=3D# drop table test6; DROP TABLE=20 postgres=3D# commit; WARNING: there is no transaction in progress COMMIT= =20=09 18:04:34 postgres=3D# CREATE TABLE test7 (id INTEGER PRIMARY KEY); INSERT = INTO test7 VALUES (generate_series(1,1000000)); EXPLAIN ANALYZE SELECT COU= NT(*) FROM test7;=09=09=09 18:11:31 postgres=3D# CREATE TABLE test8 (id INTEGER PRIMARY KEY); INSERT I= NTO test8 VALUES (generate_series(1,1000000)); EXPLAIN ANALYZE SELECT COUNT= (*) FROM test8; postgres=3D# CREATE TABLE test9 (id INTEGER PRIMARY KEY); INSERT INTO te= st9 VALUES (generate_series(1,1000000)); EXPLAIN ANALYZE SELECT COUNT(*) FR= OM test9; postgres=3D# CREATE TABLE test10 (id INTEGER PRIMARY KEY); INSERT INTO t= est10 VALUES (generate_series(1,1000000)); EXPLAIN ANALYZE SELECT COUNT(*) = FROM test10; 19:26:18 postgres=3D# vacuum; VACUUM postgres=3D# begin; INSERT INTO test10 VALUES (generate_series(2000002,3= 000002));commit; end; BEGIN INSERT 0 1000001 COMMIT WARNING: there is no tr= ansaction in progress COMMIT=20 postgres=3D# CREATE TABLE test11 (id INTEGER PRIMARY KEY); INSERT INTO t= est11 VALUES (generate_series(1,1000000)); EXPLAIN ANALYZE SELECT COUNT(*) = FROM test11; 19:30:01 (ship the WAL file to test machine) CASE-1: '2013-08-09 17:57:55' (only 3 lines in recovery.conf) restore_command =3D 'cp /var/pgsql/data/archive/%f %p' recovery_target_time =3D '2013-08-09 17:57:55' recovery_target_inclusive =3D false Result: LOG: starting point-in-time recovery to 2013-08-09 17:57:55 LOG: restored log file "000000010000006F00000066" from archive LOG: redo starts at 6F/66000020 LOG: recovery stopping before commit of transaction 75891, time 2013-08= -09 18:07:09.547682+08 LOG: redo done at 6F/66003DF0 FATAL: requested recovery stop point is before consistent recovery point LOG: startup process (PID 15729) exited with exit code 1 LOG: terminating any other active server processes [1]+ Exit 1 ... CASE-2: '2013-08-09 18:06:01' (only 3 lines in recovery.conf) restore_command =3D 'cp /var/pgsql/data/archive/%f %p' recovery_target_time =3D '2013-08-09 18:06:01' recovery_target_inclusive =3D false Result: LOG: starting point-in-time recovery to 2013-08-09 18:06:01 LOG: restored log file "000000010000006F000000B0" from archive LOG: restored log file "000000010000006F0000009B" from archive LOG: redo starts at 6F/9B000020 LOG: recovery stopping before commit of transaction 75967, time 2013-08= -09 19:30:10.217888+08 LOG: redo done at 6F/9B003500 FATAL: requested recovery stop point is before consistent recovery point LOG: startup process (PID 19100) exited with exit code 1 LOG: terminating any other active server processes [1]+ Exit 1 ...=20=20 So far I can only restore ALL (i.e. up to 19:30:01) but cannot recover PG a= t certain Point-of-time. Can you please advise? regards --=20 Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general