---
title: "收集恢复问题信息 - 敏捷诊断工具 V4.3.0 | OceanBase 文档中心"
description: "收集恢复问题信息 本文适用于独立部署 obdiag 的场景，可以一键执行将恢复问题排查所需要的排查信息统一捞回，解决分布式节点信息捞取难的痛点。 使用说明 obdiag gather scene run --scene=observer.recovery [options] 选项说明如下： 选项名 是否必选 数据类型…"
---
切换语言

- 中文站 - 简体中文
- International - English
- 日本站 - 日本語

文档反馈![](https://mdn.alipayobjects.com/huamei_22khvb/afts/img/A*5ZXST55u540AAAAAAAAAAAAADiGDAQ/original) 敏捷诊断工具V 4.3.0

# 收集恢复问题信息

更新时间：2026-04-15 16:08:11

[编辑](https://github.com/oceanbase/odt-doc/edit/V4.3.0/zh-CN/400.gather/200.scenes/224.observer_recovery.md)  

本文适用于独立部署 obdiag 的场景，可以一键执行将恢复问题排查所需要的排查信息统一捞回，解决分布式节点信息捞取难的痛点。

## 使用说明

```shell
obdiag gather scene run --scene=observer.recovery [options]

```

选项说明如下：

| 选项名 | 是否必选 | 数据类型 | 默认值 | 说明 |
| --- | --- | --- | --- | --- |
| --scene | 是 | string | 默认为空 | 场景名，可以通过obdiag gather scene list 查看当前版本支持哪些场景 |
| --from | 否 | string | 默认为空 | 日志收集的开始时间，格式为: `yyyy-mm-dd hh:mm:ss`。   #### 说明    若使用的 obdiag 为 V2.0.0 之前版本，配置该选项时无需加引号，否则会报错。V2.0.0 及之后版本不再限制配置该选项时是否加引号。 |
| --to | 否 | string | 默认为空 | 日志收集的结束时间，格式为: `yyyy-mm-dd hh:mm:ss`。   #### 说明    若使用的 obdiag 为 V2.0.0 之前版本，配置该选项时无需加引号，否则会报错。V2.0.0 及之后版本不再限制配置该选项时是否加引号。 |
| --since | 否 | string | 默认为空 | 日志收集最近的某段时间，格式为: `<n> <m\|h\|d>`，其中，n 表示待输入的时间数字，m 表示分钟，h 表示小时，d 表示天，例如 `30m` 表示收集最近 30 分钟的日志。 |
| --store_dir | 否 | string | 默认为命令执行的当前路径 | 存储结果的本地路径。 |
| -c | 否 | string | `~/.obdiag/config.yml` | 配置文件路径。 |
| --temp_dir | 否 | string | `/tmp` | 远端节点在日志收集过程中产生的临时文件存储目录。 |
| --redact | 否 | string | 默认为空 | 选择 observer 日志脱敏规则，例如可配置为 `all_sql`，使用多个规则时使用英文逗号（`,`）分隔，编写规则参考本文 [脱敏规则编写](https://www.oceanbase.com/docs/common-obdiag-cn-1000000005726950) 介绍。 |
| --inner_config | 否 | string | 默认为空 | obdiag 自用的配置。 |
| --config | 否 | string | 默认为空 | 需被 obdiag 诊断的集群的配置，固定样式：--config key1=value1 --config key2=value2。   #### 说明    支持通过该选项配置的参数可参见 [obdiag 配置](https://www.oceanbase.com/docs/common-obdiag-cn-1000000005726796)。 |
| --config_password | 否 | string | 默认为空 | obdiag 使用加密的配置文件时，需通过该选项传入对应的密码。   #### 说明    详情可参见 [配置文件加密](https://www.oceanbase.com/docs/common-obdiag-cn-1000000005726841)。 |

## 使用示例

### 方式一：无配置文件使用（开箱即用）

```shell
# 恢复问题信息收集，默认不需要添加任何参数的话收集最近30分钟的信息
obdiag gather scene run --scene=observer.recovery \
    --config db_host=xx.xx.xx.xx \
    --config db_port=xxxx \
    --config tenant_sys.user=root@sys \
    --config tenant_sys.password=*** \
    --config obcluster.servers.global.ssh_username=test \
    --config obcluster.servers.global.ssh_password=****** \
    --config obcluster.servers.global.home_path=/home/admin/oceanbase

# 通过 --sicne 参数指定恢复问题所需要采集的信息时间范围
obdiag gather scene run --scene=observer.recovery --since 30m \
    --config db_host=xx.xx.xx.xx \
    --config db_port=xxxx \
    --config tenant_sys.user=root@sys \
    --config tenant_sys.password=*** \
    --config obcluster.servers.global.ssh_username=test \
    --config obcluster.servers.global.ssh_password=****** \
    --config obcluster.servers.global.home_path=/home/admin/oceanbase

# 通过 --from/--to 参数指定恢复问题所在的时间区间
obdiag gather scene run --scene=observer.recovery --from "2022-06-30 16:25:00" --to "2022-06-30 18:30:00" \
    --config db_host=xx.xx.xx.xx \
    --config db_port=xxxx \
    --config tenant_sys.user=root@sys \
    --config tenant_sys.password=*** \
    --config obcluster.servers.global.ssh_username=test \
    --config obcluster.servers.global.ssh_password=****** \
    --config obcluster.servers.global.home_path=/home/admin/oceanbase

```

### 方式二：有配置文件使用

需要确保已经在 obdiag 配置文件 `config.yml` 中配置好需要收集节点的登录信息。相关的详细配置介绍，参见 [obdiag 配置](https://www.oceanbase.com/docs/common-obdiag-cn-1000000005726796)。

```shell
# 恢复问题信息收集，默认不需要添加任何参数的话收集最近30分钟的信息
obdiag gather scene run --scene=observer.recovery

# 通过 --sicne 参数指定恢复问题所需要采集的信息时间范围
obdiag gather scene run --scene=observer.recovery --since 30m

# 通过 --from/--to 参数指定恢复问题所在的时间区间
obdiag gather scene run --scene=observer.recovery --from "2022-06-30 16:25:00" --to "2022-06-30 18:30:00"

```

## 结果解读

命令执行后在指定目录下会生成一个文件夹，文件夹形如: obdiag_gather_pack_20240808105846

```shell
#tree
.
├── ob_log_remote_xx.xx.xx.xx_20240808201458_20240808204558.zip # 节点日志
├── result_summary.txt
├── sql_result.txt # 恢复问题排查的时候所需 SQL 信息
└── sysstat_xx.xx.xx.xx_20240808204521.zip # 恢复问题排查的时候经常得看主机的信息，所以这里将主机信息也拿回来了

```

## 实践案例

案例：用户发生恢复问题，需要排查，直接执行如下命令将诊断所需的信息打包好，发给社区论坛或者前线支持人员

```shell
obdiag gather scene run --scene=observer.recovery \
    --config db_host=xx.xx.xx.xx \
    --config db_port=xxxx \
    --config tenant_sys.user=root@sys \
    --config tenant_sys.password=*** \
    --config obcluster.servers.global.ssh_username=test \
    --config obcluster.servers.global.ssh_password=****** \
    --config obcluster.servers.global.home_path=/home/admin/oceanbase

```

 上一篇 下一篇 ![有帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*y6ocSqN8cqsAAAAAAAAAAAAAARQnAQ)![无帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*BG9IQJyLHF8AAAAAAAAAAAAAARQnAQ)![反馈](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*eTWdQKCRKHwAAAAAAAAAAAAAARQnAQ)[AI](https://www.oceanbase.com/obi) 咨询热线
