How to extract data from a corrupted table using db2dart
How to extract data from a corrupted table using db2dart
https://www.ibm.com/support/pages/how-extract-data-corrupted-table-using-db2dart
Question & Answer
Question
This technote provides troubleshooting information for the situation where your table data is corrupted and you do not have a recent good backup to restore your data. It describes a method for dumping the table data.
Answer
You can dump table data by using the ddel option of the db2dart command. The database needs to be offline to run the db2dart command.
This example extracts data from the EMPLOYEE table residing in the default USERSPACE1 tablespace with id 2 in the SAMPLE database in a DB2 V9.7 environment.
$db2dart sample /DDEL
Table object data formatting start.
Please enter
Table ID or name, tablespace ID, first page, num of pages:
EMPLOYEE,2,0,5
14 of 14 columns in the table will be dumped.
Column numbers and datatypes of the columns dumped:
0 CHAR() -FIXED LENGTH CHARACTER STRING
1 VARCHAR() -VARIABLE LENGTH CHARACTER STRING
2 CHAR() -FIXED LENGTH CHARACTER STRING
3 VARCHAR() -VARIABLE LENGTH CHARACTER STRING
4 CHAR() -FIXED LENGTH CHARACTER STRING
5 CHAR() -FIXED LENGTH CHARACTER STRING
6 DATE
7 CHAR() -FIXED LENGTH CHARACTER STRING
8 SMALLINT
9 CHAR() -FIXED LENGTH CHARACTER STRING
10 DATE
11 DECIMAL
12 DECIMAL
13 DECIMAL
Default filename for output data file is TS2T6.DEL,
do you wish to change filename used? y/n
n
Filename used for output data file is TS2T6.DEL. If existing file, data will be appended to it.
Formatted data being dumped ...
Dumping Page 0 ....
Table object data formatting end.
The requested DB2DART processing has completed successfully!
Complete DB2DART report found in:
/home/v97fp2/sqllib/db2dump/DART0000/SAMPLE.RPT
Note: Above example dumps 5 pages of data from the table Employee. If you are not sure of the number of pages, use a large number such as 99999 so that all the pages of the table will get dumped.
Sample contents in the output file (called TS2T6.DEL in this example) found in the location /home/v97fp2/sqllib/db2dump/DART0000 are as follows:
$cat TS2T6.DEL
"000010","CHRISTINE","I","HAAS","A00","3978",19950101,"PRES ",18,"F",19630824,+0152750.00,+0001000.00,+0004220.00
.....
"200340","ROY","R","ALONZO","E21","5698",19970705,"FIELDREP",16,"M",19560517,+0031840.00,+0000500.00,+0001907.00
自然语言处理爱好者,欢迎交流。QQ: 7214218
分类:
DB2
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!