Sunday, November 17, 2024

Kill PSQUERY Automatically after 60mints

 The SELECT below is being run for PSQUERY kill job


SELECT

        'alter system kill session '''  ||sid  ||','  ||serial#  ||', @'  ||inst_id  ||''';'

FROM gv$session a

WHERE a.process IN

  (SELECT ltrim(TO_CHAR(q.sessionidnum))

   FROM psprcsque q,

        psprcsrqst t

  WHERE q.prcsinstance=t.prcsinstance

  AND t.prcsname      ='PSQUERY'

  AND q.rqstdttm      =

    (SELECT DISTINCT MAX(rqstdttm)

      FROM psprcsque q1

      WHERE q1.sessionidnum=q.sessionidnum

    )

  AND t.runstatus IN (7,14,16)

  )

and a.last_call_et > 3600

No comments:

Post a Comment