© 2014 ibm corporation 1 sql for the system admin power systems 2014 sql for the system...

62
© 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie [email protected] DB2 for i Business Architect For…

Upload: stella-maria-robertson

Post on 23-Jan-2016

231 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation1 SQL for the System Admin

Power Systems 2014

SQL for the System Administrator

Scott [email protected] for i Business Architect

For…

Page 2: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation2 SQL for the System Admin

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

Page 3: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation3 SQL for the System Admin

Commands, APIs and tools – Why consider SQL?

• Even though IBM i customers are used to commands and APIs, they are not always the easiest interfaces for customers to utilize (especially if from a client or the web).

• In many cases, customers are required to write specialized programs to exploit a new IBM i command or API.

• Across the industry, SQL is recognized as a standardized and easy language to access the database. SQL skills are either commonplace or customers have a desire to do more with SQL.

• SQL as a language construct does not need to be limited to database topics.

• SQL can be used on IBM i to easily extract deep details on non-database topics. This presentation contains proof of this point.

Page 4: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation4 SQL for the System Admin

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

Page 5: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation5 SQL for the System Admin

Where to start? Get educated

• Understand the SQL coding environments:RUNSQL, RUNSQLSTM, Run SQL Scripts, STRSQL, CRTSQLxxxx, ODBC, JDBC, PHP, DRDA, etc…

• Understand the query engine and optimizer options:

• Understand the SQL coding options:Explicit 3-part names, Implicit 3-part names, INSERT with remote subselect, CREATE TABLE with remote subselect, etc...

• Keep the SQL Reference close by• Like other crafts… with repeated study and practice, your skills will

improve

Page 6: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation6 SQL for the System Admin

New to SQL? Use Navigator’s Run SQL Scripts

• Powerful, graphical interfaceIBM i Navigator (aka System i Navigator)

IBM i Access Windows Service Pack7.1 – SI53584 TR8

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

Next Planned Update…December 31, 2014

Right click

Page 7: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation7 SQL for the System Admin

SQL catalogs TCP/IP Services

TCP/IP Services

Page 8: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation8 SQL for the System Admin

QSYS2/TCPIP_INFO – view

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

SELECT * from QSYS2/TCPIP_INFO

Columns which don’t exist on IBM i 6.1:SERVER_IP_ADDRESS and SERVER_IP_ADDRESS_TYPE

Page 9: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation9 SQL for the System Admin

TCPIP_INFO – example usage

• Well defined port numbers - http://bit.ly/ibmiPorts

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

Page 10: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation10 SQL for the System Admin

TCPIP_INFO – Trigger example

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

Varies by the caller

Page 11: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation11 SQL for the System Admin

SYSIBMADM/ENV_SYS_INFO – view

• SYSIBMADM/ENV_SYS_INFO catalog returns information about the current server• This is a DB2 family compatible administrative view

Page 12: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation12 SQL for the System Admin

SQL catalogs Program Temporary Fix (PTF)

PTF Services

Page 13: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation13 SQL for the System Admin

Explore the catalog columns and detail…

SELECT * FROM QSYS2/GROUP_PTF_INFO

QSYS2/GROUP_PTF_INFO – view

Page 14: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation14 SQL for the System Admin

• Use SQL to interrogate PTF Group information• Alternative to the Work with PTF Groups (WRKPTFGRP) command• Since 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

Page 15: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation15 SQL for the System Admin

• Similar to being able to use SQL to query PTF Group information, (QSYS2/GROUP_PTF_INFO) you can interrogate PTF information using a DB2 for i catalog (QSYS2/PTF_INFO) • Data returned is similar to the QpzListPTF() API output

-- 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

Page 16: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation16 SQL for the System Admin

-- Which PTFs are loaded, but not applied?SELECT PTF_IDENTIFIER, PTF_PRODUCT_DESCRIPTION, A.* FROM QSYS2/PTF_INFO A WHERE PTF_LOADED_STATUS = 'LOADED' ORDER BY PTF_PRODUCT_ID

QSYS2/PTF_INFO – view

Page 17: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation17

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

New with TR9 / TR1

