[Zope-DB] ZODB FS ----> ORACLE Storage

Matthew T. Kromer matt@zope.com
Tue, 13 Aug 2002 11:48:11 -0400


Michael Havard wrote:

> I've downloaded ZOracleDA which includes DCOracle2 and 
> DCOracleStorage. I've successfully created the Oracle tables with the 
> scripts in DCOracleStorage.
>
> Problem:
> When I switch from using the ZODB fs to the Oracle Storage I cannot 
> login to the management interface (user name and pw don't work). 
> Additionally it appears that the DB is missing any of the content that 
> I had previously created in the ZODB fs.
>
> Question:
> How do I convert the previously used ZODB fs data to the newly created 
> Oracle storage data?
>

True!

You need to migrate your database.  It's not terribly hard, but it isn't 
exactly straightforward either.

What you have to do invoke the copyTransactionsFrom method on the NEW 
storage with the OLD storage as an argument.

For example:

#
# Python script (on the fly example, may not syntax check)
#
import ZODB
from ZODB.FileStorage import FileStorage
import DCOracle2
import DCOracleStorage

oldDataFS = FileStorage("/path/to/var/Data.fs")
newDataFS=DCOracleStorage.Full(
    lambda : DCOracle2.connect('user/pw@db'),
    prefix = "zodb_"
)

newDataFS.copyTransactionsFrom(oldDataFS, verbose=1)

# save that in your lib/python directory and run it with any corrections 
that need to be made



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