本文来自YashanDB官网,具体内容可见https://www.yashandb.com/newsinfo/7459464.html?templateId=1718516

问题现象

客户环境有时候会遇到文件损坏的情况,需要dump文件,根据rowid查询数据情况。

问题的风险及影响

熟练掌握崖山数据文件dump操作,并识别rowid,在故障的情况下可以快速确认相应的数据情况,查找需要的数据。

问题影响的版本

YashanDB版本所有版本

问题分析和处理过程

1、在故障情况下,直接查询表数据,会遇到YAS-02147的错误。



2、崖山提供dump命令,可以dump出db数据文件,但不包含数据内容。

详细说明见dump | YashanDB Doc (yasdb.com)





3、确认文件id和blockid

在上述命令中,dump的时候需要文件id和blockid。

文件id对应V$datafile表空间所在的文件id,如下面users表空间文件id是4。

表block对应dba_segments中block起始位置及数量,如下面CUSTOMER从block 131开始,有8个block。



根据上面分析,执行dump命令ALTER SYSTEM DUMP DATAFILE 4 MINBLOCK 131 MAXBLOCK 140,结果如下:

点击查看代码
SQL> ALTER SYSTEM DUMP DATAFILE 4 MINBLOCK 131 MAXBLOCK 140;

Succeed.

SQL> exit

[cod@6c5c2b1ac6f0 trace]$ ls -l

total 8

-rw-rw-r-- 1 cod cod 5541 Jul 30 10:18 yashan_yas_21.trc

[cod@6c5c2b1ac6f0 trace]$ cat yashan_yas_21.trc

*** 2024-07-30 10:17:52.212

Start dump data blocks TS#: 4 FILE#: 4 minblk 132 maxblk 132

Block dump from disk:

warning: disk dump block information is incompleted, file#: 4 blk#: 132 ts#: 4

*** 2024-07-30 10:18:53.922

Start dump data blocks TS#: 4 FILE#: 4 minblk 131 maxblk 140

Block dump from cache:

BUFFER CTRL DUMP

  FILE#: 4 BLK#: 131 TS#: 4

  bucketId: 29579 crNext: 4294967295 hashNext:4294967295

  lruListId: 2 lru: [7546, 7537]

  resStatus: 0 refCount: 1 pcFlag: 0

  scn: 0 ext: 0 node: 0 xsn: 0 ssn: 0

  lastLfn: 0 dtyList: [NULL, NULL]

  truncPoint: [0, 0, 0, 0]

BUFFER CTRL DUMP END

DISK BLOCK DUMP

segment

head: id 0-131, type 33, instance id 0 lsn 5031, checksum: 0, change num 4, isEncrypted 0, isCompressed 0

segType: heap

dataOid: 2486

ssm tree: search entry: 0-129, level: 1

level[0]: ssm block count: 1, current block: 0-128

level[1]: ssm block count: 1, current block: 0-129

level[2]: ssm block count: 1, current block: 0-130

hwm L1: 0-128

hwm L1 node: 7

extents lhwm: block id: 0-136, extent idx: 0, map block: 0-131, offset: 0, blkIdx: 8, used block count: 8. lhwmL1: 0-128

extent ctrl: extent count: 1, block count: 8, map count: 0 , extent map offset: 380

last map block: 63-67108863, offset: 0, extents change number: 0

extents hwm: block id: 0-136, extent idx: 0, offset: 0, unformatted block count: 0, used block count: 8, map block: 63-67108863

extents map: extent count: 1, capacity: 487, next map: 63-67108863, map nodes:

id: 0-128 size: 8

0. L1 block id: 0-128 data block id: 0-132

tail: change num: 4

DISK BLOCK DUMP END

*** 2024-07-30 10:18:53.922

Block dump from disk:

warning: disk dump block information is incompleted, file#: 4 blk#: 132 ts#: 4

*** 2024-07-30 10:18:53.922

Block dump from cache:

BUFFER CTRL DUMP

  FILE#: 4 BLK#: 133 TS#: 4

  bucketId: 29581 crNext: 4294967295 hashNext:4294967295

  lruListId: 2 lru: [7548, 7546]

  resStatus: 0 refCount: 1 pcFlag: 0

  scn: 0 ext: 0 node: 0 xsn: 0 ssn: 0

  lastLfn: 0 dtyList: [NULL, NULL]

  truncPoint: [0, 0, 0, 0]

BUFFER CTRL DUMP END

DISK BLOCK DUMP

heap data

head: id 0-133, type 4, instance id 0 lsn 5029, checksum: 0, change num 1, isEncrypted 0, isCompressed 0

dataOid: 2486, extent change number: 0

block scn: 0, map block: 0-128, slot: 5, freeness: 5

rows: 0, dirs: 0, xslots: 0, si xslots: 0, free size: 8108, free begin: 80, free end: 8188 free dir: 4095

tail: change num: 1

DISK BLOCK DUMP END

*** 2024-07-30 10:18:53.922

Block dump from cache:

