79
Systems Management with IBM i Services Dawn May - [email protected] IBM Client Programs Manager @DawnMayiCan

Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - [email protected] IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

  • Upload
    buidieu

  • View
    217

  • Download
    2

Embed Size (px)

Citation preview

Page 1: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

Systems Management with IBM i Services

Dawn May - [email protected] IBM Client Programs Manager @DawnMayiCan

Page 2: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

Acknowledgements

Scott Forstie [email protected] DB2 for i Business Architect

© 2016 International Business Machines Corporation 2

Page 3: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

Commands, APIs and tools – consider the options

•  IBM i has a long history of creating Commands and APIs, so much so that we frequently conclude that further investment in these interfaces is the appropriate approach to deliver new capabilities to our customers

•  The subject of this presentation is to explain the role of SQL based interfaces to allow non-DB2 for i products and components to understand that an alternative / additional choice exists

•  Development Cost, Value to the customer and Risk are the important factors to consider for any enhancement

© 2016 International Business Machines Corporation 3

Page 4: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

SQE

Commands, APIs and tools – Why consider SQL?

•  With SQL-based options, consider which interface provides the best “tool for the task”

•  Customer feedback SQL based interfaces has been very positive

•  Besides being easy to use, SQL queries can be used for: –  Selection (WHERE clause) –  Ordering –  Grouping –  Joining –  Top ‘n’ results –  IN, LIKE, NOT, and more…

•  Unleash the power of the DB2 for i query engine

© 2016 International Business Machines Corporation 4

Page 5: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

© 2016 International Business Machines Corporation

New to SQL? Use System i Navigator’s Run SQL Scripts IBM i Navigator (aka System i Navigator)

IBM i Access Windows Service Pack 7.1 – SI57907 è TR11 timed enhancements

Product Download Site: www-03.ibm.com/systems/power/software/i/access/windows_sp.html

Next Planned Update…June, 2016 Right click

5

Page 6: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

No need to start from scratch.

Save and reuse useful scripts.

Navigator’s Run SQL Scripts - Insert from Examples…

© 2016 International Business Machines Corporation 6

Page 7: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

Access Client Solutions …. Run SQL Scripts

© 2016 International Business Machines Corporation 7

New!! http://www-03.ibm.com/systems/power/software/i/access/solutions.html

Page 8: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

Insert from Examples

© 2016 International Business Machines Corporation 8

Page 9: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

IBM i Mobile Access – Run SQL and SQL Wizard

© 2016 International Business Machines Corporation 9

http://www-03.ibm.com/systems/power/software/i/access/mobile.html

Page 10: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

IBM i Services

© 2016 International Business Machines Corporation 10

https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/IBM%20i%20Technology%20Updates/page/DB2%20for%20i%20-%20Services

Page 11: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

SQL catalogs à TCP/IP Services

TCP/IP Services

© 2016 International Business Machines Corporation 11

Page 12: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

QSYS2.TCPIP_INFO – view

The TCPIP_INFO view returns detailed information for the current connection. Client/server identification, logging and other instrumentation is possible using SQL. SELECT * from QSYS2.TCPIP_INFO;

Port 8471 – as_database service

© 2016 International Business Machines Corporation 12

Page 13: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

TCPIP_INFO – example usage

Well defined port numbers – http://www-01.ibm.com/support/knowledgecenter/ssw_ibm_i_72/rzajr/rzajrservicesandports.htm?lang=en

Now it’s possible (and easy) to deploy interface specific logic with SQL

© 2016 International Business Machines Corporation 13

Page 14: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

TCPIP_INFO – Trigger example

This trigger can have conditional logic when running within a QZDASOINIT job.

Varies by the caller à

© 2016 International Business Machines Corporation 14

Page 15: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

Dilemma - Database server connectivity is popular, but lacks granular systems management controls because all connections end up using the same subsystem (QUSRWRK). Enhancement - This procedure can be used to configure alternate subsystems by user and IBM i server name. This allows an IBM i administrator to route users into subsystems that are configured to meet user expectations or to protect overall system resources. Procedure QSYS2.SET_SERVER_SBS_ROUTING() Procedure Parameters: 1.  Authorization Name

The user profile name 2.  Server Name

QZDASOINIT, QRWTSRVR or ALL QZRCSRVS added in TR11/TR3

3.  Alternate Subsystem Name The name of the subsystem to use

Authorization name can be: ü  User name ü  Group name ü  Supplemental Group name

Added in TR10 / TR2 Enhanced in TR11 / TR3 QSYS2.SET_SERVER_SBS_ROUTING() – Procedure

© 2016 International Business Machines Corporation 15

Page 16: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

Catalog QSYS2.SERVER_SBS_ROUTING is used to access the alternative subsystem user configuration. •  AUTHORIZATION_NAME

The user profile that should use an alternate subsystem for their activity.

•  QRWTSRVR_SUBSYSTEM The subsystem to be used for incoming DRDA or DDM connections for this user.

•  QZDASOINIT_SUBSYSTEM The subsystem to be used for incoming Database server connections for this user.

•  QZRCSRVS_SUBSYSTEM The subsystem to be used for incoming Remote Command server connections for this user.

The configuration detail is stored within the *USRPRF object. Retained across Save/Restore, Upgrade, etc… Authorization requirements to change the configuration: •  *SECADM user special authority •  *OBJMGT and *USE to the target *USRPRF

QSYS2.SERVER_SBS_ROUTING – View

Added in TR10 / TR2 Enhanced in TR11 / TR3

© 2016 International Business Machines Corporation 16

Page 17: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

Example: Construct a subsystem that will constrain the amount of system resources available to users who are known to execute ad hoc queries. CRTSBSD SBSD(QGPL/ADHOCSBS) POOLS((1 *BASE)) TEXT(’Ad hoc users SBS’) CRTJOBQ QGPL/ADHOCJOBQ TEXT(’Ad hoc users job queue’) ADDJOBQE SBSD(QGPL/ADHOCSBS) JOBQ(QGPL/ADHOCJOBQ) MAXACT(100) SEQNBR(40) CRTCLS CLS(QGPL/ADHOCCLS) RUNPTY(55) TIMESLICE(100) TEXT(’Ad hoc class’) ADDPJE SBSD(QGPL/ADHOCSBS) PGM(QSYS/QRWTSRVR) JOBD(QGPL/QDFTSVR)

CLS(QGPL/ADHOCCLS) ADDPJE SBSD(QGPL/ADHOCSBS) PGM(QSYS/QZDASOINIT) JOBD(QGPL/QDFTSVR)

CLS(QGPL/ADHOCCLS) STRSBS SBSD(QGPL/ADHOCSBS)

CALL QSYS2.SET_SERVER_SBS_ROUTING(’SLFUSER’,’*ALL’,’ADHOCSBS’) SELECT * FROM QSYS2.SERVER_SBS_ROUTING

