首页 > 其他分享 >【YashanDB知识库】如何dump数据文件,转换rowid, 查询对应内容

【YashanDB知识库】如何dump数据文件,转换rowid, 查询对应内容

时间:2024-09-27 11:22:23浏览次数:3  
标签:YashanDB dump DUMP num change rowid id block

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

问题现象

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

问题的风险及影响

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

问题影响的版本

YashanDB版本所有版本

问题分析和处理过程

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

【YashanDB知识库】如何dump数据文件,转换rowid, 查询对应内容 _yashandb知识库

2、崖山提供dump命令,可以dump出db数据文件,但不包含数据内容。详细说明见dump | YashanDB Doc (yasdb.com)

【YashanDB知识库】如何dump数据文件,转换rowid, 查询对应内容 _yashandb知识库_02

【YashanDB知识库】如何dump数据文件,转换rowid, 查询对应内容 _崖山数据库_03

3、确认文件id和blockid

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

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

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

【YashanDB知识库】如何dump数据文件,转换rowid, 查询对应内容 _yashandb知识库_04

根据上面分析,执行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的块中存在数据:

【YashanDB知识库】如何dump数据文件,转换rowid, 查询对应内容 _崖山数据库_05

4、转换ROWID,查询数据内容查看ROWID说明:ROWID UROWID | YashanDB Doc (yasdb.com)

【YashanDB知识库】如何dump数据文件,转换rowid, 查询对应内容 _yashandb知识库_06

对应:

dataoid 为2486

spaceid为4

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

blockid为135

dir为0

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

【YashanDB知识库】如何dump数据文件,转换rowid, 查询对应内容 _崖山数据库_07

标签:YashanDB,dump,DUMP,num,change,rowid,id,block
From: https://blog.51cto.com/u_16065869/12127367

相关文章

  • 【YashanDB知识库】如何dump数据文件,转换rowid, 查询对应内容
    本文来自YashanDB官网,具体内容可见https://www.yashandb.com/newsinfo/7459464.html?templateId=1718516问题现象客户环境有时候会遇到文件损坏的情况,需要dump文件,根据rowid查询数据情况。问题的风险及影响熟练掌握崖山数据文件dump操作,并识别rowid,在故障的情况下可以快速确认......
  • 【YashanDB知识库】windows配置ODBC跟踪日志, 使用日志定位问题
    问题现象客户刚开始使用YashanDBodbc的时候,需要查看调用日志详情,确认相应接口调用情况。问题的风险及影响客户在windowsserver2016环境测试,影响测试业务的开展。问题影响的版本YashanDB版本:所有版本问题发生原因本案例是对操作的说明,不涉及根因解决方法及规避方式1......
  • 01 dump 使用最多
    dump使用最多importjson#序列化,将python的值转换为json格式的字符串。v=[12,3,4,{'k1':'v1'},True,'asdf']#外层必须是一个列表,内部字符串:必须得是双引号v1=json.dumps(v)#'[]'print(v1)dump会进行两件事,第一、先进行序列化第二、序列化后,进行写入到......
  • 【YashanDB知识库】YMP迁移oracle不兼容给用户授权高级包
    本文转自YashanDB官网,具体内容请见https://www.yashandb.com/newsinfo/7441382.html?templateId=1718516【标题】YMP迁移oracle不兼容给用户授权高级包【关键字】oracle迁移,高级包授权【问题描述】迁移评估任务中,oracle迁移YashanDB,YMP不兼容语句:grantexecuteonsys.dbms_statst......
  • 【YashanDB知识库】decode函数中的子查询被不必要地多次执行
    本文内容转自YashanDB官网,具体内容请见https://www.yashandb.com/newsinfo/7441387.html?templateId=1718516问题现象客户向yashandb下发的SQL语句执行时间超过6分钟仍未出结果问题的风险及影响SQL语句性能慢,影响客户业务问题影响的版本所有的yashandb22.2版本23.2版本没有这个问......
  • 用户体验分享 | YashanDB V23.2.3安装部署
    近期崖山新版体验过程中,总能看到用户提问:openssl版本问题、monit命令找不到问题、yashan用户权限问题、数据库重装问题今日整理了多位用户的安装经验,希望能够帮助到大家~1.Lucifer三思而后行:YashanDB个人版数据库安装部署2.小周的数据库进阶之路:国产库学习系列之yasha......
  • 【YashanDB知识库】YMP迁移oracle不兼容给用户授权高级包
    本文转自YashanDB官网,具体内容请见https://www.yashandb.com/newsinfo/7441382.html?templateId=1718516【标题】YMP迁移oracle不兼容给用户授权高级包【关键字】oracle迁移,高级包授权【问题描述】迁移评估任务中,oracle迁移YashanDB,YMP不兼容语句:grantexecuteonsys.dbms_sta......
  • tcpdump抓包命令详解
    一、参数介绍-A以ASCII格式打印出所有分组,并将链路层的头最小化。-c在收到指定的数量的分组后,tcpdump就会停止。-C在将一个原始分组写入文件之前,检查文件当前的大小是否超过了参数file_size中指定的大小。如果超过了指定大小,则关闭当前文件,然后在打开一个新的文件。参数fi......
  • 【YashanDB知识库】yashandb执行包含带oracle dblink表的sql时性能差
    本文内容来自YashanDB官网,具体内容请见https://www.yashandb.com/newsinfo/7396959.html?templateId=1718516问题现象yashandb执行带oracledblink表的sql性能差:同样的语句,同样的数据,oracle通过dblink访问远端oracle执行,耗时不到1秒钟:问题的风险及影响yashandb通过dblink访问oracle......
  • 【YashanDB知识库】查询YashanDB表空间使用率
    本文转自YashanDB官网,具体内容请见https://www.yashandb.com/newsinfo/7369203.html?templateId=1718516【问题分类】功能使用【关键字】表空间,使用率【问题描述】YashanDB使用过程中,如何查询表空间的使用率【问题原因分析】需要查询相应的YashanDB系统表,计算表空间使用率【解决/规......