BUFFER CTRL DUMP

  FILE#: 4 BLK#: 134 TS#: 4

  bucketId: 29582 crNext: 4294967295 hashNext:4294967295

  lruListId: 2 lru: [4294967295, 7547]

  resStatus: 0 refCount: 1 pcFlag: 0

  scn: 0 ext: 0 node: 0 xsn: 0 ssn: 0

  lastLfn: 0 dtyList: [NULL, NULL]

  truncPoint: [0, 0, 0, 0]

BUFFER CTRL DUMP END

DISK BLOCK DUMP

heap data

head: id 0-134, type 4, instance id 0 lsn 5029, checksum: 0, change num 1, isEncrypted 0, isCompressed 0

dataOid: 2486, extent change number: 0

block scn: 0, map block: 0-128, slot: 6, freeness: 5

rows: 0, dirs: 0, xslots: 0, si xslots: 0, free size: 8108, free begin: 80, free end: 8188 free dir: 4095

tail: change num: 1

DISK BLOCK DUMP END

*** 2024-07-30 10:18:53.922

Block dump from cache:

BUFFER CTRL DUMP

  FILE#: 4 BLK#: 135 TS#: 4

  bucketId: 29583 crNext: 4294967295 hashNext:4294967295

  lruListId: 1 lru: [4294967295, 7543]

  resStatus: 0 refCount: 1 pcFlag: 0

  scn: 0 ext: 0 node: 0 xsn: 0 ssn: 0

  lastLfn: 0 dtyList: [NULL, NULL]

  truncPoint: [0, 0, 0, 0]

BUFFER CTRL DUMP END

DISK BLOCK DUMP

heap data

head: id 0-135, type 4, instance id 0 lsn 5030, checksum: 0, change num 4, isEncrypted 0, isCompressed 0

dataOid: 2486, extent change number: 0

block scn: 581620909456666624, map block: 0-128, slot: 7, freeness: 1

rows: 1, dirs: 1, xslots: 2, si xslots: 0, free size: 2022, free begin: 6116, free end: 8138 free dir: 4095

row[0]: size: 6036 xslot id: 0 columns: 3 format/link/migr/deleted/compact:1/0/0/0/0

xslot[0]: xid: 25-11349-1 active: 0 owscn: 0 fastcommit: 1 ura: block: 0-15758, ver: 0, dir: 1 ssn: 3055202304 fsc: 21794 mfb: 2066 scn: 581620909456666624

xslot[1]: xid: 0-0-0 active: 0 owscn: 0 fastcommit: 0 ura: block: 0-0, ver: 0, dir: 0 ssn: 0 fsc: 0 mfb: 0 scn: 0

tail: change num: 4

DISK BLOCK DUMP END

*** 2024-07-30 10:18:53.922

Block dump from disk:

DISK BLOCK DUMP

unknown

head: id 0-136, type 0, instance id 0 lsn 9, checksum: 999298229, change num 0, isEncrypted 0, isCompressed 0

unknown type 0

tail: change num: 0

DISK BLOCK DUMP END

*** 2024-07-30 10:18:53.922

Block dump from disk:

DISK BLOCK DUMP

unknown

head: id 0-137, type 0, instance id 0 lsn 9, checksum: 3105528825, change num 0, isEncrypted 0, isCompressed 0

unknown type 0

tail: change num: 0

DISK BLOCK DUMP END

*** 2024-07-30 10:18:53.922

Block dump from disk:

DISK BLOCK DUMP

unknown

head: id 0-138, type 0, instance id 0 lsn 9, checksum: 996768988, change num 0, isEncrypted 0, isCompressed 0

unknown type 0

tail: change num: 0

DISK BLOCK DUMP END

*** 2024-07-30 10:18:53.922

Block dump from disk:

DISK BLOCK DUMP

unknown

head: id 0-139, type 0, instance id 0 lsn 9, checksum: 3118723984, change num 0, isEncrypted 0, isCompressed 0

unknown type 0

tail: change num: 0

DISK BLOCK DUMP END

*** 2024-07-30 10:18:53.922

Block dump from disk:

DISK BLOCK DUMP

unknown

head: id 0-140, type 0, instance id 0 lsn 9, checksum: 979551335, change num 0, isEncrypted 0, isCompressed 0

unknown type 0

tail: change num: 0

DISK BLOCK DUMP END

分析数据发现135的块中存在数据:



4、转换ROWID,查询数据内容

查看ROWID说明:ROWID UROWID | YashanDB Doc (yasdb.com)



对应:

dataoid 为2486

spaceid为4

fileid为0(同个表空间可能有多个数据文件)

blockid为135

dir为0

最终拼接的rowid为2486:4:0:135:0,根据rowid查询结果如下:

