Run query every 5 minutes Please find the below query:
select count(*) from v$session;

This has to be run on the database every 5 minutes. What is the right way to achieve this?
The query has to be run every 5 minutes on the same sql*plus screen. Instead of pressing &quot;/&quot; every minute, I wanted to understand if there is a way.
Database/Server details:
SQL&gt; select * from v$version;
Oracle8i Enterprise Edition Release 8.1.7.4.0 - 64bit Production

SQL&gt; !uname -a
HP-UX ap12121 B.11.11 U 9000/800 ap12121 unlimited-user license
How about using a PL/Sql block:
DECLARE
    v_sessions NUMBER;
BEGIN
    WHILE true LOOP
        SELECT COUNT (*) INTO v_sessions FROM v$session;
        DBMS_OUTPUT.PUT_LINE ('Sessions: ' || v_sessions);
        DBMS_SESSION.SLEEP (300); -- 5 minutes
    END LOOP;
END;

If it really is 8i, use DBMS_LOCK.SLEEP (300) instead.