New with TR9 / TR1

Page 18: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation18

SYSTOOLS.GROUP_PTF_CURRENCY View

http://www-912.ibm.com/s_dir/sline003.nsf/PSPbyNumL.xml?OpenView&count=500

XML

namespace

&

structure

New with TR9 / TR1

New with TR9 / TR1

Page 19: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation19

SYSTOOLS.GROUP_PTF_CURRENCY View

Study the XML structure to define the data to the HTTP function.

HTTPXML 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

New with TR9 / TR1

New with TR9 / TR1

Page 20: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation20 SQL for the System Admin

SQL catalogs Journal Services

Journal Services

Page 21: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation21 SQL for the System Admin

• 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

-- Find journals that are nearing the limit of journaled objects:SELECT * FROM QSYS2.JOURNAL_INFO WHERE JOURNALED_OBJECT_LIMIT = '*MAX250K' AND JOURNALED_OBJECTS > 200000

QSYS2.JOURNAL_INFO – ViewNew with TR9 / TR1

New with TR9 / TR1

Page 22: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation22 SQL for the System Admin

• Use this new source of information to achieve better journal management• Recognize conditions that require attention

-- Which remote journals fell the farthest behind this week?SELECT MAXIMUM_TIME_BEHIND, MAXIMUM_BEHIND_TIMESTAMP, ESTIMATED_TIME_BEHIND, TOTAL_SIZE_JOURNAL_RECEIVERS, RTRIM(ATTACHED_JOURNAL_RECEIVER_LIBRARY) CONCAT '/' CONCAT RTRIM(ATTACHED_JOURNAL_RECEIVER_NAME) AS JrnName, A.* FROM QSYS2.JOURNAL_INFO A WHEREMAXIMUM_BEHIND_TIMESTAMP > CURRENT TIMESTAMP - 7 DAYS AND MAXIMUM_TIME_BEHIND > 0 AND MAXIMUM_TIME_BEHIND IS NOT NULL ORDER BY MAXIMUM_TIME_BEHIND DESC FETCH FIRST 10 ROWS ONLY

QSYS2.JOURNAL_INFO – ViewNew with TR9 / TR1

New with TR9 / TR1

Page 23: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation23 SQL for the System Admin

• Use SQL to extract data from journals• Either call the UDTF directly or use IBM i Navigator

• Why use these capabilities over the green screen commands?

Isolate detail from complex data, efficiently Automate frequent audit analysis Add logic to applications Leverage the SQL Query Engine (SQE) to order, group, join, transform journal based data

QSYS2/DISPLAY_JOURNAL() – UDTF

Page 24: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation24 SQL for the System Admin

SELECT journal_code, journal_entry_type, object, object_type, X.* FROM TABLE (QSYS2.Display_Journal('PRODDATA', 'QSQJRN', -- Journal library and name'', '', -- Receiver library and nameCAST(null as TIMESTAMP), -- Starting timestampCAST(null as DECIMAL(21,0)), -- Starting sequence number'', -- Journal codes'', -- Journal entries'',‘’,'',‘', -- Object library, Object name, Object type, Object member‘SCOTT', -- User'', -- Job'' -- Program) ) AS xORDER BY entry_timestamp DESC

Before 7.2 (must specify 15 parameters):

With 7.2 (leverage the optional parameters):

SELECT journal_code, journal_entry_type, object, object_type, X.* FROM TABLE (QSYS2.Display_Journal('PRODDATA', 'QSQJRN', -- Journal library and name“USER” => ‘SCOTT’ -- User) ) AS xORDER BY entry_timestamp DESC

QSYS2/Display_Journal – User Defined Table Function

Page 25: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation25 SQL for the System Admin

-- What rows were deleted from TOYSTORE5/SALES table this week?select ENTRY_DATA,ENTRY_TIMESTAMP,JOURNAL_ENTRY_TYPE,COUNT_OR_RRN as

ROW_DELETED,"CURRENT_USER", RTRIM(JOB_NUMBER) CONCAT '/' CONCAT RTRIM(JOB_USER) CONCAT '/' CONCAT RTRIM(JOB_NAME) AS Qualified_Job_Name from table (

QSYS2.Display_Journal('TOYSTORE5', 'QSQJRN', -- Journal library and name'', '', -- Receiver library and nameCURRENT TIMESTAMP - 7 DAYS, -- Starting timestampCAST(null as DECIMAL(21,0)), -- Starting sequence number'', -- Journal codes'DL', -- Journal entry type'TOYSTORE5','SALES','*FILE','SALES', -- Object library, Object name, Object type,

Object member'', -- User'', -- Job'' -- Program) ) as xorder by entry_timestamp desc ;

DISPLAY_JOURNAL() Example: What happened to my SALES data?

Page 26: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation26 SQL for the System Admin

-- What data was deleted from PRODDATA/SALES table this week?select cast(cast(substring(entry_data,610-610+1,10) as VARCHAR(10) for bit data) as DATE) AS SALES_DATE,cast(cast(substring(entry_data,622-610+1,15) as VARCHAR(15) for bit data) as varchar(15) ccsid 37) as SALES_PERSON,cast(cast(substring(entry_data,638-610+1,15) as VARCHAR(15) for bit data) as varchar(15) ccsid 37) as REGION,cast(cast(substring(entry_data,655-610+1,4) as VARCHAR(4) for bit data) as varchar(4)) as SALES from table (QSYS2.Display_Journal('TOYSTORE5', 'QSQJRN', -- Journal library and name'', '', -- Receiver library and nameCURRENT TIMESTAMP - 7 DAYS, -- Starting timestampCAST(null as DECIMAL(21,0)), -- Starting sequence number'', -- Journal codes'DL', -- Journal entries'TOYSTORE5','SALES','*FILE','SALES', -- Object library, Object name, Object type, Object member'', -- User'', -- Job'' -- Program) ) as xorder by entry_timestamp desc

DISPLAY_JOURNAL() Example: What happened to my SALES data?

Page 27: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation27 SQL for the System Admin

Schemas Journals View Entries Enter Filter CriteriaWe find the file and use the file format to format the data!

Navigator Example: What happened to my SALES data?

Page 28: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation28 SQL for the System Admin

SQL catalogs Work Management Services

Work Management Services

Page 29: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation29 SQL for the System Admin

QSYS2/GET_JOB_INFO() – user defined table function

• GET_JOB_INFO() accepts the jobname as input and returns a single row result table containing detail about that job.

• Enhanced with TR8:• Use ‘*’ to return detail on the current job• Current (or most recent) SQL Statement text returned

Example 1) Get job information for the current jobselect a.* from table(qsys2.get_job_info('*')) a;

Example 2) Get job information for the current jobselect a.* from table(qsys2.get_job_info('803868/Quser/Qzdasoinit')) a;

Enhanced with TR8

Enhanced with TR8

Page 30: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation30 SQL for the System Admin

QSYS2/SYSTEM_VALUE_INFO – view

• The new view return 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 valueCURRENT_NUMERIC_VALUE BIGINT – System value when binary data is returnedCURRENT_CHARACTER_VALUE VARGRAPHIC(1280) – System value when character data is returned

Example: -- Examine the system values related to maximums

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

Added in TR7

Added in TR7

Page 31: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation31 SQL for the System Admin

QSYS2/SYSTEM_VALUE_INFO – view

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;

Added in TR7

Added in TR7

Remote 3-part DGTT

statement

Remote 3-part DGTT

statement

Use a query to find the SYSVAL

differences between the two systems

Use a query to find the SYSVAL

differences between the two systems

Page 32: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation32 SQL for the System Admin

QSYS2/SYSTEM_VALUE_INFO – view

Example exception join output using SYSTEM_VALUE_INFO.

Added in TR7

Added in TR7

Page 33: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation33 SQL for the System Admin

SQL catalogs Command Services

Librarian Services

Page 34: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation34 SQL for the System Admin

QSYS2.LIBRARY_LIST_INFO – view

• 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

Example:SELECT * FROM QSYS2.LIBRARY_LIST_INFO

New with TR9 / TR1

New with TR9 / TR1

Page 35: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation35 SQL for the System Admin

SQL catalogs Command Services

