Forum Stats

  • 3,734,708 Users
  • 2,247,029 Discussions
  • 7,857,460 Comments

Discussions

Is there anyway on sqlcl to timeout a long running sql script?

StuartH
StuartH Member Posts: 16
edited Nov 4, 2019 11:21AM in SQLcl

I have a number of reports running on a daily basis, but if one SQL runs too long, I don't want to hold up the rest.

So if there a way on SQLCL to add a timeout to a long running SQL script?

Thanks

Tagged:

Answers

  • Erik van Roon
    Erik van Roon Member Posts: 58 Red Ribbon
    edited Nov 4, 2019 11:14AM

    If you're on oracle database 18c or higher you can do:

    alter system cancel sql :sid,:serial#,@:inst_id;

    from another session.

    If you're on a lower db version I don't think there's anything other that you can do than kill the session or close the sqlcl window.

  • StuartH
    StuartH Member Posts: 16
    edited Nov 4, 2019 11:21AM

    It would be run on a schedule, so it's not monitored to be able to close the sqlcl window.

    I was thinking down the lines of running it on a separate thread, and then killing that thread when it took too long.  But not sure if that's possible on sqlcl threading?

Sign In or Register to comment.