Skip to Main Content
  • Questions
  • Running sqlplus script without interruption every 1 minute or so

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Walter.

Asked: November 21, 2016 - 8:16 pm UTC

Last updated: November 22, 2016 - 4:51 am UTC

Version: 11.2.0.4

Viewed 1000+ times

You Asked

Hello Experts,

I have a requirement wherein I will be running a sql script on my sqlplus terminal. In my case the script should be running continuously every lets say 30 secs or 1 min (just like we have prstat in solaris).


Thanks,
Walter.

and Connor said...

Options

- if you want to run the script in the background, then 'cron' or windows scheduler will do the job

- if you want it in your current unix session, then some simple shell scripting, eg

while true
do
sqlplus -s -L /nolog @myscript.sql
sleep 30
done

- or if you want something that just never finishes (like 'top' etc), then you could check out the internals of MOATS

http://blog.tanelpoder.com/2011/03/29/moats-the-mother-of-all-tuning-scripts/

which uses some formatting trickery to give the appearance of being 'top-like'



Is this answer out of date? If it is, please let us know via a Comment