Message Handling Services

Page 36: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation36 SQL for the System Admin

QSYS2.JOBLOG_INFO – UDTF

• 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.

Example 1: Find the most recently executed command in a target jobSELECT 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

New with TR9 / TR1

New with TR9 / TR1

Page 37: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation37 SQL for the System Admin

QSYS2.JOBLOG_INFO – UDTF

Example 2: 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 1LANGUAGE SQL MODIFIES SQL DATA SET OPTION COMMIT = *CHGBEGIN

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')

New with TR9 / TR1

New with TR9 / TR1

Page 38: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation38 SQL for the System Admin

QSYS2.REPLY_LIST_INFO – view

• 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

Example:SELECT * FROM QSYS2.REPLY_LIST_INFO

WHERE message_ID like 'CPA%'

New with TR9 / TR1

New with TR9 / TR1

Page 39: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation39 SQL for the System Admin

SQL catalogs Security Services

Security Services

Page 40: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation40 SQL for the System Admin

QSYS2/GROUP_PROFILE_ENTRIES – view

Use SQL to understand:• What Group Profiles exist• Which User Profiles belong to specific Group Profiles• The text associated with the profileHandles both:Group profile . . . . . . . . . GRPPRF Supplemental groups . . SUPGRPPRF

Example:select * from qsys2.group_profile_entries

Page 41: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation41 SQL for the System Admin

SYSIBM.AUTHORIZATIONS – view

The AUTHORIZATIONS catalog has been extended to include a new column, which differentiates users from groups.

The AUTHORIZATIONS view is a DB2 family compatible catalog which contains one row for every authorization ID.

Page 42: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation42 SQL for the System Admin

QSYS2/USER_INFO – view

• 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 Example: -- Which users are having trouble signing on?

SELECT * FROM USER_INFO

WHERE SIGN_ON_ATTEMPTS_NOT_VALID > 0

Added in TR7

Added in TR7

Page 43: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation43 SQL for the System Admin

USER_INFO & GROUP_PROFILE_ENTRIES

• 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_DESCRIPTIONFROM QSYS2.USER_INFOWHERE SPECIAL_AUTHORITIES LIKE '%*ALLOBJ%'OR AUTHORIZATION_NAME IN (

SELECT USER_PROFILE_NAMEFROM QSYS2.GROUP_PROFILE_ENTRIESWHERE GROUP_PROFILE_NAME IN (

SELECT AUTHORIZATION_NAMEFROM QSYS2.USER_INFOWHERE SPECIAL_AUTHORITIES like '%*ALLOBJ%')

)ORDER BY AUTHORIZATION_NAME;

Page 44: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation44 SQL for the System Admin

USER_INFO & GROUP_PROFILE_ENTRIES

• Query results…

Page 45: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation45 SQL for the System Admin

QSYS2/USER_INFO – view

• Extended to include columns that are available to users of the QSYRUSRI() API.Example: -- Which enabled users are at risk of becoming disabled due to lack of use? SELECT * FROM QSYS2.USER_INFO WHERE STATUS = '*ENABLED' AND LAST_USED_TIMESTAMP IS NOT NULL ORDER BY LAST_USED_TIMESTAMP ASC FETCH FIRST 20 ROWS ONLY

Enhanced with TR8

Enhanced with TR8

New Columns

Page 46: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation46 SQL for the System Admin

QSYS2/USER_STORAGE – view

• 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

Example: -- How much storage has user SCOTTF consumed?

SELECT * FROM QSYS2/USER_STORAGE

WHERE USER_NAME = ‘SCOTTF’

Added in TR7

Added in TR7

Page 47: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation47 SQL for the System Admin

QSYS2/FUNCTION_INFO – view

• Built upon the data returned by the Retrieve Function Information (QSYRTVFI, QsyRetrieveFunctionInformation) API

• Any user can examine the function usage identifiers. • Only users with *SECADM user special authority can examine the function usage

configuration details returned via the QSYS2.FUNCTION_INFO catalog.• Each row describes the function usage defined on the machine.Example:

-- Which function usage IDs exist and what is the default configuration?

SELECT * FROM QSYS2/FUNCTION_INFO ORDER BY FUNCTION_ID

Added in TR7

Added in TR7

Page 48: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation48 SQL for the System Admin

QSYS2/FUNCTION_USAGE – view

• 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

Added in TR7

Added in TR7

Page 49: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation49 SQL for the System Admin

SQL catalogs Storage Services

Storage Services

Page 50: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation50 SQL for the System Admin

QSYS2/SYSDISKSTAT – view

The SYSDISKSTAT catalog can be used to quickly and easily understand the DISK information using SQL.

Examples:-- Query information for all SSD unitsSELECT * FROM QSYS2/SYSDISKSTAT WHERE UNIT_TYPE = 1-- Query information for all DISKs, order by percentage usedSELECT PERCENT_USED, A.* FROM QSYS2/SYSDISKSTAT A ORDER BY PERCENT_USED DESC

Page 51: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation51 SQL for the System Admin

• Observe System-wide Temporary storage consumptionvia 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 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

QSYS2/SYSTMPSTG – view

Page 52: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation52 SQL for the System Admin

SQL catalogs Command Services

Command Services

Page 53: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation53 SQL for the System Admin

QSYS2/QCMDEXC – Procedure

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');

Added in TR7

Added in TR7

Page 54: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation54 SQL for the System Admin

DB2 for i built-in Global Variables

Built-in Global Variables

Page 55: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation55 SQL for the System Admin

DB2 for i Built-in Global Variables

• The qualified job name of the current connection is easily accessed• When SQL Server Mode is used, the job name of the application instance

which owns the connection is accessed through SERVER_MODE_JOB_NAME• Use these variables to deploy advanced logic in triggers, RCAC rules, and

more

Variable name Schema Data Type Size

JOB_NAME QSYS2 VARCHAR 28

SERVER_MODE_JOB_NAME QSYS2 VARCHAR 28

CLIENT_IPADDR SYSIBM VARCHAR 128

CLIENT_HOST SYSIBM VARCHAR 255

CLIENT_PORT SYSIBM INTEGER -

PACKAGE_NAME SYSIBM VARCHAR 128

PACKAGE_SCHEMA SYSIBM VARCHAR 128

PACKAGE_VERSION SYSIBM VARCHAR 64

ROUTINE_SCHEMA SYSIBM VARCHAR 128

ROUTINE_SPECIFIC_NAME SYSIBM VARCHAR 128

ROUTINE_TYPE SYSIBM CHAR 1

New with IBM i 7.2SF99702 Level 3

Available with base IBM i 7.2

Enhanced with TR1

Enhanced with TR1

Page 56: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation56 SQL for the System Admin

Built-in Global Variables – Client information

SELECT SYSIBM.client_host AS CLIENT_HOST,

SYSIBM.client_ipaddr AS CLIENT_IP,

SYSIBM.client_port AS CLIENT_PORT

FROM LP92UT27.SYSIBM.SYSDUMMY1

SELECT * FROM LP92UT27.QSYS2.TCPIP_INFO

• Two ways to extract the detail

• Global variables fit nicely into View definitions & RCAC masks/permissions

Page 57: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation60 SQL for the System Admin

SQL catalogs Landscape view

Landscape

Page 58: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

SYSCATALOGS

INFORMATION_SCHEMA_CATALOG_NAME

Catalogs

IBMIBM®® DB2 DB2®® for i Catalogs for i Catalogs

SQLSCHEMAS

SCHEMATA

Schemas

SYSSCHEMAS

SYSCHKCSTSYSCSTSYSCSTCOLSYSCSTDEPSYSKEYCSTSYSREFCST

SQLFOREIGNKEYSSQLPRIMARYKEYS

CHECK_CONSTRAINTS REFERENTIAL_CONSTRAINTSTABLE_CONSTRAINTS

Constraints

SYSCOLUMNSSYSCOLUMNS2SYSFIELDSSYSINDEXESSYSKEYSSYSTABLEDEPSYSTABLESSYSVIEWDEPSYSVIEWS

SQLCOLUMNSSQLSPECIALCOLUMNSSQLTABLES

COLUMNSTABLESVIEWS

