prabhu2289 / roundhouse

Automatically exported from code.google.com/p/roundhouse
0 stars 0 forks source link

Non-Descriptive Error When RoundhousE Structure Not Created In Oracle #65

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Connect to the Oracle database as SYSTEM or a similar user and run the 
attached CreateNoQuotaRoundhouseUser.sql script. This creates a user that has 
the privileges to create database objects but hasn't been given any physical 
space to hold tables.
2. Run RoundhousE against the database, using the connection information for 
the user created in step 1. The script directories can all be empty.
3. Observe the error below.
4. Connect to the database as the user created in step 1 and execute the 
following query:
SELECT DISTINCT *
  FROM USER_OBJECTS
 WHERE OBJECT_TYPE = 'TABLE' AND OBJECT_NAME LIKE '%ROUNDHOUSE%';

Observe that the query returns no results, indicating that no tables with 
"ROUNDHOUSE" in the name exist on the schema.

What is the expected output? What do you see instead?

Running RoundhousE v0.8.5.0 against roundhouse_bugs - .
Looking in . for scripts to run.
==================================================
Setup, Backup, Create/Restore/Drop
==================================================
==================================================
RoundhousE Structure
==================================================
 Running database type specific tasks.
Creating a sequence for the 'Version' table.
Creating a sequence for the 'ScriptsRun' table.
Creating a sequence for the 'ScriptsRunErrors' table.
 Creating [Version] table if it doesn't exist.
 Creating [ScriptsRun] table if it doesn't exist.
 Creating [ScriptsRunErrors] table if it doesn't exist.
==================================================
Versioning
==================================================
roundhouse.databases.oracle.OracleDatabase with provider 
System.Data.OracleClient does not provide a facility for retrieving versions at 
this time.
 Attempting to resolve version from C:\Projects\CSharp\experiments\roundhousebugs\_BuildInfo.xml using //buildInfo/version.
 Found version 1.0.0.0 from C:\Projects\CSharp\experiments\roundhousebugs\_BuildInfo.xml.
 Migrating  from version 0 to 1.0.0.0.
 Versioning  database with version 1.0.0.0 based on blah.
RoundhousE encountered an error.
System.ArgumentException: The OracleParameter is already contained by another 
OracleParameterCollection.
   at System.Data.OracleClient.OracleParameterCollection.Validate(Int32 index, Object value)
   at System.Data.OracleClient.OracleParameterCollection.Add(Object value)
   at roundhouse.databases.AdoNetDatabase.setup_database_command(String sql_to_run, ConnectionType connection_type, IEnumerable`1 parameters)
   at roundhouse.databases.AdoNetDatabase.run_command_with(String sql_to_run, ConnectionType connection_type, IList`1 parameters)
   at roundhouse.databases.AdoNetDatabase.run_sql(String sql_to_run, ConnectionType connection_type, IList`1 parameters)
   at roundhouse.databases.oracle.OracleDatabase.insert_version_and_get_version_id(String repository_path, String repository_version)
   at roundhouse.migrators.DefaultDatabaseMigrator.version_the_database(String repository_path, String repository_version)
   at roundhouse.runners.RoundhouseMigrationRunner.run()
The OracleParameter is already contained by another OracleParameterCollection.

What version of the product are you using? On what operating system?

RoundhousE v0.8.5.0
Windows 7, 64-bit
Oracle XE 11g 32-bit running locally

Please provide any additional information below.

My Summary makes some assumptions about the missing RoundhousE structure tables 
being the problem, but I think that's what's happening. There are other 
situations where the RoundhousE tables are not created and this error occurs; a 
quota of zero is just a simple way to ensure that they are not created. It is 
also a case when RoundhousE clearly can't do anything to remedy the issue. I'll 
be reporting a case that RoundhousE could possibly do someting differently to 
avoid the error (although I'm not sure what).

Doing the same thing in v0.8.0.300 still causes an error to occur at the same 
point, but it is more descriptive:

Running RoundhousE v0.8.0.300 against roundhouse_bugs - .
Looking in . for scripts to run.
==================================================
Setup, Backup, Create/Restore/Drop
==================================================
==================================================
RoundhousE Structure
==================================================
 Running database type specific tasks.
 Creating [Version] table if it doesn't exist.
 Creating [ScriptsRun] table if it doesn't exist.
 Creating [ScriptsRunErrors] table if it doesn't exist.
==================================================
Versioning
==================================================
roundhouse.databases.oracle.OracleDatabase with provider 
System.Data.OracleClient does not provide a facility for retrieving versions at 
this time.
 Attempting to resolve version from C:\Projects\CSharp\experiments\roundhousebugs\_BuildInfo.xml using //buildInfo/version.
 Found version 1.0.0.0 from C:\Projects\CSharp\experiments\roundhousebugs\_BuildInfo.xml.
 Migrating  from version 0 to 1.0.0.0.
 Versioning  database with version 1.0.0.0 based on blah.
RoundhousE encountered an error.
System.Data.OracleClient.OracleException: ORA-00942: table or view does not 
exist

   at System.Data.OracleClient.OracleConnection.CheckError(OciErrorHandle errorHandle, Int32 rc)
   at System.Data.OracleClient.OracleCommand.Execute(OciStatementHandle statementHandle, CommandBehavior behavior, Boolean needRowid, OciRowidDescriptor& rowidDescriptor, ArrayList& resultParameterOrdinals)
   at System.Data.OracleClient.OracleCommand.ExecuteNonQueryInternal(Boolean needRowid, OciRowidDescriptor& rowidDescriptor)
   at System.Data.OracleClient.OracleCommand.ExecuteNonQuery()
   at roundhouse.databases.AdoNetDatabase.run_sql(String sql_to_run, IList`1 parameters)
   at roundhouse.databases.oracle.OracleDatabase.insert_version_and_get_version_id(String repository_path, String repository_version)
   at roundhouse.migrators.DefaultDatabaseMigrator.version_the_database(String repository_path, String repository_version)
   at roundhouse.runners.RoundhouseMigrationRunner.run()
ORA-00942: table or view does not exist

The point as which the error occurs is strange as well. I would expect that 
failure to create the structure tables would result in an error before the 
Versioning phase began. That's manageable, though; an error occurs and it's 
relatively simple to figure out that something kept the version table from 
being created. An error message that doesn't indicate the real problem is less 
so. Honestly, I probably wouldn't have realized that the problem was the 
missing structure tables if I hadn't seen the v0.8.0.300 error first.

Original issue reported on code.google.com by mcconnel...@gmail.com on 3 Dec 2011 at 10:49

GoogleCodeExporter commented 8 years ago
Argh. Forgot to attach the user creating script.

Original comment by mcconnel...@gmail.com on 3 Dec 2011 at 10:50

Attachments:

GoogleCodeExporter commented 8 years ago
Got the very same problem.

Original comment by alancasa...@gmail.com on 2 Mar 2012 at 8:42

GoogleCodeExporter commented 8 years ago
You may want to see ticket #66. It describes the same error, but the cause it 
less clear. I created this ticket to indicate that the error message itself is 
odd and kind of hard to figure out even when it makes sense, but #66 is more 
appropriate when you also don't know what the problem is.

Original comment by mcconnel...@gmail.com on 5 Mar 2012 at 5:44