I am using the Table Select tool within a model and it keeps returning ERROR 000224: Cannot insert features. The Help file suggests this error relates to mis-matched field definitions between input and output tables. The source table is being accessed via an ODBC connection to an Oracle database and has about 12 million records. The tool includes an SQL query which reduces the number of records returned to around 9 million. If I modify the query to return a small subset (~200 records), the tool works and I get no error - so I suspect the issue has nothing to do with field definitions. If I run the tool in an ArcMap session instead of a model, it works perfectly - but I need it to run in a model.
I have been able to determine that the failure is due to a lock on the database. The model I am using has two Table Select functions from an Oracle database into the same file geodatabase. The first one works perfectly (ie does not detect a lock on the database). The first Table Select is followed by a Make Table Query that joins data from the Table Select to an existing featureclass in the geodatabase and then copies the results to a final table using the Copy Rows tool. At this point, the second Table Select runs, but fails due to the database lock. I can only assume one of the earlier processes is putting the lock on the database. Does this sound likely - and if so, is there anyway I can release this lock from within the model?