QSYS2.SET_SERVER_SBS_ROUTING() – Procedure

© 2016 International Business Machines Corporation 17

Page 18: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

Other TCP/IP Services

•  NETSTAT_INTERFACE_INFO –  Returns information about IPv4 and IPv6 network interfaces –  Sort of like Netstat options 1 and 4

•  NETSTAT_ROUTE_INFO –  Returns information about IPv4 and IPv6 routes –  Sort of like Netstat options 2 and 5 but more

•  NETSTAT_INFO

–  Returns information about IPv4 and IPv6 network connections –  Sort of like Netstat options 3 and 6

© 2016 International Business Machines Corporation 18

Page 19: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

Other TCP/IP Services – NETSTAT_JOB_INFO

•  NETSTAT_JOB_INFO –  Returns information about jobs using IPv4 and IPv6 network connections –  Sort of like Netstat option 3 (or 6) then option 8 (display jobs)

© 2016 International Business Machines Corporation 19

Page 20: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

PTF Services

SQL catalogs à Program Temporary Fix (PTF)

© 2016 International Business Machines Corporation 20

Page 21: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

•  Use SQL to interrogate PTF Group information •  Alternative to the Work with PTF Groups (WRKPTFGRP) command

•  This command has no OUTPUT(*OUTFILE) capability, the command is not easily consumable from a program

-- What PTF Groups will change on the next IPL? SELECT * FROM QSYS2.GROUP_PTF_INFO WHERE PTF_GROUP_STATUS = ‘APPLY AT NEXT IPL’ ORDER BY PTF_GROUP_LEVEL DESC;

-- What is the most recently installed CUM? SELECT MAX(PTF_GROUP_LEVEL) AS CUM_LEVEL FROM QSYS2.GROUP_PTF_INFO WHERE PTF_GROUP_NAME IN (‘SF99610’,‘SF99710’) AND PTF_GROUP_STATUS = ‘INSTALLED’;

QSYS2.GROUP_PTF_INFO – view

© 2016 International Business Machines Corporation 21

Page 22: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

Explore the catalog columns and detail… SELECT * FROM QSYS2.GROUP_PTF_INFO;

QSYS2.GROUP_PTF_INFO – view

© 2016 International Business Machines Corporation 22

Page 23: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

•  Interrogate individual PTF information using SQL •  Data returned is similar to the QpzListPTF() API output •  Use SQL to formalize prerequisite checks within software products

-- I’m about to IPL, will the IPL impact PTF state? SELECT PTF_IDENTIFIER, PTF_IPL_ACTION, A.* FROM QSYS2.PTF_INFO A WHERE PTF_IPL_ACTION <> 'NONE‘;

QSYS2.PTF_INFO – view

© 2016 International Business Machines Corporation 23

Page 24: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

SYSTOOLS.GROUP_PTF_CURRENCY View

SELECT * from SYSTOOLS.GROUP_PTF_CURRENCY WHERE PTF_GROUP_RELEASE = ‘R720’ ORDER BY ptf_group_level_available - ptf_group_level_installed DESC;

Current or behind on service?

PTF Group Info

Level installed on this partition

Level available from IBM

Date that IBM last updated this group

© 2016 International Business Machines Corporation 24

Page 25: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

•  Use SQL to interrogate PTF Group detailed information •  Live comparison of the PTFs within PTF Groups installed on the partition

against the service levels listed on the IBM Preventive Service Planning website.

•  Review the details for the PTFs which have not yet been applied for the PTF groups installed on this partition. SELECT * FROM SYSTOOLS.GROUP_PTF_DETAILS WHERE PTF_STATUS <> 'PTF APPLIED' ORDER BY PTF_GROUP_NAME

QSYS2.GROUP_PTF_DETAILS – view

© 2016 International Business Machines Corporation 25

Page 26: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

Work Management Services SQL catalogs à Work Management Services

© 2016 International Business Machines Corporation 26

Page 27: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

•  Returns the same data as the Retrieve System Values (QWCRSVAL) API •  *ALLOBJ or *AUDIT special authority is required to retrieve the values for QAUDCTL,

QAUDENDACN, QAUDFRCLVL, QAUDLVL, QAUDLVL2, and QCRTOBJAUD (‘*NOTAVL’ or -1 are returned when accessed by an unauthorized user):

Catalog definition:

SYSTEM_VALUE_NAME VARCHAR(10) – Name of the system value CURRENT_NUMERIC_VALUE BIGINT – System value when binary data is returned CURRENT_CHARACTER_VALUE VARGRAPHIC(1280) – System value when character data is returned

-- Examine the system values related to maximums

SELECT * FROM QSYS2.SYSTEM_VALUE_INFO WHERE SYSTEM_VALUE_NAME LIKE '%MAX%' ORDER BY SYSTEM_VALUE_NAME;

QSYS2.SYSTEM_VALUE_INFO – view

© 2016 International Business Machines Corporation 27

Page 28: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

DECLARE GLOBAL TEMPORARY TABLE SESSION . Remote_System_Values

( SYSTEM_VALUE_NAME,CURRENT_NUMERIC_VALUE,CURRENT_CHARACTER_VALUE )

AS (SELECT * FROM X1423P2.QSYS2.SYSTEM_VALUE_INFO) WITH DATA

WITH REPLACE;

SELECT 'LP13UT16' AS "System Name", A.SYSTEM_VALUE_NAME,A.CURRENT_NUMERIC_VALUE,A.CURRENT_CHARACTER_VALUE FROM QSYS2.SYSTEM_VALUE_INFO A

LEFT EXCEPTION JOIN SESSION.Remote_System_Values B

ON A.SYSTEM_VALUE_NAME = B.SYSTEM_VALUE_NAME AND

A.CURRENT_NUMERIC_VALUE IS NOT DISTINCT FROM B.CURRENT_NUMERIC_VALUE AND

A.CURRENT_CHARACTER_VALUE IS NOT DISTINCT FROM B.CURRENT_CHARACTER_VALUE

UNION ALL

SELECT 'X1423P2' AS "System Name", B.SYSTEM_VALUE_NAME,B.CURRENT_NUMERIC_VALUE,B.CURRENT_CHARACTER_VALUE FROM QSYS2.SYSTEM_VALUE_INFO A

RIGHT EXCEPTION JOIN SESSION.Remote_System_Values B

ON A.SYSTEM_VALUE_NAME = B.SYSTEM_VALUE_NAME AND

A.CURRENT_NUMERIC_VALUE IS NOT DISTINCT FROM B.CURRENT_NUMERIC_VALUE AND

A.CURRENT_CHARACTER_VALUE IS NOT DISTINCT FROM B.CURRENT_CHARACTER_VALUE

ORDER BY SYSTEM_VALUE_NAME;

Remote 3-part DGTT

statement

Use a query to find the SYSVAL

differences between the two systems

QSYS2.SYSTEM_VALUE_INFO – view

© 2016 International Business Machines Corporation 28

Page 29: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

Example exception join output using SYSTEM_VALUE_INFO.

QSYS2.SYSTEM_VALUE_INFO – view

© 2016 International Business Machines Corporation 29

Page 30: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

The SCHEDULED_JOB_INFO view returns information similar to the Work with Job Schedule Entries (WRKJOBSCDE) command interface. Each row reflects the details related to each scheduled job.

Example: Review the job scheduled entries which are no longer in effect, either because they were explicitly held or because they were scheduled to run a single time and the date has passed. SELECT * FROM QSYS2.SCHEDULED_JOB_INFO WHERE STATUS IN (’HELD’, ’SAVED’) ORDER BY SCHEDULED_BY

Use SQL to level check (exception join) between production & HA or DR

QSYS2.SCHEDULED_JOB_INFO – view

© 2016 International Business Machines Corporation 30

Page 31: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

The ACTIVE_JOB_INFO table function returns one row for every active job. The information returned is similar to the detail seen from the Work with Active Jobs (WRKACTJOB) command and the Open List of Jobs (QGYOLJOB) API. The ACTIVE_JOB_INFO table function has two uses: 1. To retrieve details for active jobs. Optional parameters can be used to filter the jobs. 2. To measure elapsed statistics for active jobs. An optional parameter can be used to reset statistics. UDTF Parameters: 1.  RESET_STATISTICS (YES or NO)

Establish a new baseline for elapsed time measurements 2.  SUBSYSTEM_LIST_FILTER

Optional list of up to 25 subsystem names 3.  JOB_NAME_FILTER

Optional generic name or special values 4.  CURRENT_USER_LIST_FILTER

Optional list of up to 10 user profile names

Additional filtering is also available using the WHERE clause

QSYS2.ACTIVE_JOB_INFO() – UDTF

© 2016 International Business Machines Corporation 31

Page 32: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

Example 1: Examine active Host Server jobs and find the top consumers SELECT JOB_NAME, AUTHORIZATION_NAME, ELAPSED_CPU_PERCENTAGE,ELAPSED_TOTAL_DISK_IO_COUNT, ELAPSED_PAGE_FAULT_COUNT, X.*

FROM TABLE(ACTIVE_JOB_INFO( JOB_NAME_FILTER => 'QZDASOINIT', SUBSYSTEM_LIST_FILTER => 'QUSRWRK')) x

ORDER BY ELAPSED_CPU_PERCENTAGE DESC FETCH FIRST 10 ROWS ONLY

“ELAPSED_” columns reflect the time period after the initial call or after RESET_STATISTICS => ‘YES’ is used.

QSYS2.ACTIVE_JOB_INFO() – UDTF

© 2016 International Business Machines Corporation 32

Page 33: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

Example 2: Find the top 4 consumers of temporary storage, by memory pool WITH TOP_CONSUMERS(JOB_NAME, MEMORY_POOL, AUTHORIZATION_NAME, FUNCTION_TYPE, FUNCTION, TEMPORARY_STORAGE, Ranking) AS ( SELECT JOB_NAME, MEMORY_POOL, AUTHORIZATION_NAME, FUNCTION_TYPE, FUNCTION, TEMPORARY_STORAGE, RANK() OVER (PARTITION BY MEMORY_POOL ORDER BY TEMPORARY_STORAGE DESC)

FROM TABLE (ACTIVE_JOB_INFO()) x WHERE JOB_TYPE <> 'SYS‘ ) SELECT JOB_NAME, MEMORY_POOL, AUTHORIZATION_NAME, FUNCTION_TYPE CONCAT '-' CONCAT FUNCTION AS FUNCTION, TEMPORARY_STORAGE, Ranking FROM TOP_CONSUMERS WHERE Rank IN (1,2,3,4) ORDER BY MEMORY_POOL DESC, Ranking

QSYS2.ACTIVE_JOB_INFO() – UDTF

© 2016 International Business Machines Corporation 33

Page 34: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

Example 3: Mine the active job detail by Subsystem & by User

SELECT CASE WHEN SUBSYSTEM IS NULL THEN 'SYSTEM' ELSE SUBSYSTEM END AS SBS_NAME, COUNT(*) AS JOBS_IN_SBS FROM TABLE (active_job_info()) x GROUP BY SUBSYSTEM ORDER BY JOBS_IN_SBS DESC

SELECT AUTHORIZATION_NAME, COUNT(*) AS JOBS_BY_USER FROM TABLE (active_job_info()) x GROUP BY AUTHORIZATION_NAME ORDER BY JOBS_BY_USER DESC

QSYS2.ACTIVE_JOB_INFO() – UDTF

© 2016 International Business Machines Corporation 34

Page 35: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

The GET_JOB_INFO() UDTF returns a single row of data containing extended information for a specific job. This UDTF has access to any data available to the QUSRJOBI() API. Result columns return detail related to SQL activity in the job.

Additional Result Columns: •  V_SQL_STMT_STATUS – The status of the SQL within this job.

(ACTIVE or COMPLETE)

•  V_SQL_STMT_START_TIMESTAMP – The timestamp indicating the execution start time for an active SQL statement.

•  V_QUERY_OPTIONS_LIB_NAME – The name of the QAQQINI options library in use for this job.

QSYS2.GET_JOB_INFO() – UDTF

© 2016 International Business Machines Corporation 35

Page 36: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

Example: Use ACTIVE_JOB_INFO and GET_JOB_INFO to find the longest running SQL statements.

WITH ACTIVE_USER_JOBS (Q_JOB_NAME, CPU_TIME, RUN_PRIORITY) AS ( SELECT JOB_NAME, CPU_TIME, RUN_PRIORITY FROM TABLE (ACTIVE_JOB_INFO('NO','','','')) x WHERE JOB_TYPE <> 'SYS' ) SELECT Q_JOB_NAME, CPU_TIME, RUN_PRIORITY, V_SQL_STATEMENT_TEXT, CURRENT TIMESTAMP - V_SQL_STMT_START_TIMESTAMP AS SQL_STMT_DURATION, B.* FROM ACTIVE_USER_JOBS, TABLE(QSYS2.GET_JOB_INFO(Q_JOB_NAME)) B WHERE V_SQL_STMT_STATUS = 'ACTIVE' ORDER BY SQL_STMT_DURATION DESC

QSYS2.GET_JOB_INFO() – UDTF

© 2016 International Business Machines Corporation 36

Page 37: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

Memory Pool

•  MEMORY_POOL_INFO View –  Returns one row for every active memory pool –  Similar to information on WRKSYSSTS

§  With all views in one row

§  SELECT * FROM QSYS2.MEMORY_POOL_INFO;

•  MEMORY_POOL table function –  Use this to reset the statistics

© 2016 International Business Machines Corporation 37

Page 38: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

System Status

•  SYSTEM_STATUS_INFO View –  Returns one row with details about the partition –  Similar to information on WRKSYSSTS and WRKSYSACT

§  SELECT * FROM QSYS2.SYSTEM_STATUS_INFO;

•  SYSTEM_STATUS table function –  Use this to reset the statistics

© 2016 International Business Machines Corporation 38

Page 39: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

OBJECT_LOCK_INFO

•  Returns info similar to WRKOBJLCK –  The locked object –  The lock info –  The lock holder

•  Returns one row for every lock held for every object on the partition •  Member locks included for files •  View over (potentially) all objects on the system

–  Make sure to use a where clause! SELECT * FROM QSYS2.OBJECT_LOCK_INFO WHERE SYSTEM_OBJECT_NAME = 'SALES'

© 2016 International Business Machines Corporation 39

Page 40: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

RECORD_LOCK_INFO

•  Returns similar info to DSPRCDLCK –  The file –  The lock –  The lock holder

•  Returns one row for every record lock for the partition. •  View over (potentially) all members on the system

–  Make sure to use a where clause!

© 2016 International Business Machines Corporation 40

Page 41: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

SQL catalogs à Command Services

Java Services

© 2016 International Business Machines Corporation 41

Page 42: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

The QSYS2.JVM_INFO view returns information about active Java Virtual Machine jobs. This is a programmatic alternative to using the Work with JVM Jobs (WRKJVMJOB) command.

WRKJVMJOB has no OUTPUT parameter. Use JVM_INFO to incorporate JVM job detail into your systems management solution

QSYS2.JVM_INFO – View

© 2016 International Business Machines Corporation 42

Page 43: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

Example: Find the top 10 JVM jobs by the total amount of time spent in Garbage Collection SELECT TOTAL_GC_TIME, GC_CYCLE_NUMBER, JAVA_THREAD_COUNT, A.* FROM QSYS2.JVM_INFO A ORDER BY TOTAL_GC_TIME DESC FETCH FIRST 10 ROWS ONLY

IBM’s Must Gather Tools (QMGTOOLS) have been enhanced to use JVM_INFO http://www-01.ibm.com/support/docview.wss?uid=nas8N1011297

QSYS2.JVM_INFO – View

© 2016 International Business Machines Corporation 43

Page 44: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

The QSYS2.SET_JVM() procedure can be used to manage specific JVM jobs.

Use JVM_INFO to identify jobs of interest and automate collection of detail.

SET_JVM() Actions GC_ENABLE_VERBOSE GC_DISABLE_VERBOSE GENERATE_HEAP_DUMP GENERATE_SYSTEM_DUMP GENERATE_JAVA_DUMP

Example: Change a specific web admin JVM to provide verbose garbage collection details: CALL QSYS2.SET_JVM(’121376/QWEBADMIN/ADMIN4’,’GC_ENABLE_VERBOSE’)

QSYS2.SET_JVM() – Procedure

© 2016 International Business Machines Corporation 44

Page 45: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

SQL catalogs à Command Services

Librarian Services

© 2016 International Business Machines Corporation 45

Page 46: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

•  With direct access to the library list, SQL users can tap into the library list detail to: •  Programmatically review the environment •  Know when the library list needs to be adjusted •  Derive information about the libraries

•  IASP Number •  Schema vs Library name mapping •  User vs System vs Product libraries •  Above all else, order of libraries searched for unqualified objects

-- Programmatically review the library list detail for this connection SELECT * FROM QSYS2.LIBRARY_LIST_INFO;

QSYS2.LIBRARY_LIST_INFO – view

© 2016 International Business Machines Corporation 46

Page 47: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

•  The SYSCATALOGS catalog mirrors the Relational Database Entries (WRKRDBDIRE)

•  The catalog returns status information for Independent ASPs (iASPs) •  CATALOG_STATUS values

•  AVAILABLE – available for use •  ACTIVE – In the process of becoming available •  VARYON – About to begin the vary on process •  VARYOFF – Offline, not useable

-- Query the existence & state of the local database and iASPs SELECT CATALOG_NAME, CATALOG_STATUS, CATALOG_ASPNUM FROM

QSYS2.SYSCATALOGS WHERE CATALOG_TYPE = 'LOCAL‘;

QSYS2.SYSCATALOGS – view

© 2016 International Business Machines Corporation 47

Page 48: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

SQL catalogs à Command Services

Message Handling Services

© 2016 International Business Machines Corporation 48

Page 49: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

•  One reply list handles system wide automatic response to messages •  Now, SQL can be used to:

•  Compare (exception join) the configuration of two machines •  Determine whether a specific sequence number is already in use •  Confirm whether setup is complete

•  REPLY_LIST_INFO matches the Work Reply List Entry (WRKRPYLE) command behavior of allowing *PUBLIC users to view the reply list information

-- Review reply list detail for all messages which begin with ‘CPA’

SELECT * FROM QSYS2.REPLY_LIST_INFO WHERE message_ID like 'CPA%‘;

QSYS2.REPLY_LIST_INFO – view

© 2016 International Business Machines Corporation 49

Page 50: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

•  Job logs contain essential information. •  To understand a failure, job log messages are reviewed •  To understand which CL commands were issued, REQUEST messages in

the job log are reviewed •  Even though trace and failure collection instrumentation exists, job logs are

frequently requested by IBM Service •  The JOBLOG_INFO() UDTF provides a new service for application developers

and system managers •  A single parameter indicates the target job. •  ‘*’ can be used to indicate use the current job as the target. -- Find the most recently executed command in a target job SELECT MESSAGE_TEXT FROM

TABLE(QSYS2.JOBLOG_INFO('706721/SCOTTF/QPADEV0006')) A WHERE A.MESSAGE_TYPE = 'REQUEST' ORDER BY ORDINAL_POSITION DESC FETCH FIRST 1 ROW ONLY;

QSYS2.JOBLOG_INFO – UDTF

© 2016 International Business Machines Corporation 50

Page 51: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

-- Saving job log detail to a permanent table CREATE TABLE APPLIB.Joblog_Detail AS (SELECT QSYS2.JOB_NAME, A.* FROM

TABLE(QSYS2.JOBLOG_INFO('*')) A) WITH NO DATA; CREATE OR REPLACE PROCEDURE TOYSTORE.UPDATE_SALES (IN P_NEW_SALES INTEGER, IN P_SALES_PERSON VARCHAR(100), IN P_SALES_DATE CHAR(10)) LANGUAGE SQL MODIFIES SQL DATA Mainline: BEGIN DECLARE EXIT HANDLER FOR SQLEXCEPTION INSERT INTO APPLIB.Joblog_Detail SELECT QSYS2.JOB_NAME, A.* FROM TABLE(QSYS2.JOBLOG_INFO('*')) A ORDER BY ORDINAL_POSITION DESC FETCH FIRST 5 ROWS ONLY; UPDATE TOYSTORE.SALES SET SALES = SALES + P_NEW_SALES WHERE SALES_PERSON = P_SALES_PERSON AND SALES_DATE = P_SALES_DATE; END Mainline;

QSYS2.JOBLOG_INFO – UDTF

© 2016 International Business Machines Corporation 51

Page 52: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

Example: Find active QSQSRVR jobs and the owning application job order the results by top CPU consumers WITH tt (authorization_name, job_name, cpu_time, total_disk_io_count) AS ( select authorization_name, job_name, cpu_time, total_disk_io_count from table(qsys2.active_job_info( SUBSYSTEM_LIST_FILTER=>'QSYSWRK', JOB_NAME_FILTER=>'QSQSRVR')) x ) select authorization_name, ss.message_text, job_name, cpu_time, total_disk_io_count from tt, table(qsys2.joblog_info(job_name)) ss where message_id = 'CPF9898' and from_program = 'QSQSRVR'

ORDER BY CPU_TIME DESC;

ACTIVE_JOB_INFO() & JOBLOG_INFO()

© 2016 International Business Machines Corporation 52

Page 53: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

SQL catalogs à Security Services

Security Services

© 2016 International Business Machines Corporation 53

Page 54: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

Use SQL to understand: •  What Group Profiles exist •  Which User Profiles belong to specific Group Profiles •  The text associated with the profile Handles both: Group profile . . . . . . . . . GRPPRF Supplemental groups . . SUPGRPPRF -- Examine all groups and the group members SELECT * from qsys2.group_profile_entries;

QSYS2.GROUP_PROFILE_ENTRIES – view

© 2016 International Business Machines Corporation 54

Page 55: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

•  Built upon the data returned by the Retrieve User Information (QSYRUSRI) API. •  Users see the data for any *USRPRF to which they have *READ authority •  Setup details, authorizations, and more… easy access to deep details

-- Which users are having trouble signing on?

SELECT * FROM QSYS2.USER_INFO

WHERE SIGN_ON_ATTEMPTS_NOT_VALID > 0;

QSYS2.USER_INFO – view

© 2016 International Business Machines Corporation 55

Page 56: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

•  Leverage multiple services to answer more interesting questions

-- -- Which users have *ALLOBJ authority either directly -- or via a Group or Supplemental profile? -- SELECT AUTHORIZATION_NAME, STATUS, NO_PASSWORD_INDICATOR,

PREVIOUS_SIGNON, TEXT_DESCRIPTION FROM QSYS2.USER_INFO WHERE SPECIAL_AUTHORITIES LIKE '%*ALLOBJ%' OR AUTHORIZATION_NAME IN (

SELECT USER_PROFILE_NAME FROM QSYS2.GROUP_PROFILE_ENTRIES WHERE GROUP_PROFILE_NAME IN (

SELECT AUTHORIZATION_NAME FROM QSYS2.USER_INFO WHERE SPECIAL_AUTHORITIES like '%*ALLOBJ%' )

) ORDER BY AUTHORIZATION_NAME;

USER_INFO & GROUP_PROFILE_ENTRIES

© 2016 International Business Machines Corporation 56

Page 57: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

•  Query results…excess authority! USER_INFO & GROUP_PROFILE_ENTRIES

© 2016 International Business Machines Corporation 57

Page 58: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

•  The detail returned corresponds to the data returned by the Retrieve Function Usage Information (QSYRTFUI, QsyRetrieveFunctionUsageInfo) API.

•  Only users with *SECADM user special authority can examine the function usage configuration details returned with this view. Users without *SECADM authority who attempt to reference this view will get SQLCODE -443.

•  Each row corresponds with users or groups that have function usage settings Example: -- What function usage has been granted or revoked?

SELECT * FROM QSYS2.FUNCTION_USAGE ORDER BY FUNCTION_ID, USER_NAME;

QSYS2.FUNCTION_USAGE – view

© 2016 International Business Machines Corporation 58

Page 59: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

The DRDA_AUTHENTICATION_ENTRY_INFO can be used to assess, track and compare DRDA & DDM user access. Prior to this catalog, the Display Server Authentication Entries (DSPSVRAUTE) command had to be used, one user at a time.

SELECT * FROM QSYS2.DRDA_AUTHENTICATION_ENTRY_INFO ORDER BY AUTHORIZATION_NAME, SERVER_NAME

Special values can appear under Server_Name

QSYS2.DRDA_AUTHENTICATION_ENTRY_INFO – View

© 2016 International Business Machines Corporation 59

Page 60: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

SQL catalogs à Storage Services

Storage Services

© 2016 International Business Machines Corporation 60

Page 61: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

•  Built upon the data returned by the Retrieve User Information (QSYRUSRI) API. •  Users see the data for any *USRPRF to which they have *READ authority •  User storage is broken down by SYSBAS and iASPs

-- How much storage has user SCOTTF consumed?

SELECT * FROM QSYS2.USER_STORAGE

WHERE USER_NAME = ‘SCOTTF’;

QSYS2.USER_STORAGE – view

© 2016 International Business Machines Corporation 61

Page 62: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

-- Review the top 10 storage consumers

SELECT A.AUTHORIZATION_NAME, SUM(A.STORAGE_USED) AS TOTAL_STORAGE_USED, B.TEXT_DESCRIPTION, B.ACCOUNTING_CODE, B.MAXIMUM_ALLOWED_STORAGE

FROM QSYS2.USER_STORAGE A

INNER JOIN QSYS2.USER_INFO B ON B.USER_NAME = A.AUTHORIZATION_NAME

GROUP BY A.AUTHORIZATION_NAME, B.TEXT_DESCRIPTION, B.ACCOUNTING_CODE, B.MAXIMUM_ALLOWED_STORAGE

ORDER BY TOTAL_STORAGE_USED DESC FETCH FIRST 10 ROWS ONLY;

QSYS2.USER_STORAGE – view

© 2016 International Business Machines Corporation 62

Page 63: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

QSYS2.SYSTMPSTG – view •  Observe System-wide Temporary storage consumption

via a new DB2 for i Service: QSYS2.SYSTMPSTG •  Read all about it in IBM Knowledge Center:

www.ibm.com/support/knowledgecenter/ssw_ibm_i_72/rzajq/rzajqviewsystmpstg.htm -- Which active jobs are the top consumers of temporary storage? SELECT bucket_current_size, bucket_peak_size, rtrim(job_number) concat '/' concat rtrim(job_user_name) concat '/' concat rtrim(job_name) as q_job_name

FROM QSYS2.SYSTMPSTG WHERE job_status = '*ACTIVE' ORDER BY bucket_current_size desc;

Improved System Management

with DB2 for i

© 2016 International Business Machines Corporation 63

Page 64: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

QSYS2.SYSTMPSTG – view

•  Combine services to extract more detail -- Which active database server connections

-- are consuming the most temporary storage

WITH TOP_TMP_STG (bucket_current_size, q_job_name) AS (

SELECT bucket_current_size, rtrim(job_number) concat '/' concat rtrim(job_user_name) concat '/' concat rtrim(job_name) as q_job_name

FROM QSYS2.SYSTMPSTG

WHERE job_status = '*ACTIVE' AND JOB_NAME IN ('QZDASOINIT', 'QZDASSINIT', 'QRWTSRVR', 'QSQSRVR')

ORDER BY bucket_current_size desc fetch first 10 rows only

) SELECT bucket_current_size, q_job_name, V_SQL_STATEMENT_TEXT, B.* FROM TOP_TMP_STG, TABLE(QSYS2.GET_JOB_INFO(q_job_name)) B;

Improved System Management

with DB2 for i

© 2016 International Business Machines Corporation 64

Page 65: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

SQL catalogs à Command Services

Application Services

© 2016 International Business Machines Corporation 65

Page 66: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

The QCMDEXC procedure can be used within SQL applications to easily execute CL Commands. Examples:

•  DECLARE V_CPYLIB_COMMAND VARCHAR(500); DECLARE V_CPYLIB_LEN DECIMAL(15, 5); SET V_CPYLIB_COMMAND = 'CPYLIB FROMLIB(' CONCAT RTRIM(V_LIBRARY) CONCAT ') TOLIB(' CONCAT RTRIM(V_NEW_LIBRARY) CONCAT ') DATA(*NO)‘; SET V_CPYLIB_LEN = CHARACTER_LENGTH(V_CPYLIB_COMMAND); CALL QSYS2.QCMDEXC(V_CPYLIB_COMMAND, V_CPYLIB_LEN);

•  CALL QSYS2.QCMDEXC('ADDLIBLE PRODLIB2',17);

•  Length argument no longer required: CALL QSYS2.QCMDEXC('ADDLIBLE PRODLIB2');

QSYS2.QCMDEXC – Procedure

© 2016 International Business Machines Corporation 66

Page 67: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

Other Services

© 2016 International Business Machines Corporation 67

Page 68: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

7.2 TR1 and 7.1 TR11 – New and Enhanced IBM i Services

© 2016 International Business Machines Corporation 68

Page 69: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

SQL catalogs à Landscape view

Landscape

© 2016 International Business Machines Corporation 69

Page 70: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

SYSTOOLS.ACT_ON_INDEX_ADVICE – PROCEDURE SYSTOOLS.HARVEST_INDEX_ADVICE – PROCEDURE

QSYS2.OVERRIDE_QAQQINI – PROCEDURE QSYS2.RESET_TABLE_INDEX_STATISTICS – PROCEDURE

QSYS2.SYSIXADV – TABLE SYSTOOLS.REMOVE_INDEXES – PROCEDURE

QSYS2.DATABASE_MONITOR_INFO – VIEW

Performance Services

QSYS2.HEALTH_ACTIVITY QSYS2.HEALTH_DATABASE_OVERVIEW QSYS2.HEALTH_DESIGN_LIMITS QSYS2.HEALTH_ENVIRONMENTAL_LIMITS QSYS2.HEALTH_SIZE_LIMITS QSYS2.RESET_ENVIRONMENTAL_LIMITS

Health Center Procedures

PTF Services QSYS2.PTF_INFO – VIEW

QSYS2.GROUP_PTF_INFO – VIEW SYSTOOLS.GROUP_PTF_CURRENCY – VIEW

http://ibm.biz/DB2foriServices http://www.ibm.com/developerworks/ibmi/techupdates/db2/landscape

QSYS2.CANCEL_SQL QSYS2.DUMP_SQL_CURSORS QSYS2.EXTRACT_STATEMENTS QSYS2.FIND_AND_CANCEL_QSQSRVR_SQL QSYS2.FIND_QSQSRVR_JOBS QSYS2.GENERATE_SQL QSYS2.RESTART_IDENTITY SYSTOOLS.CHECK_CST SYSTOOLS.CHECK_SYSROUTINE

Utility Procedures Security Services QSYS2.FUNCTION_INFO – VIEW

QSYS2.FUNCTION_USAGE – VIEW QSYS2.GROUP_PROFILE_ENTRIES – VIEW

SYSPROC.SET_COLUMN_ATTRIBUTE – PROCEDURE QSYS2.SQL_CHECK_AUTHORITY – UDF

QSYS2.USER_INFO – VIEW QSYS2.DRDA_AUTHENTICATION_ENTRY_INFO – VIEW

TCP/IP Services QSYS2.TCPIP_INFO – VIEW

SYSIBMADM.ENV_SYS_INFO – VIEW QSYS2.SET_SERVER_SBS_ROUTING – PROCEDURE

QSYS2.SERVER_SBS_ROUTING – VIEW

Work Management Services QSYS2.SYSTEM_VALUE_INFO – VIEW

QSYS2.GET_JOB_INFO – UDTF QSYS2.ACTIVE_JOB_INFO – UDTF

QSYS2.SCHEDULED_JOB_INFO – VIEW

QSYS2.CHANGE_PLAN_CACHE_SIZE QSYS2.DUMP_PLAN_CACHE QSYS2.DUMP_PLAN_CACHE_PROPERTIES QSYS2.DUMP_PLAN_CACHE_topN QSYS2.DUMP_SNAP_SHOT_PROPERTIES QSYS2.END_ALL_PLAN_CACHE_EVENT_MONITORS QSYS2.END_PLAN_CACHE_EVENT_MONITOR QSYS2.START_PLAN_CACHE_EVENT_MONITOR (2) QSYS2.CLEAR_PLAN_CACHE

Plan Cache Procedures

System Health Services QSYS2.SYSLIMTBL – TABLE

QSYS2.SYSLIMITS – VIEW QSYS2.OVERRIDE_TABLE – PROCEDURE

QSYS2.DELIMIT_NAME – UDF SYSPROC.WLM_SET_CLIENT_INFO – PROCEDURE

Application Services

Journal Services QSYS2.DISPLAY_JOURNAL – UDTF

QSYS2.JOURNAL_INFO – VIEW

Storage Services QSYS2.SYSDISKSTAT – VIEW

QSYS2.SYSTMPSTG – VIEW QSYS2.USER_STORAGE – VIEW

IBM® DB2® for i Services

QSYS2.QCMDEXC – PROCEDURE

Librarian Services QSYS2.LIBRARY_LIST_INFO – VIEW

QSYS2.OBJECT_STATISTICS – UDTF

Message Handling Services QSYS2.JOBLOG_INFO – UDTF

QSYS2.REPLY_LIST_INFO – VIEW

Java Services QSYS2.JVM_INFO – VIEW

QSYS2.SET_JVM – PROCEDURE

DB2 for i Services IBM i Services New or Enhanced in the DB2 PTF Group for IBM i 7.2 TR2 & IBM 7.1 TR10

© 2016 International Business Machines Corporation 70

Page 71: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

SYSCATALOGS

INFORMATION_SCHEMA_CATALOG_NAME

Catalogs

IBM® DB2® for i Catalogs

SQLSCHEMAS

SCHEMATA

Schemas

SYSSCHEMAS

SYSCHKCST SYSCST SYSCSTCOL SYSCSTDEP SYSKEYCST SYSREFCST

SQLFOREIGNKEYS SQLPRIMARYKEYS

CHECK_CONSTRAINTS REFERENTIAL_CONSTRAINTS TABLE_CONSTRAINTS

Constraints

SYSCOLUMNS SYSCOLUMNS2 SYSFIELDS SYSINDEXES SYSKEYS SYSTABLEDEP SYSTABLES SYSVIEWDEP SYSVIEWS

SQLCOLUMNS SQLSPECIALCOLUMNS SQLTABLES

COLUMNS TABLES VIEWS

Tables Views Indexes

SYSTRIGCOL SYSTRIGDEP SYSTRIGGERS SYSTRIGUPD

Triggers SYSPACKAGE SYSSEQUENCES SYSTYPES SYSVARIABLEDEP SYSVARIABLES

SQLTYPEINFO SQLUDTS

USER_DEFINED_TYPES SEQUENCES

Miscellaneous Objects

SYSFUNCS SYSJARCONTENTS SYSJAROBJECTS SYSPARMS SYSPROCS SYSROUTINEDEP SYSROUTINES

SQLFUNCTIONCOLS SQLFUNCTIONS SQLPROCEDURECOLS SQLPROCEDURES

PARAMETERS ROUTINES

Routines Statistics

SYSCOLUMNSTAT SYSINDEXSTAT SYSMQTSTAT SYSPACKAGESTAT SYSPACKAGESTMTSTAT SYSPARTITIONDISK SYSPARTITIONINDEXES SYSPARTITIONINDEXDISK SYSPARTITIONINDEXSTAT SYSPARTITIONMQTS SYSPARTITIONSTAT SYSPROGRAMSTAT SYSPROGRAMSTMTSTAT SYSTABLEINDEXSTAT SYSTABLESTAT

SQLSTATISTICS

DB2 for i catalog views (QSYS2) ODBC and JDBCTM catalog views (SYSIBM) ANS and ISO catalog views (QSYS2)

SQL_FEATURES SQL_LANGUAGES SQL_SIZING CHARACTER_SETS

Database Support

XSRANNOTATIONINFO XSROBJECTCOMPONENTS XSROBJECTHIERARCHIES XSROBJECTS

XML Schemas

Privileges

SQLCOLPRIVILEGES SQLTABLEPRIVILEGES

AUTHORIZATIONS ROUTINE_PRIVILEGES UDT_PRIVILEGES USAGE_PRIVILEGES VARIABLE_PRIVILEGES

SYSCOLAUTH SYSCONTROLS SYSCONTROLSDEP SYSPACKAGEAUTH SYSROUTINEAUTH SYSSCHEMAAUTH SYSSEQUENCEAUTH SYSTABAUTH SYSUDTAUTH SYSVARIABLEAUTH SYSXSROBJECTAUTH

Java is a registered trademark of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

http://www.ibm.com/systems/i/software/db2/

© 2016 International Business Machines Corporation 71

Page 72: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

Documentation •  With IBM i 7.2, these and other

services are documented within the “Database Performance and Query Optimization” book

•  The Technology Updates wiki includes fact pages for these services http://ibm.biz/DB2foriServices

© 2016 International Business Machines Corporation 72

Page 73: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

www.ibm.com/power/i

© 2016 International Business Machines Corporation 73

Page 74: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

SYSTOOLS.GROUP_PTF_CURRENCY View Study the XML structure to define the data to the HTTP function.

HTTPàXML document structure

Developer resources

TCP/IP Enablement: ‘www-912.ibm.com’ maps to 129.42.160.32 IBM i TCP/IP configuration Technote: http://www-01.ibm.com/support/docview.wss?uid=nas8N1018980

White papers: •  https://ibm.biz/XMLandDB2fori •  https://ibm.biz/HTTPandDB2fori

Enablement

© 2016 International Business Machines Corporation 74

Page 75: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

•  Use SQL to retrieve detail for local & remote journals •  Information from QjoRetrieveJournalInformation() API, RJRN0100

format. •  The view returns Key 1 & 3 information, one row == information about one journal.

-- Which remote journals are the most heavily used? SELECT JOURNALED_OBJECTS, A.* FROM QSYS2.JOURNAL_INFO A WHERE NUMBER_REMOTE_JOURNALS > 0 AND JOURNALED_OBJECTS IS NOT NULL ORDER BY JOURNALED_OBJECTS DESC; -- Journals nearing the limit of journaled objects? SELECT * FROM QSYS2.JOURNAL_INFO WHERE JOURNALED_OBJECT_LIMIT = '*MAX250K' AND JOURNALED_OBJECTS > 200000;

QSYS2.JOURNAL_INFO – View

© 2016 International Business Machines Corporation 75

Page 76: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

Automatic consumption of job log in an application

call TOYSTORE.UPDATE_SALES(5, 'Frank Salesguy', '2014-1011'); SELECT A.JOB_NAME, MESSAGE_ID, MESSAGE_TEXT,MESSAGE_TOKENS,A.*

from APPLIB.Joblog_Detail A ORDER BY MESSAGE_TIMESTAMP ASC;

QSYS2.JOBLOG_INFO – UDTF

© 2016 International Business Machines Corporation 76

Page 77: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

-- Automatic consumption of job log in an application CREATE OR REPLACE PROCEDURE TOYSTORE.UPDATE_SALES (IN P_NEW_SALES INTEGER, IN P_SALES_PERSON VARCHAR(100), IN P_SALES_DATE DATE)

DYNAMIC RESULT SETS 1 LANGUAGE SQL MODIFIES SQL DATA SET OPTION COMMIT = *CHG BEGIN

DECLARE C_RESULT_SET1 CURSOR WITH RETURN TO CALLER FOR SELECT MESSAGE_ID, MESSAGE_TEXT, MESSAGE_TYPE FROM SESSION.My_Joblog;

Mainline: BEGIN DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN DECLARE GLOBAL TEMPORARY TABLE My_Joblog AS (SELECT * FROM TABLE(QSYS2.JOBLOG_INFO('*')) A) WITH DATA WITH REPLACE; OPEN C_RESULT_SET1; END; UPDATE TOYSTORE.SALES SET SALES = SALES + P_NEW_SALES WHERE SALES_PERSON = P_SALES_PERSON AND SALES_DATE = P_SALES_DATE; END Mainline; END ; CALL TOYSTORE.UPDATE_SALES(3, 'LUCCHESSI', '1995-12-31');

QSYS2.JOBLOG_INFO – UDTF

© 2016 International Business Machines Corporation 77

Page 78: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

This document was developed for IBM offerings in the United States as of the date of publication. IBM may not make these offerings available in other countries, and the information is subject to change without notice. Consult your local IBM business contact for information on the IBM offerings available in your area. Information in this document concerning non-IBM products was obtained from the suppliers of these products or other public sources. Questions on the capabilities of non-IBM products should be addressed to the suppliers of those products. IBM may have patents or pending patent applications covering subject matter in this document. The furnishing of this document does not give you any license to these patents. Send license inquires, in writing, to IBM Director of Licensing, IBM Corporation, New Castle Drive, Armonk, NY 10504-1785 USA. All statements regarding IBM future direction and intent are subject to change or withdrawal without notice, and represent goals and objectives only. The information contained in this document has not been submitted to any formal IBM test and is provided "AS IS" with no warranties or guarantees either expressed or implied. All examples cited or described in this document are presented as illustrations of the manner in which some IBM products can be used and the results that may be achieved. Actual environmental costs and performance characteristics will vary depending on individual client configurations and conditions. IBM Global Financing offerings are provided through IBM Credit Corporation in the United States and other IBM subsidiaries and divisions worldwide to qualified commercial and government clients. Rates are based on a client's credit rating, financing terms, offering type, equipment type and options, and may vary by country. Other restrictions may apply. Rates and offerings are subject to change, extension or withdrawal without notice. IBM is not responsible for printing errors in this document that result in pricing or information inaccuracies. All prices shown are IBM's United States suggested list prices and are subject to change without notice; reseller prices may vary. IBM hardware products are manufactured from new parts, or new and serviceable used parts. Regardless, our warranty terms apply. Any performance data contained in this document was determined in a controlled environment. Actual results may vary significantly and are dependent on many factors including system hardware configuration and software design and configuration. Some measurements quoted in this document may have been made on development-level systems. There is no guarantee these measurements will be the same on generally-available systems. Some measurements quoted in this document may have been estimated through extrapolation. Users of this document should verify the applicable data for their specific environment.

Revised September 26, 2006

Special notices

78 © 2016 International Business Machines Corporation

Page 79: Management with IBM i Services - LISUG · Systems Management with IBM i Services Dawn May - dmmay@us.ibm.com IBM Client Programs Manager @DawnMayiCan . Acknowledgements Scott Forstie

IBM, the IBM logo, ibm.com AIX, AIX (logo), AIX 5L, AIX 6 (logo), AS/400, BladeCenter, Blue Gene, ClusterProven, DB2, ESCON, i5/OS, i5/OS (logo), IBM Business Partner (logo), IntelliStation, LoadLeveler, Lotus, Lotus Notes, Notes, Operating System/400, OS/400, PartnerLink, PartnerWorld, PowerPC, pSeries, Rational, RISC System/6000, RS/6000, THINK, Tivoli, Tivoli (logo), Tivoli Management Environment, WebSphere, xSeries, z/OS, zSeries, Active Memory, Balanced Warehouse, CacheFlow, Cool Blue, IBM Systems Director VMControl, pureScale, TurboCore, Chiphopper, Cloudscape, DB2 Universal Database, DS4000, DS6000, DS8000, EnergyScale, Enterprise Workload Manager, General Parallel File System, , GPFS, HACMP, HACMP/6000, HASM, IBM Systems Director Active Energy Manager, iSeries, Micro-Partitioning, POWER, PowerExecutive, PowerVM, PowerVM (logo), PowerHA, Power Architecture, Power Everywhere, Power Family, POWER Hypervisor, Power Systems, Power Systems (logo), Power Systems Software, Power Systems Software (logo), POWER2, POWER3, POWER4, POWER4+, POWER5, POWER5+, POWER6, POWER6+, POWER7, System i, System p, System p5, System Storage, System z, TME 10, Workload Partitions Manager and X-Architecture are trademarks or registered trademarks of International Business Machines Corporation in the United States, other countries, or both. If these and other IBM trademarked terms are marked on their first occurrence in this information with a trademark symbol (® or ™), these symbols indicate U.S. registered or common law trademarks owned by IBM at the time this information was published. Such trademarks may also be registered or common law trademarks in other countries. A full list of U.S. trademarks owned by IBM may be found at: http://www.ibm.com/legal/copytrade.shtml. Adobe, the Adobe logo, PostScript, and the PostScript logo are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States, and/or other countries. AltiVec is a trademark of Freescale Semiconductor, Inc. AMD Opteron is a trademark of Advanced Micro Devices, Inc. InfiniBand, InfiniBand Trade Association and the InfiniBand design marks are trademarks and/or service marks of the InfiniBand Trade Association. Intel, Intel logo, Intel Inside, Intel Inside logo, Intel Centrino, Intel Centrino logo, Celeron, Intel Xeon, Intel SpeedStep, Itanium, and Pentium are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. IT Infrastructure Library is a registered trademark of the Central Computer and Telecommunications Agency which is now part of the Office of Government Commerce. Java and all Java-based trademarks and logos are trademarks or registered trademarks of Oracle and/or its affiliates. Linear Tape-Open, LTO, the LTO Logo, Ultrium, and the Ultrium logo are trademarks of HP, IBM Corp. and Quantum in the U.S. and other countries. Linux is a registered trademark of Linus Torvalds in the United States, other countries or both. Microsoft, Windows and the Windows logo are registered trademarks of Microsoft Corporation in the United States, other countries or both. NetBench is a registered trademark of Ziff Davis Media in the United States, other countries or both. SPECint, SPECfp, SPECjbb, SPECweb, SPECjAppServer, SPEC OMP, SPECviewperf, SPECapc, SPEChpc, SPECjvm, SPECmail, SPECimap and SPECsfs are trademarks of the Standard Performance Evaluation Corp (SPEC). The Power Architecture and Power.org wordmarks and the Power and Power.org logos and related marks are trademarks and service marks licensed by Power.org. TPC-C and TPC-H are trademarks of the Transaction Performance Processing Council (TPPC). UNIX is a registered trademark of The Open Group in the United States, other countries or both. Other company, product and service names may be trademarks or service marks of others.

Revised December 2, 2010

Special notices (cont.)

79 © 2016 International Business Machines Corporation