Tables Views Indexes

SYSTRIGCOLSYSTRIGDEPSYSTRIGGERSSYSTRIGUPD

Triggers SYSPACKAGESYSSEQUENCESSYSTYPESSYSVARIABLEDEPSYSVARIABLES

SQLTYPEINFOSQLUDTS

USER_DEFINED_TYPESSEQUENCES

Miscellaneous Objects

SYSFUNCSSYSJARCONTENTSSYSJAROBJECTSSYSPARMSSYSPROCSSYSROUTINEDEPSYSROUTINES

SQLFUNCTIONCOLSSQLFUNCTIONSSQLPROCEDURECOLSSQLPROCEDURES

PARAMETERSROUTINES

Routines Statistics

SYSCOLUMNSTATSYSINDEXSTATSYSMQTSTATSYSPACKAGESTATSYSPACKAGESTMTSTATSYSPARTITIONDISKSYSPARTITIONINDEXESSYSPARTITIONINDEXDISKSYSPARTITIONINDEXSTATSYSPARTITIONMQTSSYSPARTITIONSTATSYSPROGRAMSTATSYSPROGRAMSTMTSTATSYSTABLEINDEXSTATSYSTABLESTAT

SQLSTATISTICS

DB2 for i catalog views (QSYS2)

ODBC and JDBCTM catalog views (SYSIBM)

ANS and ISO catalog views (QSYS2)

SQL_FEATURESSQL_LANGUAGESSQL_SIZINGCHARACTER_SETS

Database Support

XSRANNOTATIONINFOXSROBJECTCOMPONENTSXSROBJECTHIERARCHIESXSROBJECTS

XML Schemas

Privileges

SQLCOLPRIVILEGESSQLTABLEPRIVILEGES

AUTHORIZATIONSROUTINE_PRIVILEGESUDT_PRIVILEGESUSAGE_PRIVILEGESVARIABLE_PRIVILEGES

SYSCOLAUTHSYSCONTROLSSYSCONTROLSDEPSYSPACKAGEAUTHSYSROUTINEAUTHSYSSCHEMAAUTHSYSSEQUENCEAUTHSYSTABAUTHSYSUDTAUTHSYSVARIABLEAUTHSYSXSROBJECTAUTH

Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.Other company, product or service names may be trademarks or service marks of others.

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

Page 59: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

SYSTOOLS.ACT_ON_INDEX_ADVICE - PROCEDURESYSTOOLS.HARVEST_INDEX_ADVICE - PROCEDURE

QSYS2.OVERRIDE_QAQQINI - PROCEDUREQSYS2.RESET_TABLE_INDEX_STATISTICS -

PROCEDUREQSYS2.SYSIXADV - TABLE

SYSTOOLS.REMOVE_INDEXES - PROCEDURE

Performance Services

QSYS2.HEALTH_ACTIVITYQSYS2.HEALTH_DATABASE_OVERVIEWQSYS2.HEALTH_DESIGN_LIMITSQSYS2.HEALTH_ENVIRONMENTAL_LIMITSQSYS2.HEALTH_SIZE_LIMITSQSYS2.RESET_ENVIRONMENTAL_LIMITS

Health Center Procedures PTF Services

QSYS2.PTF_INFO – VIEWQSYS2.GROUP_PTF_INFO – VIEW

DB2 for i Services

IBM i Services

http://www.ibm.com/developerworks/ibmi/db2

QSYS2.CANCEL_SQLQSYS2.DUMP_SQL_CURSORSQSYS2.EXTRACT_STATEMENTSQSYS2.FIND_AND_CANCEL_QSQSRVR_SQLQSYS2.FIND_QSQSRVR_JOBSQSYS2.GENERATE_SQLQSYS2.RESTART_IDENTITYSYSTOOLS.CHECK_CSTSYSTOOLS.CHECK_SYSROUTINE

Utility Procedures Security Services

QSYS2.FUNCTION_INFO – VIEWQSYS2.FUNCTION_USAGE – VIEW

QSYS2.GROUP_PROFILE_ENTRIES – VIEWSYSPROC.SET_COLUMN_ATTRIBUTE - PROCEDURE

QSYS2.SQL_CHECK_AUTHORITY - UDFQSYS2.USER_INFO – VIEW

TCP/IP Services

QSYS2.TCPIP_INFO – VIEWSYSIBMADM.ENV_SYS_INFO – VIEW

Work Management Services

QSYS2.SYSTEM_VALUE_INFO – VIEWQSYS2.GET_JOB_INFO – UDTF

QSYS2.CHANGE_PLAN_CACHE_SIZEQSYS2.DUMP_PLAN_CACHEQSYS2.DUMP_PLAN_CACHE_PROPERTIESQSYS2.DUMP_PLAN_CACHE_topNQSYS2/DUMP_SNAP_SHOT_PROPERTIESQSYS2.END_ALL_PLAN_CACHE_EVENT_MONITORSQSYS2.END_PLAN_CACHE_EVENT_MONITORQSYS2.START_PLAN_CACHE_EVENT_MONITOR (2)

Plan Cache Procedures

System Health Services

QSYS2.SYSLIMTBL - TABLEQSYS2.SYSLIMITS – VIEW

QSYS2.OVERRIDE_TABLE – PROCEDUREQSYS2.DELIMIT_NAME – UDF

SYSPROC.WLM_SET_CLIENT_INFO – PROCEDURE

Application Services

Journal Services

QSYS2.DISPLAY_JOURNAL – UDTFQSYS2.JOURNAL_INFO – View

Storage Services

QSYS2.SYSDISKSTAT – VIEWQSYS2.SYSTMPSTG – VIEW

QSYS2.USER_STORAGE – VIEW

Object Services

QSYS2.OBJECT_STATISTICS – UDTF

IBMIBM®® DB2 DB2®® for i Services for i Services

QSYS2.QCMDEXC - PROCEDURE

Librarian Services

QSYS2.LIBRARY_LIST_INFO – View

Message Handling Services

QSYS2.JOBLOG_INFO – ViewQSYS2.REPLY_LIST_INFO – View

Page 60: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation63 SQL for the System Admin

Documentation

• With IBM i 7.2, these and other services will be documented within the “Database Performance and Optimization” book

• The Technology Updates wiki includes fact pages for these services

www.ibm.com/developerworks/ibmi/techupdates/db2

Page 61: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation64 SQL for the System Admin

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.

Special notices

Page 62: © 2014 IBM Corporation 1 SQL for the System Admin Power Systems 2014 SQL for the System Administrator Scott Forstie forstie@us.ibm.com DB2 for i Business

© 2014 IBM Corporation65 SQL for the System Admin

IBM, the IBM logo, ibm.com AIX, AIX (logo), 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, AIX 5L, Chiphopper, Chipkill, Cloudscape, DB2 Universal Database, DS4000, DS6000, DS8000, EnergyScale, Enterprise Workload Manager, General Purpose 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+, System i, System p, System p5, System Storage, System z, Tivoli Enterprise, 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 current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml

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.UNIX is a registered trademark of The Open Group in the United States, other countries or both. 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.Intel, Itanium, Pentium are registered trademarks and Xeon is a trademark of Intel Corporation or its subsidiaries in the United States, other countries or both.AMD Opteron is a trademark of Advanced Micro Devices, Inc.Java and all Java-based trademarks and logos are trademarks of Sun Microsystems, Inc. in the United States, other countries or both. TPC-C and TPC-H are trademarks of the Transaction Performance Processing Council (TPPC).SPECint, SPECfp, SPECjbb, SPECweb, SPECjAppServer, SPEC OMP, SPECviewperf, SPECapc, SPEChpc, SPECjvm, SPECmail, SPECimap and SPECsfs are trademarks of the Standard Performance Evaluation Corp (SPEC).NetBench is a registered trademark of Ziff Davis Media in the United States, other countries or both.AltiVec is a trademark of Freescale Semiconductor, Inc.Cell Broadband Engine is a trademark of Sony Computer Entertainment Inc.InfiniBand, InfiniBand Trade Association and the InfiniBand design marks are trademarks and/or service marks of the InfiniBand Trade Association. Other company, product and service names may be trademarks or service marks of others.

Special notices (cont.)