Stop a runaway job before it fills your disk

It happens all the time; one runaway job fills your disk before lunch. A query builds a result set with no limit. A batch job loops and keeps grabbing storage. By the time the ASP alarm sounds, you are scrambling to find which job did it.

Stop guessing. This is one of my favorites. Ask the system which active jobs hold the most temporary storage right now:

SELECT JOB_NAME, AUTHORIZATION_NAME,
       SUBSYSTEM, TEMPORARY_STORAGE
  FROM TABLE(QSYS2.ACTIVE_JOB_INFO())
 ORDER BY TEMPORARY_STORAGE DESC
 FETCH FIRST 15 ROWS ONLY;

TEMPORARY_STORAGE comes back in megabytes, largest first. The job at the top is the one to look at.

What the list shows:

  • The runaway query building a result set with no limit
  • The batch job climbing since the last IPL
  • The job holding storage it should have released hours ago

Run it when disk starts climbing. Run it on a normal day too, so you know what normal looks like. The gap between the two is your answer.

Catch the job while it runs and you fix a problem. Find it after the ASP fills and you clean up after an outage. Pick the first one.

#IBMi

Originally posted on LinkedIn. Join the conversation there.

Get new posts by email

Practical IBM i tips on SQL services, security and backup, sent when I publish. No spam, unsubscribe anytime.

Leave a Reply