[Zope-DB] Unpickling data from OracleStorage

Randy Jay Yarger ryarger@webelite.com
14 Oct 2002 14:25:10 -0400


On Mon, 2002-10-14 at 10:24, Matthew T. Kromer wrote:
> 
> Randy, I dont have much experience probing the possible failure modes 
> after you lose data out of OracleStorage due to disk corruption.  With 

Hi Matt,

Thanks for the input! Luckily I was able to recover my data. I'll share
this with the list as it worked for me, but I don't know enough about
the details of ZODB_RECORD to swear that it's always true.

* After examining the details of ZODB_RECORD it appeared that the
following was true (at least for my data):
	* Z_OID was the Object ID
        * Z_TID was the transaction ID
        * Z_VID was always 0 (I didn't have any Versions)
        * Z_PRE was the highest TID for this OID lower than the current
TID
        * Z_NV was always 0
        * Z_DATA was always the same as Z_TID (I don't know why but this
made it all possible)

Given those criteria, it's possible to recreate the ZODB_RECORD table
from a valid ZODB_PICKLE table by doing the following:
        * Select every Z_OID, Z_TID pair from ZODB_PICKLE ordered by
Z_TID
        * Insert a record into ZODB_RECORD using the OID, TID, 0 (If
you're like me an not using Versions), the previously highest TID for
that OID, 0 again, then the TID again.

After doing this, I was able to restart Zope and voila, it worked! Now,
the first thing I'm doing is exporting my entire tree, then dropping and
re-creating the whole instance, just to be safe. But it appears that, at
least with the kind of system I am working with (no Versions, etc.) that
ZODB_RECORD is a re-calculable table.

Hope this helps someone in the future!
-Randy Yarger
randy@yarger.net

> -- 
> Matt Kromer
> Zope Corporation  http://www.zope.com/ 
>