Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(oracle) error when rh inserts a record into its own scriptsrun table #37

Closed
wijnanjo opened this issue Nov 30, 2011 · 22 comments
Closed

Comments

@wijnanjo
Copy link

We have one .sql file that rh completely executes but right after rh fails to insert that script's record in the SCRIPTSRUN table (Error is below). However, all other scripts are inserted nicely in that same table and moreover.when I split that .sql file in two, they get both inserted into the table. What is going on here?

2011-11-30 09:32:19,943 [INFO ] - Running 0005_Indexes.sql on localhost - .
2011-11-30 09:32:20,033 [ERROR] - roundhouse.databases.oracle.OracleDatabase with provider System.Data.OracleClient does not provide a facility for recording scripts run at this time.
could not insert: [roundhouse.model.ScriptsRun#5][SQL: INSERT INTO PRODATA_ScriptsRun (version_id, script_name, text_of_script, text_hash, one_time_script, entry_date, modified_date, entered_by, id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)]
2011-11-30 09:32:20,055 [ERROR] - RoundhousE encountered an error.
NHibernate.Exceptions.GenericADOException: could not insert: [roundhouse.model.ScriptsRun#5][SQL: INSERT INTO PRODATA_ScriptsRun (version_id, script_name, text_of_script, text_hash, one_time_script, entry_date, modified_date, entered_by, id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)] ---> System.Data.OracleClient.OracleException: ORA-01461: can bind a LONG value only for insert into a LONG column

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 NHibernate.AdoNet.AbstractBatcher.ExecuteNonQuery(IDbCommand cmd)
at NHibernate.AdoNet.NonBatchingBatcher.AddToBatch(IExpectation expectation)
at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, Int32 j, SqlCommandInfo sql, Object obj, ISessionImplementor session)
--- End of inner exception stack trace ---
at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, Int32 j, SqlCommandInfo sql, Object obj, ISessionImplementor session)
at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Object obj, ISessionImplementor session)
at NHibernate.Action.EntityInsertAction.Execute()
at NHibernate.Engine.ActionQueue.Execute(IExecutable executable)
at NHibernate.Engine.ActionQueue.ExecuteActions(IList list)
at NHibernate.Engine.ActionQueue.ExecuteActions()
at NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session)
at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)
at NHibernate.Impl.SessionImpl.Flush()
at roundhouse.infrastructure.persistence.Repository.save_or_update[T](T item)
at roundhouse.databases.DefaultDatabase`1.insert_script_run(String script_name, String sql_to_run, String sql_to_run_hash, Boolean run_this_script_once, Int64 version_id)
at roundhouse.migrators.DefaultDatabaseMigrator.record_script_in_scripts_run_table(String script_name, String sql_to_run, Boolean run_this_script_once, Int64 version_id)
at roundhouse.migrators.DefaultDatabaseMigrator.run_sql(String sql_to_run, String script_name, Boolean run_this_script_once, Boolean run_this_script_every_time, Int64 version_id, Environment environment, String repository_version, String repository_path, ConnectionType connection_type)
at roundhouse.runners.RoundhouseMigrationRunner.traverse_files_and_run_sql(String directory, Int64 version_id, MigrationsFolder migration_folder, Environment migrating_environment, String repository_version, ConnectionType connection_type)
at roundhouse.runners.RoundhouseMigrationRunner.log_and_traverse(MigrationsFolder folder, Int64 version_id, String new_version, ConnectionType connection_type)
at roundhouse.runners.RoundhouseMigrationRunner.run()

@ferventcoder
Copy link
Member

size of the script text?

@wijnanjo
Copy link
Author

Hi,

It's just about 50-60 lines of 'CREATE INDEX ...' statements like the ones
below:

--table people
CREATE INDEX my_index1 ...
CREATE INDEX my_index ...
;
--table addresses
CREATE INDEX...
;
--etc.

The problem is indeed related with the number of lines or statements in the
script because splitting that script decreases the number of lines/script.
On the other hand our 'create tables' script has a lot more lines (less
create statements though) and just works fine.

hope that helps you, greets,

Jo

2011/11/30 Rob Reynolds <
reply@reply.github.com

size of the script text?


Reply to this email directly or view it on GitHub:
#37 (comment)

@ferventcoder
Copy link
Member

While this shouldn't be considered a fix for the issue, have you thought about moving your index items to the new indexes folder?

@wijnanjo
Copy link
Author

wijnanjo commented Dec 1, 2011

I have exactly the same problem if I put the script in the indexes folder:
one 'big' script fails, split into two smaller ones is fine.

2011/11/30 Rob Reynolds <
reply@reply.github.com

While this shouldn't be considered a fix for the issue, have you thought
about moving your index items to the new indexes folder?


Reply to this email directly or view it on GitHub:
#37 (comment)

@wimjans
Copy link

wimjans commented Dec 15, 2011

I've done some testing, and apparently the error occurs (on any of the folders) if the size of an entry being inserted into a CLOB column is between 2000 and 4000 characters.

This happen on all tables which have a CLOB column, be it in scriptruns or scriptrunerrors.

It seems like this is an issues with NHibernate and the default driver used.

I've found one website explaining this issue:
http://thebasilet.blogspot.com/2009/07/nhibernate-oracle-clobs.html

One solution is to use a different driver:
"NHibernate.Driver.OracleDataClientDriver instead of
NHibernate.Driver.OracleClientDriver"

Can RoundHousE be adapated so we can choose a different driver to be used with NHibernate?

Thanks,

Wim

@ferventcoder
Copy link
Member

Interesting. I bet it could be adapted. This would likely solve some other issues as well.

LodewijkSioen pushed a commit to Infohos/roundhouse that referenced this issue Aug 17, 2012
This is a workaround for a problem with NHibernate in combination with
the Microsoft Oracle driver. See
http://thebasilet.blogspot.be/2009/07/nhibernate-oracle-clobs.html for
details
LodewijkSioen added a commit to Infohos/roundhouse that referenced this issue Aug 31, 2012
Issue chucknorris#37 was not completely fixed. The customtype must be set
with a stringvalue for the driver to see the change
LodewijkSioen pushed a commit to Infohos/roundhouse that referenced this issue Sep 10, 2012
This is a workaround for a problem with NHibernate in combination with
the Microsoft Oracle driver. See
http://thebasilet.blogspot.be/2009/07/nhibernate-oracle-clobs.html for
details
LodewijkSioen added a commit to Infohos/roundhouse that referenced this issue Sep 10, 2012
Issue chucknorris#37 was not completely fixed. The customtype must be set
with a stringvalue for the driver to see the change
@Buthrakaur
Copy link

Is there any special reason why this fix wasn't merged? I'm still facing the same ORA error on latest RoundhousE version grabbed from CodeBetter build server.

Buthrakaur pushed a commit to Buthrakaur/roundhouse that referenced this issue Jun 19, 2013
This is a workaround for a problem with NHibernate in combination with
the Microsoft Oracle driver. See
http://thebasilet.blogspot.be/2009/07/nhibernate-oracle-clobs.html for
details
Buthrakaur pushed a commit to Buthrakaur/roundhouse that referenced this issue Jun 19, 2013
Issue chucknorris#37 was not completely fixed. The customtype must be set
with a stringvalue for the driver to see the change
@mpareja
Copy link
Member

mpareja commented Jun 19, 2013

@Buthrakaur It has been a while since the last RH release, so we're working to get a new release out soon. We've made some changes to our build infrastructure with the hope that we will be able to release more frequently in the future.

There are some mapping related changes in the release, so it might be a good idea to sneak your pull request #83 in.

@Buthrakaur
Copy link

@mpareja Thanks for quick response. I just tried to merge #83 into my own fork (https://github.com/Buthrakaur/roundhouse), but I ended with much more cryptic ORA error unfortunately:

INSERT INTO X__RH_SCRIPTS_RUN (version_id, script_name, text_of_script, text_hash, one_time_script, entry_date, modified_date, entered_by, id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)] ---> System.Data.OracleClient.OracleException: ORA-01084: invalid argument in OCI call

There're quite a lot of issues with CLOB/BLOB columns and Microsoft Oracle driver AFAIK. :/

@mpareja
Copy link
Member

mpareja commented Jun 19, 2013

Ouch, maybe we won't sneak this one in, yet!

@Buthrakaur
Copy link

I'm afraid there is just one right fix for Oracle - migrate from System.Data.OracleClient provider to Oracle's own Oracle.DataAccess (ODP.NET), which is much more mature according to my experience. I wonder if anybody really use RoundhousE with Oracle when I see such errors...

@ferventcoder
Copy link
Member

We are getting rid of the microsoft driver

@ferventcoder
Copy link
Member

There was another driver suggested that doesn't even require the oracle client tools and I would lean towards that.

@Buthrakaur
Copy link

You mean probably Oracle Managed Driver (https://nuget.org/packages/odp.net.managed/) - I think it doesn't work with NH yet (it's probably .NET 4 only), but I'll give it a try.

On the other side I easily managed to overcome the issues I mentioned here in my fork using ODP.NET driver (Oracle.DataAccess) instead of the MS one, but it requires Oracle client installation of course...

@Buthrakaur
Copy link

I just got the managed driver working and fixed some Oracle specific SQL syntax problems in my fork: Buthrakaur@b48e1f9

@ferventcoder
Copy link
Member

the managed driver? With NH? That's pretty rockstar!

@mpareja
Copy link
Member

mpareja commented Jun 20, 2013

Were you required to upgrade RH to .NET 4 in order to sort the driver issue
out?

On Thu, Jun 20, 2013 at 11:01 AM, Rob Reynolds notifications@github.comwrote:

the managed driver? With NH? That's pretty rockstar!


Reply to this email directly or view it on GitHubhttps://github.com//issues/37#issuecomment-19758967
.

@Buthrakaur
Copy link

Yes - I had to migrate RH to .NET 4 and got NH working with the managed
Oracle driver (reimplemented RoundhousEOracleDriver class). It was quite straightforward. You can see the changes in the commit I mentioned in my previous comment.

@ChrisMissal ChrisMissal added this to the Release 0.8.7 milestone Feb 18, 2015
@ferventcoder ferventcoder modified the milestone: Release 0.8.7 Jun 3, 2015
@ChrisMissal ChrisMissal modified the milestone: Release 0.8.7 Jul 21, 2015
@BiggerNoise
Copy link
Member

@Buthrakaur I know it's been quite a long time, but would you consider opening a P/R with your changes to use the Managed Oracle driver?

@Buthrakaur
Copy link

@BiggerNoise the original PR is here: #191 , but I'm afraid it needs to clean up little bit :/

@BiggerNoise
Copy link
Member

Are you able to do a new P/R with the needed cleanup? I'm not using Oracle, so there's no telling where we're going to end up if I do it.

@BiggerNoise
Copy link
Member

I'm going to close this issue in favor of #171. It sounds like this will be fixed if we can update the Oracle driver and I'm trying to get the issue list down so I can fit it in my head.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants