https://github.com/famousdraw

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

posted on   红色MINI  阅读(29)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示