<?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; PostgreSQL</title>
	<atom:link href="https://www.xifenfei.com/category/database/postgresql/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>Sun, 22 Nov 2026 15:21:14 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>注意:PostgreSQL库出现readme_to_recover勒索</title>
		<link>https://www.xifenfei.com/2026/01/pg-readme_to_recover.html</link>
		<comments>https://www.xifenfei.com/2026/01/pg-readme_to_recover.html#comments</comments>
		<pubDate>Thu, 22 Jan 2026 13:30:25 +0000</pubDate>
		<dc:creator><![CDATA[惜分飞]]></dc:creator>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[pg 删表勒索]]></category>
		<category><![CDATA[readme_to_recover]]></category>

		<guid isPermaLink="false">https://www.xifenfei.com/?p=11936</guid>
		<description><![CDATA[联系：手机/微信(+86 17813235971) QQ(107644445)  &#8230; <a href="https://www.xifenfei.com/2026/01/pg-readme_to_recover.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/2026/01/pg-readme_to_recover.html" target="_blank">注意:PostgreSQL库出现readme_to_recover勒索</a></p>
<p>作者：<a href="https://www.xifenfei.com" target="_blank">惜分飞</a>©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]</p>
</div>
<p>以前恢复过不少mysql库被删除的勒索case,比如:<br />
<a href="https://www.xifenfei.com/2024/05/read_me_recover_tn-recovery.html" title="read_me_recover_tn勒索恢复" rel="noopener" target="_blank">read_me_recover_tn勒索恢复</a><br />
<a href="https://www.xifenfei.com/2024/10/a_h_readme_to_recover.html" title="A_H_README_TO_RECOVER勒索恢复" rel="noopener" target="_blank">A_H_README_TO_RECOVER勒索恢复</a><br />
<a href="https://www.xifenfei.com/2023/11/a____z____recover____data.html" title="A____Z____RECOVER____DATA勒索恢复" rel="noopener" target="_blank">A____Z____RECOVER____DATA勒索恢复</a><br />
今天在PostgreSQL库中也简单了类似的勒索案例</p>
<pre class="brush: sql; title: ; notranslate">
[postgres@xifenfei database]$ psql 
psql (12.8)
Type &quot;help&quot; for help.

postgres=&gt; \l
                                     List of databases
       Name        |  Owner   | Encoding |  Collate   |   Ctype    |   Access privileges   
-------------------+----------+----------+------------+------------+-----------------------
 ldar-test         | postgres | UTF8     | en_US.utf8 | en_US.utf8 | 
 postgres          | postgres | UTF8     | en_US.utf8 | en_US.utf8 | 
 readme_to_recover | postgres | UTF8     | en_US.utf8 | en_US.utf8 | 
 template0         | postgres | UTF8     | en_US.utf8 | en_US.utf8 | =c/postgres          +
                   |          |          |            |            | postgres=CTc/postgres
 template1         | postgres | UTF8     | en_US.utf8 | en_US.utf8 | =c/postgres          +
                   |          |          |            |            | postgres=CTc/postgres
(5 rows)

postgres=&gt; \c readme_to_recover
You are now connected to database &quot;readme_to_recover&quot; as user &quot;postgres&quot;.
readme_to_recover=&gt; \d
         List of relations
 Schema |  Name  | Type  |  Owner   
--------+--------+-------+----------
 public | readme | table | postgres
(1 row)

readme_to_recover=&gt; select * from readme;
                                                                                                   
                                 text_field                                              
-------------------------------------------------------------------------------------------------------
-------------------------------------------------
 All your data is backed up. You must pay 0.0051 BTC to bc1q9p333xxxxxxxxxxxxxj2z5fs27pu3u In 48 hours, 
  your data will be publicly disclosed and deleted . (more information: go to http://2info.win/psg)
 After paying send mail to us: rambler+3d2l7@onionmail.org and we will provide a link for 
   you to download your data. Your DBCODE is: xxxxx
(2 rows)

readme_to_recover=&gt; select oid,relname from pg_class;
   oid   |                    relname                    
---------+-----------------------------------------------
 2196735 | readme
    2619 | pg_statistic
    1247 | pg_type
    4159 | pg_toast_2600
    4160 | pg_toast_2600_index
    2830 | pg_toast_2604
    2831 | pg_toast_2604_index
    4161 | pg_toast_3456
    4162 | pg_toast_3456_index
    2832 | pg_toast_2606
    2833 | pg_toast_2606_index
………………
   13373 | _pg_foreign_tables
   13377 | foreign_table_options
   13383 | _pg_user_mappings
   13391 | user_mappings
   13387 | user_mapping_options
(396 rows)
</pre>
<p>根据这里的readme的oid值，初步怀疑是drop所有业务表,然后创建了readme表,并且插入了勒索信息.<br />
<br />
我做的各种数据库恢复比较多，说实话一直对pg这个特点非常不满意：<br />
<em>1. pg的数据存储本身依赖文件系统，通过oid(来表示库，表示表以及其他各种对象，和很多商业化数据库不一样，对于文件系统过于依赖，这样的情况如果发生了drop/truncate表等操作，表从文件系统中被删除，恢复难度较大<br />
2. pg的表对应本身没有在每个数据块的block记录表的id信息，这样使得无法很好的进行底层基于block的扫描恢复数据，目前我知道的pdu一定的这样的功能，但是那是依赖列匹配，原则上来说对于一个稍微复杂一点的系统，这个恢复思路基本上不可行（因为列相似的数据表可能很多，导致恢复的数据过于混乱）</em><br />
基于上述的两个特点，如果整个业务库被这种勒索破坏，如果没有备份，想比较好的恢复效果基本上很难（除非你运气非常好，os层面反删除恢复效果特别好，这要取决被删除的表在os上没有覆盖，文件系统元数据没有回收，系统没有识别是ssd环境等因素决定）<br />
<br />
基于这种故障在没有备份的情况下很难恢复，那我们要做的就是：<br />
1）有有效的备份或者容灾不被破坏;<br />
     1> 数据需要有效的备份,有条件的建议异机或者离线<br />
     2> 如果有条件可以部署延迟同步的备库,避免发生故障备库同步 被破坏</p>
<p>2）尽可能不让这种故障发生:<br />
     1>数据库不要暴露在公网上,减少被攻击和入侵的风险<br />
     2>数据库不要使用弱口令,减少被暴力攻破密码的风险<br />
     3>注意应用漏洞，减少通过sql注入进行数据库进行破坏<br />
     4>注意已知的数据库安全漏洞,防止被利用进行攻击<br />
     5>注意操作系统安全,因为登录了数据库服务器对于数据库来说就没有安全可言</p>
<div id="crp_related"><ul><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/04/pg-createdb-gbk.html" rel="bookmark" class="crp_title">pg创建gbk字符集库</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2024/04/pg_filedump_batch.html" rel="bookmark" class="crp_title">PostgreSQL恢复系列:pg_filedump批量处理</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/09/pg-truncate-recovery.html" rel="bookmark" class="crp_title">Postgres数据库truncate表无有效备份恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2018/08/pg-tablespace-database-schema.html" rel="bookmark" class="crp_title">PostgreSQL的表空间、数据库、用户之间的关系</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/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/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/2024/04/postgresql-walminer.html" rel="bookmark" class="crp_title">PostgreSQL解析wal日志之&#8212;walminer</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2015/06/%e5%9c%a8linux%e4%b8%8a%e5%ae%89%e8%a3%85postgresql-9-4%e5%b9%b6%e5%90%af%e5%8a%a8%e5%92%8c%e5%85%b3%e9%97%ad%e6%95%b0%e6%8d%ae%e5%ba%93.html" rel="bookmark" class="crp_title">在linux上安装PostgreSQL 9.4并启动和关闭数据库</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/2024/04/postgresql-16-source-install.html" rel="bookmark" class="crp_title">PostgreSQL 16 源码安装</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>https://www.xifenfei.com/2026/01/pg-readme_to_recover.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>记录一次国产数据库被rm -rf /*删除的救援过程</title>
		<link>https://www.xifenfei.com/2026/01/hgdb-rm-rf-recovery.html</link>
		<comments>https://www.xifenfei.com/2026/01/hgdb-rm-rf-recovery.html#comments</comments>
		<pubDate>Fri, 02 Jan 2026 16:46:40 +0000</pubDate>
		<dc:creator><![CDATA[惜分飞]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PostgreSQL恢复]]></category>
		<category><![CDATA[pdu恢复]]></category>
		<category><![CDATA[rm -rf / 故障恢复]]></category>
		<category><![CDATA[rm -rf 国产库恢复]]></category>
		<category><![CDATA[rm 数据库恢复]]></category>

		<guid isPermaLink="false">https://www.xifenfei.com/?p=11872</guid>
		<description><![CDATA[联系：手机/微信(+86 17813235971) QQ(107644445)  &#8230; <a href="https://www.xifenfei.com/2026/01/hgdb-rm-rf-recovery.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/2026/01/hgdb-rm-rf-recovery.html" target="_blank">记录一次国产数据库被rm -rf /*删除的救援过程</a></p>
<p>作者：<a href="https://www.xifenfei.com" target="_blank">惜分飞</a>©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]</p>
</div>
<p>有一套国产数据库运行在arm平台的Kylin Linux上</p>
<pre class="brush: bash; title: ; notranslate">
NAME=&amp;amp;quot;Kylin Linux Advanced Server&amp;amp;quot;
VERSION=&amp;amp;quot;V10 (Lance)&amp;amp;quot;
ID=&amp;amp;quot;kylin&amp;amp;quot;
VERSION_ID=&amp;amp;quot;V10&amp;amp;quot;
PRETTY_NAME=&amp;amp;quot;Kylin Linux Advanced Server V10 (Lance)&amp;amp;quot;
ANSI_COLOR=&amp;amp;quot;0;31&amp;amp;quot;
</pre>
<p>由于数据库归档日志导致磁盘空间满,在清理归档日志的时候不慎执行了rm -rf /*命令<br />
<a href="https://www.xifenfei.com/wp-content/uploads/2026/01/rm.png"><img src="https://www.xifenfei.com/wp-content/uploads/2026/01/rm.png" alt="rm" width="268" height="321" class="alignleft size-full wp-image-11873" /></a><br />
<hr />
导致系统无法正常启动,客户尝试通过把磁盘挂载到其他机器上启动,但是无法恢复需要数据.由于客户这个是ssd盘的虚拟化环境,担心可能触发trim和进一步破坏的风险,建议客户尽快把虚拟磁盘下载到本地,然后通过工具分析,发现大量数据已经被删除,特别是数据库目录只剩下部分文件<br />
<a href="https://www.xifenfei.com/wp-content/uploads/2026/01/1.png"><img src="https://www.xifenfei.com/wp-content/uploads/2026/01/1.png" alt="1" width="239" height="353" class="alignleft size-full wp-image-11874" /></a><br />
<hr />
通过分析data/global/1262文件(pg_database)的出来数据库名字对应关系,然后根据应用提供的需要恢复的数据库名称.在data目录中尝试恢复该目录中oid文件,发现最核心的几个字典文件全部异常(元数据异常)<br />
<a href="https://www.xifenfei.com/wp-content/uploads/2026/01/3.png"><img src="https://www.xifenfei.com/wp-content/uploads/2026/01/3.png" alt="3" width="1077" height="448" class="alignleft size-full wp-image-11875" /></a><br />
<hr />
<pre class="brush: bash; title: ; notranslate">
pg_class	1259	存储数据库中所有关系（表、索引、视图、序列等）的元数据
pg_attribute	1249	存储表的列（属性）信息，每个字段对应一行
pg_namespace	2615	存储模式（Schema）信息
pg_type	        1247	存储数据类型信息（内置类型、自定义类型）
</pre>
<p>对于这种问题,普通的恢复工具无法解决,协调专业的文件系统恢复专家对其进行处理,比较完美的恢复出来的该目录下面绝大部分文件(包括字典文件)<br />
<a href="https://www.xifenfei.com/wp-content/uploads/2026/01/4.png"><img src="https://www.xifenfei.com/wp-content/uploads/2026/01/4.png" alt="4" width="602" height="532" class="alignleft size-full wp-image-11877" /></a><br />
<hr />
有了比较完美的恢复出来了需要的数据库文件,然后pdu专家进行该国产库的块结构分析和调整程序并恢复出来数据<br />
<a href="https://www.xifenfei.com/wp-content/uploads/2026/01/5.png"><img src="https://www.xifenfei.com/wp-content/uploads/2026/01/5.png" alt="5" width="741" height="755" class="alignleft size-full wp-image-11878" /></a><br />
<a href="https://www.xifenfei.com/wp-content/uploads/2026/01/6.png"><img src="https://www.xifenfei.com/wp-content/uploads/2026/01/6.png" alt="6" width="1598" height="716" class="alignleft size-full wp-image-11879" /></a><br />
<hr />
完成数据恢复之后,把数据提供给客户,由客户那边安排厂商进行后续应用层面工作(比如和历史数据整合,应用调试等),总体算比较完美帮忙客户完成了本次rm -rf /* 故障救援</p>
<div id="crp_related"><ul><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2026/06/deepseek_oracle_recovery_major_fault.html" rel="bookmark" class="crp_title">使用deepseek进行Oracle恢复,引起重大故障</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2026/01/dd-asm-recovery.html" rel="bookmark" class="crp_title">在生产环境错误执行dd命令破坏asm磁盘故障恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2026/04/orafhr-oracle-wman.html" rel="bookmark" class="crp_title">OraFHR快速open被勒索加密破坏的Oracle数据库</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2026/03/wman-mysql-recovery.html" rel="bookmark" class="crp_title">.wman扩展名勒索mysql数据库恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2026/03/orafhr.html" rel="bookmark" class="crp_title">Oracle数据库被勒索加密一键open工具&#8211;OraFHR</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2026/01/aix-nfs-combehin.html" rel="bookmark" class="crp_title">aix环境写入大文件设置combehin提高效率</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2026/10/bres-dmp-recovery.html" rel="bookmark" class="crp_title">.bres勒索病毒加密数据库dmp文件可恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2026/07/obet-2026-07.html" rel="bookmark" class="crp_title">Oracle Block Edit Tool (obet) 功能增强&#8211;2026.07</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2026/03/win-rm-datafile-recovery.html" rel="bookmark" class="crp_title">记录一次win删除数据文件完美恢复案例</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2026/08/obet-forcecopy-ioerror.html" rel="bookmark" class="crp_title">obet forcecopy功能抢救硬件故障中的数据文件</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/12/sql-bak-0-lost-data.html" rel="bookmark" class="crp_title">模拟sql server故障备份完成恢复实现数据0丢失</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2026/08/redo-corrupt-recovery.html" rel="bookmark" class="crp_title">不太常见的10.2.0.1的oracle redo损坏恢复</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>https://www.xifenfei.com/2026/01/hgdb-rm-rf-recovery.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PostgreSQL查询一个表相关的所有oid</title>
		<link>https://www.xifenfei.com/2025/12/get-table-all-oid.html</link>
		<comments>https://www.xifenfei.com/2025/12/get-table-all-oid.html#comments</comments>
		<pubDate>Fri, 12 Dec 2025 14:59:24 +0000</pubDate>
		<dc:creator><![CDATA[惜分飞]]></dc:creator>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[pg表相关oid]]></category>
		<category><![CDATA[表所有oid]]></category>

		<guid isPermaLink="false">https://www.xifenfei.com/?p=11851</guid>
		<description><![CDATA[联系：手机/微信(+86 17813235971) QQ(107644445)  &#8230; <a href="https://www.xifenfei.com/2025/12/get-table-all-oid.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/12/get-table-all-oid.html" target="_blank">PostgreSQL查询一个表相关的所有oid</a></p>
<p>作者：<a href="https://www.xifenfei.com" target="_blank">惜分飞</a>©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]</p>
</div>
<p>在pg中查询一个表相关的所有oid(表OID、TOAST表OID、索引OID、TOAST表的索引OID、约束OID)</p>
<pre class="brush: sql; title: ; notranslate">
-- 替换这里的表名和模式名
\set search_path = public;
\set table_name '\'AO_6384AB_DISCOVERED\''
\set schema_name '\'public\''

WITH table_info AS (
    -- 基础表信息：表OID
    SELECT
        c.oid AS table_oid,
        c.relname AS table_name,
        c.reltoastrelid AS toast_oid,
        n.nspname AS schema_name
    FROM
        pg_catalog.pg_class c
    JOIN
        pg_catalog.pg_namespace n ON c.relnamespace = n.oid
    WHERE
        c.relname = :table_name
        AND n.nspname = :schema_name
        AND c.relkind = 'r'
),
index_info AS (
    -- 索引信息：索引OID
    SELECT
        t.table_oid,
        i.oid AS object_oid,
        i.relname AS object_name,
        'index' AS object_type
    FROM
        pg_catalog.pg_class i
    JOIN
        pg_catalog.pg_index idx ON i.oid = idx.indexrelid
    JOIN
        table_info t ON idx.indrelid = t.table_oid
    WHERE
        i.relkind = 'i'
),
toast_info AS (
    -- TOAST表信息：TOAST表OID
    SELECT
        t.table_oid,
        t.toast_oid AS object_oid,
        c.relname AS object_name,
        'toast_table' AS object_type
    FROM
        table_info t
    JOIN
        pg_catalog.pg_class c ON t.toast_oid = c.oid
    WHERE
        t.toast_oid &lt;&gt; 0
),
toast_index_info AS (
    -- TOAST索引信息：TOAST表的索引OID
    SELECT
        t.table_oid,
        i.oid AS object_oid,
        i.relname AS object_name,
        'toast_index' AS object_type
    FROM
        table_info t
    JOIN
        pg_catalog.pg_class c ON t.toast_oid = c.oid
    JOIN
        pg_catalog.pg_index idx ON c.oid = idx.indrelid
    JOIN
        pg_catalog.pg_class i ON idx.indexrelid = i.oid
    WHERE
        t.toast_oid &lt;&gt; 0
        AND i.relkind = 'i'
),
constraint_info AS (
    -- 约束信息：约束OID
    SELECT
        t.table_oid,
        con.oid AS object_oid,
        con.conname AS object_name,
        CASE con.contype
            WHEN 'p' THEN 'primary_key'
            WHEN 'u' THEN 'unique_constraint'
            WHEN 'f' THEN 'foreign_key'
            WHEN 'c' THEN 'check_constraint'
            ELSE 'other_constraint'
        END AS object_type
    FROM
        pg_catalog.pg_constraint con
    JOIN
        table_info t ON con.conrelid = t.table_oid
)
-- 合并所有结果，先输出表本身的信息，再输出其他关联对象
SELECT
    t.table_oid AS object_oid,
    t.table_name AS object_name,
    'table' AS object_type,
    t.schema_name AS schema_name
FROM
    table_info t
UNION ALL
SELECT
    object_oid,
    object_name,
    object_type,
    (SELECT schema_name FROM table_info) AS schema_name
FROM
    index_info
UNION ALL
SELECT
    object_oid,
    object_name,
    object_type,
    (SELECT schema_name FROM table_info) AS schema_name
FROM
    toast_info
UNION ALL
SELECT
    object_oid,
    object_name,
    object_type,
    (SELECT schema_name FROM table_info) AS schema_name
FROM
    toast_index_info
UNION ALL
SELECT
    object_oid,
    object_name,
    object_type,
    (SELECT schema_name FROM table_info) AS schema_name
FROM
    constraint_info
ORDER BY
    object_type;
</pre>
<div id="crp_related"><ul><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/2012/02/%e8%80%81%e7%89%88%e6%9c%acplsql-developer%e6%93%8d%e4%bd%9c%e6%95%b0%e6%8d%ae%e5%ba%93%e5%af%bc%e8%87%b4ora-0060017113.html" rel="bookmark" class="crp_title">老版本PL/SQL Developer操作数据库导致ORA-00600[17113]</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/12/vpwfile_users%e5%92%8c%e5%af%86%e7%a0%81%e6%96%87%e4%bb%b6%e5%85%b3%e7%b3%bb%e7%bb%ad.html" rel="bookmark" class="crp_title">V$PWFILE_USERS和密码文件关系(续)</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/03/%e8%af%af%e5%88%a0%e9%99%a4dual%e8%a1%a8%e6%81%a2%e5%a4%8d.html" rel="bookmark" class="crp_title">误删除dual表恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/03/%e6%9f%a5%e6%89%bevparameter-%e5%9f%ba%e8%a1%a8.html" rel="bookmark" class="crp_title">查找V$PARAMETER 基表</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/08/%e8%a1%a8%e5%9c%a8%e7%ba%bf%e9%87%8d%e5%ae%9a%e4%b9%89%e6%97%a0%e4%b8%bb%e9%94%ae.html" rel="bookmark" class="crp_title">表在线重定义(无主键)</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2021/03/ora-600-16703-orachk-insert-tab.html" rel="bookmark" class="crp_title">ORA-600 16703直接把orachk备份表插入到tab$恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/08/%e5%9c%a8%e7%ba%bf%e9%87%8d%e5%ae%9a%e4%b9%89%e5%8e%9f%e7%90%86%e6%8e%a2%e8%ae%a8.html" rel="bookmark" class="crp_title">在线重定义原理探讨</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/grant-dml-to-public-authorization-expires.html" rel="bookmark" class="crp_title">表dml操作权限授权给public,导致只读用户失效</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/07/inactive-transaction-branch%e7%ad%89%e5%be%85%e4%ba%8b%e4%bb%b6.html" rel="bookmark" class="crp_title">inactive transaction branch等待事件</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2020/08/upgrade-db-sys-dbms_sqltune.html" rel="bookmark" class="crp_title">数据库升级遭遇ORA-04063: package body &#8220;SYS.DBMS_SQLTUNE&#8221;</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>https://www.xifenfei.com/2025/12/get-table-all-oid.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PostgreSQL oid文件替换实现数据访问</title>
		<link>https://www.xifenfei.com/2025/12/pg-replace-oid-recovery.html</link>
		<comments>https://www.xifenfei.com/2025/12/pg-replace-oid-recovery.html#comments</comments>
		<pubDate>Fri, 12 Dec 2025 13:00:21 +0000</pubDate>
		<dc:creator><![CDATA[惜分飞]]></dc:creator>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[PostgreSQL恢复]]></category>
		<category><![CDATA[oid恢复]]></category>
		<category><![CDATA[pg恢复]]></category>
		<category><![CDATA[replace oid recovery]]></category>
		<category><![CDATA[替换oid恢复]]></category>

		<guid isPermaLink="false">https://www.xifenfei.com/?p=11847</guid>
		<description><![CDATA[联系：手机/微信(+86 17813235971) QQ(107644445)  &#8230; <a href="https://www.xifenfei.com/2025/12/pg-replace-oid-recovery.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/12/pg-replace-oid-recovery.html" target="_blank">PostgreSQL oid文件替换实现数据访问</a></p>
<p>作者：<a href="https://www.xifenfei.com" target="_blank">惜分飞</a>©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]</p>
</div>
<p>对于postgresql数据库,我们都知道他的数据在独立的oid文件里面,而字典主要在pg_type/1247,pg_class/1259,pg_attribute/1260等对象中,而数据是存储在独立的oid和toast oid文件中.如果通过提供oid文件,可以实现狸猫换太子的恢复数据.这里做一个简单测试,大概思路是这样的库里面有一个表a,然后创建一个空表b,然后把a表相关的oid文件复制成b表的oid文件,然后验证数据是否可以正常查询<br />
创建一个空的b表,结构和a表一致</p>
<pre class="brush: sql; title: ; notranslate">
[postgres@xifenfei 13676]$ psql
psql (12.8)
Type &quot;help&quot; for help.

postgres=# CREATE TABLE &quot;public&quot;.&quot;AO_6384AB_DISCOVERED1&quot; (
postgres(#   &quot;DATE&quot; &quot;pg_catalog&quot;.&quot;timestamp&quot;,
postgres(#   &quot;ID&quot; &quot;pg_catalog&quot;.&quot;int4&quot;,
postgres(#   &quot;KEY&quot; &quot;pg_catalog&quot;.&quot;varchar&quot; COLLATE &quot;pg_catalog&quot;.&quot;default&quot;,
postgres(#   &quot;PLUGIN_KEY&quot; &quot;pg_catalog&quot;.&quot;varchar&quot; COLLATE &quot;pg_catalog&quot;.&quot;default&quot;,
postgres(#   &quot;USER_KEY&quot; &quot;pg_catalog&quot;.&quot;varchar&quot; COLLATE &quot;pg_catalog&quot;.&quot;default&quot;
postgres(# )
postgres-# ;
CREATE TABLE
</pre>
<p>检查a/b的情况</p>
<pre class="brush: sql; title: ; notranslate">
postgres=# select count(1) from &quot;AO_6384AB_DISCOVERED&quot;;
 count 
-------
   544
(1 row)

postgres=# select count(1) from &quot;AO_6384AB_DISCOVERED1&quot;;
 count 
-------
     0
(1 row)

postgres=# \d &quot;AO_6384AB_DISCOVERED&quot;
                    Table &quot;public.AO_6384AB_DISCOVERED&quot;
   Column   |            Type             | Collation | Nullable | Default 
------------+-----------------------------+-----------+----------+---------
 DATE       | timestamp without time zone |           |          | 
 ID         | integer                     |           |          | 
 KEY        | character varying           |           |          | 
 PLUGIN_KEY | character varying           |           |          | 
 USER_KEY   | character varying           |           |          | 

postgres=# \d &quot;AO_6384AB_DISCOVERED1&quot;
                   Table &quot;public.AO_6384AB_DISCOVERED1&quot;
   Column   |            Type             | Collation | Nullable | Default 
------------+-----------------------------+-----------+----------+---------
 DATE       | timestamp without time zone |           |          | 
 ID         | integer                     |           |          | 
 KEY        | character varying           |           |          | 
 PLUGIN_KEY | character varying           |           |          | 
 USER_KEY   | character varying           |           |          | 
</pre>
<p>存在数据的a/b表相关oid信息</p>
<pre class="brush: sql; title: ; notranslate">


postgres=# select oid,relname,relfilenode from pg_class where relname like '%AO_6384AB_DISCOVERED%';
  oid  |        relname        | relfilenode 
-------+-----------------------+-------------
 16516 | AO_6384AB_DISCOVERED  |       16516
 17069 | AO_6384AB_DISCOVERED1 |       17069
(2 rows)

postgres=# select oid,relname,relfilenode from pg_class where relname like '%16516%' or  relname like '%17069%'  ;
  oid  |       relname        | relfilenode 
-------+----------------------+-------------
 16519 | pg_toast_16516       |       16519
 16521 | pg_toast_16516_index |       16521
 17072 | pg_toast_17069       |       17072
 17074 | pg_toast_17069_index |       17074
(4 rows)
</pre>
<p>关闭数据库把a表相关的oid文件拷贝替换b表的oid文件</p>
<pre class="brush: bash; title: ; notranslate">
[postgres@xifenfei 13676]$ pg_ctl stop -D /pgdata
waiting for server to shut down....2025-12-12 20:00:58.804 HKT [21445] LOG:  received fast shutdown request
2025-12-12 20:00:58.805 HKT [21445] LOG:  aborting any active transactions
2025-12-12 20:00:58.805 HKT [21471] FATAL:  terminating connection due to administrator command
2025-12-12 20:00:58.805 HKT [21473] FATAL:  terminating connection due to administrator command
2025-12-12 20:00:58.805 HKT [21856] FATAL:  terminating connection due to administrator command
2025-12-12 20:00:58.806 HKT [21472] FATAL:  terminating connection due to administrator command
2025-12-12 20:00:58.806 HKT [21445] LOG: background worker&quot;logical replication launcher&quot;(PID 252)exited with exit code 1
2025-12-12 20:00:58.807 HKT [21447] LOG:  shutting down
2025-12-12 20:00:58.811 HKT [21445] LOG:  database system is shut down
 done
server stopped
[postgres@xifenfei 13676]$ cp  16516 17069
[postgres@xifenfei 13676]$ cp  16519 17072
[postgres@xifenfei 13676]$ cp  16521 17074
[postgres@xifenfei 13676]$ pg_ctl start -D /pgdata
waiting for server to start....2025-12-12 20:02:05.985 HKT [22241] LOG:  
starting PostgreSQL 12.8 on x86_64-pc-linux-gnu, 
compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-26.0.1), 64-bit
2025-12-12 20:02:05.985 HKT [22241] LOG:  listening on IPv4 address &quot;0.0.0.0&quot;, port 5432
2025-12-12 20:02:05.986 HKT [22241] LOG:  listening on IPv6 address &quot;::&quot;, port 5432
2025-12-12 20:02:05.986 HKT [22241] LOG:  listening on Unix socket &quot;/tmp/.s.PGSQL.5432&quot;
2025-12-12 20:02:05.993 HKT [22242] LOG:  database system was shut down at 2025-12-12 20:00:58 HKT
2025-12-12 20:02:05.995 HKT [22241] LOG:  database system is ready to accept connections
 done
server started
</pre>
<p>查询a/b表数据</p>
<pre class="brush: sql; title: ; notranslate">
[postgres@xifenfei 13676]$ psql
psql (12.8)
Type &quot;help&quot; for help.

postgres=# select count(1) from &quot;AO_6384AB_DISCOVERED1&quot;;
 count 
-------
   544
(1 row)

postgres=# select count(1) from &quot;AO_6384AB_DISCOVERED&quot;;
 count 
-------
   544
(1 row)
</pre>
<p>通过上述从测试,证明创建一个新的表结构,完全可以访问老的oid文件中的数据</p>
<div id="crp_related"><ul><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/09/pg-truncate-recovery.html" rel="bookmark" class="crp_title">Postgres数据库truncate表无有效备份恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/03/invalid-checkpoint-record.html" rel="bookmark" class="crp_title">pg启动报invalid checkpoint record处理</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/04/pg-createdb-gbk.html" rel="bookmark" class="crp_title">pg创建gbk字符集库</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2018/08/pg-tablespace-database-schema.html" rel="bookmark" class="crp_title">PostgreSQL的表空间、数据库、用户之间的关系</a></li><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/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/navicat-postgresql-datlastsysoid.html" rel="bookmark" class="crp_title">Navicat连接postgresql时出现column &#8220;datlastsysoid&#8221; does not exist错误解决</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/2026/01/pg-readme_to_recover.html" rel="bookmark" class="crp_title">注意:PostgreSQL库出现readme_to_recover勒索</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/2010/08/fckeditor%e4%bd%bf%e7%94%a8%e8%af%b4%e6%98%8e.html" rel="bookmark" class="crp_title">fckeditor使用说明</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>https://www.xifenfei.com/2025/12/pg-replace-oid-recovery.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Postgres数据库truncate表无有效备份恢复</title>
		<link>https://www.xifenfei.com/2025/09/pg-truncate-recovery.html</link>
		<comments>https://www.xifenfei.com/2025/09/pg-truncate-recovery.html#comments</comments>
		<pubDate>Sun, 28 Sep 2025 15:12:07 +0000</pubDate>
		<dc:creator><![CDATA[惜分飞]]></dc:creator>
				<category><![CDATA[pdu工具]]></category>
		<category><![CDATA[PostgreSQL恢复]]></category>
		<category><![CDATA[pg truncate 恢复]]></category>
		<category><![CDATA[Postgres truncate恢复]]></category>

		<guid isPermaLink="false">https://www.xifenfei.com/?p=11661</guid>
		<description><![CDATA[联系：手机/微信(+86 17813235971) QQ(107644445)  &#8230; <a href="https://www.xifenfei.com/2025/09/pg-truncate-recovery.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/09/pg-truncate-recovery.html" target="_blank">Postgres数据库truncate表无有效备份恢复</a></p>
<p>作者：<a href="https://www.xifenfei.com" target="_blank">惜分飞</a>©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]</p>
</div>
<p>创建一个Postgres表,并插入数据</p>
<pre class="brush: sql; title: ; notranslate">
postgres=# CREATE TABLE &quot;PeisInterfaceLog&quot;(
postgres(#         &quot;PeisInterfaceLogId&quot; text,
postgres(#         &quot;PeisDepartmentId&quot; text,
postgres(#         &quot;PeisDepartmentName&quot; text,
postgres(#         &quot;PeisInterfaceSubjectType&quot; text,
postgres(#         &quot;PeisInterfaceSubjectId&quot; text,
postgres(#         &quot;PeisInterfaceNo&quot; text,
postgres(#         &quot;PeisInterfaceName&quot; text,
postgres(#         &quot;PeisInterfaceDirection&quot; text,
postgres(#         &quot;PeisInterfaceCallAddress&quot; text,
postgres(#         &quot;PeisInterfaceLogStartTime&quot; timestamp,
postgres(#         &quot;PeisInterfaceInputContent&quot; json,
postgres(#         &quot;PeisInterfaceInputTranscodeContent&quot; json,
postgres(#         &quot;PeisInterfaceOutContent&quot; json,
postgres(#         &quot;PeisInterfaceOutTranscodeContent&quot; json,
postgres(#         &quot;PeisInterfaceSuccessSign&quot; int4,
postgres(#         &quot;PeisInterfaceLogStatusCode&quot; text,
postgres(#         &quot;PeisInterfaceLogNote&quot; text,
postgres(#         &quot;PeisInterfaceLogTimestamp&quot; timestamp,
postgres(#         &quot;PeisInterfaceLogInfo&quot; text,
postgres(#         &quot;PeisPatientRegisterId&quot; text
postgres(# );
CREATE TABLE
postgres=# \i /postgres/COPY/public_copy.sql 
SET
COPY 722957
postgres=# select count(1) from &quot;PeisInterfaceLog&quot;;
 count  
--------
 722957
(1 row)
</pre>
<p>验证truncate操作,引起Postgres中oid的变化</p>
<pre class="brush: sql; title: ; notranslate">
postgres=# checkpoint;
CHECKPOINT
postgres=#  show data_directory;
 data_directory 
----------------
 /pgdata
(1 row)
postgres=# select oid, datname from pg_database ;
  oid  |  datname  
-------+-----------
 13676 | postgres
     1 | template1
 13675 | template0
(3 rows)
postgres=# select relname, relowner, relfilenode from pg_class where relowner = 10 and relname like '%PeisInterfaceLog%';
     relname      | relowner | relfilenode 
------------------+----------+-------------
 PeisInterfaceLog |       10 |       16384
(1 row)

postgres=# truncate table &quot;PeisInterfaceLog&quot;;
TRUNCATE TABLE
postgres=# select count(1) from  &quot;PeisInterfaceLog&quot;;
 count 
-------
     0
(1 row)

postgres=# select relname, relowner, relfilenode from pg_class where relowner = 10 and relname like '%PeisInterfaceLog%';
     relname      | relowner | relfilenode 
------------------+----------+-------------
 PeisInterfaceLog |       10 |       16394
(1 row)
</pre>
<p>使用工具进行初始化字典信息</p>
<pre class="brush: bash; title: ; notranslate">
PDU.public=# b;

开始初始化...
 -pg_database:&lt;/pgdata/global/1262&gt;

数据库:postgres 
      -pg_schema:&lt;/pgdata/base/13676/2615&gt;
      -pg_class:&lt;/pgdata/base/13676/1259&gt; 共88行
      -pg_attribute:&lt;/pgdata/base/13676/1249&gt; 共2950行
      模式:
        ▌ public 1张表

PDU.public=# use postgres;

┌────────────────────────────────────────┐
│          模式             │  表数量    │
├────────────────────────────────────────┤
│    public                 │  1         │
└────────────────────────────────────────┘
postgres.public=# set public;

┌──────────────────────────────────────────────────┐
│               表名                  │  表大小    │
├──────────────────────────────────────────────────┤
│    PeisInterfaceLog                 │  0         │
└──────────────────────────────────────────────────┘
        仅显示表大小排名前 1 的表名
postgres.public=# \d PeisInterfaceLog;

┌──────────────────────────────────────────────────────────────┐
│                            列类型                            │
└──────────────────────────────────────────────────────────────┘
text,text,text,text,text,text,text,text,text,timestamp,json,json,json,json,int4,text,text,timestamp,text,text

</pre>
<p>配置软件磁盘扫描操作（pdu.ini中配置）</p>
<pre class="brush: bash; title: ; notranslate">
#dropScan需要扫描的磁盘
DISK_PATH=/data/test.dd
#dropScan时跳跃的数据块数量，数值越小覆盖磁盘越全面，速度越慢
BLOCK_INTERVAL=5
</pre>
<p>启用磁盘扫描操作</p>
<pre class="brush: bash; title: ; notranslate">
PDU.public=# p idxmode off;

┌─────────────────────────────────────────────────────────────────┐
│              参数                │             当前值           │
├─────────────────────────────────────────────────────────────────┤
│    startwal                      │                              │
│    endwal                        │                              │
│    startlsnt                     │                              │
│    endlsnt                       │                              │
│    starttime                     │                              │
│    endtime                       │                              │
│    resmode(Data Restore Mode)    │              TIME            │
│    exmode(Data Export Mode)      │              CSV             │
│    encoding                      │              UTF8            │
│    restype(Data Restore Type)    │              DELETE          │
          ----------------------DropScan----------------------
│    dsoff(DropScan startOffset)   │              0               │
│    blkiter(Block Intervals)      │              5               │
│    itmpcsv(Items Per Csv)        │              100             │
│    idxmode                       │              off             │
└─────────────────────────────────────────────────────────────────┘
PDU.public=# ds;

 ▌全量扫描恢复模式 

 ▌数据文件扫描 
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
          表名           │                                   结果                                    
├────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
 PeisInterfaceLog           99.976 %(21469593600)   数据页: 71158      成功: 722947    (疑似乱码: 2809      ) 失败: 0 

耗时 15.28 秒
└────────────────────────────────────────────────────────────────────────────────────────────────────┘
扫描完毕,文件目录如下: 
        restore/dropscan/PeisInterfaceLog
PDU.public=# ds copy;
已导出: 
/restore/dropscan/PeisInterfaceLog/COPY.sql
PDU.public=# 

[root@xifenfei PeisInterfaceLog]# more COPY.sql 
[root@xifenfei PeisInterfaceLog]# cat /restore/dropscan/PeisInterfaceLog/COPY.sql
COPY PeisInterfaceLog FROM '/restore/dropscan/PeisInterfaceLog/09-28-21:29:55_226738176_32760blks_336787items.csv';
COPY PeisInterfaceLog FROM '/restore/dropscan/PeisInterfaceLog/09-28-21:30:01_595968000_32767blks_330416items.csv';
COPY PeisInterfaceLog FROM '/restore/dropscan/PeisInterfaceLog/09-28-21:30:04_1116061696_5631blks_55744items.csv';
</pre>
<p>把恢复数据导入到Postgres数据中</p>
<pre class="brush: sql; title: ; notranslate">
[root@xifenfei ~]# su - postgres 
[postgres@xifenfei ~]$ psql
psql (12.8)
Type &quot;help&quot; for help.

postgres=# \i /restore/dropscan/PeisInterfaceLog/COPY.sql
COPY 336787
COPY 330416
COPY 55744
postgres=# select count(1) from &quot;PeisInterfaceLog&quot;;
 count  
--------
 722947
(1 row)
</pre>
<p>经过上述扫描测试证明该工具实现了在Postgres中truncate数据的绝大部分数据恢复(这里的乱码不是由于没有扫描到数据,主要是由于个别字符串由于类型判断关系识别不对导致乱码抛弃).<br />
如果你遇到Postgres 数据库由于drop/truncate等误操作，而且无有效备份进行恢复，面临数据丢失风险,请第一时间保护现场(数据文件所在分区尽可能不要有写入操作)，联系我们提供专业恢复技术支持:<br />
<strong><font color="red" size=4>电话/微信:17813235971 &nbsp;&nbsp;   Q Q:107644445<a target="_blank" href="https://wpa.qq.com/msgrd?v=3&amp;uin=107644445&amp;site=qq&amp;menu=yes"><img id="xffqqimg" src="//www.xifenfei.com/wp-content/themes/img/site_qq.jpg" alt="QQ咨询惜分飞" title="QQ咨询惜分飞"></a>  &nbsp;&nbsp;  E-Mail:dba@xifenfei.com</font></strong></p>
<div id="crp_related"><ul><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/04/pg-createdb-gbk.html" rel="bookmark" class="crp_title">pg创建gbk字符集库</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/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/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/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/2026/01/pg-readme_to_recover.html" rel="bookmark" class="crp_title">注意:PostgreSQL库出现readme_to_recover勒索</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2018/08/pg-tablespace-database-schema.html" rel="bookmark" class="crp_title">PostgreSQL的表空间、数据库、用户之间的关系</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2024/04/pg_filedump_batch.html" rel="bookmark" class="crp_title">PostgreSQL恢复系列:pg_filedump批量处理</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2024/04/pg_filedump-batch-recovery.html" rel="bookmark" class="crp_title">PostgreSQL恢复系列:pg_filedump恢复字典构造</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/03/navicat-postgresql-datlastsysoid.html" rel="bookmark" class="crp_title">Navicat连接postgresql时出现column &#8220;datlastsysoid&#8221; does not exist错误解决</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></ul></div>]]></content:encoded>
			<wfw:commentRss>https://www.xifenfei.com/2025/09/pg-truncate-recovery.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>pg_wal中文件的名称中的logseq和实际文件中的logseq不匹配</title>
		<link>https://www.xifenfei.com/2025/08/pg_wal_filename-logseq-mismatch.html</link>
		<comments>https://www.xifenfei.com/2025/08/pg_wal_filename-logseq-mismatch.html#comments</comments>
		<pubDate>Tue, 05 Aug 2025 16:03:50 +0000</pubDate>
		<dc:creator><![CDATA[惜分飞]]></dc:creator>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[pg logseq]]></category>
		<category><![CDATA[pg_wal logseq]]></category>
		<category><![CDATA[pg_waldump: fatal: could not find a valid record]]></category>

		<guid isPermaLink="false">https://www.xifenfei.com/?p=11568</guid>
		<description><![CDATA[联系：手机/微信(+86 17813235971) QQ(107644445)  &#8230; <a href="https://www.xifenfei.com/2025/08/pg_wal_filename-logseq-mismatch.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/08/pg_wal_filename-logseq-mismatch.html" target="_blank">pg_wal中文件的名称中的logseq和实际文件中的logseq不匹配</a></p>
<p>作者：<a href="https://www.xifenfei.com" target="_blank">惜分飞</a>©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]</p>
</div>
<p>一个朋友由于某种原因给我发了一个pg_wal里面的wal文件,让我帮忙分析下故障原因,我打开文件之后发现文件编号小的修改时间比编号大的文件修改时间要新<br />
<a href="https://www.xifenfei.com/wp-content/uploads/2025/08/pg_wal.png"><img src="https://www.xifenfei.com/wp-content/uploads/2025/08/pg_wal.png" alt="pg_wal" width="658" height="179" class="alignleft size-full wp-image-11569" /></a><br />
<hr />
<strong>wal日志文件命名规则：</strong><br />
我们看到的wal日志是这样的：0000000100004D6E000000CF<br />
其中前8位:00000001表示timeline<br />
中间8位：00004D6E表示logid<br />
最后8位：000000CF表示logseg<br />
在上述截图中,可以看到logseq为CF的文件比D0的要新很多,这个初步给人感觉不太正常.使用pg_waldump分别对其进行dump操作<br />
<a href="https://www.xifenfei.com/wp-content/uploads/2025/08/pg_waldump1.png"><img src="https://www.xifenfei.com/wp-content/uploads/2025/08/pg_waldump1.png" alt="pg_waldump1" width="1251" height="352" class="alignleft size-full wp-image-11570" /></a><br />
<hr />
<pre class="brush: bash; title: ; notranslate">
[postgres@xifenfei bin]$ pg_waldump /data/wal/0000000100004D6E000000D0|head -10
pg_waldump: fatal: could not find a valid record after 4D6E/D0000000
</pre>
<p>这样可以看出来CF的wal文件可以正常dump出来,但是D0的文件dump报pg_waldump: fatal: could not find a valid record after类似异常.通过od命令分别对两个文件进行分析</p>
<pre class="brush: bash; title: ; notranslate">
[postgres@xifenfei bin]$ od -x /data/wal/0000000100004D6E000000CF|head -1
0000000 d101 0006 0001 0000 0000 cf00 4d6e 0000
[postgres@xifenfei bin]$ od -x /data/wal/0000000100004D6E000000D0|head -1
0000000 d101 0007 0001 0000 0000 9400 4d6e 0000
</pre>
<p>从第8个字节到第12个字节结束为logseq的值,这里明显可以看出来D0文件的logseq值和实际文件中的不一致.尝试把D0修改为94之后即可正常的pg_waldump进行分析<br />
<a href="https://www.xifenfei.com/wp-content/uploads/2025/08/pg_waldump2.png"><img src="https://www.xifenfei.com/wp-content/uploads/2025/08/pg_waldump2.png" alt="pg_waldump2" width="1172" height="421" class="alignleft size-full wp-image-11571" /></a><br />
<hr />
通过这里可以的出来一个结论,pg_wal中文件的名称中的logseq和实际文件中的logseq不匹配.出现这种问题的本质是由于pg_wal中的wal日志是相当oracle的redo,是通过类似重命名机制(看到有文档介绍是说硬链接指向旧文件然后删除旧文件)引起的问题.</p>
<div id="crp_related"><ul><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/12/sql-bak-0-lost-data.html" rel="bookmark" class="crp_title">模拟sql server故障备份完成恢复实现数据0丢失</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/10/linux7-8-single-user.html" rel="bookmark" class="crp_title">redhat系列7/8进入单用户模式</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/10/grubx64-efi-not-found.html" rel="bookmark" class="crp_title">Failed to open \EFI\redhat\grubx64.efi &#8211; Not Found 故障处理</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/12/ufs-recovery-lvm.html" rel="bookmark" class="crp_title">linux异常磁盘lvm恢复操作演示</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/01/fio-disk-destruction-recovery.html" rel="bookmark" class="crp_title">fio测试io,导致磁盘文件系统损坏故障恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/01/ar8mswin1256.html" rel="bookmark" class="crp_title">中文环境显示AR8MSWIN1256（阿拉伯语字符集）</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/02/sql-server-recovering.html" rel="bookmark" class="crp_title">sql server数据库“正在恢复”故障处理</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/04/sql-tempdb-error.html" rel="bookmark" class="crp_title">可能是 tempdb 空间用尽或某个系统表不一致故障处理</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/03/aix-disk-had-oracle-recovery.html" rel="bookmark" class="crp_title">aix磁盘损坏oracle数据库恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/09/delete-df-some-overwrit-recovery.html" rel="bookmark" class="crp_title">删除数据库文件并部分覆盖情况下Oracle恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/01/first-oracle-21c-recovery-ask.html" rel="bookmark" class="crp_title">第一例Oracle 21c恢复咨询</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/11/mysql-drop-database-recovery.html" rel="bookmark" class="crp_title">mysql drop database 恢复思路</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>https://www.xifenfei.com/2025/08/pg_wal_filename-logseq-mismatch.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>由于空间满导致PostgreSQL数据库异常处理</title>
		<link>https://www.xifenfei.com/2025/07/no-space-left-on-device-postgresql.html</link>
		<comments>https://www.xifenfei.com/2025/07/no-space-left-on-device-postgresql.html#comments</comments>
		<pubDate>Tue, 29 Jul 2025 15:36:09 +0000</pubDate>
		<dc:creator><![CDATA[惜分飞]]></dc:creator>
				<category><![CDATA[PostgreSQL恢复]]></category>
		<category><![CDATA[pg异常处理]]></category>
		<category><![CDATA[pg恢复支持]]></category>
		<category><![CDATA[postgres恢复]]></category>

		<guid isPermaLink="false">https://www.xifenfei.com/?p=11562</guid>
		<description><![CDATA[联系：手机/微信(+86 17813235971) QQ(107644445)  &#8230; <a href="https://www.xifenfei.com/2025/07/no-space-left-on-device-postgresql.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/07/no-space-left-on-device-postgresql.html" target="_blank">由于空间满导致PostgreSQL数据库异常处理</a></p>
<p>作者：<a href="https://www.xifenfei.com" target="_blank">惜分飞</a>©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]</p>
</div>
<p>朋友和我反馈pg库异常,通过查看日志确认最初故障是由于磁盘空间满，导出出现类似:无法扩展文件 &#8220;pg_tblspc/16394/PG_13_202007201/16395/5055912.143&#8243;: No space left on device错误</p>
<pre class="brush: bash; title: ; notranslate">
2025-07-28 09:06:02.703 HKT [15352] 错误:  无法扩展文件 &quot;pg_tblspc/16394/PG_13_202007201/16395/5055912.143&quot;: No space left on device
2025-07-28 09:06:02.703 HKT [15352] 提示:  检查空闲磁盘控件.
2025-07-28 09:06:02.703 HKT [15352] 语句:  insert into 语句
2025-07-28 09:06:02.703 HKT [576] 错误:  无法扩展文件 &quot;pg_tblspc/16394/PG_13_202007201/16395/4477723.73&quot;: No space left on device
2025-07-28 09:06:02.703 HKT [576] 提示:  检查空闲磁盘控件.
2025-07-28 09:06:02.703 HKT [576] 语句:  update 语句
2025-07-28 09:06:02.706 HKT [11940] 错误:  无法扩展文件 &quot;pg_tblspc/16394/PG_13_202007201/16395/5055912.143&quot;: No space left on device
2025-07-28 09:06:02.706 HKT [11940] 提示:  检查空闲磁盘控件.
2025-07-28 09:06:02.706 HKT [11940] 语句:  insert into 语句
</pre>
<p><a href="https://www.xifenfei.com/wp-content/uploads/2025/07/pg-nofree.png"><img src="https://www.xifenfei.com/wp-content/uploads/2025/07/pg-nofree.png" alt="pg-nofree" width="846" height="481" class="alignleft size-full wp-image-11563" /></a><br />
<hr />
后续对d盘空间进行了清理,pg报无法打开文件&#8221;pg_tblspc/16394/PG_13_202007201/16395/4477706.16&#8243;(目标数据块5544906): Permission denied</p>
<pre class="brush: bash; title: ; notranslate">
2025-07-28 10:53:10.435 HKT [11920] 语句:  insert into语句
2025-07-28 10:53:10.435 HKT [18300] 错误:  无法打开文件&quot;pg_tblspc/16394/PG_13_202007201/16395/4477706.16&quot;(目标数据块5544906): Permission denied
</pre>
<p>和报:警告:  无法写入pg_tblspc/16394/PG_13_202007201/16395/4477706的块5545387错误</p>
<pre class="brush: bash; title: ; notranslate">
2025-07-28 11:05:11.008 HKT [5380] 警告:  无法写入pg_tblspc/16394/PG_13_202007201/16395/4477706的块5545387
2025-07-28 11:05:11.008 HKT [5380] 详细信息:  多次失败 --- 写错误可能是永久性的
2025-07-28 11:05:11.015 HKT [12072] 错误:  无法打开文件&quot;pg_tblspc/16394/PG_13_202007201/16395/4477706.17&quot;（目标块5545398）：上一段只有952个块
2025-07-28 11:05:11.015 HKT [12072] 上下文:  写入关系pg_tblspc/16394/PG_13_202007201/16395/4477706的块5545398
2025-07-28 11:05:11.015 HKT [12072] 语句:  select 语句
2025-07-28 11:05:11.016 HKT [12072] 警告:  无法写入pg_tblspc/16394/PG_13_202007201/16395/4477706的块5545398
2025-07-28 11:05:11.016 HKT [12072] 详细信息:  多次失败 --- 写错误可能是永久性的
</pre>
<p>查看4477706相关文件情况,初步看部分文件大小不对,结合上述报错,可以断定该表异常<br />
<a href="https://www.xifenfei.com/wp-content/uploads/2025/07/pgsize.png"><img src="https://www.xifenfei.com/wp-content/uploads/2025/07/pgsize.png" alt="pgsize" width="507" height="323" class="alignleft size-full wp-image-11564" /></a><br />
<hr />
通过查询pg字典确认该表具体名称</p>
<pre class="brush: sql; title: ; notranslate">
xifenfei=# select oid,relname,relnamespace from pg_class where  relfilenode=4477706;
  oid  |     relname      | relnamespace
-------+------------------+--------------
 16880 | xifenfei01_log   |         2200
(1 行记录)
</pre>
<p>尝试pg_dump导入数据报错：多次失败 &#8212; 写错误可能是永久性的</p>
<p>这次运气比较好,损坏的对象是一个日志表,可以直接清理掉,对该日志表进行清理,然后正常导出数据,如果遇到的损坏表是业务需要的表,可以使用pdu(<a href="https://www.xifenfei.com/2025/03/pdu-recovery-corrupt-block.html" title="PostgreSQL表文件损坏恢复—pdu恢复损坏的表文件" rel="noopener" target="_blank">PostgreSQL表文件损坏恢复—pdu恢复损坏的表文件</a>)进行恢复</p>
<div id="crp_related"><ul><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/12/sql-bak-0-lost-data.html" rel="bookmark" class="crp_title">模拟sql server故障备份完成恢复实现数据0丢失</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/10/linux7-8-single-user.html" rel="bookmark" class="crp_title">redhat系列7/8进入单用户模式</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/03/pg-delete-recovery.html" rel="bookmark" class="crp_title">pg误删除数据恢复（PostgreSQL delete数据恢复）</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/10/grubx64-efi-not-found.html" rel="bookmark" class="crp_title">Failed to open \EFI\redhat\grubx64.efi &#8211; Not Found 故障处理</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/01/ar8mswin1256.html" rel="bookmark" class="crp_title">中文环境显示AR8MSWIN1256（阿拉伯语字符集）</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/11/prvg-11975.html" rel="bookmark" class="crp_title">PRVG-11975 : The I/O scheduler parameter of device &#8220;/dev/sdm&#8221; did not match the expected value on nodes</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/09/delete-df-some-overwrit-recovery.html" rel="bookmark" class="crp_title">删除数据库文件并部分覆盖情况下Oracle恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/01/fio-disk-destruction-recovery.html" rel="bookmark" class="crp_title">fio测试io,导致磁盘文件系统损坏故障恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/12/ufs-recovery-lvm.html" rel="bookmark" class="crp_title">linux异常磁盘lvm恢复操作演示</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/04/sql-tempdb-error.html" rel="bookmark" class="crp_title">可能是 tempdb 空间用尽或某个系统表不一致故障处理</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/03/navicat-postgresql-datlastsysoid.html" rel="bookmark" class="crp_title">Navicat连接postgresql时出现column &#8220;datlastsysoid&#8221; does not exist错误解决</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/01/first-oracle-21c-recovery-ask.html" rel="bookmark" class="crp_title">第一例Oracle 21c恢复咨询</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>https://www.xifenfei.com/2025/07/no-space-left-on-device-postgresql.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>pdu完美支持金仓数据库恢复(KingbaseES)</title>
		<link>https://www.xifenfei.com/2025/04/pdu-support-kingbasees-recovery.html</link>
		<comments>https://www.xifenfei.com/2025/04/pdu-support-kingbasees-recovery.html#comments</comments>
		<pubDate>Tue, 08 Apr 2025 11:41:53 +0000</pubDate>
		<dc:creator><![CDATA[惜分飞]]></dc:creator>
				<category><![CDATA[pdu工具]]></category>
		<category><![CDATA[KingbaseES删除数据恢复]]></category>
		<category><![CDATA[KingbaseES恢复]]></category>
		<category><![CDATA[KingbaseES无法启动恢复]]></category>
		<category><![CDATA[pdu支持KingbaseES]]></category>
		<category><![CDATA[金仓删除数据恢复]]></category>
		<category><![CDATA[金仓数据库恢复]]></category>
		<category><![CDATA[金仓无法启动恢复]]></category>

		<guid isPermaLink="false">https://www.xifenfei.com/?p=11408</guid>
		<description><![CDATA[联系：手机/微信(+86 17813235971) QQ(107644445)  &#8230; <a href="https://www.xifenfei.com/2025/04/pdu-support-kingbasees-recovery.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/04/pdu-support-kingbasees-recovery.html" target="_blank">pdu完美支持金仓数据库恢复(KingbaseES)</a></p>
<p>作者：<a href="https://www.xifenfei.com" target="_blank">惜分飞</a>©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]</p>
</div>
<p>最近朋友对pdu进行了一些完善,让其可以比较好的支持电科金仓数据库（KingbaseES）的v8/v9版本<br />
<strong>使用pdu直接unload数据</strong></p>
<pre class="brush: sql; title: ; notranslate">
[kingbase@xifenfei ~]$ isql -Usystem test
Password for user system: 
isql (V9.0)
Licesen Type: SALES-企业版.
Type &quot;help&quot; for help.

test=# select version();
         version         
-------------------------
 KingbaseES V009R002C010
(1 row)

test=# \dt
        List of relations
 Schema | Name  | Type  | Owner  
--------+-------+-------+--------
 public | t_xff | table | system
(1 row)

test=# drop table walminer_contents;
DROP TABLE
test=# select * from t_xff;
 id |       name       
----+------------------
  1 | 汉字
  2 | xff测试
  3 | 惜分飞测试
  4 | www.xifenfei.com
(4 rows)

test=# insert into t_xff values(5,'www.xifenfie.com
test'# www.orasos.com');
INSERT 0 1
test=# select * from t_xff;
 id |       name       
----+------------------
  1 | 汉字
  2 | xff测试
  3 | 惜分飞测试
  4 | www.xifenfei.com
  5 | www.xifenfie.com+
    | www.orasos.com
(5 rows)

test=# checkpoint;
CHECKPOINT
</pre>
<p>pdu直接unload恢复</p>
<pre class="brush: bash; title: ; notranslate">
test.public=# b; 
开始初始化...
 -pg_database:&lt;/data/kingbase/v9/data/global/1262&gt;

数据库:test 
      -pg_schema:&lt;/data/kingbase/v9/data/base/13856/2615&gt;
      -pg_class:&lt;/data/kingbase/v9/data/base/13856/1259&gt; 共132行
      -pg_attribute:&lt;/data/kingbase/v9/data/base/13856/1249&gt; 共8863行
      模式:
        --&gt;public 1张表

数据库:kingbase 
      -pg_schema:&lt;/data/kingbase/v9/data/base/13857/2615&gt;
      -pg_class:&lt;/data/kingbase/v9/data/base/13857/1259&gt; 共131行
      -pg_attribute:&lt;/data/kingbase/v9/data/base/13857/1249&gt; 共8855行
      模式:
        --&gt;public 0张表
PDU.public=# use test;    
|----------------------------------------|
|          模式             |  表数量    |
|----------------------------------------|
|    public                 |  1         |
|----------------------------------------|
test.public=# set public;
|--------------------------------------------------|
|               表名                  |  表大小    |
|--------------------------------------------------|
|    t_xff                            |  8.00 KB   |
|--------------------------------------------------|

        仅显示表大小排名前 1 的表名
test.public=# param exmode sql;
-------------------------------------------------------------------
|              参数                |             当前值           |
-------------------------------------------------------------------
|    startwal                      |                              |
|    endwal                        |                              |
|    starttime                     |                              |
|    endtime                       |                              |
|    resmode(Data Restore Mode)    |              TX              |
|    exmode(Data Export Mode)      |              SQL             |
------------------------------------------------------------------
test.public=# unload tab t_xff;
正在解析表 &lt;t_xff&gt;. 已解析数据页: 1, 已解析数据: 5 条
表名&lt;t_xff&gt;-&lt;/data/kingbase/v9/data/base/13856/16384&gt; 解析完成, 1 个数据页 ,共计 5 条数据. 成功 5 条; 失败 0 条 
COPY文件路径为:&lt;test/public/t_xff.sql&gt;

test.public=# unload ddl;

DDL导出完成. 文件路径: test/DDL/public_ddl.sql, 共计 1 张表
</pre>
<p>查看恢复结果,证明可以完美恢复金仓中表的数据</p>
<pre class="brush: bash; title: ; notranslate">
[root@xifenfei pdu]# cat test/public/t_xff.sql
INSERT INTO t_xff VALUES(1,'汉字');
INSERT INTO t_xff VALUES(2,'xff测试');
INSERT INTO t_xff VALUES(3,'惜分飞测试');
INSERT INTO t_xff VALUES(4,'www.xifenfei.com');
INSERT INTO t_xff VALUES(5,'www.xifenfie.com
www.orasos.com');
[root@xifenfei pdu]# cat test/DDL/public_ddl.sql
CREATE SCHEMA public;
set search_path to public;
CREATE TABLE t_xff(
        id int,
        name varchar
);
</pre>
<p><strong>pdu恢复金仓数据库delete数据</strong><br />
删除数据尝试恢复</p>
<pre class="brush: sql; title: ; notranslate">
test=# delete from t_xff where id in(4,2);
DELETE 2
test=# checkpoint;
CHECKPOINT
test=# select * from t_xff;
 id |       name       
----+------------------
  1 | 汉字
  3 | 惜分飞测试
  5 | www.xifenfie.com+
    | www.orasos.com
(3 rows)
</pre>
<p>使用pdu恢复被删除数据</p>
<pre class="brush: bash; title: ; notranslate">
PDU.public=# use test;
|----------------------------------------|
|          模式             |  表数量    |
|----------------------------------------|
|    public                 |  1         |
|----------------------------------------|
test.public=# set public;
|--------------------------------------------------|
|               表名                  |  表大小    |
|--------------------------------------------------|
|    t_xff                            |  8.00 KB   |
|--------------------------------------------------|

        仅显示表大小排名前 1 的表名
test.public=# scan t_xff;

正在扫描表&lt;t_xff&gt;的删除记录...

开始扫描归档目录
|-起始文件&lt;000000010000000000000005&gt;
|-终点文件&lt;000000010000000000000009&gt;

正在扫描中

-------------------------------------------------------------------
当前为 事务号恢复 模式,扫描结果将以 事务号 为单位进行输出
---------------------------------------------------------------------

读取到最后的日志段： 0/504EC68: 


扫描结束,当前扫描的时间段为
|-开始时间：2025-04-06 19:13:15.280234 CST
|-结束时间：2025-04-08 01:45:59.493354 CST

---------------------------------------------------------------------------------------------------------
 时间戳：2025-04-08 01:45:59.493354 CST | 事务号：1120 | 数据文件oid：16384 | toast文件oid：0 |待恢复条数：2 
---------------------------------------------------------------------------------------------------------
test.public=# restore del 1120;
开始扫描归档目录
|-起始文件&lt;000000010000000000000005&gt;
|-终点文件&lt;000000010000000000000009&gt;

正在扫描中
读取到最后的日志段： 0/504EC68: 
|-已解析出2条数据读取到最后的日志段： 0/504EC68: 


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
解析结果：成功 2, 失败 0 (即对应FPW未找到), 共计2条数据
恢复出的csv文件路径为&lt;restore/public/t_xff_1120.csv&gt;
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

扫描结束,当前扫描的时间段为
|-开始时间：2025-04-06 19:13:15.280234 CST
|-结束时间：2025-04-08 01:45:59.493354 CST

restore完成
test.public=# exit;
[root@xifenfei pdu]# cat restore/public/t_xff_1120.csv
2       xff测试
4       www.xifenfei.com
</pre>
<p>通过上述测试,证明pdu工具可以完美的恢复金仓中刚刚被删除的delete数据.</p>
<div id="crp_related"><ul><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/03/pdu-single-oid-recovery.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/09/pg-truncate-recovery.html" rel="bookmark" class="crp_title">Postgres数据库truncate表无有效备份恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/12/%e5%88%a0%e9%99%a4oracle%e6%95%b0%e6%8d%ae%e6%96%87%e4%bb%b6%e4%b8%b4%e6%97%b6%e6%96%87%e4%bb%b6.html" rel="bookmark" class="crp_title">删除Oracle数据文件/临时文件</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/03/%e9%80%9a%e8%bf%87%e4%bf%ae%e6%94%b9%e5%9f%ba%e8%a1%a8link%e8%ae%a9%e9%9d%9epublic-dblink%e5%8f%98%e4%b8%bapublic.html" rel="bookmark" class="crp_title">通过修改基表(link$)让非public dblink变为public</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/02/pdu-threshold.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/2011/07/ora-04091.html" rel="bookmark" class="crp_title">触发器引起ORA-04091</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2024/04/postgresql-walminer.html" rel="bookmark" class="crp_title">PostgreSQL解析wal日志之&#8212;walminer</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/07/mysqldumpmysqlbinlog%e6%81%a2%e5%a4%8d%e6%b5%8b%e8%af%95.html" rel="bookmark" class="crp_title">mysqldump+mysqlbinlog恢复测试</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2010/08/mysql-%e4%bd%bf%e7%94%a8%e4%ba%8c%e8%bf%9b%e5%88%b6%e6%97%a5%e5%bf%97%e6%96%87%e4%bb%b6%e6%81%a2%e5%a4%8d%e6%95%b0%e6%8d%ae%e5%ba%93.html" rel="bookmark" class="crp_title">mysql 使用二进制日志文件恢复数据库</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/03/%e9%80%9a%e8%bf%87%e4%bf%ae%e6%94%b9col-col%e6%94%b9%e5%8f%98%e5%88%97%e5%b1%95%e7%a4%ba%e9%a1%ba%e5%ba%8f.html" rel="bookmark" class="crp_title">通过修改col$.col#改变列展示顺序</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/03/grant-dml-to-public-authorization-expires.html" rel="bookmark" class="crp_title">表dml操作权限授权给public,导致只读用户失效</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>https://www.xifenfei.com/2025/04/pdu-support-kingbasees-recovery.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>pg创建gbk字符集库</title>
		<link>https://www.xifenfei.com/2025/04/pg-createdb-gbk.html</link>
		<comments>https://www.xifenfei.com/2025/04/pg-createdb-gbk.html#comments</comments>
		<pubDate>Fri, 04 Apr 2025 15:04:47 +0000</pubDate>
		<dc:creator><![CDATA[惜分飞]]></dc:creator>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[pg创建gbk字符集库]]></category>

		<guid isPermaLink="false">https://www.xifenfei.com/?p=11401</guid>
		<description><![CDATA[联系：手机/微信(+86 17813235971) QQ(107644445)  &#8230; <a href="https://www.xifenfei.com/2025/04/pg-createdb-gbk.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/04/pg-createdb-gbk.html" target="_blank">pg创建gbk字符集库</a></p>
<p>作者：<a href="https://www.xifenfei.com" target="_blank">惜分飞</a>©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]</p>
</div>
<p>记录下，Postgres库创建中文字符集</p>
<pre class="brush: sql; title: ; notranslate">
postgres=# CREATE DATABASE mydb_gbk
postgres-#     ENCODING 'EUC_CN'
postgres-#     LC_COLLATE 'zh_CN' 
postgres-#     LC_CTYPE 'zh_CN'
postgres-#     TEMPLATE template0;
CREATE DATABASE
postgres=# \l
                                                 List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    | ICU Locale | Locale Provider |   Access privileges   
-----------+----------+----------+-------------+-------------+------------+-----------------+-----------------------
 mydb_gbk  | postgres | EUC_CN   | zh_CN       | zh_CN       |            | libc            | 
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            | 
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            | =c/postgres          +
           |          |          |             |             |            |                 | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            | =c/postgres          +
           |          |          |             |             |            |                 | postgres=CTc/postgres
(4 rows)
</pre>
<p>前提系统必须支持zh_CN语言包,检查命令为:</p>
<pre class="brush: bash; title: ; notranslate">
[root@xifenfei yum.repos.d]# locale -a |grep zh_CN
zh_CN
zh_CN.gb18030
zh_CN.gbk
zh_CN.utf8
</pre>
<p>如果没有使用yum以下命令安装</p>
<pre class="brush: bash; title: ; notranslate">
yum groupinstall &quot;fonts&quot;
yum install glibc-langpack-zh.x86_64
</pre>
<div id="crp_related"><ul><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2026/01/pg-readme_to_recover.html" rel="bookmark" class="crp_title">注意:PostgreSQL库出现readme_to_recover勒索</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/2024/04/pg_filedump_batch.html" rel="bookmark" class="crp_title">PostgreSQL恢复系列:pg_filedump批量处理</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2018/08/pg-tablespace-database-schema.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/09/pg-truncate-recovery.html" rel="bookmark" class="crp_title">Postgres数据库truncate表无有效备份恢复</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/2015/06/%e5%9c%a8linux%e4%b8%8a%e5%ae%89%e8%a3%85postgresql-9-4%e5%b9%b6%e5%90%af%e5%8a%a8%e5%92%8c%e5%85%b3%e9%97%ad%e6%95%b0%e6%8d%ae%e5%ba%93.html" rel="bookmark" class="crp_title">在linux上安装PostgreSQL 9.4并启动和关闭数据库</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/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/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/invalid-checkpoint-record.html" rel="bookmark" class="crp_title">pg启动报invalid checkpoint record处理</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2024/04/postgresql-walminer.html" rel="bookmark" class="crp_title">PostgreSQL解析wal日志之&#8212;walminer</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>https://www.xifenfei.com/2025/04/pg-createdb-gbk.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PostgreSQL运行日志管理</title>
		<link>https://www.xifenfei.com/2025/04/postgresql-pg_log.html</link>
		<comments>https://www.xifenfei.com/2025/04/postgresql-pg_log.html#comments</comments>
		<pubDate>Thu, 03 Apr 2025 14:40:58 +0000</pubDate>
		<dc:creator><![CDATA[惜分飞]]></dc:creator>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[pg日志]]></category>
		<category><![CDATA[pg日志管理]]></category>

		<guid isPermaLink="false">https://www.xifenfei.com/?p=11398</guid>
		<description><![CDATA[联系：手机/微信(+86 17813235971) QQ(107644445)  &#8230; <a href="https://www.xifenfei.com/2025/04/postgresql-pg_log.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/04/postgresql-pg_log.html" target="_blank">PostgreSQL运行日志管理</a></p>
<p>作者：<a href="https://www.xifenfei.com" target="_blank">惜分飞</a>©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]</p>
</div>
<p>PostgreSQL目前配置中,不直接记录日志文件,这样的情况给数据库后期出现问题(特别是无法正常启动的情况)分析带来很大麻烦,不知道具体问题所在,建议在PG安装完成之后,启用日志功能,便于数据库运行状态检查和错误跟踪,主要日志参数涉及以下配置</p>
<pre class="brush: bash; title: ; notranslate">
log_destination = 'stderr'              # Valid values are combinations of
                                        # stderr, csvlog, jsonlog, syslog, and
                                        # eventlog, depending on platform.
                                        # csvlog and jsonlog require
                                        # logging_collector to be on.

# This is used when logging to stderr:
logging_collector = on          # Enable capturing of stderr, jsonlog,
                                        # and csvlog into log files. Required
                                        # to be on for csvlogs and jsonlogs.
                                        # (change requires restart)
//是否将日志重定向至文件中，默认是off。

# These are only used if logging_collector is on:
log_directory = 'pg_log'                   # directory where log files are written,
                                        # can be absolute or relative to PGDATA
//日志文件目录，默认是PGDATA的相对路径，即PGDATA的相对路径，即{PGDATA}/pg_log，也可以改为绝对路径。
//日志文件可能会非常多，建议将日志重定向到其他目录或分区。
//将此配置修改其他目录时，必须先创建此目录，并修改权限，使得postgres用户对该目录有写权限。

log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern,
                                        # can include strftime() escapes
log_file_mode = 0600                    # creation mode for log files,
                                        # begin with 0 to use octal notation
log_rotation_age = 1d                   # Automatic rotation of logfiles will
                                        # happen after that time.  0 disables.
log_rotation_size = 10MB                # Automatic rotation of logfiles will
                                        # happen after that much log output.
                                        # 0 disables.
#log_truncate_on_rotation = off         # If on, an existing log file with the
                                        # same name as the new log file will be
                                        # truncated rather than appended to.
                                        # But such truncation only occurs on
                                        # time-driven rotation, not on restarts
                                        # or size-driven rotation.  Default is
                                        # off, meaning append to existing files
                                        # in all cases.
//当日志文件已存在时，该配置如果为off，新生成的日志将在文件尾部追加，如果为on，则会覆盖原来的日志。
</pre>
<p>上述配置得到的结果如下</p>
<pre class="brush: bash; title: ; notranslate">
[postgres@xifenfei pg_log]$ pwd
/data/pg/15/data/pg_log
[postgres@xifenfei pg_log]$ ls -l
total 4
-rw------- 1 postgres postgres 1263 Apr  3 22:37 postgresql-2025-04-03_223117.log
</pre>
<p><a href="https://www.xifenfei.com/wp-content/uploads/2025/04/pglog.png"><img src="https://www.xifenfei.com/wp-content/uploads/2025/04/pglog.png" alt="pglog" width="2169" height="324" class="alignleft size-full wp-image-11399" /></a><br />
<hr />
<div id="crp_related"><ul><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/2025/03/invalid-checkpoint-record.html" rel="bookmark" class="crp_title">pg启动报invalid checkpoint record处理</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/2025/03/pg-delete-recovery.html" rel="bookmark" class="crp_title">pg误删除数据恢复（PostgreSQL delete数据恢复）</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2018/08/pg-tablespace-database-schema.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/12/sql-bak-0-lost-data.html" rel="bookmark" class="crp_title">模拟sql server故障备份完成恢复实现数据0丢失</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/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/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/2021/03/makop-db-recovery.html" rel="bookmark" class="crp_title">.makop病毒加密数据库恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/10/linux7-8-single-user.html" rel="bookmark" class="crp_title">redhat系列7/8进入单用户模式</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2015/06/%e5%9c%a8linux%e4%b8%8a%e5%ae%89%e8%a3%85postgresql-9-4%e5%b9%b6%e5%90%af%e5%8a%a8%e5%92%8c%e5%85%b3%e9%97%ad%e6%95%b0%e6%8d%ae%e5%ba%93.html" rel="bookmark" class="crp_title">在linux上安装PostgreSQL 9.4并启动和关闭数据库</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>https://www.xifenfei.com/2025/04/postgresql-pg_log.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
