Re: [Zope] Restore files from Data.fs.tr0 SOLVED

2013-03-18 Thread Jaroslav Lukesh

This simple script and diff and manual changes against appropriate files.

#!/var/zope/python/bin/python
f = open(Data.fs.tr0, r+ab)
c =  f.read()
s='__name__q'
a = c.split(s)
i = 0
print(len(a))
for polozka in a:
   i = i + 1
   fn = 'vystup_' + str(i)
   x = open(fn,ab)
   x.write(polozka)
   x.close()
f.close()

Lucky that it was no much of filenames. Select both files in Total 
Commander, then File - Diff - uncheck binary and check again - Edit, helps a 
lot.


For bigger truncated slices it could be better to do it with filename 
support etc.


Regards, JL. 


___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
https://mail.zope.org/mailman/listinfo/zope-announce
https://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Restore files from Data.fs.tr0

2013-03-15 Thread Jaroslav Lukesh

Hi all,

due disk and backup failure, I need to restore latest versions of files and 
properties from Data.fs.tr0, does have anybody some script or tips how to do 
it with zope tools, please?


Note that original Data.fs have changes after failure date, size at time of 
the failure is unknown.


Many thanks,
Jaroslav Lukesh 


___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
https://mail.zope.org/mailman/listinfo/zope-announce
https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Restore files from Data.fs.tr0

2013-03-15 Thread Cornel Nitu
Hi,

I use the following steps to get objects from a corrupted Data.fs. You can 
apply some guesses regarding the dates.

1. Make another Zope instance, with same products
2. Copy the real Data.fs into this temporary zope instance
3. Start zopedebug: $:/path-to-zope/bin/zopectl debug. Run these commands:

import ZODB.DB, ZODB.FileStorage, cPickle
from ZODB.TimeStamp import TimeStamp
from OFS import ObjectManager
date_tuple = (2009,8,23,23,17,06) #date when data was safe
special_date = TimeStamp(*date_tuple) #make date into special format
filename=’/var/local/zopetest/var/db.fs’ #path to Zope’s Data.fs (zope instance 
have to be stopped atm)
storage = ZODB.FileStorage.FileStorage(filename, 
read_only=1,stop=`special_date`) #wait few minutes, until it opens Data.fs
DB = ZODB.DB(storage) #mount database
conn = DB.open() #open database
root = conn.root()['Application']
folder = getattr(root, ‘myfolder’) #the parent containing the folder with the 
objects you want to recover
folder.manage_exportObject(id=’mycontent’,download=0)

Hope it helps.

Good luck,
Cornel

--
Cornel Nitu
Eau de Web (http://www.eaudeweb.ro)
Clucerului 55, ap 7, 011364 Bucharest
Tel/fax: +40 21 222 1522, Mobile: +40 721 223 623
Jabber: cor...@jabber.eaudeweb.ro, Skype: nitucornel

On Mar 15, 2013, at 2:01 PM, Jaroslav Lukesh wrote:

 Hi all,
 
 due disk and backup failure, I need to restore latest versions of files and 
 properties from Data.fs.tr0, does have anybody some script or tips how to do 
 it with zope tools, please?
 
 Note that original Data.fs have changes after failure date, size at time of 
 the failure is unknown.
 
 Many thanks,
 Jaroslav Lukesh 
 ___
 Zope maillist  -  Zope@zope.org
 https://mail.zope.org/mailman/listinfo/zope
 **   No cross posts or HTML encoding!  **
 (Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )

___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Restore files from Data.fs.tr0

2013-03-15 Thread Jaroslav Lukesh

Hi,

thanks for assistance, but this solution make export of data up to specified 
date in Undo history, instead of rescuing things from data.fs.tr0.


Is it possible to rescue data from data.fs.tr0, please?

Many thanks, JL.

- Puvodní zpráva - 
Od: Cornel Nitu cornel.n...@eaudeweb.ro

Komu: Jaroslav Lukesh luk...@seznam.cz
Kopie: zope@zope.org; zodb-...@zope.org
Odesláno: 15. brezna 2013 13:34
Predmet: Re: [Zope] Restore files from Data.fs.tr0


Hi,

I use the following steps to get objects from a corrupted Data.fs. You can 
apply some guesses regarding the dates.


1. Make another Zope instance, with same products
2. Copy the real Data.fs into this temporary zope instance
3. Start zopedebug: $:/path-to-zope/bin/zopectl debug. Run these commands:

import ZODB.DB, ZODB.FileStorage, cPickle
from ZODB.TimeStamp import TimeStamp
from OFS import ObjectManager
date_tuple = (2009,8,23,23,17,06) #date when data was safe
special_date = TimeStamp(*date_tuple) #make date into special format
filename=’/var/local/zopetest/var/db.fs’ #path to Zope’s Data.fs (zope 
instance have to be stopped atm)
storage = ZODB.FileStorage.FileStorage(filename, 
read_only=1,stop=`special_date`) #wait few minutes, until it opens Data.fs

DB = ZODB.DB(storage) #mount database
conn = DB.open() #open database
root = conn.root()['Application']
folder = getattr(root, ‘myfolder’) #the parent containing the folder with 
the objects you want to recover

folder.manage_exportObject(id=’mycontent’,download=0)

Hope it helps.

Good luck,
Cornel

--
Cornel Nitu
Eau de Web (http://www.eaudeweb.ro)
Clucerului 55, ap 7, 011364 Bucharest
Tel/fax: +40 21 222 1522, Mobile: +40 721 223 623
Jabber: cor...@jabber.eaudeweb.ro, Skype: nitucornel

On Mar 15, 2013, at 2:01 PM, Jaroslav Lukesh wrote:


Hi all,

due disk and backup failure, I need to restore latest versions of files 
and properties from Data.fs.tr0, does have anybody some script or tips how 
to do it with zope tools, please?


Note that original Data.fs have changes after failure date, size at time 
of the failure is unknown.


Many thanks,
Jaroslav Lukesh
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
https://mail.zope.org/mailman/listinfo/zope-announce
https://mail.zope.org/mailman/listinfo/zope-dev )


___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
https://mail.zope.org/mailman/listinfo/zope-announce
https://mail.zope.org/mailman/listinfo/zope-dev ) 


___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
https://mail.zope.org/mailman/listinfo/zope-announce
https://mail.zope.org/mailman/listinfo/zope-dev )