My Mul-Threads Data Export Tool
Posted in 2010
Hi, everybody, I'm a new guy here.
First of all, my English is poor, I'll try my best to explain my tools.
Ignore my spell and grammar errors please :D
In these days, I study IDS socket communcation package and disk storage
structure, and write 2 tools. One is fake a user and commucate to IDS throught
TCP/IP directly. The other is export data from disk file directly. Here is the
second one.
---------- 0. WHAT CAN IT DO ----------
Export data from disk file directly, using mul-threads.
It doesn't need IDS Online.
If IDS is Online, run "onmode -c" to flush shared memory before export.
---------- 1. WORK ENV ----------
I compile source in AIX 5.2, and it works on IDS 9.4
I do not have other version IDS, so I didn't test it for other version. But I
guess it will work for lower version IDS, and it doesn't support IDS 11 for
IDS 11 support different page size.
---------- 2. ARGUMENT ----------
myexport -d<database> [-t<table>] [-p<thread num>]
Argument <database> is required
If argument <table> is set, it only exports this <table>
<thread num> default number is 20. In this debug version, <thread num> up to
30.
Because of debug version, there are lots of debug information, re-define
stdout to a log file please. Some important information will display to stderr.
And, this version, I didn't check every function return carefully. When it
runs error, kill it!
---------- 3. HOW IT WORK ----------
1) It getenv and read file $INFORMIXDIR/etc/$ONCONFIG, and get ROOTOFFSET,
ROOTPATH
2) It read ROOTDBS and get PAGESIZE, DBSPACES, CHUNKS
3) It analyze the TBLSPACES and get tables entry
4) It read <database>:systables, and get table lists(skip system tables)
5) It read TBLSPACES, and get table extents
6) It read <database>:syscolumns, and get table schemas
7) And then, export tables! It will mkdir <database>, and export data to file
<database>/<table>.unl
---------- 4. SUPPORT AND UN-SUPPORT ----------
1) It exports data use '|' as delimident
2) Support SQL types: char, varchar, smallint, int, decimal, serial, data,
money, dtime, text, bytes. Other SQL types may support later
3) Because I export data for awk, '\\
' may cause awk work err. So I skip '\\
'
in char, this will CHANGE orgial data!
4) For the same reason, I skip text, bytes columns as NULL
5) It support table with fragment
6) Unsupport table that rowsize is bigger than page size
---------- 5. DOWNLOAD ----------
http://g.zhubajie.com/urllink.php?id=92405462h13mbrp3s101l7p
click the orange fonts url link to download
Ok, thanks for your patience. If you find bugs or have any advice, send me an
email: lohengramn@sina.com