Re: Patching Informix Chunks
Posted in 1995
Joe Lumbley wrote: > > folks, > > A while back (maybe a year ago), someone (from Germany maybe?) posted > a highly-unsupported way to get into the reserved pages for OnLine. > This made use of the "dd" command to change the bytes in the database > that indicates a chunk is down from (I believe) 41 to 40 to mean that > the chunk was again good. > > I've lost my copy. Anybody else save this posting? > > I know, I know.....this is a very dangerous script. Kids don't try this > at home. > > Joe > > -- > --------------------------------------------------------------------------- > Joe Lumbley(jlumbley@netcom.com) Dallas, Texas > ---------------------------------------------------------------------------- > Here it is!! I have done this very thing in the past with great success! I had to write a C program to change the hex values because of differences in "dd", otherwise it worked as advertised. Good Luck!! -----------------------------------------------------------------+------------ _______ _______ _______ | /\\ ____\\ /\\__ __\\ /\\__ __\\ David Buchholz | \\ \\ \\___/ \\/_/\\ \\_/ \\/_/\\ \\_/ Unix System Administrator | Standard \\ \\ \\____ \\ \\ \\ \\_\\ \\__ ConferTech International Inc. | Disclaimers \\ \\______\\ \\ \\_\\ /\\______\\ Westerminster, CO. | Apply \\/______/ \\/_/ \\/______/ daveb@cfer.com/(303)633-3089 | | -----------------------------------------------------------------+------------ I found a way to take an offline or bad chunk back to online: This works for AIX 3.2.5 and informix online 5.0 UC2. I dont know if it works on any other platform, but yout can try a similar way: NOTE: This is my private way to do it. If you try it, it is your own risk !! My 2. chunk went offline due to a temporary disk error, tbinit fails. tbcheck -pr produces: .. Chunk number 1 Next chunk in DBSpace 2 Chunk offset 0 Chunk size 10000 Number of free pages 4 DBSpace number 1 Overhead 0 Flags 40 Chunk is online Chunk name length 12 Chunk path /dev/raw_db1 Chunk number 2 Next chunk in DBSpace 0 Chunk offset 0 Chunk size 15000 Number of free pages 3149 DBSpace number 1 Overhead 0 Flags 20 Chunk is offline Chunk name length 12 Chunk path /dev/raw_db2 .. The Flags or the 2. chunk are 20 instead of 40. The thing I do is to set that flag back to the 'good' value 40. 1. read out the first 100k of the first(!) chunk (/dev/raw_db1) to file o1: cd /tmp dd bs=100k count=1 if=/dev/raw_db1 of=o1 2. display the contents in with od in ascii-format and with hex-adresses: od -Ax -a <o1 >o1.a 3. look (in o1.a ) for the name of the bad chunk (search for example for "b 2"). you should find it twice: 0005ff0 nul nul nul nul nul nul nul nul nul can nul 0 nul dc1 f $ 0006000 nul dle nul ack nul dc2 rs ht nul stx dle nul nul h si ff 0006010 nul nul nul nul nul nul nul nul nul soh nul stx nul nul nul nul 0006020 nul nul ' dle nul nul nul eot nul soh nul nul nul @ nul ff 0006030 / d e v / r a w _ d b 1 nul nul nul nul 0006040 nul stx nul nul nul nul nul nul nul nul : can nul nul ff M 0006050 nul soh nul nul nul sp nul ff / d e v / r a w 0006060 _ d b 2 nul nul nul nul nul nul nul nul nul nul nul nul 0006070 nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul * 0006ff0 nul nul nul nul nul @ nul ( nul can nul ( nul dc2 rs ht 0007000 nul dle nul bel nul dc2 rs nak nul stx dle nul nul h si ff 0007010 nul nul nul nul nul nul nul nul nul soh nul stx nul nul nul nul 0007020 nul nul ' dle nul nul nul eot nul soh nul nul nul @ nul ff 0007030 / d e v / r a w _ d b 1 nul nul nul nul 0007040 nul stx nul nul nul nul nul nul nul nul : can nul nul ff M 0007050 nul soh nul nul nul sp nul ff / d e v / r a w 0007060 _ d b 2 nul nul nul nul nul nul nul nul nul nul nul nul 0007070 nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul some bytes in front of the chunkname there is the wrong value (hex 20) = "sp": here v 0006050 nul soh nul nul nul sp nul ff / d e v / r a w here v 0007050 nul soh nul nul nul sp nul ff / d e v / r a w These two values must be set to (hex 40) = "@" The adresses of these bytes are (in my example!!): (hex 6055) = (dec 24661), and (hex 7055) = (dec 28757) 4. replace these two values in the file o1: #!/bin/ksh print -n "@" | dd bs=1 seek=24661 count=1 conv=notrunc of=o1 print -n "@" | dd bs=1 seek=28757 count=1 conv=notrunc of=o1 5. verify the result as in step 3; instead of "sp" there should be "@" twice 6. write back the file o1 to the database (first chunk, not the bad one!!): dd bs=100k count=1 conv=notrunc if=o1 of=/dev/raw_db1 7. tbinit goes thru