RE: Is there a way/hack to allow the query only to run for specified duration in Oracle and kill it.

From: <post.ethan_at_gmail.com>
Date: Wed, 1 May 2019 12:54:10 -0500
Message-ID: <010a01d50046$e1f44350$a5dcc9f0$_at_gmail.com>



I am going to assume you have very limited access to this database and likely ability to implement some of the other solutions.  

Using a scheduled job is going to be your best bet. Something akin to this…  

begin

   get current session id and schedule job to run in one minute to kill this session using dbms package or alter statement.

end;

/  

Your SQL here…  

The problem is your user will likely require some explicit grants on alter or dbms package to work.  

The other idea would be to set up a job that monitors for the specific SQL and automatically kills it after it has been running one minute. Or perhaps you can submit two .sqls, one to run the SQL and the other to find the session and kill it after 1 minute of sleep (dbms_lock).  

It is really best when you kill sessions to make sure it is killed both on the DB and on the OS. Ideally someone with a lot more access could set this up for you.  

Ethan

notaframework.com

_at_poststop    

From: oracle-l-bounce_at_freelists.org <oracle-l-bounce_at_freelists.org> On Behalf Of kunwar singh Sent: Wednesday, May 1, 2019 10:46 AM
To: ORACLE-L <oracle-l_at_freelists.org> Subject: Is there a way/hack to allow the query only to run for specified duration in Oracle and kill it.  

Hi Listers,

Small question.  

I currently working on a remote database in which i can only pass a query through a tool and i want to kill it after letting it run only for 1 minute

The reason for this is i have to try different underscore parameters at session to check if the issue is fixed or not.  

I am looking for any solution which is completely in a single sql . What i pass to the tool is a .sql file , thats all.

If you have a simple solution in shell then i will try that one as well. Meaning i can run a shell command like this:

!hostname    

The query that i want to run is a big select sql , which unfortunately i cannot paste here.  

--

Cheers,
Kunwar

--
http://www.freelists.org/webpage/oracle-l
Received on Wed May 01 2019 - 19:54:10 CEST

Original text of this message