skills/database-plan-cache/SKILL.md
Explore and manage the IBM i SQL plan cache including snapshots, event monitors, and procedure references. Use when user asks about: (1) plan cache services or procedures available, (2) plan cache snapshot files on the system, (3) plan cache event monitor status, (4) how to dump or manage the plan cache, (5) plan cache sizing or QSQSRVR job memory usage, or (6) SQL syntax for plan cache management operations.
npx skillsauth add ajshedivy/ibmi-agent-skills database-plan-cacheInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Explore and manage the SQL plan cache including service discovery, snapshot analysis, event monitor tracking, and management procedure references.
The ibmi CLI is the primary tool for executing plan cache queries. Set SKILL_DIR to this skill's installed location (the directory containing this SKILL.md file):
# SKILL_DIR = directory containing this SKILL.md
# Examples: ./skills/database-plan-cache, ~/.claude/skills/database-plan-cache
# List all plan cache tools
ibmi tools --tools "$SKILL_DIR/tools/" --toolset database_plan_cache_default
# Run a specific tool
ibmi tool list_plan_cache_services --tools "$SKILL_DIR/tools/"
# Run with parameters
ibmi tool get_plan_cache_procedure_details --tools "$SKILL_DIR/tools/" --procedure-name DUMP_PLAN_CACHE
# Ad-hoc SQL for plan cache analysis
ibmi sql "SELECT * FROM QSYS2.SERVICES_INFO WHERE SERVICE_CATEGORY = 'DATABASE-PLAN CACHE'"
Plan cache CALL operations require a connection that supports write operations (the default dev system, not a READ_ONLY system).
ibmi tool list_plan_cache_services --tools "$SKILL_DIR/tools/"
ibmi tool get_plan_cache_procedure_details --tools "$SKILL_DIR/tools/" --procedure-name DUMP_PLAN_CACHE_TOPN
ibmi tool list_plan_cache_snapshots --tools "$SKILL_DIR/tools/"
ibmi tool get_plan_cache_management_sql --tools "$SKILL_DIR/tools/"
CALL QSYS2.DUMP_PLAN_CACHE_TOPN(
FILESCHEMA => 'MYLIB',
FILENAME => 'PCTOP50',
TOPN => 50,
CATEGORY => 'TOTAL_TIME');
SELECT QQJOB, QQUSER, QQUCNT, QQETIM, QQSTIM
FROM MYLIB.PCTOP50
ORDER BY QQETIM DESC
FETCH FIRST 20 ROWS ONLY;
The tools/database-plan-cache.yaml file provides 7 ready-to-use tools:
| Tool | Description |
|------|-------------|
| list_plan_cache_services | All plan cache services from SERVICES_INFO |
| get_plan_cache_procedure_details | Parameter info for a specific procedure |
| list_plan_cache_snapshots | Find existing snapshot files across libraries |
| get_plan_cache_snapshot_info | Metadata for a specific snapshot file |
| list_plan_cache_event_monitors | Active and inactive database monitors |
| get_plan_cache_size_info | QSQSRVR job memory and resource usage |
| get_plan_cache_management_sql | Ready-to-use CALL statements for all operations |
ibmi tool <tool_name> --tools "$SKILL_DIR/tools/" # Execute
ibmi tool <tool_name> --tools "$SKILL_DIR/tools/" --dry-run # Preview SQL
ibmi tools show <tool_name> --tools "$SKILL_DIR/tools/" # View details
tools
Query, monitor, and analyze jobs on IBM i using SQL table functions via the ibmi CLI. Use when user asks about: (1) finding jobs by status, user, subsystem, or type, (2) monitoring active job performance (CPU, I/O, memory), (3) detecting long-running SQL statements, (4) analyzing lock contention, (5) checking job queues, (6) scheduled jobs, (7) job logs, (8) replacing WRKACTJOB, WRKUSRJOB, WRKSBSJOB, WRKSBMJOB commands, or (9) any IBM i work management task.
testing
Monitor IBM i system health including CPU, memory, disk, ASPs, system limits, and network status via SQL services. Use when user asks about: (1) CPU utilization or system status, (2) memory pool sizes or page faults, (3) disk capacity or ASP usage, (4) system limits approaching thresholds, (5) TCP/IP connections and network status, (6) system activity overview, (7) replacing WRKSYSSTS, WRKDSKSTS, WRKTCPSTS commands, or (8) any system health monitoring task.
development
Monitor and analyze IBM i storage resources including ASPs, disk units, temporary storage, user storage consumption, and NVMe devices via SQL services. Use when user asks about: (1) ASP capacity, usage, or health, (2) disk unit status or I/O performance, (3) temporary storage consumption by jobs, (4) storage used per user profile, (5) NVMe device health, (6) IASP vary operations, or (7) replacing WRKDSKSTS, WRKSYSSTS storage info, or WRKSTG commands.
testing
Manage and analyze spooled files, output queues, and printer configurations on IBM i via SQL services. Use when user asks about: (1) listing or searching output queues, (2) viewing spooled file entries by queue, user, or status, (3) reading spool file content, (4) identifying top spool consumers or old spool files, (5) printer file definitions, (6) spool storage analysis, (7) replacing WRKSPLF, WRKOUTQ, WRKOBJLCK commands, or (8) any spool file management task.