【YashanDB知识库】如何dump数据文件,转换rowid, 查询对应内容的更多相关文章

  1. DG_数据文件转换参数测试

    本篇博客流程图: 一.测试需求及参数说明 二.测试环境进行相关测试 三.问题总结 一.测试需求及参数说明 1.1测试需求说明 DG切换 切换前,数据库版本12.2.0.1,主库rac两节点,备一rac ...

  2. Spark2 加载保存文件,数据文件转换成数据框dataframe

    hadoop fs -put /home/wangxiao/data/ml/Affairs.csv /datafile/wangxiao/ hadoop fs -ls -R /datafiledrwx ...

  3. RMAN备份与恢复之数据文件

    备份数据文件,模拟磁盘损坏时,还原恢复数据文件. 首先,查询数据文件序号,备份数据文件,可根据数据文件序号指定备份的数据文件. SQL SQL> select file_name,file_id ...

  4. 【基础】Oracle 表空间和数据文件

    多个表空间的优势:1.能够将数据字典与用户数据分离出来,避免由于字典对象和用户对象保存在同一个数据文件中而产生的I/O冲突2.能够将回退数据与用户数据分离出来,避免由于硬盘损坏而导致永久性的数据丢失3 ...

  5. redis通过dump.db文件 进行数据替换 复制

    进行数据替换无非就是三步, 杀掉redis进程 ------------> 复制 dump.db文件 ------------------>启动redis   pkill redis-se ...

  6. 【数据预处理】TIMIT语料库WAV文件转换

    1 问题描述 这两天复现代码.先构造数据集,纯净语音.不同噪声.不同SNR的混合语音.其中纯净语音由两部分组成,IEEE corpus和TIMIT. 一开始我用MATLAB中的audioread读取音 ...

  7. asm和file system之间数据文件的转换

    How to move a datafile from a file system to ASMMoving a datafile from the file system can be achive ...

  8. bbed的使用--查看数据文件信息 & sid信息

    1.得到文件的块大小和数据块个数 在Linux和Unix上,oracle提供了一个小工具dbfsize用于查看文件块大小 (可以参看[ID:360032.1]How to detect and fix ...

  9. [20181031]12c 在线移动数据文件.txt

    [20181031]12c 在线移动数据文件.txt --//12c以前,移动或者改名数据文件是一项比较麻烦的事情,至少要停一下业务.而12c支持在线移动或者改名数据文件,并且有点不可思议--//的是 ...

  10. jstack Dump 日志文件中的线程状态

    [转]jstack Dump 日志文件中的线程状态 dump 文件里,值得关注的线程状态有: 死锁,Deadlock(重点关注)  执行中,Runnable 等待资源,Waiting on condi ...

随机推荐

  1. MiniAuth 一个轻量 ASP.NET Core Identity Web 后台管理中间插件

    MiniAuth 一个轻量 ASP.NET Core Identity Web 后台管理中间插件 「一行代码」为「新.旧项目」 添加 Identity 系统跟用户.权限管理网页后台系统 开箱即用,避免 ...

  2. Java 根据XPATH批量替换XML节点中的值

    根据XPATH批量替换XML节点中的值 by: 授客 QQ:1033553122 测试环境 JDK 1.8.0_25 代码实操 message.xml文件 <Request service=&q ...

  3. Docker PHP容器安装composer

    1.进入php容器docker exec -it cb6c1fe83bff(php容器ID) bash2.安装composerphp -r "copy('https://install.ph ...

  4. 一张图看懂 SQL 的各种 JOIN 用法(含数据集和韦恩图)

  5. 我用Awesome-Graphs看论文:解读Naiad

    Naiad论文:<Naiad: A Timely Dataflow System> 前面通过文章<论文图谱当如是:Awesome-Graphs用200篇图系统论文打个样>向大家 ...

  6. Cesium 实现可视域分析

    *前言:尝试了网上好多个版本的可视域分析,感觉都有一些问题,我这个也可能不是最完美的,但是我觉得对我来说够用了,实现效果如下* 此示例基于vue3上实现,cesium版本1.101.0 ,vite-p ...

  7. 【Server - 运维】更改腾讯云数据库参数设置

    购买的MySQL实例是一个屏蔽了后台设置的服务器: 默认大小写设置是使用严格区分的: 要设置忽略大小写,就要在my.cnf中更改配置参数 https://cloud.tencent.com/devel ...

  8. 【Git】03 撤销 & 版本回退

    回退分为三种情况,每种情况对应了我们文件的存储区域 工作区 | 暂存区 | 版本区(当前分支) 1.文件可能存放在工作区,没有被Git追踪[红色标记状态] 2.文件可能已经添加到暂存区,没有被Git提 ...

  9. 位段 -- 内存布局详解C语言

    目录 位段的介绍 位段使用示例: 位段的内存分配 Example 内存分配解析: ## 位段 位段的介绍 位段(二进制位):就是按位存储 位段(bit-field)是C语言中的一种特殊数据类型,它允许 ...

  10. 工作站CPU超频,通过测试软件的压力测试就OK了吗?终极测试还是要看具体的应用场景

    最近想起超频试试自己年初入手的工作站,也是纯玩,超超频,看看是什么个体验,不过这个过程中还真有所学习. 由于电脑的主板,电源,散热等配的都比较高端,所以上来直接超频5.2G,电压选择为自动,不过再整个 ...