admin管理员组

文章数量:1302350

Using a fairly recent version of spring-batch (5.1.0) we've had some runtime errors when two batches in separate linux processes kick off at the same time.

The error occurs within the spring-batch code that inserts into BATCH_JOB_INSTANCE.

Exception in SpringApplication.run()
.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [INSERT INTO BATCH_JOB_INSTA
NCE(JOB_INSTANCE_ID, JOB_NAME, JOB_KEY, VERSION)
        VALUES (?, ?, ?, ?)
]; SQL state [72000]; error code [8177]; ORA-08177: can't serialize access for this transaction

I understand this to be a problem where the data in the BATCH_JOB_INSTANCE table is changing at the same time that spring-batch is trying to write to it.

What I don't understand is what the user of spring-batch is supposed to do about this. I would think that this should be a framework issue rather than a user issue.

Thanks for any enlightenment and / or pointers.

-alan

Using a fairly recent version of spring-batch (5.1.0) we've had some runtime errors when two batches in separate linux processes kick off at the same time.

The error occurs within the spring-batch code that inserts into BATCH_JOB_INSTANCE.

Exception in SpringApplication.run()
.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [INSERT INTO BATCH_JOB_INSTA
NCE(JOB_INSTANCE_ID, JOB_NAME, JOB_KEY, VERSION)
        VALUES (?, ?, ?, ?)
]; SQL state [72000]; error code [8177]; ORA-08177: can't serialize access for this transaction

I understand this to be a problem where the data in the BATCH_JOB_INSTANCE table is changing at the same time that spring-batch is trying to write to it.

What I don't understand is what the user of spring-batch is supposed to do about this. I would think that this should be a framework issue rather than a user issue.

Thanks for any enlightenment and / or pointers.

-alan

Share asked Feb 10 at 22:03 ALAN PAINTERALAN PAINTER 151 silver badge4 bronze badges 2
  • I guess that I'll have to ask the question to Copilot. – ALAN PAINTER Commented Feb 14 at 8:02
  • I'm wondering if this problem isn't related to this issue: github/spring-projects/spring-batch/issues/2252 – al.truisme Commented Feb 25 at 13:14
Add a comment  | 

1 Answer 1

Reset to default 0

The question seems to be addressed here as well:

Spring Batch ORA-08177: can't serialize access for this transaction when running single job, SERIALIZED isolation level

You can set a different isolationLevelForCreate, recommended to be READ_COMMITTED.

https://docs.spring.io/spring-batch/reference/job/configuring-repository.html#txConfigForJobRepository

本文标签: