AmbiguousTableNameException while migrating to Oracle DB

I'm just in the process of attempting to migrate to an Oracle schema, but am hitting this AmbiguousTableNameException problem too.

Working with one of our DBAs we've cut down the privilages of the user to a minimum but I'm still getting this exception.

I've noticed some posts on DBUnit boards discussing this exception and one possible solution seems to be to explicitly set the schema when connecting to the database. Apparently DBUnit has a habit of picking up table names from other schemas. I've tried doing this in the jdbc:oracle:thin connection string but without any luck. Does the schema get set explicitly in the TeamCity migration code?

Thanks,


Andy

0
7 comments

Andy,

I've branched your post from the thread to a new one since this can be a different issue.

--
Yegor Yarko

0

Andy,

could you please provide us with the following information:

  - which version of TeamCity are you using,
  - the 'dbMigration.properties' file (without your DB passwords),
  - the log file.

The log file is:
  -  named 'migration*.log' and may be found in the 'bin' directory for versions less than 4.5,
  -  named 'teamcity-dbmt*.log' and may be found in the 'logs' directory for the version 4.5.

As for explicitly setting the schema name – in case of Oracle the dbmt uses schema name that is the same as the user name.

Thanks.

Leonid

0
Avatar
Permanently deleted user

Leonid,

Thanks for looking into this. I'm using the latest TeamCity (4.5.2). I've attached the complete properties file and log.

The TeamCity tables get created fine but the import fails on the first non-empty table (which for me is AGENT.csv) The exception refers to a table from another schema which does not share a name with any of the TeamCity tables. (Actually several schemas on that database contain this table and some have--for whatever reason--granted PUBLIC access.) Still, there shouldn't be any conflict with the TeamCity tables.

Our DBA has "...revoked connect from  teamcity.  I have granted create session."

Config snippet:


# Oracle
# do not forget to place Oracle driver (ojdbc*.jar) into <path to TeamCity application folder>\WEB-INF\lib directory
targetDriver=oracle.jdbc.driver.OracleDriver
targetURL=jdbc:oracle:thin:@oracle-server-1:1521:sid1
targetUser=TEAMCITY
targetPassword=SECRET


Log snippet:

[2009-06-15 19:05:44,368]   INFO [           main] -     jetbrains.buildServer.dbmt - Importing from C:\Program Files\TeamCity\bin\TC-export-1245089089846
[2009-06-15 19:05:44,587]   INFO [           main] -     jetbrains.buildServer.dbmt - Importing table: action_history, rows number: 0
[2009-06-15 19:05:44,602]   INFO [           main] -     jetbrains.buildServer.dbmt - Importing table: agent, rows number: 2
[2009-06-15 19:05:53,538]  ERROR [           main] -     jetbrains.buildServer.dbmt - Error importing data. Last processed row #2

[2009-06-15 19:05:53,554]  DEBUG [           main] -     jetbrains.buildServer.dbmt - org.dbunit.database.AmbiguousTableNameException: SOME_NON_TEAMCITY_TABLE
org.dbunit.database.AmbiguousTableNameException: SOME_NON_TEAMCITY_TABLE
    at org.dbunit.database.DatabaseDataSet.initialize(DatabaseDataSet.java:163)
    at org.dbunit.database.DatabaseDataSet.getTableMetaData(DatabaseDataSet.java:215)
    at org.dbunit.operation.AbstractOperation.getOperationMetaData(AbstractOperation.java:73)
    at org.dbunit.operation.AbstractBatchOperation.execute(AbstractBatchOperation.java:150)
    at jetbrains.buildServer.serverSide.DBMTool.importToTargetDatabase(DBMTool.java:15)
    at jetbrains.buildServer.serverSide.DBMTool.main(DBMTool.java:227)
[2009-06-15 19:05:53,554]   INFO [           main] -     jetbrains.buildServer.dbmt - Closing source database connection...
[2009-06-15 19:05:53,554]   INFO [           main] -     jetbrains.buildServer.dbmt - Closing connection...
[2009-06-15 19:05:54,069]   INFO [           main] -     jetbrains.buildServer.dbmt - Closing target database connection...
[2009-06-15 19:05:54,069]   INFO [           main] -     jetbrains.buildServer.dbmt - Done.


Appreciate your time. Please let me know if I can provide any more info.

Thanks,


Andy



Attachment(s):
teamcity-dbmt.log
dbMigration.properties
0

Andy,

Thank you for the provided info.

I could reproduce the bug and I've filled an issue for it: TW-8545. You can vote/watch this issue.
I'm planning to find a fix or workaround in a couple of days.

Thanks,
Leonid

0
Avatar
Permanently deleted user

Leonid,

Great, thanks very much for that. Glad to hear you could reproduce it. Let me know if you need any more info or want someone to test a fix.

Thanks,


Andy

0

Andy,

I've attached a hotfix file to the issue TW-8545, and wrote a comment how to patch.

Please let me know has the problem been solved.

Thanks,
Leonid

0
Avatar
Permanently deleted user

Leonid,

Thanks very much for that. I used the fix and managed to get the migrate to run. I've added a note to the issue.

Many thanks,


Andy

0

Please sign in to leave a comment.