Limit the query running time with Resource limit facility (RLF)

If you need to limit the query(package,plan) running time, but the JCL/JOB TIME parameters doesn't work in most case. Here is some step by step of how to make it work using the resouce limit facility.

  • Check the RLFAUTH in your zparm file, the default was sysibm.
    RLFAUTH=SYSIBM
  • Create table DSNARL and related index with schema above.
  • Populate the data to limit the query execution time.
    INSERT INTO sysibm.DSNRLST01                           
      (RLFFUNC, RLFCOLLN, RLFPKG, LUNAME, ASUTIME)         
     VALUES('2', 'DSNTEP2', '', 'PUBLIC', 5);

Keep the LUNAME as PUBLIC so all local and remote SQLs will been terminated.
Change the DSNTEP2 name to your collection name if you bind it with different name or want to limit other package/collection.
Adjust the ASUTIME to meet your requirement, you can just explain the whole workload and select max(procsu) from dsn_statemnt_table to get the minimal value for it.
On zEC12, the query will run 30 seconds, the -905 report 90 CPU SECONDS = 000006000000 SERVICE UNITS

http://www-01.ibm.com/support/knowledgecenter/SSEPEK_10.0.0/com.ibm.db2z10.doc.perf/src/tpc/db2z_calculateserviceunits.dita?lang=en

  • Start the rlimit with command
    -SA9HSTA rlimit id=01
    Run some long running query to verify it. The job will exit with return code 8. But if you set the SYSPRINT to dummy, it didn't show the error code, you need to set it //SYSPRINT DD SYSOUT=* to check the error code.
  • Stop the rlimit after your workload run.
    -SA9HSTO rlimit
  • The rlimit will inactive after refresh DB2, so add the start rlimit after your had start DB2.
原文地址:https://www.cnblogs.com/db2zos/p/3607786.html