<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>惜分飞 &#187; invalid checkpoint record</title>
	<atom:link href="https://www.xifenfei.com/tag/invalid-checkpoint-record/feed" rel="self" type="application/rss+xml" />
	<link>https://www.xifenfei.com</link>
	<description>提供7*24专业数据库(Oracle,SQL Server,MySQL,PostgreSQL等)恢复和技术支持@Tel:17813235971</description>
	<lastBuildDate>Thu, 29 Oct 2026 15:31:46 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>pg启动报invalid checkpoint record处理</title>
		<link>https://www.xifenfei.com/2025/03/invalid-checkpoint-record.html</link>
		<comments>https://www.xifenfei.com/2025/03/invalid-checkpoint-record.html#comments</comments>
		<pubDate>Sun, 09 Mar 2025 15:36:03 +0000</pubDate>
		<dc:creator><![CDATA[惜分飞]]></dc:creator>
				<category><![CDATA[PostgreSQL恢复]]></category>
		<category><![CDATA[invalid checkpoint record]]></category>
		<category><![CDATA[pg启动异常处理]]></category>

		<guid isPermaLink="false">https://www.xifenfei.com/?p=11318</guid>
		<description><![CDATA[联系：手机/微信(+86 17813235971) QQ(107644445)  &#8230; <a href="https://www.xifenfei.com/2025/03/invalid-checkpoint-record.html">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<div id="xifenfeicopyright">
<p>联系：<a href="https://www.xifenfei.com/about_xifenfei" target="_blank">手机/微信(+86 17813235971)   QQ(107644445)</a><a target="_blank" href="http://wpa.qq.com/msgrd?v=3&#038;uin=107644445&#038;site=qq&#038;menu=yes"><img src="https://www.xifenfei.com/wp-content/themes/img/site_qq.jpg" alt="QQ咨询惜分飞" title="QQ咨询惜分飞"/></a></p>
<p>标题：<a href="https://www.xifenfei.com/2025/03/invalid-checkpoint-record.html" target="_blank">pg启动报invalid checkpoint record处理</a></p>
<p>作者：<a href="https://www.xifenfei.com" target="_blank">惜分飞</a>©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]</p>
</div>
<p>pg库启动报PANIC:  could not locate a valid checkpoint record错误</p>
<pre class="brush: bash; title: ; notranslate">
2025-03-09 10:59:10.365 EDT [73013] LOG:  starting PostgreSQL 16.8 on x86_64-pc-linux-gnu, 
                                          compiled by gcc (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5), 64-bit
2025-03-09 10:59:10.365 EDT [73013] LOG:  listening on IPv4 address &quot;0.0.0.0&quot;, port 5432
2025-03-09 10:59:10.365 EDT [73013] LOG:  listening on IPv6 address &quot;::&quot;, port 5432
2025-03-09 10:59:10.367 EDT [73013] LOG:  listening on Unix socket &quot;/tmp/.s.PGSQL.5432&quot;
2025-03-09 10:59:10.401 EDT [73018] LOG:  database system was interrupted; last known up at 2025-03-09 10:54:43 EDT
2025-03-09 10:59:11.506 EDT [73018] LOG:  invalid checkpoint record
2025-03-09 10:59:11.508 EDT [73018] PANIC:  could not locate a valid checkpoint record
2025-03-09 10:59:12.004 EDT [73013] LOG:  startup process (PID 73018) was terminated by signal 6: Aborted
2025-03-09 10:59:12.004 EDT [73013] LOG:  aborting startup due to startup process failure
2025-03-09 10:59:12.006 EDT [73013] LOG:  database system is shut down
</pre>
<p>从报错信息中看,是有无法读取到有效的checkpoint记录导致,初步怀疑是wal异常,检查pg_wal目录,发现wal日志为空</p>
<pre class="brush: bash; title: ; notranslate">
[root@localhost pg_wal]# ls -ltr
total 16388
drwx------  2 postgres postgres        6 Mar  6 08:10 archive_status
[root@localhost pg_wal]# 
</pre>
<p>进一步检查系统操作命令rm删除wal日志命令</p>
<pre class="brush: bash; title: ; notranslate">
cd pg_wal
rm -rf 0000000*
</pre>
<p>初步确认是由于wal日志被意外删除导致pg库无法启动,尝试重置wal,由于库不是干净关闭,无法直接重置成功</p>
<pre class="brush: bash; title: ; notranslate">
[postgres@localhost log]$ pg_resetwal $PGDATA
The database server was not shut down cleanly.
Resetting the write-ahead log might cause data to be lost.
If you want to proceed anyway, use -f to force reset.
</pre>
<p>使用pg_resetwal  -f强制重置</p>
<pre class="brush: bash; title: ; notranslate">
[postgres@localhost log]$ pg_resetwal -f $PGDATA
Write-ahead log reset
</pre>
<p>尝试启动pg库成功</p>
<pre class="brush: bash; title: ; notranslate">
[postgres@localhost log]$ pg_ctl start 
waiting for server to start....2025-03-09 11:02:02.609 EDT [73088] LOG:  
redirecting log output to logging collector process
2025-03-09 11:02:02.609 EDT [73088] HINT:  Future log output will appear in directory &quot;log&quot;.
 done
server started
</pre>
<pre class="brush: bash; title: ; notranslate">
2025-03-09 11:02:02.609 EDT [73088] LOG:  starting PostgreSQL 16.8 on x86_64-pc-linux-gnu, 
                                          compiled by gcc (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5), 64-bit
2025-03-09 11:02:02.609 EDT [73088] LOG:  listening on IPv4 address &quot;0.0.0.0&quot;, port 5432
2025-03-09 11:02:02.609 EDT [73088] LOG:  listening on IPv6 address &quot;::&quot;, port 5432
2025-03-09 11:02:02.610 EDT [73088] LOG:  listening on Unix socket &quot;/tmp/.s.PGSQL.5432&quot;
2025-03-09 11:02:02.645 EDT [73092] LOG:  database system was shut down at 2025-03-09 11:01:53 EDT
2025-03-09 11:02:02.650 EDT [73088] LOG:  database system is ready to accept connections
</pre>
<div id="crp_related"><ul><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2022/05/pg-wal-lost-recovery.html" rel="bookmark" class="crp_title">PostgreSQL恢复系列:wal日志丢失恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/03/pdu-recovery-corrupt-block.html" rel="bookmark" class="crp_title">PostgreSQL表文件损坏恢复&#8212;pdu恢复损坏的表文件</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/12/pg-replace-oid-recovery.html" rel="bookmark" class="crp_title">PostgreSQL oid文件替换实现数据访问</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2018/08/psql-fatal-no-pg_hba-conf-entry-for-host.html" rel="bookmark" class="crp_title">psql: FATAL:  no pg_hba.conf entry for host</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/03/pg_control-rebuild.html" rel="bookmark" class="crp_title">pg_control丢失/损坏处理</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2018/08/pg_rman_backup_restore.html" rel="bookmark" class="crp_title">pg_rman 备份还原测试</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2018/08/postgresql-archive_mode.html" rel="bookmark" class="crp_title">PostgreSQL修改归档模式</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/08/pg_wal_filename-logseq-mismatch.html" rel="bookmark" class="crp_title">pg_wal中文件的名称中的logseq和实际文件中的logseq不匹配</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2022/05/pg-pg_control-lost-recovery.html" rel="bookmark" class="crp_title">PostgreSQL恢复系列:pg_control异常恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/07/no-space-left-on-device-postgresql.html" rel="bookmark" class="crp_title">由于空间满导致PostgreSQL数据库异常处理</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/03/pdu-pg-delete-recovery.html" rel="bookmark" class="crp_title">pg删除数据恢复&#8212;pdu恢复pg delete数据</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/02/connect-pdb-sid-use_sid_as_service_listener.html" rel="bookmark" class="crp_title">使用sid方式直接访问pdb(USE_SID_AS_SERVICE_LISTENER)</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>https://www.xifenfei.com/2025/03/invalid-checkpoint-record.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
