DB migration from Oracle to MySQL

21 views
Skip to first unread message

olive

unread,
Apr 3, 2008, 12:47:01 PM4/3/08
to Django users
Hello,

I need to migrate a DB schema and data from Oracle to MySQL.

How would perform that :

1) Using Oracle SqlDevelopper migration tool ?
2) Using MySql migration tool ?
3) Using inspectdb/syncdb ?
4) ____________________ ?

I've already tried inspectdb/syncdb with some apparent success by
tweaking a little the models.py before syncing.
The site admin is there !
But I don't know yet how much details I've lost from the original
schema definition.

And now, I need to feed my tables.
How would you transfer data from Oracle to MySQL ?
Using dumpdata/loaddata (sql, xml or json ?) or something else ?

Please, share your success story with me !

Regards,

Olivier.

olive

unread,
Apr 3, 2008, 1:20:13 PM4/3/08
to Django users
Hello again,

I've tried dumpdata after having copied back my tweaked models.py to
the Oracle powered Django project.

After 1 minute of intensive CPU activity this message appears:

D:\test>python manage.py dumpdata test
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
File "D:\django\core\management\__init__.py", line 272, in
execute_manager
utility.execute()
File "D:\django\core\management\__init__.py", line 219, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "D:\django\core\management\base.py", line 72, in run_from_argv
self.execute(*args, **options.__dict__)
File "D:\django\core\management\base.py", line 86, in execute
output = self.handle(*args, **options)
File "D:\django\core\management\commands\dumpdata.py", line 41, in
handle
objects.extend(model._default_manager.all())
File "D:\django\db\models\query.py", line 114, in __iter__
return iter(self._get_data())
File "D:\django\db\models\query.py", line 486, in _get_data
self._result_cache = list(self.iterator())
File "D:\django\db\backends\oracle\base.py", line 123, in iterator
cursor.execute(full_query, params)
File "D:\django\db\backends\util.py", line 18, in execute
return self.cursor.execute(sql, params)
File "D:\django\db\backends\oracle\base.py", line 499, in execute
return Database.Cursor.execute(self, query, params)
cx_Oracle.DatabaseError: ORA-00904: "RCLENTRYALL_TMP2"."ID": invalid
identifier


Here is the culprit:

class RclentryallTmp2(models.Model):
symbol = models.CharField(max_length=15, blank=True)
endsymbol = models.CharField(max_length=15, blank=True)
rclentrytype = models.CharField(max_length=3, blank=True)
class Meta:
db_table = u'RCLENTRYALL_TMP2'

class Admin:
pass

This models is one of those for which there were no modification after
the initial inspectdb operation.

Any idea ?

Ian

unread,
Apr 3, 2008, 5:58:54 PM4/3/08
to Django users
Oracle appears to be complaining about the ID column. Does the table
have one? If not, does it have a primary key at all? Django expects
every model to have a primary key field, which could be the problem.

olive

unread,
Apr 4, 2008, 5:34:14 AM4/4/08
to Django users
Thank you for your answer Ian.

Then I dropped the models for which there is no id (in fact I don't
need them).

I also removed these apps to prevent dumpdata from trying to read the
related tables (which does not exists in the source Oracle DB):
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',

Now its running... but I fear its going to run forever !

python.exe is occupying all the remaining 800 MB from a total 1GB
physical memory.

I am wondering if Python is really using the virtual memory (10GB) or
not ?
Reply all
Reply to author
Forward
0 new messages