Spring Batch
  1. Spring Batch
  2. BATCH-1747

How to Delete data from Spring Batch Metadata tables that are 90 days old.

    Details

    • Type: Support Support
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.1.5
    • Fix Version/s: None
    • Component/s: Test
    • Labels:
    • Environment:
      Windows XP, Oracle

      Description

      I want to write stored procedure to delete records that are created in spring batch metadata. Can you please let me know the query to do it. I need to delete data that are 90 days old. We are using oracle as DB.

        Activity

        Hide
        Mariam added a comment -

        I want to delete records from all Batch_XXX tables based on last_updated date in batch_job_execution table.

        Show
        Mariam added a comment - I want to delete records from all Batch_XXX tables based on last_updated date in batch_job_execution table.
        Hide
        Lucas Ward added a comment -

        I'm closing as won't fix, as this issue is much more appropriate to ask on the forum(it's not an issue, it's a question). However, I'm assuming you're having issues because of the foreign key constraints. You have three options:

        1. remove the constraints
        2. Delete in the correct order, such that children are deleted before parent, in the case of SB it would be:
        batch_step_execution_context
        batch_step_execution
        batch_job_execution_context
        batch_job_execution
        batch_job_params
        batch_job_instance

        As long as you remove from the bottom up, it will be fine.

        3. Update the constraints to support cascading delete.

        Show
        Lucas Ward added a comment - I'm closing as won't fix, as this issue is much more appropriate to ask on the forum(it's not an issue, it's a question). However, I'm assuming you're having issues because of the foreign key constraints. You have three options: 1. remove the constraints 2. Delete in the correct order, such that children are deleted before parent, in the case of SB it would be: batch_step_execution_context batch_step_execution batch_job_execution_context batch_job_execution batch_job_params batch_job_instance As long as you remove from the bottom up, it will be fine. 3. Update the constraints to support cascading delete.
        Hide
        Elryk added a comment -

        For all interested people, I have published on Github a tasklet that removes the Spring Batch historic:
        https://github.com/arey/spring-batch...ryTasklet.java
        I hope that may help

        Show
        Elryk added a comment - For all interested people, I have published on Github a tasklet that removes the Spring Batch historic: https://github.com/arey/spring-batch...ryTasklet.java I hope that may help

          People

          • Assignee:
            Unassigned
            Reporter:
            Mariam
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: