<?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; MongoDB恢复</title>
	<atom:link href="https://www.xifenfei.com/category/mongodb/mongodb%e6%81%a2%e5%a4%8d/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, 06 Dec 2026 04:31:12 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>MongoDB 离线提取工具&#8212;mongoext</title>
		<link>https://www.xifenfei.com/2026/10/mongoext.html</link>
		<comments>https://www.xifenfei.com/2026/10/mongoext.html#comments</comments>
		<pubDate>Sun, 11 Oct 2026 13:58:58 +0000</pubDate>
		<dc:creator><![CDATA[惜分飞]]></dc:creator>
				<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[MongoDB恢复]]></category>
		<category><![CDATA[mongodb无法启动恢复]]></category>
		<category><![CDATA[mongodb离线提取数据]]></category>
		<category><![CDATA[mongoext]]></category>
		<category><![CDATA[monogdb恢复]]></category>

		<guid isPermaLink="false">https://www.xifenfei.com/?p=12372</guid>
		<description><![CDATA[联系：手机/微信(+86 17813235971) QQ(107644445)  &#8230; <a href="https://www.xifenfei.com/2026/10/mongoext.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/10/mongoext.html" target="_blank">MongoDB 离线提取工具&#8212;mongoext</a></p>
<p>作者：<a href="https://www.xifenfei.com" target="_blank">惜分飞</a>©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]</p>
</div>
<p>在某些情况下,由于断电、硬件故障、软件bug等导致mongodb数据库无法正常启动,甚至使用repair依然无法启动,对于这样的情况.我专门开发了mongodb离线提取工具mongoext,在离线情况下直接提取mongodb的数据<br />
<strong>整体命令支持</strong></p>
<pre class="brush: bash; title: ; notranslate">
G:\mongodb\mongoext&gt;mongoext.exe -h
usage: mongoext [-h] {scan,recover,info} ...

脱机 MongoDB 数据文件提取工具

positional arguments:
  {scan,recover,info}
    scan               扫描 dbPath 并导出
    recover            恢复孤立的单个 collection 文件（无 catalog）
    info               打印 dbPath 元信息

options:
  -h, --help           show this help message and exit
</pre>
<p>scan 是基于mongodb字典直接提取数据<br />
recover是直接恢复单个集合文件中数据<br />
info是获取字典信息以及集合对应关系<br />
<br />
<strong>mongoext scan 命令介绍</strong></p>
<pre class="brush: bash; title: ; notranslate">
G:\mongodb\mongoext&gt;mongoext.exe scan -h
usage: mongoext scan [-h] [--db DB] [--collection COLLECTION] [--include-system] [--out OUT]
                     [--format {jsonl,sql,bson,mongo}] [--uri URI] [--batch BATCH] [--no-indexes] [--ttl-indexes]
                     [--keep-existing] [--sql-dialect {postgres,mysql}] [--dedup] [--no-progress] [--dry-run]
                     [--allocation-size ALLOCATION_SIZE]
                     dbpath

positional arguments:
  dbpath                dbPath 路径

options:
  -h, --help            show this help message and exit
  --db DB               只导出指定数据库
  --collection COLLECTION
                        只导出指定集合
  --include-system      连 admin/config/local 也一起导入（默认跳过，会污染目标实例）
  --out OUT             输出目录（--format mongo 时不需要）
  --format {jsonl,sql,bson,mongo}
                        输出格式；mongo = 直接写入运行中的 mongod（BSON 类型保真）
  --uri URI             --format mongo 的目标连接串
  --batch BATCH         --format mongo 每批 insert_many 的条数
  --no-indexes          --format mongo 导入后不重建索引
  --ttl-indexes         --format mongo 连 TTL 索引也重建（默认不建：建了会立刻按过期时间删数据）
  --keep-existing       --format mongo 不 drop 目标集合，追加写入
  --sql-dialect {postgres,mysql}
                        SQL 方言
  --dedup               按 _id 去重（多版本 leaf page 残留时开启）
  --no-progress         关闭 tqdm 进度条
  --dry-run             只统计不写盘，用于核对提取完整性与文档计数
  --allocation-size ALLOCATION_SIZE
                        手工指定块对齐粒度（默认从 turtle / 元数据读，读不到才穷举探测）
</pre>
<p><a href="https://www.xifenfei.com/wp-content/uploads/2026/10/mongoext-scan.png"><img src="https://www.xifenfei.com/wp-content/uploads/2026/10/mongoext-scan.png" alt="mongoext-scan" width="1540" height="631" class="alignnone size-full wp-image-12373" /></a></p>
<hr />
<strong>mongoext recover命令介绍</strong></p>
<pre class="brush: bash; title: ; notranslate">
G:\mongodb\mongoext&gt;mongoext.exe recover -h
usage: mongoext recover [-h] [--orphans DBPATH] [--db DB] [--collection COLLECTION] [--meta-dir META_DIR] [--out OUT]
                        [--format {jsonl,sql,bson,mongo}] [--uri URI] [--batch BATCH] [--no-indexes] [--ttl-indexes]
                        [--keep-existing] [--sql-dialect {postgres,mysql}] [--dedup] [--no-progress] [--dry-run]
                        [--allocation-size ALLOCATION_SIZE]
                        [wt_file]

positional arguments:
  wt_file               孤立的 collection-*.wt 文件

options:
  -h, --help            show this help message and exit
  --orphans DBPATH      批量恢复该 dbPath 里 catalog 未记录的 collection 文件
  --db DB               手工指定库名（与 --collection 一起用）
  --collection COLLECTION
                        手工指定集合名（与 --db 一起用）
  --meta-dir META_DIR   伴生文件（turtle / _mdb_catalog.wt / WiredTiger.wt）所在目录，用来反查 namespace；
                        文件已拷走但原 dbPath 还在时指过去即可
  --out OUT             输出目录（--format mongo 时不需要）
  --format {jsonl,sql,bson,mongo}
                        输出格式；mongo = 直接写入运行中的 mongod（BSON 类型保真）
  --uri URI             --format mongo 的目标连接串
  --batch BATCH         --format mongo 每批 insert_many 的条数
  --no-indexes          --format mongo 导入后不重建索引
  --ttl-indexes         --format mongo 连 TTL 索引也重建（默认不建：建了会立刻按过期时间删数据）
  --keep-existing       --format mongo 不 drop 目标集合，追加写入
  --sql-dialect {postgres,mysql}
                        SQL 方言
  --dedup               按 _id 去重（多版本 leaf page 残留时开启）
  --no-progress         关闭 tqdm 进度条
  --dry-run             只统计不写盘，用于核对提取完整性与文档计数
  --allocation-size ALLOCATION_SIZE
                        手工指定块对齐粒度（默认从 turtle / 元数据读，读不到才穷举探测）
</pre>
<p><a href="https://www.xifenfei.com/wp-content/uploads/2026/10/mongoext-recover.png"><img src="https://www.xifenfei.com/wp-content/uploads/2026/10/mongoext-recover.png" alt="mongoext-recover" width="1496" height="204" class="alignnone size-full wp-image-12374" /></a><br />
<hr />
<strong>常使用命令说明</strong></p>
<pre class="brush: bash; title: ; notranslate">
# 看库结构
mongoext.exe info DBPATH

# 只统计不写盘
mongoext.exe scan DBPATH --out ./out --dry-run --dedup

# 全库导 JSON Lines（人看 / 给别的程序吃）
mongoext.exe scan DBPATH --out ./out --format jsonl --dedup

# 全库导 BSON（给 mongorestore 用）
mongoext.exe scan DBPATH --out ./out --format bson --dedup

# 全库导 SQL
mongoext.exe scan DBPATH --out ./out --format sql --sql-dialect mysql --dedup

# 保真导入运行中的 MongoDB（推荐路径）
mongoext.exe scan DBPATH --format mongo --dedup

# 只导一个集合
mongoext.exe scan DBPATH --format mongo --db mydb --collection users --dedup

# 导到远程实例
mongoext.exe scan DBPATH --format mongo \
    --uri &quot;mongodb://user:pass@host:27017/?authSource=admin&quot; --dedup

# 恢复孤立的单个 collection 文件（无 dbPath / 无 catalog）
mongoext.exe recover FILE.wt --dry-run --dedup          # 先看探测结论
mongoext.exe recover FILE.wt --db mydb --collection users --format mongo --dedup
mongoext.exe recover FILE.wt --meta-dir /原/dbPath --format mongo --dedup

# 批量恢复一个 dbPath 里的孤儿文件
mongoext.exe recover --orphans DBPATH --out ./out --dedup
</pre>
<div id="crp_related"><ul><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2014/08/%e5%9c%a8chrome%e9%ab%98%e7%89%88%e6%9c%ac%e4%b8%ad%e9%85%8d%e7%bd%ae%e9%85%8d%e7%bd%ae%e4%bd%bf%e7%94%a8awr-format-for-chrome%e6%8f%92%e4%bb%b6.html" rel="bookmark" class="crp_title">在Chrome高版本中配置使用AWR-Format for Chrome插件</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2026/10/firebirdext_firebird-recovery-tool.html" rel="bookmark" class="crp_title">Firebird 损坏数据库数据抢救工具&#8212;firebirdext</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2010/08/oracle-%e4%b9%8brman%e5%a4%87%e4%bb%bd%e6%95%b0%e6%8d%ae%e5%ba%93.html" rel="bookmark" class="crp_title">oracle 之rman备份数据库</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2019/12/dbca-delete-and-rm-database-recovery.html" rel="bookmark" class="crp_title">dbca删除库和rm删库恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2021/04/libclntsh-so-file-format-not-recognized.html" rel="bookmark" class="crp_title">安装19c 数据库 libclntsh.so: file format not recognized</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2023/06/asm-add-vg.html" rel="bookmark" class="crp_title">asm磁盘加入vg恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2010/08/oracle%e4%b9%8brman2.html" rel="bookmark" class="crp_title">oracle之rman(2)</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/09/mysql-recovery-2-case.html" rel="bookmark" class="crp_title">docker回收和mysql备份导入导致数据丢失恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2010/08/oracle%e4%b9%8brman%e5%a2%9e%e9%87%8f%e5%a4%87%e4%bb%bd.html" rel="bookmark" class="crp_title">oracle之rman增量备份</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2018/03/bitcoin-interval-encryption.html" rel="bookmark" class="crp_title">比特币加密勒索间隔加密</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2018/10/restore-mis-operation-recovery.html" rel="bookmark" class="crp_title">restore database误操作恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2018/11/file-system-corruption-oracle-recovery.html" rel="bookmark" class="crp_title">文件系统损坏导致数据文件异常恢复</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>https://www.xifenfei.com/2026/10/mongoext.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
