ADM525 Database Administration DB2/400
ADM525
SAP Netweaver on DB2 UDB for iSeries:
Database Administration
THE BEST-RUN BUSINESSES RUN SAP
SAP AG 2005 © SAP AG 2005
Software components used in the course:
SAP WEB AS 6.40
IBM i5/OS V5R3M0
2005/Q4
50072441
© SAP AG
ADM525
Preface - 1
Copyright
Copyright 2005 SAP AG. All rights reserved.
No part of this publication may be reproduced or transmitted in any
form or for any purpose without the express permission of SAP AG.
The information contained herein may be changed without prior
notice.
All rights reserved.
SAP AG 2005
© SAP AG
ADM525
Preface - 2
Target Audience
This course is intended for the following audiences:
SAP system administrators
Database administrators
Technology consultants
Duration: 5 days
SAP AG 2005
User notes
These training materials are not a teach-yourself program. They complement the explanations
provided by your course instructor. Space is provided on each page for you to note down additional
information.
There may not be sufficient time during the course to complete all the exercises. The exercises
provide additional examples that are covered during the course. You can also work through these
examples in your own time to increase your understanding of the topics.
© SAP AG
ADM525
Preface - 3
Course Prerequisites
Required Knowledge:
SAPTEC (Application Platform Fundamentals)
Basic knowledge of relational databases
Recommended Knowledge:
ADM100 (SAP Web AS Administration I)
Basic knowledge of administering at least one operating
system
SAP AG 2005
© SAP AG
ADM525
Preface - 4
Course Overview
Contents:
Course Goals
Course Objectives
Course Content
Course Overview Diagram
Main Business Scenario
SAP AG 2004, ADM525 Course Overview / Christian Bartels / 1
© SAP AG
ADM525
Course Overview - 1
Course Goals
This course will prepare you to:
Describe the implementation of SAP on i5/OS
Save and restore data on i5/OS
Perform basic performance and problem analysis
SAP AG 2004, ADM525 Course Overview / Christian Bartels / 2
© SAP AG
ADM525
Course Overview - 2
Course Objectives
After completing this course, you will be able to:
Explain i5/OS data structures and their usage by the
SAP software
Perform operating system and database
administration tasks
Prepare and implement a backup strategy
Perform data recovery
Analyze problems by using operating system logs
Improve database performance by using SAP tools
for DB2 UDB for iSeries
SAP AG 2004, ADM525 Course Overview / Christian Bartels / 3
© SAP AG
ADM525
Course Overview - 3
Course Content
Preface
Unit 1
Course Overview
Unit 4
Backup and Recovery
Unit 2
Concepts of IBM eServer
iSeries and i5/OS
Unit 5
Maintenance and Install
Unit 6
Problem and
Performance Analysis
Unit 7
Conclusion
Unit 3
SAP Architecture for IBM
eServer iSeries
Appendices
SAP AG 2004, ADM525 Course Overview / Christian Bartels / 4
© SAP AG
ADM525
Course Overview - 4
Course Overview Diagram
1 Course Overview
2 Concepts of IBM eServer
iSeries and i5/OS
3 SAP Architecture for IBM
eServer iSeries
4 Backup and Recovery
5 Maintenance and Install
6 Problem and Performance
Analysis
7 Conclusion
SAP AG 2004, ADM525 Course Overview / Christian Bartels / 5
© SAP AG
ADM525
Course Overview - 5
Main Business Scenario
You are responsible for system administration of an
SAP installation running on i5/OS with DB2 UDB for
iSeries. You are performing regular maintenance, and
you need to know what to do in case of unexpected
situations.
You are a basis consultant and need to understand
the architecture of IBM eServer iSeries with i5/OS in
order to advise customers when they choose a
platform. You want to install and tune SAP systems
on i5/OS as part of customer projects.
SAP AG 2004, ADM525 Course Overview / Christian Bartels / 6
© SAP AG
ADM525
Course Overview - 6
Concepts of IBM eServer iSeries and i5/OS
Contents:
z iSeries Overview
z Objects and File Systems
z User Interfaces
z CL Programming
z iSeries Software Products
z System Administration Overview
Note: Prior to V5R3M0, the operating system on iSeries was
named „OS/400“. Starting with V5R3M0, the name is
„i5/OS“. During this class we will use the new name.
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 1
© SAP AG
ADM525
Concepts of i5/OS - 1
Concepts of i5/OS: Unit Objectives
After completing this unit, you will be able to:
z Explain the single level storage concept of i5/OS
z Classify objects and file systems
z Enter and prompt i5/OS commands
z Create simple CL programs
z Choose software products to run with i5/OS
z Perform basic administration tasks
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 2
© SAP AG
ADM525
Concepts of i5/OS - 2
Concepts of i5/OS: Course Overview Diagram
1 Course Overview
2 Concepts of IBM eServer
iSeries and i5/OS
3 SAP Architecture for IBM
eServer iSeries
4 Backup and Recovery
5 Maintenance and Install
6 Problem and Performance
Analysis
7 Conclusion
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 3
© SAP AG
ADM525
Concepts of i5/OS - 3
Concepts i5/OS: Business Scenario
z You are new to iSeries. In order to perform system
administration, you need a general understanding of
the concepts in i5/OS. You also need to know the
user interfaces and the most important operating
system commands.
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 4
© SAP AG
ADM525
Concepts of i5/OS - 4
Concepts iSeries and i5/OS - Overview
iSeries
Overview
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 5
© SAP AG
ADM525
Concepts of i5/OS - 5
Overview i5/OS: Single Level Storage
Object
Temporary Storage
Virtual Address Range:
X‘0000000000000000‘
through
X‘FFFFFFFFFFFFFFFF‘
i5/OS Licensed Internal Code
Page
Page
Storage Management
Page
Page
Main Storage
Auxiliary Storage Pools
(Disk Storage)
Page
ASP 1 (System ASP)
ASP 2
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 6
The iSeries server has a unique way of addressing storage. It views the disk space on your server and your
server's main memory as one large storage area. This way of addressing storage is known as single-level
storage. Each object and each piece of temporary storage has its own unique virtual address, wich is 64
bits wide. On disk and in main storage, the data is organized in pages of 4 KB in size. The pages that
belong to one object can be distributed over multiple disks.
The disk units that are attached to an iSeries server are combined into one or multiple Auxiliary Storage
Pools (ASPs). You will always have an ASP 1, also known as System ASP. Optional, one or multiple
additional ASPs can be configured. These are called User ASPs. Each disk unit is uniquely assigned to an
ASP. The pages that belong to temporary storage always reside in the System ASP. Most objects can
reside either in the System ASP or in a User ASP.
Whenever a program accesses a page for the first time, the page is copied from disk into main storage. It
stays there, but may be paged out if it is not being used for a long time. The Storage Management
component is responsible for allocating and freeing space on disk. It distributes the data evenly over the
available disk units in the ASP.
If the disk units in a User ASP are completely filled, the extra data will overflow into the System ASP. If
the System ASP is completely filled, the iSeries server will stop. Usually, the restart of the server frees
enough temporary storage to allow an operator to logon and check for large objects that can be deleted.
The amount of storage used in the system ASP can be displayed with the i5/SO command WRKSYSSTS
(„Work with System Status“).
© SAP AG
ADM525
Concepts of i5/OS - 6
Overview i5/OS: Logical Partitions (LPAR)
CPU
CPU
IOP
Disk
Disk
Main
Storage
Physical
iSeries
Hardware:
One Server
IOP
CPU
Disk
Disk
Power Hypervisor
CPU
CPU
Main
Storage
IOP
CPU
Disk
Main
Storage
Disk
Partition A: i5/OS
HMC
IOP
Disk
Disk
Multiple Logical
Partitions:
Independent
Hardware and
Operating
Systems
Partition B: i5/OS
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 7
The iSeries server offers you the ability to partition one server into several independent servers. Each
logical partition operates as an independent logical server. However, each partition shares a few physical
system attributes such as the system serial number, system model, and processor feature code. All other
system attributes may vary among partitions.
Prior to i5/OS V5R3M0 and POWER5 hardware, it was necessary to define one primary partition that
manages the other partitions. If the primary partition went down, the secondary partitions would go down
as well. Starting with POWER5 hardware and i5/OS V5R3M0 the partition management is done by the
Hardware Management Console (HMC), so a primary partition is no longer necessary.
Logical Partitions can use their own hardware resources, but it is possible to setup shared resources like
CPU or main storage. Shared resources can be moved dynamically between partitions. This can be useful
if one partition contains a system that is only used occasionally, for example for data warehousing. It is
possible to assign fractions of CPUs down to 0.1 CPUs to partitions, if very small partitions are needed.
With POWER5 hardware, i5/OS V5R3M0, AIX 5L, and Linux are supported as operating systems. Each
partition can run any of the supported operating systems.
© SAP AG
ADM525
Concepts of i5/OS - 7
Overview i5/OS: Independent ASP
Logical Partitions in a Cluster
CPU
Multisystem Cluster
CPU
CPU
Main
Storage
Main
Storage
CPU
Main
Storage
Main
Storage
Local
Disks
Local
Disks
Primary
IOP
Local
Disks
Primary
Backup
Backup
HSL
Shared Bus
IOP
IOP
Local
Disks
Disk
Disk
Independent
Disk ASP
Disk
Independent
ASP
Switchable I/O Tower
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 8
An independent auxiliary storage pool (ASP) contains user data and all of the necessary system
information associated with the data. An independent ASP can be made available (varied on) and made
unavailable (varied off) to the server without restarting the system. Switched disk support in an LPAR
environment (disks switch between partitions) is available on all systems that support LPAR. This is ideal
for a test environment as it can be done using only one physical system. Switched disk between systems is
only supported on a subset of the available iSeries models. Switched disk support is based on the system's
ability to use the HSL SAN (System Area Network) function available with Version 5 Release 1.
In order to perform an automatic switchover or failover from a primary to a backup system, you can
configure an iSeries cluster. An iSeries cluster is a collection or group of one or more servers that work
together as a single server. A cluster node is a server or logical partition that is a member of a cluster. In
cluster resource groups (CRGs) you can define actions to be taken during a switchover or failover. SAP
note 568820 explains how to configure the use of independent ASPs with the SAP software.
© SAP AG
ADM525
Concepts of i5/OS - 8
Overview i5/OS: Layered Architecture and PASE
i5/OS PASE
Applications
i5/OS ILE Applications
SAP Kernel >= 6.40
SAP Kernel up to Release 6.20
i5/OS PASE
Runtime
i5/OS *BASE
Syscall Boundary
Loader
PowerPC
Technology Independent Machine Interface
Licensed Internal Code (LIC) Kernel
PowerPC iSeries
Server IOPs
Device IOPs
iSeries Hardware
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 9
On its right side, the picture is showing the layered architecture of i5/OS. All applications and the base
operating system are based on the technology independent machine interface (TIMI). If the underlying
hardware changes with new models, only the licensed internal code needs to be adjusted. The applications
do not need to be recompiled, only their internal code representation may need to be retranslated. This is
usually done at „first touch“ and does not require user intervention.
Starting with kernel release 6.40, SAP is using the Portable Application Solutions Environment (PASE) as
runtime. PASE provides a broad set of AIX interfaces, in a runtime that allows AIX binary programs to
execute directly on the PowerPC processor of IBM eServer iSeries. While many of the executables in the
6.40 kernel are now AIX binaries, the application still uses the integrated database DB2 UDB for iSeries
and keeps the „look and feel“ of an iSeries application.
© SAP AG
ADM525
Concepts of i5/OS - 9
Concepts iSeries and i5/OS – Objects, File Systems
Objects and
File Systems
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 10
© SAP AG
ADM525
Concepts of i5/OS - 10
Objects and File Systems: Objects in Libraries
Object header:
Name: QSYS
Type: *LIB
Owner: QSYS
Size: …
Object header:
Name: MYLIB
Type: *LIB
Owner: JOHN
Size: …
*LIB MYLIB
*PGM TEST
*FILE MYDATA
*USRPRF JOHN
Object header:
Name: JOHN
Type: *USRPRF
Owner: JOHN
Size: …
Owned Objects
Private Authorities
Object header:
Name: TEST
Type: *PGM
Owner: JOHN
Size: …
MI Template
Constants
Instructions
Object header:
Name: MYDATA
Type: *FILE
Owner: JOHN
Size: …
Member: MYDATA
Customer Data
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 11
i5/OS objects provide the means through which all data processing information is stored and processed by
the iSeries. An i5/OS object is a named unit that exists (occupies space) in storage and on which
operations are performed on it by the operating system. Object names can be 10 characters long. Usually
object names start with a letter and can contain letters, numbers 0-9, as well as some characters like
underscore, dollar sign or pound sign. It is possible to create objects with other names if the name is
enclosed in double quotes (which leaves only 8 characters for the object name).
i5/OS objects have the following in common:
y Each object is uniquely identified by an object name, object type, and the library it resides in.
y You can rename all objects and move most objects to another library. You cannot modify the type of an
object.
y Each object has a generic header that is the same for all object types. It contains the object name and
type, the owner, the library that the object resides in, the object size, backup information and more.
y Depending on the object type, the object contains a type-specific header and the data that is associated
with that type.
y The object type decides the types of operations that can be performed on an object.
© SAP AG
ADM525
Concepts of i5/OS - 11
Objects and File Systems: Important Object Types
Object types in any library:
Object types only in QSYS:
*PGM (Program)
*LIB (Library)
*SQLPKG (SQL Package)
*USRPRF (User Profile)
*SRVPGM (Service Program)
*JRNRCV (Journal Reveiver)
*DEVD (Device Description)
*JRN (Journal)
*LIND (Line Description)
*JOBQ (Job Queue)
*CTLD (Controller Description)
*OUTQ (Output Queue)
*MSGF (Message File)
*FILE:
PF (Physical File, SQL Table)
LF (Logical File, Index, View)
*MSGQ (Message Queue)
*JOBD (Job Description)
*CMD (Command)
*AUTL (Authorization List)
Special library QTEMP:
z Available in each process/job
z Only visible for this process
*SBSD (Subsystem Description)
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 12
This is a list of some important object types in the SAP environment. Many objects can be in any library,
but some can only be in library QSYS. Among those that can only be in QSYS, you find the object type
*LIB (library). This means that you do not have a hierarchical but a flat structure of objects in the system.
In order to keep an overview, processes or jobs maintain a library list that contains only the libraries of
interest for this environment.
There is a special library that is called QTEMP. Each process or job has its own library QTEMP, and
objects in this library are only visible to the owning process or job. When a process ends, the library
QTEMP gets deleted. That‘s why it is primarily used for temporary objects.
© SAP AG
ADM525
Concepts of i5/OS - 12
Objects and File Systems: SQL Collection Objects
Journal
Journal receivers
Views
Indexes
BEFORE
AFTER
QSQJRNxxxx
QSQJRN
Journal library
Catalog Views
Cross-Reference Files
SYSTABLES, …
QADB*
Tables
Database library
Library QSYS
Collection, Schema
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 13
An SQL collection or schema is a library containing a number of specific objects:
y Library (*LIB): All tables, views and indexes as well as the catalog views and the journal are in one
library that has the same name as the collection (or schema). The journal receivers can be in the same
library or in a different one.
y Tables (*FILE, PF): Physical files that contain data.
y Views (*FILE, LF): Logical files over one or multiple tables.
y Indexes (*FILE, LF): Logical files over one or multiple keys in a table for faster access.
y Catalog Views (*FILE, LF): Logical files over system cross-reference files, for example used to link
long SQL names to short i5/OS names.
y Journal (*JRN): Name QSQJRN, located in the collection library. All tables that are created in this
collection, are automatically journalled.
y Journal receiver (*JRNRCV): Name QSQJRNxxxx, where xxxx is an automatically generated number.
© SAP AG
ADM525
Concepts of i5/OS - 13
Objects and File Systems: SQL Long Name Mapping
SQL name
i5/OS name
SFLIGHT (Table)
SFLIGHT (Physical file)
AKB_EXCEPT2 (Table)
AKB_E00001 (Physical file)
AKB_EXCEPT2+APP (Index)
AKB_0002 (Logical file)
/BI0/PHIER_VERS (Table)
"/BI00049" (Physical file)
/BI0/MHIER_VERS (View)
"/BI00132" (Logical file)
Catalog view SYSTABLES
TABLE_NAME
SYSTEM_TABLE_NAME
Catalog view SYSINDEXES
INDEX_NAME
SYSTEM_INDEX_NAME
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 14
SQL permits names of up to 128 characters, but the i5/OS operating system can only process names with a
maximum length of 10 characters. Therefore, different names exist in SQL and on the operating system
level. The mapping between short operating system names and long SQL names is done with the help of
the catalog views. Catalog view SYSTABLES can be used for the mapping of table and view names, and
catalog view SYSINDEXES can be used for the mapping of index names.
If the SQL name has a maximum of 10 characters and represents a valid i5/OS object name, the SQL
name and the operating system name are the same (see first example SFLIGHT). If the SQL name exceeds
10 characters, but starts with a letter and uses no special characters, the operating system builds a name
based on the first five characters of the SQL name and a generated fiive digits number (see the second
example AKB_EXCEPT2, which is 11 characters long). If the name contains special characters like ‘+’ or
‘/’, the operating builds a name based on the first four characters and a generated four digits number (see
the third example AKB_EXCEPT2+APP). If the resulting name is not a valid i5/OS name, it is enclosed
in double quotes (see the last two examples). The operating system ensures that no duplicate names are
generated.
To find the corresponding i5/OS name for an SQL name, the catalog views SYSTABLES or
SYSINDEXES can be queried. If the short i5/OS name of an object is known, the corresponding SQL
name can also be found in the output of the DSPFD (Display File Description) command. Primary keys
are not implemented as objects in a library, but are part of the SQL table.
© SAP AG
ADM525
Concepts of i5/OS - 14
Objects and File Systems: Primary Key Constraint
Primary key constraint
Index
Table
MARA_ _ _ _ _ _ 0
MARA
WRKPFCST
Stored as part of the physical file
Constraint . . .. . . . . . : MARA______0
Type . . . .
. . . . . : *PRIMARY
Key . . . . . . . . . . . : MANDT
MATNR
Number of fields in key . : 2
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 15
The primary index has two functions:
1. It defines a set of columns whose values are unique for each row in the table. By specifying all
columns of a primary key in the WHERE clause of an SQL statement, it can be ensured that only one
row is returned.
2. It provides an index to the table which can be used for faster access, ordering or grouping of rows.
This primary index is stored within the physical file object (SQL table) in the database, not as a separate
logical file. SAP’s naming convention for the primary key is to start with the name of the table and end
with the character 0.
Information about the primary key constraint can be found in the catalog views (SYSCST,
SYSKEYCST), in the file description of the SQL table (physical file) with the i5/OS command DSPFD,
or with the i5/OS command WRKPFCST. To find out which columns build the primary key, use the
command DSPFD (Display File Description).
© SAP AG
ADM525
Concepts of i5/OS - 15
Objects and File Systems: Journaling
Update...
Journal (*JRN):
R3<SID>DATA/QSQJRN
Changes
are written…
1.
2.
to the journal
receiver
to a table and
its indexes
Bef
ore
Afte
r
MSSA
VBSK
VBBE
VBBS
Journal receiver (*JRNRCV):
R3<SID>JRN/QSQJRNxxxx
Commit
or
Rollback
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 16
Journaling is a chronological recording of database changes. These records are required for commitment
control, that is the capability of treating a set of SQL statements as one entity. Journaling also enables:
y forward recovery of the database from the latest backup up to a specific point in time
y backward recovery of the database from its current state backwards to a specific point in time
Two objects enable journaling in i5/OS:
y The journal QSQJRN, located in the collection library. It defines which objects are to be recorded in the
journal. In an SAP system, all tables are journaled.
y The journal receivers QSQJRNxxxx either in the collection library or in another library. The last four
characters in the name are a four-digit number. The receivers are containing the journal entries, and they
can grow quickly on a busy system. Journal receivers are typically defined with a size threshold. When
the threshold is reached, the system creates a new journal receiver and switches the journal to the new
receiver. The old detached receiver can then be saved and deleted.
For every update request, the database management system writes a copy of the data record to the journal
receiver and then changes the database. The journal receiver then contains two records, the data record
before the change (Before Image) and the record after the change (After Image).
© SAP AG
ADM525
Concepts of i5/OS - 16
Objects and File Systems: SQL Packages
SQL Package (*SQLPKG)
PRTSQLINF Output
Objec
?
t
RAA
G" =
Objec name........
AAAF "ACTFLA ?
q
c
N
R3CH
t type
=
T
ME :
AL"
L SE
B0
....
CRTS
NT N A
DD25 "AS4LOC 5
QL*** .....*SQLPK 2040/RADE
/0
TEME HBDATA/
D
9
A
N
T
/1
A
1
S
G
NACT
3C
n0
=?
PGM(
CA UPDATE RIEWNAME" st saved o
R3CH
.
la
B0
COMM
E "V
plan
conds
.
WHER 1 Access t 15:14:02 ime is 1 se
IT(*CH 2040/RAD
a
OPTIO
E N AC
02
nt
G)
SQL4
ery ru
TCA)
N
1.
ted qu
TGTR (*SYS *PE
a
table
im
t
L
RIOD
ed for 1.
20 Es
r
0
e
4
id
L
)
ALWC S(*PRV)
s
SQ
on
ble
d
P
xes c
f o r ta
g use
CLOS YDTA(*OP
...
ll inde 25L used
ionin
A
it
s
6
o
0
p
D
0
Q
T
SQL4 8 Index D n-key row
STAT LCSR(*EN IMIZE)
E ME N
DPGM
L400 Index sca
Q
S
A
T TE X
)
1.
011
AHbA
T C CS
SQL4
SQL
PACKAGES
n table E: NcqAA
o
ID(81
9)
T NAM
EMEN
STAT
…
General SQL package attributes
(valid for all statements in package)
Statement specific information
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 17
An SQL package contains all the access information needed by the optimizer for DB2 UDB for iSeries. It
is used for two purposes:
1. It is used as a reference when using an SQL statement in multiple steps, such as opening a cursor and
multiple fetches. The library, the package name, and the statement ID within the SQL package
uniquely identify a statement.
2. It contains the access plan for the database optimizer. Optimizing an SQL statement is quite complex
and time consuming, especially when the query is joining multiple tables. The optimizer needs to
identify the best join order, identify indexes that can be used, and pick the best performing access
method. In order to reduce the overhead, the access plan is saved in the SQL package and reused when
the same statement is executed again. There are checks to verify that the implementation is still valid,
for example that the number of rows in the used tables did not change significantly since the
optimization. If an access plan is found to be no longer valid, it is automatically reoptimized.
The information that is stored in an SQL package can be viewed or printed by using the i5/OS command
PRTSQLINF.
© SAP AG
ADM525
Concepts of i5/OS - 17
Objects and File Systems: Integrated File System
Root (not case sensitive)
/
/QOpenSys
Open systems (case sensitive)
/QSYS.LIB
Library File System
/QOPT
Optical file system (CD/DVD)
/QFileSvr.400
i5/OS file server
/<mounted path>
Network file system (NFS)
/<ASP name>
Independent ASP
More file systems: NetWare, NetClient, User-defined, …
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 18
The integrated file system is a part of i5/OS that supports stream input/output similar to PC‘s and UNIX
operating systems. These are the most commonly used file systems in an SAP environment:
Root File System: All directories and stream files that are not part of another file system. Each component
of file and path names can be up to 255 characters long and are not case sensitive.
Open Systems File System (/QOpenSys): This is a Unix style file system, path names and file names are
case sensitive, can be up to 255 characters long, and start with /QOpenSys.
Library File System (/QSYS.LIB): This is the access to libraries and objects as described earlier. Objects
are accessed like: /QSYS.LIB/MYLIB.LIB/MYDATA.FILE/MYDATA.MBR.
Optical File System (/QOPT): This file system is used to access data on CDs or DVDs that are loaded
into the built-in CD or DVD drive. The path name starts with /QOPT.
i5/OS File Server (/QFileSvr.400): Allows to access data remotely between iSeries servers.
Network File System (NFS): This file system uses the standard TCP/IP protocol for NFS and can be used
to access data on or from remote Unix or iSeries servers.
Independent ASP: When an independent ASP is varied on, a user-defined file system (UDFS) is created
automatically in that ASP. The user-defined file system is named /dev/<ASP
name>/QDEFAULT.UDFS. In addition, a directory with the name of the ASP is created in the root
directory, and the user-defined file system is mounted over that directory (/<ASP name>).
© SAP AG
ADM525
Concepts of i5/OS - 18
Objects and File Systems: Symbolic Links
Directory A
Absolute paths to file 4:
• Symbolic link I
• Symbolic link II
• File 1
• Directory B
Remote
system
Directory B
/Dir. A/Dir. B/Dir. C/file 4
/Dir. A/Dir. B/sym.link III
/Dir. A/sym.link II/file 4
Relative path from
directory B to file 4 :
• Symbolic link III
• File 2
• Directory C
Dir. C/file 4
symbolic link III
.. /symbolic link II/file 4
Directory C
• Symbolic link IV
• File 4
Symbolic link
?
Hard link
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 19
There are two types of links: hard links and symbolic links. Whenever a new directory or file is created, a
hard link to that object is defined. It is possible to add multiple hard links to the same object. When
multiple hard links are pointing to the same object and one of the links is removed, the object itself is not
deleted. Only when the last hard link to an object is removed, the object gets deleted as well.
A soft link or symbolic link is created as an object with an object type *SYMLNK. A symbolic link
contains a path name as reference to an object. When a symbolic link is created, the target is not verified.
When the symbolic link is used by an application, the contents of the symbolic link is resolved. Symbolic
links can cross file system boundaries, for example a symbolic link
/usr/sap/<sid>/sys/exe/run/AS4RMTCCMS (Root file system) can have a contents of
/QSYS.LIB/R3640A0056.LIB/AS4RMTCCMS.PGM (Library file system). When removing a symbolic
link, the object that it points to does not get deleted.
Path names can be absolute (starting with a ‘/’ in the root directory) or relative to the current directory.
When creating symbolic links, you should be careful with relative path names. Each user has a home
directory, which can be specified as ‘~’ in relative path names.
© SAP AG
ADM525
Concepts of i5/OS - 19
Objects and File Systems: Remote File Systems
/
/
QFileSvr.400
QSYS.LIB
HOST2
usr
QFileSvr.400
HOST2 (iSeries)
HOST1 (iSeries)
1. md ‘/QFileSvr.400/HOST2‘
2. wrklnk ‘/QFileSvr.400/HOST2/usr/*‘
/
/
sapmnt
HOST3 (iSeries/Unix)
sapmnt
NFS
trans
HOST4 (iSeries/Unix)
1. exportfs *dft ‘/sapmnt‘
2. mount *nfs ‘HOST4:/sapmnt‘ ‘/sapmnt‘
3. wrklnk ‘/sapmnt/trans/*‘
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 20
This picture demonstrates two methods to access IFS objects on remote hosts. In both cases it is assumed,
that a TCP/IP connection exists between the two hosts, and the hosts are known by their names (HOST2
or HOST4). It is also assumed that all necessary TCP/IP services are started automatically during system
startup. The command ‚wrklnk‘ in this picture is only used to show how to access the directories. It will be
explained in more detail later.
The first case is showing the access through QFileSvr.400. The directory /QFileSvr.400 always exists on
an iSeries. In order to access the remote server HOST2, the system administrator or a user needs to create
a directory with the same name as the remote host in /QFileSvr.400 directory. This can be done with the
command „md“. After this, a user can access the root directory and any underlying directories on the
remote host by using a path name of ‘/QFileSvr.400/HOST2/…‘ if he has sufficient permissions. A
requirement for this connection type is that the user has the same user profile name with the same
password on both hosts.
The second case is showing the access through NFS. This also allows to access directories on Unix system
from an iSeries server. First the administrator on the target system (HOST4) needs to export a directory to
allow remote access. Then the administrator of the source system (HOST3) can mount the directory over
an existing directory on the source system. After that, a user can access all subdirectories of the exported
directory on the target system if he has sufficient permissions. Unless public access is granted, the users
have to have the same UID on the source and target system.
© SAP AG
ADM525
Concepts of i5/OS - 20
Objects and File Systems: Language Support
Library (*LIB) QSYS or Product Library
*PGM
*SRVPGM
*CMD
*MSGF
Language independent
objects
*FILE
Language dependent objects
in primary language (for
example: German)
Library (*LIB) QSYS2924
*CMD
*MSGF
*FILE
Language dependent objects
in secondary language (for
example: English)
Library (*LIB) QSYS2931
*CMD
*MSGF
*FILE
Language dependent objects
in secondary language (for
example: Spanish)
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 21
i5/OS allows to use multiple national languages in parallel on one server. This is acomplished by splitting
up all applications into objects that are language independent (for example programs and service
programs) and language dependent objects that contain text elements and need to be translated (for
example commands, message files and data files). This concept is supported by IBM products for the
iSeries server, such as the operating system and additional licensed products.
When an iSeries server is installed for the first time, you can choose a primary language, usually the
language that your administrators are most familiar with, or English in a multi-national environment. The
language independent objects and the language dependent objects of the primary language always go into
library QSYS for the operating system or the product library for a licensed program.
In addition, one or more secondary languages can be installed. Each language has a four-digit code, such
as 2929 for English, 2924 for German, 2931 for Spanish or 2928 for French. The language dependent
objects of each secondary language are stored in libraries QSYS<xxxx> with <xxxx> being replaced by
the four digit language code.
In order to see screens in a choosen secondary language, the library QSYS<xxxx> must be in the job
library list in a position prior to QSYS. This can be controlled system-wide through system value
QSYSLIBL, subsystem-wide through the subsystem description, or in a specific job with the command
CHGSYSLIBL.
© SAP AG
ADM525
Concepts of i5/OS - 21
Objects and File Systems: Character Representation
iSeries:
Windows / Unix:
EBCDIC:
1 byte characters
Space: 0x40
Character order:
a…z
A…Z
0…9
ASCII:
1 byte characters
Space: 0x20
Character order:
0…9
A…Z
a…z
EBCDIC CCSIDs:
ASCII CCSIDs:
37
273
284
290
297
500
870
…
819
850
1252
…
ISO 8859-1; Latin 1
PC Data; MLP 222 Latin 1
Windows, Latin 1
1208
13488
Unicode (UTF-8), 1..4 bytes
Unicode (UCS-2), 2 bytes
English USA, Australia, …
German
Spanish
Japanese Katakana
French
Multilingual Latin 1
Multilingual Latin 2
CCSID = Coded Character Set Identifier
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 22
Traditionally, the iSeries server uses an EBCDIC encoding schema for its data, while PCs and Unix
servers typically use an ASCII encoding schema. Both EBCDIC and ASCII use one byte per character,
but the internal hex values for characters are different between EBCDIC and ASCII. For example, the
digits ‚0‘ to ‚9‘ in EBCDIC have internal values of 0xf0 to 0xf9, while they have 0x30 to 0x39 in ASCII.
As the picture shows, the values of lowercase characters, uppercase characters and the digits 0 to 9 are in a
different relation to each other when comparing EBCDIC with ASCII.
Besides the main differences between EBCDIC and ASCII, there are also minor differences to handle
special characters that are used only in specific languages and countries. Each character set has a number
assigned, the so-called Coded Character Set Identifier (CCSID). The CCSID defines the relation between
each character and its internal representation. For example, the German character ‚ü‘ has a value of 0xdc
in CCSID 500, but a value of 0xd0 in CCSID 273.
With ongoing globalization, the limitations of single-byte character representations become more and
more a problem. That‘s why computer manufacturers and software producers move more and more
towards Unicode. Unicode allows the representation of many more characters, but requires more space
and computing power. Unicode is coming in many different variations, such as UTF-8, UTF-16, or UCS2. The SAP Unicode implementation on iSeries uses UCS-2 for the database, which is represented as
CCSID 13488. IFS data can also be stored as UTF-8 with CCSID 1208.
© SAP AG
ADM525
Concepts of i5/OS - 22
Objects and File Systems: Character Conversion
Process 1
CCSID 65535
File 1
U
‘ U‘ (0x00e4)
=> no conversion
Workstation 1: CCSID 273
‘ä‘ (0x00e4)
CCSID 13488
Process 2
CCSID 273
ä
‘ä‘ (0xc0)
=> conversion
Workstation 2: CCSID 273
File 2
‘ä‘ (0x43)
CCSID 500
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 23
Objects and processes on iSeries can be tagged with a CCSID value. The workstation software is also
configured for a CCSID value. The values of the workstation software and the process should match to get
a correct display of special characters. When the CCSID of an object and the CCSID of the process are not
the same, character conversion happens automatically. An exception is the special value 65535 for the
CCSID because it indicates that no conversion should happen.
In the example, we read a character in Unicode (CCSID 13488) from a file. Process 1 has CCSID 65535
configured, so the data is sent to the workstation without conversion. On the screen the character occupies
two positions, the first one appears blank because 0x00 is a non-displayable character, the second one
shows a ‚U‘, which is the character for value 0xe4 in CCSID 273. Process 2 is configured to run in CCSID
273, so the double byte Unicode character gets converted into a valid EBCDIC character in CCSID 273.
When writing the data to a file that is tagged with CCSID 500, the character again gets converted from
CCSID 273 to CCSID 500.
Character conversion does not happen if file operations are executed in binary mode (on stream files). In
the database, each column can be tagged with an individual CCSID. Columns that contain binary data are
flagged with CCSID 65535, so no conversion takes place on that data.
© SAP AG
ADM525
Concepts of i5/OS - 23
Concepts iSeries and i5/OS – User Interfaces
User
Interfaces
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 24
© SAP AG
ADM525
Concepts of i5/OS - 24
User Interfaces: PC5250 Emulation
IBM Personal Communications (5250 emulation) with signon screen
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 25
Most administration work for the iSeries server can be done using the command line interface. To access
the command line interface, you need an emulation for the 5250 datastream on your workstation. There
are multiple products in the market, one is the product IBM Personal Communications for Windows,
another one is the 5250 emulation program that is included in the product IBM iSeries Access for
Windows. The emulation accesses the iSeries server through TCP/IP using the standard Telnet port 23.
At the signon screen, you have to enter your username and password. Optional you can enter a program, a
menu, or a current library. These fields can be used if an initial program, a start menu, or a current library
have been assigned to your user profile and something is wrong with them, for example the current library
got deleted. Usually this would cause an immediate job end, but you can skip the predefined values by
specifying *NONE as the program, MAIN as the menu, and *CRTDFT as the current library.
© SAP AG
ADM525
Concepts of i5/OS - 25
User Interfaces: Main Menu and Command Line
Menu options: Choose by number
Command entry line
System information
Function key description (F4 = Prompt)
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 26
The main menu is the default screen that you get after signing on to the system. A menu usually allows
you to either pick a menu option by entering its number or to enter a command name. Most screens show
information about the system in the upper right corner (useful in an environment with many systems) and
the available function keys at the bottom of the screen. Useful function keys for a command line are:
y F1 Get help – help contents depending on the cursor position on the screen
y F3 Exit the screen
y F4 Prompt the command with its parameters, or a selection of commands if no command is typed
y F9 Retrieve previous commands
© SAP AG
ADM525
Concepts of i5/OS - 26
User Interfaces: Command Prompt
Screen after using F4 (= Prompt) on the command CRTLIB:
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 27
After typing the name of a command, you can push the function key F4 to prompt the command. This will
bring up a screen that lists the parameters of the command. To the left, you see a descriptive text, to the
right you see possible values for a parameter. Many parameters are optional and show the default value in
the prompt. Required parameters (like the library name in the example) are highlighted.
For a better overview, only the most important parameters are shown in the first display. Additional, less
often used parameters can be shown by pressing the F10 key. When placing the cursor on a parameter, you
can use the F1 function key to get help on individual parameters or the F4 function key to get a complete
list of possible values for that parameter.
© SAP AG
ADM525
Concepts of i5/OS - 27
User Interface: Parameter Keywords
Function key F11 toggles between parameter keywords and values:
Resulting command string: CRTLIB LIB(MYLIB) ASP(1)
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 28
In the command prompt screen, you can use the function key F11 ot toggle between the possible
parameter values (shown in the previous picture) and the parameter keywords (shown in this picture). The
parameter keywords are needed when typing the command into the command line or using the command
in a program. The format is: COMMAND KEYWORD1(value1) KEYWORD2(value2)… Usually the
first few parameters can also specified directly without the keyword, for example: CRTLIB MYLIB.
However, in most cases you have to specify the keywords (or prompt) when using more than the first
parameter(s).
© SAP AG
ADM525
Concepts of i5/OS - 28
User Interfaces: Lists and Dependent Parameters
Type a plus sign and hit enter to specify a list of values
These parameters are only available for a tape device (TAP01)
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 29
This screen shot of the save object command demonstrates two features of the command prompt:
1. If a parameter can hold a list of elements, you see the two lines and the text „+ for more values“ on the
initial command prompt. If you want to enter more than 2 parameters here, you can type a ‚+‘ sign and
hit the Enter key. This brings up a list where you can specify as many values as the command
definition allows. Using the Enter key on this list entry returns to the main screen, so that you can fill
in the remaining parameters.
2. In some cases the value of one parameter defines what other parameters are displayed. In the SAVOBJ
command, the value for parameter Device decides what additional values are needed. In the example,
the devide is a tape unit, so volume identifier, sequence numberm label and so on can be specified. If
the device was an optical device, you would not need to specify a sequence number or a label. If the
special value *SAVF (save file) would be used, you would not need to specify volume identifiers and
so on, but you needed to define the name and library of a save file. In such a case, the command
prompt first offers you only a few choices. After you specify the device and hit Enter, you get
additional parameters depending on you input in the device selection.
The function key F9 displays a complete list of all possible parameters.
© SAP AG
ADM525
Concepts of i5/OS - 29
User Interfaces: Extending Parameter Space
Type ‘&‘ and hit Enter to extend parameter input area:
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 30
If the input area on a command prompt screen is not large enough to hold the data that you need to enter,
you can type an ampersand character (‚&‘) and hit the enter key to extend the space. You can repeat this
multiple times until the field is large enough for your needs.
© SAP AG
ADM525
Concepts of i5/OS - 30
User Interfaces: Important Commands (1)
Object Management Commands:
CRTxxx
DSPxxx
WRKxxx
DLTxxx
MOVOBJ
RNMOBJ
DSPOBJD
CRTDUPOBJ
Create object, for example CRTUSRPRF, CRTLIB, CRTJRN, …
Display object, for example DSPUSRPRF, DSPFD, DSPFFD, …
Work with object, for example WRKLIB, WRKF, WRKJRNA, …
Delete object, for example DLTUSRPRF, DLTLIB, DLTF, …
Move object into another library
Rename object
Display object description
Create duplicate object (copy object)
Integrated File System (IFS) Commands:
WRKLNK
Work with links; similar to Windows: dir or Unix: ls
ADDLNK
Add link; create symbolic (soft) or hard link
RMVLNK
Remove link; removing last hard link deletes object
MKDIR/MD
Make directory
CHGCURDIR/CD Change current directory
RNM/MOV/CPY Rename / move / copy object
EDTF
Edit file; simple editor, like Notepad on Windows
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 31
iSeries commands consist of an abbreviated „verb“ and an „object“, such as CRT, DSP, DLT for the verbs
or LIB, JRN, PGM, USRPRF, JRNRCV for objects. The WRK… commands usually bring up a list of the
selected objects, where further actions can be taken on each element in the list.
If you are new to iSeries, you should familiarize yourself with those commands by prompting them (to see
the parameters) and by reading the help text of the commands. If you only know the beginning of the
command, but not the full command, you can also enter the beginning of a command followed by a ‚*‘,
for example WRKJ*. This will bring up all commands that start with the characters WRKJ, such as
WRKJRN, WRKJRNA, and WRKJRNRCV.
© SAP AG
ADM525
Concepts of i5/OS - 31
User Interfaces: Important Commands (2)
System Control Commands:
WRKACTJOB
WRKSYSSTS
WRKDSKSTS
WRKSYSVAL
GO LICPGM
GO PTF
PWRDWNSYS
SIGNOFF
Work with active jobs; like Windows task manager or ps -ef
Work with system status; CPU usage, paging, disk filling
Work with disk status; disk usage and filling per drive
Work with system values; control system properties
Work with licensed programs; install or uninstall
Work with program temporary fixes (code corrections)
Power down the system; with or without restart
End interactive job
Communication Configuration Commands:
WRKHDWRSC
CFGTCP
Work with hardware resources; entry point to create line
descriptions for an Ethernet line
Configure TCP/IP menu; important options:
1. Work with TCP/IP interfaces: own IP address, line descript.
2. Work with TCP/IP routes: how to get to other systems
10. Work with TCP/IP host table entries: local host table
12. Change TCP/IP domain information: own system name
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 32
Some of the commands listed in this page will be explained later in more detail. It is a selection of
important commands for a system administrator. The command ‚GO‘ brings up a menu (object type:
*MENU), such as LICPGM, PTF, or MAIN.
© SAP AG
ADM525
Concepts of i5/OS - 32
User Interfaces: Interactive SQL
STRSQL:
SQLUTIL:
• Requires iSeries software
product „DB2 Query Mgr and
SQL DevKit”
• Supports prompting of SQL
statements
• Allows changing of session
attributes and saving a
session with SQL statements
• Can be downloaded as PTF
from IBM or as attachment
to SAP note 68732
• Does not support prompting
of SQL statements
• No control of session
attributes and no saving of
session
SELECT SYSTEM_TABLE_NAME
FROM R3<sid>DATA/SYSTABLES
WHERE TABLE_NAME = ‘/BI0/PHIER_VERS‘
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 33
Sometimes it is helpful to enter SQL statements directly, for example to map long SQL names to short
i5/OS names. There are two tools available to enter SQL statements in a 5250 emulation.
The STRSQL command is only available if the chargeable software product „DB2 Query Manager and
SQL Development Kit“ (product number 5722ST1) is installed on the iSeries server. It allows to prompt
SQL statements similar to the i5/OS command prompt. Prompting also includes to get a list of available
columns after specifying a table, so that it is quite easy to build the complete SQL statement. In addition, it
is possible to set session attributes, such as the default commit level, and to save the session when leaving
it. If a session was saved and STRSQL is executed again, the SQL statements from the previous session
can be retrieved using thf F9 function key.
A cheap alternative is the SQLUTIL tool. You can download it from IBM as PTF or from SAP as
attachment to SAP note 68732. The SAP note also contains the PTF number to download (depending on
the operating system release). After entering SQLUTIL, you get a screen where you can enter your SQL
statement. However, there is no prompt support, so you have to know the exact syntax of the statement
and the column names. You can neither change session attributes nor save your session. The function ke
F9 only retrieves the last statement in the current session.
© SAP AG
ADM525
Concepts of i5/OS - 33
User Interfaces: STRSQL Prompt
Example for prompt of a SELECT statement with STRSQL:
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 34
The screen shot shows the prompt function for the STRSQL tool. After typing a file (table or view) name,
you can position the cursor on any of the lines below and press the function key F4 to get a list of fields
(or columns) to choose from. Similar prompts are available for other SQL statements such as INSERT,
UPDATE, DELETE, CREATE TABLE and many more.
© SAP AG
ADM525
Concepts of i5/OS - 34
User Interfaces: iSeries Navigator
iSeries Navigator overview
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 35
The iSeries Navigator is another way to access and administrate your iSeries server. It is a graphical tool
that can be installed on your workstation with the software product IBM iSeries Access for Windows.
On the left side, you see a list of all connections. You can add additional iSeries servers by clicking on the
iSeries symbol in the upper left corner. You can expand the selection of tasks underneath each system
(shown for AS0016). In the following charts, we will have a closer look at the Network and the File
Systems.
© SAP AG
ADM525
Concepts of i5/OS - 35
User Interfaces: iSeries Navigator - Network
List of TCP/IP servers with status information
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 36
This is one example how to use the iSeries Navigator to administrate TCP/IP servers. On the right side of
the screen, you get a list of all available TCP/IP servers. You can start and stop servers from this view, and
you can change properties of the servers by using the right mouse button. You can also list the server jobs
that belong to a server and get detail information about the server jobs.
© SAP AG
ADM525
Concepts of i5/OS - 36
User Interfaces: iSeries Navigator – File Systems
List of available file shares
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 37
On the right side of the screen you see a list of file shares that can be accessed from your workstation
through the Windows file system (map network drive). In order to make iSeries directories as shares
available, you position the cursor in the left part of the screen on „File Shares“. The right mouse button
brings up possible actions. You can select „Open iSeries NetServer“ to define iSeries directories as shares.
Besides directories, you can also share iSeries printers in the Windows network.
© SAP AG
ADM525
Concepts of i5/OS - 37
User Interfaces: iSeries Navigator – Run SQL Scripts
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 38
If you select a database in iSeries Navigator, such as AS0016 in the slide, you can choose the option „Run
SQL Scripts“ to bring up the window that is shown in this picture. You can enter SQL statements in the
input area and execute the statements. This tool offers a function „SQL Assist“ to get guidance with the
SQL syntax and a function calles „VisualExplain“ to execute statements and see their implementation.
This can sometimes be helpful to analyze performance. However, this tool needs to be used with care
when trying to analyze SQL statements used by SAP: The VisualExplain tool may return a different
access path than the one that is actually used by SAP because it accesses the database through a different
interface.
© SAP AG
ADM525
Concepts of i5/OS - 38
Concepts iSeries and i5/OS – CL Programming
CL
Programming
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 39
© SAP AG
ADM525
Concepts of i5/OS - 39
CL Programming: Overview
PGM
DCL
DCLF
IF
1
2
OVRDBF
DSPOBJD
PARM(&LIB)
VAR(&LIB) TYPE(*CHAR) LEN(10)
FILE(QADSPOBJ)
COND(%SST(&LIB 1 2) *NE 'R3') THEN(GOTO +
CMDLBL(PROGRAMEND))
FILE(QADSPOBJ) TOFILE(QTEMP/OBJECTLIST)
OBJ(&LIB/*ALL) OBJTYPE(*SQLPKG) +
OUTPUT(*OUTFILE) OUTFILE(QTEMP/OBJECTLIST)
MSGID(CPF0000) EXEC(DO)
CMDLBL(PROGRAMEND)
MONMSG
GOTO
ENDDO
4
MAINLOOP:
RCVF
MONMSG
MSGID(CPF0864) EXEC(GOTO CMDLBL(PROGRAMEND))
DLTSQLPKG SQLPKG(&LIB/&ODOBNM)
GOTO
CMDLBL(MAINLOOP)
PROGRAMEND: ENDPGM
/* Comment */
3
1
Parameters and variables
3
Loops and branches
2
Input file processing
4
Message handling
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 40
The command language (CL) allows you to use i5/OS operating system commands in combination with
elements of a high level programming language. The example is showing the source of a program that
creates a list of all SQL packages in a given library and deletes each SQL package from the list. The
name of the library to process is passed into the program as parameter. As a check, the program only
processes the library when the name starts with the characters „R3“. The program demonstrates some
important features of the CL programming language:
1. Parameters and variables: You can pass parameters into a program and declare variables. Variables can
be modified and compared, and they can be used as parameters for commands.
2. Input file processing: You can declare and read files. Typically a CL program is creating a list of items
in an output file and reading the list for individual processing of its entries.
3. Loops and branches: You can create loops with the help of labels and the GOTO instruction. You can
also have conditional statements with IF and ELSE. You can group statements, for example after an
IF, with DO and ENDDO.
4. Message handling: i5/OS commands communicate with the user or other programs by sending
messages. If you expect messages (such as CPF0864: „End of file detected…“), you can handle them
appropriately with the MONMSG instruction.
In general you can place comments (/* … */) anywhere in the source. If a command does not fit on one
line, you can place a plus sign at the end of the line and continue in the next line.
© SAP AG
ADM525
Concepts of i5/OS - 40
CL Programming: Parameters and Variables
TYPE
*DEC, *CHAR,
*LGL, *INT, *UINT
Declare with
DCL VAR(&…)
Variable naming:
‘&‘ plus up
to 10 characters
Use as parameter:
PGM PARM(&…)
Modify contents:
CHGVAR VAR(&…) VALUE(…)
String functions: *CAT, *TCAT, *BCAT, %SST
Numeric operations: (&A + (-&B))
LEN
VALUE
(optional)
Use in commands:
CRTLIB LIB(&LIB)
DLTF FILE(&LIB/&FILE)
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 41
Variables are being declared with the DCL statement. You must specify a type (keyword: TYPE), you can
specify a length (keyword: LEN) and an initial value (keyword: VALUE). A variable name always starts
with an ampersand (‚&‘) and can have up to 10 characters. The maximum length of variables depends on
the type: decimal (*DEC) - 15 digits, 9 decimal positions; character (*CHAR) - 9999 bytes; logical
(*LGL) - 1 byte, integer (*INT) - 4 bytes, unsigned integer (*UINT) - 4 bytes.
You can use the PARM qualifier on the initial PGM statement to specify up to 255 parameters. Each
parameter must be declared afterwards in the program. All parameters must have corresponding values
when the program is called, so you cannot have „optional“ parameters. If you specify a variable of type
*INT or *UINT as parameter and call the program from the command line, you can specify values in
hexadecimal format, such as X‘00000001‘ for the value 1.
Variables can be modified with the CHGVAR command. The new value can be a constant or an
expression, an automatic type conversion takes place whenever necessary and possible. You can
concatenate character variables with the operators *CAT (takes variables as they are), *TCAT (removes
trailing blanks) and *BCAT (adds a blank between the two variables). You can get a substring with the
%SST function. For numeric variables, you have the usual numeric operators (+, -, *, and /).
You can use a variable name in all parameters of commands that you specify. You need to make sure that
the variable type matches the parameter type in the command.
© SAP AG
ADM525
Concepts of i5/OS - 41
CL Programming: File Processing
DCLF FILE(<file template>)
DSP… OUTPUT(*OUTFILE)
OUTFILE(<file>)
OVRDBF FILE(<file template>)
TOFILE(<file>)
File template
in QSYS
RCVF
File
CPF0864
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 42
This picture describes the typical processing of files in a CL program. Many i5/OS commands to display
objects provide the option to redirect the output to an outfile. This allows you to create lists of objects that
follow a certain pattern and process each object in the list individually. Prior to i5/OS V5R3M0 you could
only declare and use one file per CL program, with i5/OS V5R3M0 that limit has been increased to 5 files.
You need to specify an OPNID parameter on both the DCLF and RCVF commands when using more than
one file in a CL program.
Usually the outfile does not exist at the time when the program get compiled, so it cannot be used for the
DCLF statement. Instead, you can use a template file in library QSYS for the declaration part. The IBM
documentation for iSeries lists the files that are relevant for each command that supports an OUTFILE
parameter; for example the file name for the DSPOBJD command is QADSPOBJ. Later in the program
you can override the template with the actual outfile (command OVRDBF), which will redirect your
program to read from the actual output file.
Reading the file is done with the RCVF command. It will read one row at a time, so you should execute
the command in a loop. After the last record is read, you receive a message CPF0864. You can monitor
this message and exit the loop to end processing og the file. With the DCLF statement, all fields (columns)
in the file are automatically declared as variables in the CL program. To see a list of fields in the template
file, you can use the command Display File Field Description (DSPFFD). For example, the file
QADSPOBJ contains a field ODOBNM that contains the name of the object. By declaring the file, you
automatically get a variable &ODOBNM in your CL program.
© SAP AG
ADM525
Concepts of i5/OS - 42
CL Programming: Loops and Branches
<label>:
*GT, *GE,
*LT, *LE,
*EQ, *NE
…
/* do not forget a */
/* conditional exit */
…
GOTO CMDLBL(<label>)
*AND, *OR,
*NOT
IF COND(<condition>) THEN(DO)
…
ENDDO
ELSE CMD(DO)
…
ENDDO
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 43
Prior to i5/OS V5R3M0, the GOTO statement was the only way to create loops in a CL program. That‘s
why this method is widespread and still used here. A label can precede any statement and is followed by a
colon (‚:‘). The GOTO statement can jump backwards and forwards by simply specifying the label
(without colon). Starting with i5/OS V5R3M0, you also have loops based on DOUNTIL, DOWHILE, and
DOFOR.
The IF statement allows to execute different code branches based on a condition. The condition consists of
comparison between variables and variables or values. The operands can be compared to be equal (*EQ),
not equal (*NE), greater than (*GT), greater than or equal (*GE), less than (*LT), and less than or equal
(*LE). Comparisons can be combined with operators *AND, *OR, or *NOT. An example for a valid
condition is: ((&C *LT 1) *AND (&TIME *GT 1430)).
After the condition in the IF statement, you can specify either a single command for the THEN parameter,
or you can start a group of statements with DO. This group is ended with an ENDDO. The ELSE branch is
optional. It can also have a single command in the CMD parameter, or it can start a set of commands with
DO.
© SAP AG
ADM525
Concepts of i5/OS - 43
CL Programming: Message Handling
PGM
DCL
DCLF
MONMSG
PARM(&LIB)
VAR(&LIB) TYPE(*CHAR) LEN(10)
FILE(QADSPOBJ)
MSGID(CPF2182)
CPF2110
CPF2113
…
DSPOBJD
MONMSG
GOTO
ENDDO
OBJ(&LIB/*ALL) …
MSGID(CPF2110) EXEC(DO)
CMDLBL(SHORTCUT)
CPF2105
…
DLTSQLPKG
MONMSG
CPF2182
SQLPKG(&LIB/&ODOBNM)
MSGID(CPF0000)
CPF2182
…
CPF2189
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 44
Each command in a CL program can send error messages. For example, the DSPOBJD command could
send CPF2110 „Library not found“, CPF2113 „Cannot allocate library“, or CPF2182 „Not authorized to
library“. The DLTSQLPKG can send CPF2105 „Object not found“, CPF2189 „Not authorized to object“,
or CPF2182 „Not authorized to library“. Usually such a message causes the program to stop.
With the MONMSG statement, you can monitor for messages and define appropriates actions when
certain messages appear. If a MONMSG statement is placed right behind the declarations (DCL, DCLF)
and before the first executable command, it is valid for all commands in the program. This is called a
program-level monitor. Other MONMSG statements are valid only for the preceeding command. If both a
program-level and a command-level monitor exist for a message, the command-level monitor takes
precedence. The message ID CPF0000 is a non-existing message ID. It is used to define a monitor for all
messages that start with „CPF“.
The EXEC parameter is optional. If you do not specify it, the message is simply ignored. You can specify
a single command, or a group of commands enclosed in DO and ENDDO. You can specify multiple
MONMSG statements at both program level and command level in order to react differently to different
messages.
© SAP AG
ADM525
Concepts of i5/OS - 44
CL Programming: Creating CL Programs
Library MYLIB
CRTLIB LIB(MYLIB)
QCLSRC
MYPGM
CRTSRCPF FILE(MYLIB/QCLSRC)
WRKMBRPDM FILE(MYLIB/QCLSRC)
F6 => SRCMBR(MYPGM) TYPE(CLP)
PGM PARM(&LIB)
DCL VAR(&LIB) …
DCLF FILE(QADSP …
IF
COND(%SST …
EDTF FILE(MYLIB/QCLSRC)
MBR(MYPGM)
CRTCLPGM PGM(MYLIB/MYPGM)
SRCFILE(MYLIB/QCLSRC)
MYPGM
*PGM
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 45
These are the necessary steps when creating a CL program:
1. If a library for your program and source does not yet exist, you need to create a library with the
CRTLIB command.
2. If a source file does not yet exist, you need to create a source files with the command CRTSRCPF. It is
recommended to name the file QCLSRC because the command CRTCLPGM uses that name as
default.
3. The actual source text is in a member of the file QCLSRC. The file can have as many members as you
like. It is recommended to give the member the name that you are planning to use for your program
because that is the default on the CRTCLPGM command. If the member does not yet exist, it gets
automatically created when invoking the editor. As an editor, you can use the Programming
Development Manager (PDM) if the Application Development Tools product is installed. The editor
supports prompting and syntax check functions for CL programs. If the product is not installed, you
can use EDTF instead. This is a simple editor that does not support prompting or a syntax check.
4. To compile the source, you can use the CRTCLPGM command. If you picked the names as suggested,
you can leave most parameters as default. If you plan to debug the program later, you must specify the
parameter OPTION(*SRCDBG) on the CRTCLPGM command.
© SAP AG
ADM525
Concepts of i5/OS - 45
CL Programming: Editing with PDM
Sequence number and line command area (I = Insert)
Function keys: F4 = command prompt
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 46
This is the screen that you get when you use the editor of the Programming Development Manager
(PDM). At the bottom of the screen, you can see some of the supported function keys. An important
feature is function key F4 that allows to prompt the CL commands. With that key you don‘t need to know
all the parameters but simply fill in the prompted list.
On the left side you see sequence numbers in front of each line. This is also the space for line commands.
Important commands are:
I – Insert lines. To insert more than one line, you can type I followed by the number of lines to insert (for
example I5 to insert 5 lines).
D – Delete lines. As with the insert command, you can delete more than one lines by adding a number.
You can also mark the begin and the end of a block of lines to be deleted by DD.
C – Copy lines. You can mark the line to copy by a C or the begin and end of a block to copy by CC. The
target for the copy command is specified by A (copy after this line) or B (copy before this line).
M – Move lines. This works the same as copy.
To find a character string in the text, type the text on the command line (after SEUÎ) and use the function
key F16. You can use F14 to limit the search to certain columns and to setup the replace function. You can
then use F17 to perform the actual replacement.
© SAP AG
ADM525
Concepts of i5/OS - 46
CL Programming: Editing with EDTF
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 47
If you do not have the product Programming Development Manager (PDM) installed, you can also use the
tool EDTF to edit the source. The command entries are the same as in PDM: I = Insert, D = Delete, C =
Copy, and so on. The function keys are shown at the bottom of the screen. This editor does not support
prompting, so you have to type the complete command.
© SAP AG
ADM525
Concepts of i5/OS - 47
CL Programming: Compiling
Prompting the command CRTCLPGM:
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 48
To compile your source, you use the command CRTCLPGM. The screen shot is showing the prompt of
the command after pressing function key F10 for additional parameters. In the upper half of the screen
you specify the name and library of the resulting program and source file and member. In the additional
parameters you can specify compiler options. Two of them could be interesting for you:
1. The source listing option OPTION(*SRCDBG): If you specify this option, you can later debug the
program at source level. This may be helpful to find and correct logic errors.
2. The user profile USRPRF(*USER): The default *USER indicates that the program is running with the
authority of the user that is executing it. In some cases that may not be enough authority to perform
certain system administration tasks. You can then change this parameter to USRPRF(*OWNER) and
make sure that the program is owned by a user that has all the required authorities. You can change the
owner of the program with the command CHGOBJOWN. You should use this feature carefully to
avoid security holes.
© SAP AG
ADM525
Concepts of i5/OS - 48
CL Programming: Compiler Errors
CRTCLPGM PGM(MYLIB/MYPGM)
SRCFILE(MYLIB/QCLSRC) OPTION(*SRCDBG)
Yes
Successful?
No
Message „Program
MYPGM not created.“
Program MYPGM
created in library MYLIB
Enter WRKSPLF and look
at spool file MYPGM
Execute with:
CALL PGM(MYLIB/MYPGM)
PARM('<library>')
…
Defined Labels
Label
Defined
JUNK
******
* CPD0715 30 Label 'JUNK
…
References
1100
' does not exist.
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 49
If the compilation is successful, a program object gets created. You can execute it with the CALL
command and specify the parameters as defined by the program. If the compilation fails, you will see and
error message „Program … not created.“ (CPF0801). The compilation creates a spool file that has the
same name as your program. You can look at your own spool files with the command WRKSPLF. If you
see multiple spool files with the same name, the last one is the one related to the most recent compile. You
can look at the spool file with option 5 (Display). In the spool file you should see what your error is. You
can correct it and try the compilation again.
© SAP AG
ADM525
Concepts of i5/OS - 49
CL Programming: Source Level Debug
STRDBG PGM(MYLIB/MYPGM) UPDPROD(*YES) OPMSRC(*YES)
F12: Resume - CALL PGM(MYLIB/MYPGM) PARM('<library>')
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 50
If your program compiles successfully but still does not do what you expected, you can debug by using the
compiler option OPTION(*SRCDBG). To execute your program in debug mode, use the command:
STRDBG PGM(MYLIB/MYPGM) UPDPROD(*YES) OPMSRC(*YES).
The option UPDPROD on the STRDBG command is intended as a protection of your data. When creating
a library, you can classify on the CRTLIB command whether the library contains production data or test
data (TYPE(*PROD) or TYPE(*TEST)). The default is TYPE(*PROD). If you specify UPDPROD(*NO)
on the STRDBG command, your program is not allowed to modify any data in a production type library.
In most cases your libraries will be classified as „production“, so you typically specify UPDPROD(*YES)
on the STRDBG command.
The parameter OPMSRC(*YES) takes care that the source of your program is displayed when you enter
the STRDBG command. You can scroll through the source and set break points before the program gets
executed. To set a breakpoint on a line, you position the cursor on that line and press function key F6. You
can also set conditional break points or variable watches, and you can find places in the source with
function key F16.
When all your initial break points are set, you exit the screen with function key F12 (Resume) and enter
the command to execute your program. It will stop at the first break point that it reaches. You can then
display variables (function key F11 when the cursor is placed on the variable), execute single steps
(function key F10), add or remove break points (function key F6) or continue processing (function key
F12). You can leave the debugger with the command ENDDBG.
© SAP AG
ADM525
Concepts of i5/OS - 50
CL Programming: Retrieve CL Source
DSPPGM PGM(MYLIB/MYPGM)
Program attribute: CLP
Source file . . : QCLSRC
Library . . . :
MYLIB
Source member . : MYPGM
…
Allow RTVCLSRC . : *YES
…
CRTSRCPF FILE(YOURLIB/QCLSRC)
RTVCLSRC PGM(MYLIB/MYPGM) SRCFILE(YOURLIB/QCLSRC)
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 51
The command DSPPGM allows you to look at the attributes of a program. Among others, you can see
what programming language was used to create the program (CLP), what the source file and member was,
and whether you are allowed to retrieve the source from the CL program. This option can be useful if you
have lost the source, or if you think the source does not match the contents of the program. It is possible to
disallow retrieving the source by specifying the command CRTCLPGM with parameter
ALWRTVSRC(*NO).
If it is allowed to retrieve the source of the CL program, you can create a source file to hold the result.
Then you can use the command RTVCLSRC to retrieve the source of the program. The member name in
the source file is the same name as the program name.
© SAP AG
ADM525
Concepts of i5/OS - 51
Concepts iSeries and i5/OS – Software Products
iSeries
Software Products
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 52
© SAP AG
ADM525
Concepts of i5/OS - 52
Software Products: Naming and Options
Licensed program id:
5722 – prefix for
version 5
5722999 *BASE
5722SS1 *BASE
5722SS1 *BASE
5722SS1 1
5722SS1 1
5722AF1 *BASE
5722AF1 *BASE
5050
5050
2924
5050
2924
5050
2924
*CODE
*CODE
*LNG
*CODE
*LNG
*CODE
*LNG
Product version,
release, modification
V5R3M0
V5R3M0
V5R3M0
V5R3M0
V5R3M0
V5R2M0
V5R2M0
Licensed Internal Code
Operating System/400
Operating System/400
OS/400 Extended Base Support
OS/400 Extended Base Support
AFP Utilities for iSeries
AFP Utilities for iSeries
Product feature:
5050 = program code
29xx = language objects
Product option:
*BASE required,
others as needed
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 53
Each licensed program is named with a seven digit product id, such as 5722SS1. For products in version 5,
you will mostly see the prefix 5722. The prefix was 5769 in version 4 and will most likely be different
again when a version 6 is created. In addition to the standard software products, you can sometimes also
see special products with a prefix 5799. The level of a product is specified as a combination of version,
release and modification. Additional licensed products can have a different level than the operating system
that they are installed on. However, there are dependencies that need to be considered. Many licensed
products need to be updated as well when the base operating system is upgraded to a higher release.
Many products come with multiple options. You always need to install the *BASE option, but then you
can decide which additional options you want to install. Sometimes the additional options are free of
charge, sometimes you have to pay a license fee for them. Software products are usually separated in the
language independent code (feature 5050) and language dependent objects that are being translated. You
can install multiple languages for one product. The Licensed Internal Code does not have language objects
but consists only of code.
© SAP AG
ADM525
Concepts of i5/OS - 53
Software Products: Installing and Uninstalling
Menu: GO LICPGM
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 54
The „Work with Licensed Programs“ menu (GO LICPGM) allows you to display installed software
products, install new software products, delete installed software products and save software products for
distribution. All options work with lists that you can pick a product from to work with. If you need to
work with products that are not on the list, you can use the following commands:
y DSPSFWRSC – show all installed products
y RSTLICPGM – install a new product
y DLTLICPGM – remove a product
y SAVLICPGM – save a product for distribution
© SAP AG
ADM525
Concepts of i5/OS - 54
Software Products: Licensing
Usage type:
Product,
license term,
feature,
usage limit
*CONCURRENT
*REGISTERED
*PROCESSOR
Work with License
Information (WRKLICINF)
Add license key
Usage count,
peak usage,
current users,
audit information
Grace period: 70 days
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 55
Some software products require license keys to enforce a user-based licensing concept. There are
basically three types of licensing models available:
1. Based on concurrent users, that is users that use the product at the same time.
2. Based on registered users, that is users that have been registered to the product.
3. Based on the number of processors.
You can have an unlimited number of users, or you can limit the number of users if only few of your
users are using a specific software. After you install new software, you have a 70 days grace period
during which you can use the software without a valid license. After that, a valid license key has to be
installled to allow working with the software.
The command „Work with License Information“ is the key to license administration. Here you can see
the current number of users and the peak number (for usage type concurrent). This information can help
to find out the actual number of licenses that you need. This menu can also be used to add the license key
that you get from IBM.
© SAP AG
ADM525
Concepts of i5/OS - 55
Software Products: Required Products for SAP
Product
Option(s)
Description
5722999
*BASE
Licensed internal code
5722SS1
*BASE
Operating system
5722SS1
1, 2, 3, 12, 21, 30, 33
Operating system extensions
Product
Option(s)
Description
5722SS1
13, 39
Extensions for Unicode
Product
Option(s)
Description
5722AC3
*BASE
Crypto access provider 128-bit
5722JC1
*BASE
Toolbox for Java
5722JV1
*BASE
Developer kit for Java
5722JV1
5, 6
JDK 1.3, JDK 1.4
Web AS
ABAP
non-Unicode
Web AS
ABAP
Unicode
Web AS
Java
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 56
The installation guide provides you with a list of required software products and options for your SAP
installation. As you can see in the picture, running Unicode or Java requires additional software on top of
the base set. Many of these products or options are free of charge, you just need to make sure that they are
installed.
The different product options of the operating system have the following descriptions:
Product
Option
5722SS1
1
OS/400 - Extended Base Support
5722SS1
2
OS/400 - Online Information
5722SS1
3
OS/400 - Extended Base Directory Support
5722SS1
12
OS/400 - Host Servers
5722SS1
13
OS/400 - System Openness Includes
5722SS1
21
OS/400 - Extended NLS Support
5722SS1
30
OS/400 – Qshell
5722SS1
33
OS/400 - Portable App Solutions Environment
5722SS1
39
OS/400 - International Components for Unicode
© SAP AG
Description
ADM525
Concepts of i5/OS - 56
Software Products: Useful Optional Products
SQL tools (STRSQL),
SQL precompiler
Administration of
tape libraries and
backup policies
5722BR1
Backup Recovery and
Media Services for iSeries
Programming
Development
Manager
(PDM)
i5/OS
Performance
Analysis
Tools
5722PT1
Performance Tools
for iSeries
5722WDS option 21
Tools - Application Development
5722ST1
DB2 Query Manager and
SQL Development Kit
Database performance:
parallel data retrievel,
parallel index build,
table partitioning (BW)
5722SS1 option 26
DB2 Symmetric Multiprocessing
5722SS1 option 27
DB2 Multisystem
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 57
The products on this screen are not really required to run SAP on iSeries. However, they may provide
some use for your administration business or in special environments like the Business Warehouse
application.
© SAP AG
ADM525
Concepts of i5/OS - 57
Concepts iSeries and i5/OS – Administration
System
Administration
Overview
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 58
© SAP AG
ADM525
Concepts of i5/OS - 58
System Administration: Key Elements (1)
4. Network configuration
1. Work mgmt.
2. Disks
3. Security
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 59
The system administration includes the following areas:
Work management
Disks
Security and authorizations
Network configuration
The following pictures will have a closer look at these elements.
© SAP AG
ADM525
Concepts of i5/OS - 59
System Administration: System Values
*ALC
Allocation
system values
*SYSCTL
System control
system values
*STG
Storage system
values
*DATTIM
Date and time
system values
Command:
Work with system value
(WRKSYSVAL)
*SEC
Security
system values
*EDT
Editing
system values
*LIBL
Library list
system values
*MSG
Message and
logging system
values
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 60
System values control the overall behaviour of the system. System values are grouped into categories as
shown in the picture. The command WRKSYSVAL can be used to list system values (all system values or
those that belong to a category) and display or change them. To display or change an individual system
value by name, you can also use the commands DSPSYSVAL or CHGSYSVAL.
To get more information about the meaning of a system value and its possible values, you can use the help
ke F1 on the WRKSYSVAL screen or the IBM online documentation. We will explain some system
values during this class.
© SAP AG
ADM525
Concepts of i5/OS - 60
System Administration: System Values for SAP
QACTJOB
QADTLACTJ
QTOTJOB
QADLTOTJ
QJOBMSGQFL
Initial number of active jobs
Additional number of active jobs
Initial total number of jobs
Additional number of total jobs
Job message queue full action
QCTLSBSD
QSTRUPPGM
QAUTOCFG
QPFRADJ
Controlling subsystem
Startup program
Autoconfigure devices
Performance adjustment
*SYSCTL
QDATE
QTIME
QTIMZON
QUTCOFFSET
System date
Time of day
Time zone
Coordinated universal time offset
*DATTIM
*ALC
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 61
When you install an SAP system, the installation guide explains some system values that you should check
and set appropriately to avoid problems with your SAP system. The recommendations from the
installation guides may change over time or with new operating system releases, so you should check for
SAP notes in addition to the installation guides.
The first four system values in the first set (type *ALC – Allocation) control how much space is reservered
for new processes. If the values are too high, temporary space may wasted, if the values are too low,
starting new processes may slow down significantly. The last value (QJOBMSGQFL) controls the action
that occurs when the predefined joblog size (controlled by system value QJOBMSGQSZ) is used up. It is
higly recommended to set this value to *WRAP or *PRTWRAP, because a lot of informational messages
may be written to a joblog.
The first two system values in the second set (type *SYSCTL – System control) define the subsystem that
comes up first after an IPL (usually QCTL or QBASE), and the program to execute automatically when
the system starts. The other two values control the system behaviour and should be set as described in the
installation guides for automatic device configuration (QAUTOCFG = 1) and good performance
(QPFRADJ = 0).
The third set of system values controls the system date and time. Up to OS/400 V5R3M0, time zones
where handled in the QUTCOFFSET system value, and switching of daylight savings time was done
manually. As of i5/OS V5R3M0, system value QTIMZON is used instead of QUTCOFFSET, and
switching of daylight saving time happens automatically (SAP note 391658).
© SAP AG
ADM525
Concepts of i5/OS - 61
System Administration: Subsystems and Jobs
Subsystem QCTL
Subsystem QSERVER
Subsystem R3_<nn>
Autostart job
QSTRUPJD
Client access file
server job
Dispatcher
Message Server
Work process
Subsystem QBATCH
Subsystem QSYSWRK
Nightly
backup
Native JDBC
server job
TCP/IP
server job
Subsystem QINTER
Sys. operator
interactive
Administrator
Subsystem QUSRWRK
interactive
JTOpen JDBC
server job
Work process
System job
SCPF
System job
QDBSRVXR
System job
QDBFSTCCOL
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 62
Processes, or jobs as they are called on iSeries, are organized in subsystems. The picture is showing the
subsystems that you will typically see on a systems. However, you can create your own subsystems, so the
picture could look quite different.
Subsystem QCTL is usually the one that brings up the system and starts an autostart job. It is called the
„controlling subsystem“ and configured in system value QCTLSBSD. It automatically executes a program
that is specified in system value QSTRUPPGM.
Subsystem QBATCH is used to run background processes, such as nightly backup or cleanup jobs.
Subsystem QINTER is used for interactive work. When running SAP, you will not have much interactive
work, except operator or administrator jobs.
The subsystems QSERVER, QSYSWRK and QUSRWRK are used by the different types of server jobs,
such as server jobs for Telnet, FTP, file server jobs or database server jobs for Java (JDBC).
When running SAP, you will have subsystems named R3_<nn> with <nn> being the instance number, for
example R3_00, R3_01, and so on. All processes that are needed for an SAP instance are running in that
subsystem.
Besides the jobs in subsystems, there are also some system jobs that are not running in a subsystem. The
SCPF job is the system control process. It is the first job to be started when the system comes up. Job
QDBSRVXR is a system job to update the database catalog files asynchronously. job QDBFSTCCOL is
the statistics collector for the database.
© SAP AG
ADM525
Concepts of i5/OS - 62
System Administration: Active Job Overview
Job overview screen, command: WRKACTJOB
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 63
The command WRKACTJOB is giving you an overview over all active jobs on the system. From this
menu you can see what jobs are active in a subsystem, what the status of the jobs is, and whether they use
any CPU. By choosing option 5, you can get a detailed menu for a job that gives you even more
information, such as the joblog, spool files associated with the job, a call stack, and detailed job attributes.
To get more explanations about the information on the screen, position the cursor on the column that you
are interested in (such as „Status“) and press the function key F1. That will bring up a help window with
detailed information.
© SAP AG
ADM525
Concepts of i5/OS - 63
System Administration: Memory Pools
MAIN MEMORY
*MACHINE
*BASE
*SPOOL
*INTERACT
As large as possible
10 %
88%
1%
1%
All SAP work processes
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 64
All the main storage that is available on iSeries (or in an iSeries partition) is split up into several pools. As
a default, the iSeries is being shipped with the following pools:
*MACHINE – used by the operating system and licensed internal code,
*BASE – used by all processes that are not assigned to another pool, such as SAP processes,
*SPOOL – used for spool writers, and
*INTERACT – used for interactive jobs.
You may also see cases where only the *MACHINE and the *BASE pool exist. The subsystem
descriptions of your active subsystems define what pools are being used.
i5/OS knows two types of pools: shared and private storage pools. Private pools can only be assigned to a
single subsystem and are not used in the SAP environment. Shared pools can be used by multiple
subsystems simultaneously. All of the above pools are shared pools.
If your system is used mostly or exclusively for SAP, you should distribute the pool sizes similar to the
picture. Most of the available main storage is allocated to the *BASE pool, a certain amount is needed in
the *MACHINE pool for internal functions. The *SPOOL pool and the *INTERACT pool can be
relatively small unless you have highly complex printing tasks (*SPOOL) or other applications besides
SAP (*INTERACT).
© SAP AG
ADM525
Concepts of i5/OS - 64
System Administration: Checking Pool Sizes
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 65
To look at pool sizes and adjust them, use the command WRKSYSSTS. In this example, the current pool
distribution is 1 = *MACHINE, 2 = *BASE, 3 = *INTERACT, and 4 = *SPOOL. Each pool is shown
with its actual size, the resevered size (that is the amount of storage that cannot be paged out), and the
number of jobs that can be active in the pool at the same time.
A certain amount of main memory is required in the *MACHINE pool to make sure that the LIC and the
operating system work properly. The machine-enforced minimum value varies depending on the memory
size of the machine. The system automatically increases the size of the machine memory pool to the
machine-enforced minimum value if you specify a smaller value.
To determine whether a pool size is sufficient for your workload, check the page faults (database plus nondatabase faults). A page fault happens when a program tries to access data that is not (yet) in the main
storage but must be read from disk. The time that is needed to read the data from disk depends on the
speed of your disk drives, typically between 1 and 10 milliseconds.
The following formula lets you guess whether page faults in the *BASE pool are causing performance
degradation: (DB faults/s + non-DB faults/s) <= (number of CPUs) * (CPU usage)
For example: DB faults/s = 120, Non-DB faults/s = 100, Number of CPUs = 6, CPU usage = 70 %. The
number of DB and non-DB faults adds up to 220, the number of CPU’s times the usage results in 420, so
the paging should not be an issue.
If you see too high page faults in a pool, you can try to increase the pool size by taking away storage from
other pools. If the other pools do not have enough storage to be taken away, you need to add more main
storage to your system or reduce the workload.
© SAP AG
ADM525
Concepts of i5/OS - 65
System Administration: Job/Thread Status Transition
CPU
Short wait 2.
(up to 2 seconds)
Active
1.
Active
jobs/threads
Wait
Bad:
transitions
act → inel
2. Long wait
Bad:
transitions
wait → inel
Ineligible
Ready
3.
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 66
A process (on iSeries usually referred to as “job”) or thread can be in one of the following states:
Active state: An active job or thread is existing in main storage and processing work requested by the
application. All active jobs and threads are placed on a queue and processed according to their run
priority (a lower run priority value represents higher priority). At the end of its CPU time slice, the job
or thread is placed on that queue again. While a job or thread is using CPU, its run priority is slowly
lowered.
Wait state: The terms short wait, short wait extended, and long wait are used to describe a job or thread
waiting for system resource. For example, a page fault usually results in a short wait. During a short
wait, the job or thread is still considered active, and its resources are kept in main storage. When a
short wait lasts more than two seconds, it is cancelled and the job or thread is changed to short wait
extended. Long waits are waits that are right away expected to take longer, such as lock waits or waits
on tape I/O.
Ineligible state: In order to reduce paging in a main storage pool, you can set an activity level to limit the
number of jobs and threads that can be active at the same time. If as many jobs or threads are active as
specified by the activity level, additional ones go into ineligible state.
Transitions from the wait queues to the ineligible queue and from the active queue to the ineligible queue
should be avoided in an SAP environment. You can see the number of activce->ineligible and wait>ineligible transitions by using the WRKSYSSTS command and pressing function key F11. The values
in columns Wait->Inel and Active->Inel should be 0 for all pools.
© SAP AG
ADM525
Concepts of i5/OS - 66
System Administration: Changing Pool Parameters
Paging option *CALC
(„Expert cache“)
QPFRADJ = 0
QMCHPOOL
QBASACTLVL
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 67
In order to change pool size and the activity level (“Max Active”) for the pools, simply overwrite the old
values in the WRKSYSSTS screen and press Enter. The pool size of the *BASE pool cannot be changed
directly. It automatically gets all the available storage that is not assigned to another pool. The activity
level in the *MACHINE pool cannot be changed.
As discussed previously, the activity level in the *BASE pool should be large enough, so that no jobs or
threads go into ineligible state. Making it too big can have a negative impact on the database optimizer,
because the optimizer calculates a “fair share” of main storage based on the activity level and the available
storage for the implementation of database queries. Select a number based on all work processes, database
shadow processes, and Java threads that are running on this system.
Some of the values in WRKSYSSTS have a direct relation to i5/OS system values: The size of the
*MACHINE pool is in system value QMCHPOOL, the activity level of the *BASE pool is in system
value QBASACTLVL. You should keep an eye on system value QMAXACTLVL because that limits the
number of active jobs in all pools. The shipped value is *NOMAX and does not need to be changed. If it
was changed it to a lower value, it may cause jobs or threads to go into ineligible state.
If you use F11 in the WRKSYSSTS screen, you get to the “Paging option” for the pools. For the machine
pool, this value cannot be changed, but for all other pools the value should be set to *CALC. System value
QPFRADJ controls whether pool sizes and activity levels are automatically adjusted when the workload
changes. While this may be helpful in interactive environments, it is not recommended in the SAP
environment (QPFRADJ = 0).
© SAP AG
ADM525
Concepts of i5/OS - 67
System Administration: Key Elements (2)
4. Network configuration
1. Work mgmt.
2. Disks
3. Security
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 68
Even though the iSeries server works logically with single-level storage, there are some considerations
when configuring your disk units. You can separate data into multiple auxiliary storage pools (ASP’s) for
a variety of reasons:
Data recovery after disk errors up to the point in time right before the error by storing tables and
journal receivers in different ASP’s,
performance improvement by separating random read/write access on tables from sequential write
access on journal receivers,
switching data between systems by using independent ASP’s.
© SAP AG
ADM525
Concepts of i5/OS - 68
System Administration: Disk Layout with RAID-5
Device parity protection (RAID)
RAID
Device parity set 1
Device parity set 3
Device parity set 2
System ASP
User ASP
LIC, i5/OS, executables,
tables, views, indexes, …
Journal
receiver
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 69
Single level storage as used on iSeries has many advantages in terms of system administration. You do
not need to worry about “table spaces” or the optimum distribution of the data over the disk units, the
system takes care of that. However, because the data is spread over all disks, loosing one disk and its
contents can mean to loose the whole system.
Usually you will use device parity protection (also known as RAID) for your disk units so that one disk
failure does not hurt. To protect data, the disk input/output adapter (IOA) calculates and saves a parity
value for each bit of data. Conceptually, the IOA computes the parity value from the data at the same
location on each of the other disk units in the device parity set. When a disk failure occurs, the data can
be reconstructed by using the parity value and the values of the bits in the same locations on the other
disks. A device parity set can consist of three to 18 disk units. The more units you have in a device parity
set, the less overhead exists for the parity bit.
If more disks than one in the same RAID set are failing at the same time, you may still loose all data in
the affected ASP. If you store the database tables and the journal receivers in separate ASP’s, you are
able to recover your data up to the point of the hardware failure. That’s why it is recommended for an
SAP system to set up at least one separate ASP for the journal receivers. If you install a test system as
copy of the prodction system and do not care too much about recovery up to the last minute, you can also
store everything in one ASP. You will then only be able to restore your data up the last backup.
© SAP AG
ADM525
Concepts of i5/OS - 69
System Administration: Disk Layout with Mirroring
Mirroring
Mirroring
System ASP
User ASP
LIC, i5/OS, executables,
tables, views, indexes, …
Journal
receiver
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 70
Instead of using device parity protection, you can also use mirroring to protect your data against disk
failures. With mirroring, each disk unit has a second unit assigned, that keeps an exact copy of the data.
This provides even better protection against disk failures than device parity protection but requires more
overhead. You can also use a combination between mirroring and device parity protection, where you use
device parity protection in the system ASP and mirroring in the user ASP with the journal receivers.
Even though you usually do not need many disks in the user ASP for space reasons, having too few disk
arms can cause a performance bottleneck when running I/O intensive operations such as client copy. So
you may consider adding more disks to the user ASP than you actually need for space to distribute the
write workload ver more arms.
© SAP AG
ADM525
Concepts of i5/OS - 70
System Administration: Mirrored Protection Levels
Disk-unit level
protection
I/O adapter
level protection
I/O processor
level protection
Bus
Bus
Bus
IOP
IOP
IOA
IOA
IOA
Bus-level
protection
Bus
Bus
IOP
IOP
IOP
IOP
IOA
IOA
IOA
IOA
Price / Protection level
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 71
When you choose mirroring as protection for your disk hardware, you can mirror the disk related hardware
at multiple levels, starting at disk-unit level and ending at bus-level mirroring. The more duplicate
hardware you have, the more failures can be handled without system-outage or data loss. It depends on
your business needs what level of protection you want to pay for.
© SAP AG
ADM525
Concepts of i5/OS - 71
System Administration: Disk Configuration
STRSST
Service tools user ID
Service tools password
Triggers warning,
default: 90 %
…
3. Work with disk units
…
1.
Display disk
configuration
Config. status
Config. capacity
Config. protection
Device parity status
…
2.
Work with disk
configuration
Add units to ASP
ASP threshold
Include unit to RAID
Start RAID protection
…
3.
Work with disk
unit recovery
Replace config. unit
Disk problem recovery
Suspend mirroring
Resume mirroring
…
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 72
Much of the necessary disk configuration work can be done with the System Service Tools (SST), that are
invoked through the command STRSST. The system service tools are quite powerful, so they have extra
protection with a separate SST user ID and password.
In the main menu, you can select option 3 to get the available disk options. The menus below are then
used to display the configuration, change it for example by adding more units, or perform disk repair
actions (usually done by the IBM customer engineer). In the menu „Work with disk configuration“, you
can set a threshold for the system ASP. The default is 90%. When this threshold is exceeded, a warning
message is sent to the system operator. If you think, 90 % is the wrong threshold, you can change it here.
© SAP AG
ADM525
Concepts of i5/OS - 72
System Administration: Storage Housekeeping
CPF0907 „Serious storage condition may exist. Press HELP.“
Command: WRKSYSSTS
Auxiliary storage:
System ASP . . . . . . :
% system ASP used . . :
Total . . . . . . . . :
Current unprotect used :
Maximum unprotect . . :
No
1160 G
93.7574
1160 G
50489 M
57368 M
„unprotect used“ << System ASP?
Problem with temporary storage:
DSPTMPSTG for analysis,
STOPSAP or IPL to free storage
Yes
Problem with permanent storage:
RTVDSKINF and PRTDSKINF for
analysis, DLTxxx to free storage
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 73
If the system ASP gets filled more than the configured threshold (default: 90 %), a warning message is
issued to the system operator message queue. You can also monitor the system ASP with the
WRKSYSSTS command and check the value „%system ASP used“ in the upper right corner occasionally.
If your system ASP is nearing its capacity, you must clean your system to avoid a system crash.
The first check is on the WRKSYSSTS screen to see whether the storage is occupied by temporary
storage, that is storage which is cleaned up when restarting the system, or permanent storage. The value
„current unprotected used“ represents the temporary storage.
If the temporary storage occupies a significant part of the storage, you can analyze its usage with a tool
that is shipped by SAP. It is invoced by the command DSPTMPSTG and lists the amount of temporary
storage used by each process and by SAP shared memory. To clean up you system, you can simply restart
it. You may then consider adding more disk or let the support organisations of SAP or IBM analyze
whether there is a memory leak.
If the temporary storage is not significant (as in the shown example: ~50 GB out of 1160 GB), then you
need to add more disk units or indentify data that can be deleted. The command RTVDSKINF collects
size information for all objects on the system. It should be submitted to batch. When it is finished, you can
use PRTDSKINF to get a list of the largest libraries and objects. You can use that to identify data that is
no longer needed and can be deleted.
© SAP AG
ADM525
Concepts of i5/OS - 73
System Administration: Avoiding Disk Hot Spot
WRKDSKSTS
Unit
1
2
3
4
5
6
7
8
ASP
1
1
1
1
1
1
2
2
--Protection-Type Status
DPY
ACTIVE
DPY
ACTIVE
DPY
ACTIVE
DPY
ACTIVE
DPY
ACTIVE
DPY
ACTIVE
MRR
ACTIVE
MRR
ACTIVE
--Protected-Size % Used
30769
24.0
30769
24.0
30769
24.5
30769
24.2
30769
24.0
30769
0.1
35165
8.7
35165
8.7
-UnprotectedSize % Used
0
.0
0
.0
0
.0
0
.0
0
.0
0
.0
0
.0
0
.0
New unit added: STRASPBAL to balance disk usage
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 74
Usually the data is distributed evenly over all disk units in an ASP. However, when adding new units, they
are empty in the beginning. The storage management algorithm tries to compensate for the uneven
balance, so new data will preferebly written to the new disk units. This could end in a so-called “hot spot”
because the majority of the work concentrates on the new disks for a while.
To check the disk status, you can use the command WRKDSKSTS (Work with Disk Status). It shows you
the size of the disk units and how much they are used. Funktion key F11 is showing you the ASP number
and the protection status. If you realize that some units in an ASP have significant differen %Used values
than the rest of the ASP, you can use the command STRASPBAL TYPE(*CAPACITY) ASP(<your
ASP>) to let the system distribute the data over all disks. Please note that is is normal to have different
filling levels in different ASP’s: In the example, ASP 2 is being used for journal receivers and only 8.7 %
used, while ASP 1 is used for all the other data and 24 % used.
© SAP AG
ADM525
Concepts of i5/OS - 74
System Administration: Key Elements (3)
4. Network configuration
1. Work mgmt.
2. Disks
3. Security
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 75
© SAP AG
ADM525
Concepts of i5/OS - 75
System Administration: Security Level
System value QSECURITY:
10
No security
USER:
20
Password security
USER:
...
Password: ...
30
Resource security
...
Object and data authority
40
Operating security
User state
Program
System state
50
C2 Level security
User state
program
...
System
domain
data
Restrictions on QTEMP,
messages, control blocks
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 76
By changing system values QSECURITY, you can specify the level of security for your system:
No passwords are needed and users have authority to all resources (10): The system does not require
a password to sign on and the user has access to all system resources. Security level 10 is not available
unless your system is already running at this level.
Passwords are required and users have authority to all resources (20): The system will require a user
name and password to sign on but the user has still access to all system resources. Only someone with
security administrator (*SECADM) authority can create user profiles.
Passwords are required and users' access is based on their authority (30): In addition to level 20, the
user must have the specific authority required to access system resources. Only user profiles created
with security officer (*SECOFR) class are given all object (*ALLOBJ) authority automatically.
Protect from undocumented system interfaces (40): In addition to level 30, programs fail if they try to
access objects through interfaces that are not supported. This is the recommended level for running SAP
on iSeries
Enhance protection of system interfaces (50): In additoin to level 40, programs fail if they try to pass
unsupported parameter values to supported interfaces. Also, no job can get addressability to the QTEMP
library for another job, and there are restrictions when sending an exception type message (status,
notify, or escape) to a system state program.
© SAP AG
ADM525
Concepts of i5/OS - 76
System Administration: Password Rules
WRKSYSVAL SYSVAL(*SEC):
System value
QPWDLVL
Value
0
Description
Password level
QPWDLVLPGM
*NONE
Password validation program
QMAXSGNACN
3
System reaction after max. attempt
QDSPSGNINF
1
Display last signon information
QMAXSIGN
3
Maximum signon attempts
QINACTITV
*NONE
Time to loss of connection
QPWDMAXLEN
10
Maximum password length
QPWDMINLEN
6
Minimum password length
QPWDLMTCHR
*NONE
QPWDLMTREP
0
Limit repeating characters in password
QPWDEXPITV
*NOMAX
Password expiration interval in days
Character limited within password
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 77
This picture lists some system values that allow to define rules for passwords. The first one (QPWDLVL)
defines whether passwords can be up to 10 characters long and case insensitive (value 0) or up to 128
characters long and case sensitive. Others define rules for valid passwords and what should happen in case
of invalid signon attempts.
A complete list is available with the command WRKSYSVAL SYSVAL(*SEC). By displaying the
system values from the list (option 5) and using the help key (F1), you can get more information about the
meaning of a value and possible values.
© SAP AG
ADM525
Concepts of i5/OS - 77
System Administration: Object Authority Overview
Owner
GROUP1
USER2
A
Owner
P
ate
riv
a
USER3
B
ty
ori
h
t
u
*PUBLIC
Program
running with
owner auth.
AUTL1
Private
authority
Owner
USER1
USER4
Commands:
EDTOBJAUT
CHGOBJOWN
WRKAUT
CHGOWN
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 78
This chart shows the concept of object authority. Each user is represented by a user profile object (type:
*USRPRF). A user profile can have authority to an object through the following methods:
y A user profile can be the owner of an object (such as USER1, who is the owner of object A).
y A user profile can have another user profile as group profile, and that group profile can be the owner of
an object (such as USER1 and USER2, who have GROUP1 as group profile, and GROUP1 owns object
B).
y A user profile can have private authority to an object (such as USER3, who has a private authority to
object B).
y A user profile can be implicitely authorized through the *PUBLIC authority of an object.
y A user profile can be listed on an authority list object (type: *AUTL) that is assigned to an object (such
as USER4, who is member of authority list AUTL1 and as such authorized to object B).
y A user profile can execute a program that is compiled for „adopted authority“ (parameter:
USRPRF(*OWNER)) and owned by a user profile that has authority to the object (such as USER4 who
calls a program that is using adopted authority and owned by USER1).
You can use the command CHGOBJOWN to change the owner of an object in a library and
EDTOBJAUT to modify the authority values of an object in a library. For objects in the integrated file
system, you can use the commands WRKAUT and CHGOWN.
© SAP AG
ADM525
Concepts of i5/OS - 78
System Administration: User Profiles
Current
library
Commands:
CRTUSRPRF
CHGUSRPRF
DSPUSRPRF
Password
Initial program
to call
Status:
*ENABLED
*DISABLED
Initial menu
User class
User profile
Special
authorities
Home
directory
Group
profile(s)
uid, gid
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 79
User profiles define both user preferences and authority-relevant information. On the left side, you see
some of the preferences, such as the current library and the home directory, or the program that is executed
automatically when the user signs on. On the right side you see some authority information such as the
group profile and password information. A Unix-style uid and gid are assigned autmatically if you do not
specify values when creating user profiles. They are needed if you want to use NFS to access remote
directories, so especially in a mixed iSeries/Unix (Linux) environment, you should also specify explicit
uid and gid numbers when creating user profiles. User class and special authority are explained in the next
picture.
© SAP AG
ADM525
Concepts of i5/OS - 79
System Administration: Special Authorities
User class
*USER
User class
*SECADM
Special Authorities
*SECADM
*SAVSYS
*ALLOBJ
*JOBCTL
*IOSYSCFG
*SPLCTL
*AUDIT
*SERVICE
User class
*PGMR
User class
*SYSOPR
Shipped:
QSYSOPR
User class
*SECOFR
Shipped:
QSECOFR
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 80
When creating user profiles with the command CRTUSRPRF, you can specify special authorities. Special
authorities are required for certain functions, for example you need the special authority *SECADM in
order to create or change user profiles. A user that creates user profiles can only pass on authorities that he
has himself, for example a user profile that has only *SECADM and *SAVSYS special authorities cannot
create a user profile with *ALLOBJ special authority.
A user profile with *ALLOBJ special authority can access any object on the system, no matter what the
object authorities specify. In order to change the network configuration, you need to have *IOSYSCFG
special authority. *SAVSYS special authority is needed to backup the system, *JOBCTL allows you to
manage jobs for other users.
Some important authorities are combined to user classes. The *SECOFR class includes all special
authorities, so it should be used with care. However, in some cases a user profile with that authority is
required, for example when installing new software. The iSeries system is shipped with default profiles
such as QSECOFR (with all special authorities) or QSYSOPR (for basis operation tasks).
© SAP AG
ADM525
Concepts of i5/OS - 80
System Administration: Key Elements (4)
4. Network configuration
1. Work mgmt.
2. Disks
3. Security
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 81
© SAP AG
ADM525
Concepts of i5/OS - 81
System Administration: Configure TCP/IP Basics
1. Create line description
WRKHDWRSC TYPE(*CMN)
options 5 → 1 → CRTLINETH
2. Define own IP address
CFGTCP option 1 (link to *LIND)
3. Define routes to network
CFGTCP option 2 (next hop)
4. Adjust TCP/IP buffer sizes
CFGTCP option 3 → 1 MB
5. Setup host and domain names
CFGTCP option 12 (name, DNS)
CFGTCP option 10 (host table)
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 82
This picture describes the basic steps to setup a TCP/IP network on iSeries after adding a new adapter to
your iSeries. To configure the adapter for your network, perform the following steps:
1. Create a line description. The easiest way to do that is to look up your network adapter in the list that
is displayed when you enter WRKHDWRSC TYPE(*CMN). Select option 5 („Work with
configuration descriptions“) in front of your network adapter, type a new name in the top line, and
select option 1 to prompt the appropriate command to create the line description. Most parameters can
be left as default, only the „Line speed“ parameter must be adjusted.
2. Define the IP address for your server. The command CFGTCP provides a menu that is used for further
steps in the configuration. Option 1 („Work with TCP/IP interfaces“) allows you to define the IP
address and subnet mask that is used in combination with your line descripition.
3. Define the routes to the network. Option 2 in the CFGTCP menu („Work with TCP/IP routes“) allows
you to specify routes to other servers in the network. You need at least a default route.
4. Adjust TCP/IP buffer sizes. When running SAP in a 3-tier environment over a Gigabit line, you should
increase the TCP send and receive buffer sizes to at least 1 MB for good performance. This is done
through option 3 on the CFGTCP menu („Change TCP/IP attributes“).
5. Setup host and domain names. Option 12 in the CFGTCP menu („Change TCP/IP domain
information“) allows you to define the host name, domain name and domain name server. Additional
hosts can be defined with option 10 („Work with TCP/IP host table entries“).
© SAP AG
ADM525
Concepts of i5/OS - 82
System Administration: Host Names
5250
5250 Emulation
Emulation –– upper
upper right
right corner:
corner:
TCP/IP Domain
Name Server
CHGNETA
CHGNETA SYSNAME(…)
SYSNAME(…) ++ IPL
IPL
TCP/IP local host & domain name:
Host names
case sensitive!
SAP system profiles:
CFGTCP option 12
TCP/IP local host table:
SAPLOCALHOST
SAPDBHOST
rdisp/mshost
j2ee/dbhost
CFGTCP option 10
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 83
There are several places on iSeries where host names can be defined. The most obvious place on most
operating system menus in the 5250 emulation is the upper right corner of the screen: this host name is
configured through the command CHGNETA, but completely unrelated to the TCP/IP configuration or the
host names used by SAP. Note that a change of the host name in this place only takes effect after restarting
the server or partition.
The TCP/IP name and domain of the local server is configured through option 12 in the CFGTCP menu.
Remote hosts can either be defined through a domain name server (DNS) or in the local host table through
option 10 in the CFGTCP menu. While TCP/IP host names in general are not case sensitive, the SAP
application considers the names case sensitive, so your entries in the SAP profiles must match the names
in the TCP/IP configuration.
If you are running on a DBCS i5/OS operating system, such as Chinese or Japanese, you may consider
using uppercase characers only for the host names to avoid character conversion problems.
© SAP AG
ADM525
Concepts of i5/OS - 83
System Administration: Configure TCP/IP Servers
Start, stop, and configure TCP/IP servers through iSeries Navigator:
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 84
The different TCP/IP servers can easily be administrated throug the iSeries Navigator. Here you can start
or stop servers, and you can set properties. Among others, you can defined what servers are started
automatically when the system is coming up. You can also start and stop servers from the command line
interface by using the commands STRTCPSVR and ENDTCPSVR. You can configure some (not all)
servers through option 20 („Configure TCP/IP applications“) on the CFGTCP menu.
© SAP AG
ADM525
Concepts of i5/OS - 84
System Administration: Netstat and Services
1. TCP/IP interface status
IP address
Line descr.
Status
10.17.184.16
GIGALINE
Active
NETSTAT
2. TCP/IP route information
IP address
Next Hop
Avail.
10.17.184.0
*DIRECT
*YES
3. TCP/IP connection status
Rem. address Local port
State
*
*
*
10.17.184.16
Listen
*UDP
Listen
Established
telnet
ntp
sapdp30
5013
WRKSRVTBLE
Service
Port
as-edrsql 4402
ftp-data
20
ftp-data
20
sapdp30
3230
sapgw30
3330
sapmsCHB 3630
Protocol
tcp
tcp
udp
tcp
tcp
tcp
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 85
The i5/OS commands NETSTAT and WRKSRVTBLE („Work with Service Table Entries”) are useful for
diagnosis in the TCP/IP configuration. NETSTAT has three options that are shown on the left side. Here
you can verify that your TCP/IP interface is active, your route is available, and the ports that you are
expecting are in a proper state.
WRKSRVTBLE is used to map port numbers to symbolic names. Names that start with “as-” are iSeries
specific ports that are shipped with the operating system, and port names that start with “sap” are defined
by the SAP software during the installation. You can also see well-known TCP/IP ports such as FTP or
Telnet.
© SAP AG
ADM525
Concepts of i5/OS - 85
System Administration: Using FTP with iSeries
*FILE (SAVF)
<lib1>/<file1>
*STMF
/<path1>/<file1>
CRTSAVF FILE(<lib2>/<file2>)
FTP <hostname>
Login ID/password
bin
get <lib1>/<file1> <lib2>/<file2> (replace
quit
FTP <hostname>
Login ID/password
namefmt 1
put /<path2>/<file2> /<path1>/<file1>
quit
*FILE (SAVF)
<lib2>/<file2>
*STMF
/<path2>/<file2>
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 86
When using FTP to transfer data from and to iSeries, there are a few things different than on other
platforms. The first example is showing the transfer of objects in libraries, saved in a save file, the second
example is showing the transfer of data in the integrated file system („stream files“). In both examples, we
are entering the commands on the host that has the data on the right side of the picture (<lib2>/<file2> or
/<path2>/<file2>).
When working with objects in libraries, you can only transfering objects of type *FILE. This is not a
severe limitation because you can save all other object types in save files. To do that, you first create a
save file with the command CRTSAVF, then save the object with the command SAVOBJ DEV(*SAVF).
Before you can receive the save file with the object data via FTP, you must create an empty save file on
your target system. Then you use FTP as usual to connect to the remote system. Save file data must always
be transfered in binary mode, so you switch to bin. The save file names on the get command are specified
in the form <library>/<file>. Because the target save file does already exist, you must specify the iSeries
specific option (replace on the get command.
When transfering data in the integrated file system, you can use binary or text mode. To tell FTP that the
file names are not speficied as <library>/<file> but as a complete path name, you must execute the FTP
command namefmt 1. To switch back, use namefmt 0. When executing FTP on a non-iSeries system to
transfer data to an iSeries, the FTP server on iSeries guesses the right name format based on whether the
name starts with a slash (path name) or with a letter (library / object name). In both name formats you do
not need to specify the (replace option on a put command.
© SAP AG
ADM525
Concepts of i5/OS - 86
Concepts i5/OS: Unit Summary
You should now be able to:
z Explain the single level storage concept of i5/OS
z Classify objects and file systems
z Enter and prompt i5/OS commands
z Create simple CL programs
z Choose software products to run with i5/OS
z Perform basic administration tasks
SAP AG 2004, ADM525 Concepts of iSeries and i5/OS / Christian Bartels / 87
© SAP AG
ADM525
Concepts of i5/OS - 87
Exercises
Unit: Concepts of IBM eServer iSeries and i5/OS
Topic: Modify the system startup CL program
At the conclusion of this exercise, you will be able to:
• Identify the system startup program
• Retrieve the CL source of the system startup program
• Add statements to the source of the system startup program
• Compile the modified source of the system startup program
Often you would like to have the system perform certain tasks
automatically during startup. The i5/OS operating system is shipped with
a default system startup program that you can modify. In this exercise,
you will let the startup program perform two additional functions
automatically during system startup:
1) Add a directory to a remote i5/OS server under the /QFileSvr.400
file system. Typically the /usr/sap/trans directory is implemented
as symbolic link to /QFileSvr.400/<transport host>/sapmnt/trans.
The link to <transport host> needs to be reestablished after each
IPL, which is done by the command md ‘/QFileSvr.400/transport
host’.
2) Start an SAP instance automatically after the system start. Note
that the system startup program will be executed under user
profile QUSER, so you must setup the environment first before
you can execute the STARTSAP command. To do that, you need
to execute program R3INLPGM in library R3<SID>400.
On a customer’s system, you may consider compiling the startup program
to run under the owner’s authority and change the owner to QSECOFR to
avoid authority problems.
1-1
Sign on to the iSeries server
1-1-1 On your workstation, start the 5250 Emulation to the class server.
1-1-2 Sign on with user name ADM525## and password PWADM525##.
1-2
Create your own library and source file
1-2-1 Check if a library ADM525## already exists on the server. Use the
command DSPLIB ADM525## to find out. If the library does not exist,
create a library ADM525## with the CRTLIB command. To see the
necessary parameters for CRTLIB, type the command name and use
function key F4 to prompt it.
1-2-2 Change the “current library” of your job to the library ADM525##. You
can do that with the command CHGCURLIB. If you want library
ADM525## to be your current library again after signing off and on again,
you can change your own user profile with the command CHGPRF. Type
the command name and prompt it with F4, then enter ADM525## as
current library. From the command prompt, you can press F10 to see more
parameters that can be changed in your user profile. You can use the
command DSPLIBL to verify that library ADM525## is your current
library.
1-2-3 Create a source file named QCLSRC in your library ADM525##. Use the
command CRTSRCPF and enter the file name QCLSRC and the library
name ADM525##. Leave all other parameters with their default values.
1-3
Identify the system startup program and retrieve the source
1-3-1 The name and library of the program that gets automatically executed
during system startup are stored in a system value QSTRUPPGM. Use the
command DSPSYSVAL, or WRKSYSVAL with option 5, to see the
startup program that is currently configured. Write down the name and the
library:
Program: _____________________, Library: _____________________.
1-3-2 Check if this program allows its source to be retrieved. You can do that
with the command DSPPGM.
Value for “Allow RTVCLSRC (CL program)”: ________
1-3-3 Use the command RTVCLSRC to retrieve the source of this program into
the source file that you created in step 1-2. Specify QCLSRC in library
ADM525## as the source file to retrieve the data to. Make the member
name the same as the program name.
1-4
Modify the source and create the program
1-4-1 Enter the command STRPDM to start the Program Development Manager
tools. On the initial menu, chose option 2 (“Work with objects”). Enter
ADM525## as the name of the library to work with.
1-4-2 Use option 12 (“Work with”) in front of file QCLSRC to display the
members of this source file. It should have at least the member that you
created in the previous step via RTVCLSRC.
1-4-3 Use option 2 (“Edit”) in front of the member that contains the startup
program source. Hit function key F13 to change the session defaults and
enter ‘N’ as the value for the setting “Uppercase input only”. To change
this setting permanently, page down on the “Change Session Defaults”
screen and set the value for “Default to uppercase input for this source
type” to ‘N’ as well.
1-4-4 Go to the end of the source and insert a new line right before the program
is left (usually an ENDPGM or RETURN statement). To insert a line, type
the letter ‘I’ over the line number on the left side of the screen. This will
insert a line after the line where you specified the insert command.
1-4-5 Type the command “MD ‘/QFileSvr.400/<server name>’” into the new
line. Replace <server name> by the name of the iSeries server that is given
to you by the instructor. Press Enter after typing the command. This will
create another new line.
1-4-6 On the next line, type “MONMSG MSGID(CPF0000)” and hit Enter
twice. Press F3 to leave the editor and select the proper options on the exit
screen to save your changes.
1-4-7 Add another line and enter the command “CALL
PGM(R3<sid>400/R3INLPGM”), replacing <sid> with the SAP system Id
of the classroom system. This line will setup the environment to execute
the STARTSAP command. Add another line with “MONMSG
MSGID(CPF0000)” to catch any possible error.
1-4-8 Insert a new line and type the command “<kernel library>/STARTSAP
SID(<sid>) INSTANCE(*ALL)”, replacing <kernel library> with the
name of the kernel library of your classroom system and <sid> with the
SAP system Id. Add another line with “MONMSG MSGID(CPF0000)”.
1-4-9 Use option 14 (“Compile”) in front of the member to compile your
program. The compile will be submitted to batch, and the program will be
created in your library ADM525##.
1-4-10 After a while, you should see the program in your library (use the DSPLIB
command to check). If it does not appear, you can use the WRKSPLF
command and check for compiler errors.
Solutions
Unit: Concepts of IBM eServer iSeries and i5/OS
Topic: Modify the system startup CL program
1-3
Solution to Step “Identify the system startup program and retrieve the source”
1-3-1 The program name and library name depend on the system configuration.
Enter the command DSPSYSVAL SYSVAL(QSTRUPPGM) to get the
current settings for the classroom system.
1-3-2 If the system was prepared according to the instructor guide, the answer
should be *YES.
SAP Architecture for IBM eServer iSeries
Contents:
z DB2/400 Usage by SAP
z Directory Structures
z Security and Work Management
z 3-Tier Scenarios
z SAP Printing with i5/OS
z Java Considerations
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 1
© SAP AG
ADM525
SAP Architecture for iSeries - 1
SAP Architecture: Unit Objectives
After completing this unit, you will be able to:
z Explain the database objects used by SAP
z Describe the integrated file system structure used
by SAP
z Identify SAP user profiles and work management
objects
z Define a 3-tier configuration for SAP
z Configure printers for SAP on iSeries
z Recognize JVM versions and JDBC drivers on i5/OS
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 2
© SAP AG
ADM525
SAP Architecture for iSeries - 2
SAP Architecture: Course Overview Diagram
1 Course Overview
2 Concepts of IBM eServer
iSeries and i5/OS
3 SAP Architecture for IBM
eServer iSeries
4 Backup and Recovery
5 Maintenance and Install
6 Problem and Performance
Analysis
7 Conclusion
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 3
© SAP AG
ADM525
SAP Architecture for iSeries - 3
SAP Architecture: Business Scenario
z You want to install an SAP system on i5/OS and
need to plan your system configuration.
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 4
© SAP AG
ADM525
SAP Architecture for iSeries - 4
SAP Architecture for iSeries – DB2 UDB and SAP
DB2 UDB for iSeries
DB2 UDB
Usage by SAP
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 5
© SAP AG
ADM525
SAP Architecture for iSeries - 5
DB2 UDB and SAP: Libraries used by SAP
SAP WebAS ABAP
SAP WebAS Java
Database (SQL Schema)
Database (SQL Schema)
R3<sid>DATA
SAP<sid>DB
Journal receivers
Journal receivers
R3<sid>JRN
SAP<sid>JRN
SQL packages
os_libs
R3<sid>xxxxx
R3<sid>xxxxx
SAPJ2EE<inst.no>
WM objects, DB monitor
Common
R3<rel>OPT
R3<sid>400
SAPOSCOL data
Kernel
Exit pgms, cmds
R3400
R3SYS
(temp. data)
R3WRK<inst.no>
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 6
This picture is giving an overview of all libraries that are used by an SAP installation. <sid> is standing
for the three character SAP system Id, <inst.no> for the two digit instance number, and <rel> for the
kernel release.
y R3<sid>DATA and R3<sid>JRN are the database for SAP WebAS ABAP.
y R3<sid>xxxxx are libraries to contain SQL packages.
y SAP<sid>DATA and SAP<sid>JRN are the database for SAP WebAS Java.
y SAPJ2EE<inst.no> contains native executables that are used by SAP WebAS Java.
y R3<sid>400 contains work management objects such as a subsystem descriptions and job descriptions,
as well as the output files for the memory based database monitor.
y R3400 contains temporary data collected by the SAP operating system collector (SAPOSCOL).
y R3SYS contains copies of the commands CRTPF and CRTLF, and exit programs that are registered to
activate the database monitor for JDBC connections.
y R3<rel>OPT stands for the kernel library, even though you can choose any name you like for the kernel
library.
y R3WRK<inst.no> is automatically cleared during start and stop of an instance, so it can only be used
for temporary data.
© SAP AG
ADM525
SAP Architecture for iSeries - 6
DB2/400 and SAP: Database and Journal Libraries
SAP WebAS ABAP
Indexes
Views
SQL Tables
SAP WebAS Java
Catalog
views
Indexes
Views
Catalog
views
SQL Tables
QSQJRN
QSQJRN
Database library R3<sid>DATA
Database library SAP<sid>DB
QSQJRN0152 QSQJRN0153
QSQJRN0046
Journal receiver lib R3<sid>JRN
Journal receiver lib SAP<sid>JRN
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 7
SAP WebAS ABAP and SAP WebAS Java are storing their data in different SQL schemas. On DB2 UDB
for iSeries, a schema is implemented by a library, so we have a database library R3<sid>DATA for SAP
WebAS ABAP and a database library SAP<sid>DB for SAP WebAS Java. <sid> is being replaced by the
SAP system ID. If you have a combined installation (SAP WebAS with both ABAP and Java), you also
get both libraries.
The database libraries contain all tables, indexes and views of the schema. In addition, they contain the
catalog views (SYSTABLES, SYSINDEXES, and so on) and the journal QSQJRN. All tables in the
database library are journaled to that journal. The actual entries of the journaling function are written to
the journal receivers, which are located in different libraries. This is done to make it easier to store the
journal receivers in a separate ASP. The journal receiver library for SAP WebAS ABAP is called
R3<sid>JRN, the journal receiver library for SAP WebAS Java is called SAP<sid>JRN.
© SAP AG
ADM525
SAP Architecture for iSeries - 7
DB2 UDB and SAP: Common Journal with V5R3M0
SAP WebAS ABAP
Indexes
Views
SQL Tables
SAP WebAS Java
Catalog
views
Indexes
Views
Catalog
views
SQL Tables
QSQJRN
QDFTJRN
R3<sid>DATA
QSQJRN
Database library R3<sid>DATA
Database library SAP<sid>DB
QSQJRN0152 QSQJRN0153
New in V5R3M0!
SAP note 744055
Journal receiver lib R3<sid>JRN
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 8
Starting with i5/OS V5R3M0, you have the option to journal both the ABAP database library and the
Java database library into the same journal. This has two advantages:
1. You only need to backup and maintain one set of journal receivers.
2. In case of a recovery, you can apply journal changes on both the ABAP and the Java server to exactly
the same point in time. If you use two independent journals, you must apply the changes separately,
and you can only apply them to a specific point in time (granularity: one second). In such a case it may
happen that a transaction in ABAP is considered complete and restored, while a related transaction in
Java (that was commited a fraction of a second later) is considered incomplete and rolled back.
The activation of this feature is explained in SAP note 744055. Basically you create a data area name
QDFTJRN in the database library of the SAP WebAS Java server. This data area holds the name and
library of the journal to use. The command to do this is:
CRTDTAARA DTAARA(SAP<SID>DB/QDFTJRN) TYPE(*CHAR) LEN(30)
VALUE('R3<SID>DATA QSQJRN *FILE ')
© SAP AG
ADM525
SAP Architecture for iSeries - 8
DB2 UDB and SAP: MCOD Implementation
Multiple Components in One Database (MCOD)
NW 04
CRM
BW
R3NW4DATA
R3CRMDATA
R3BW1DATA
R3NW4JRN
R3CRMJRN
(prior to V5R3M0)
R3BW1JRN
(prior to V5R3M0)
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 9
The term Multiple Components on One Database (MCOD) stands for a new style of installing an SAP
System: You can now install an SAP System into an existing SAP System database, so that you have
multiple SAP systems in one single database. More information about the MCOD concept in general can
be found at http://service.sap.com/mcod.
While the installation of multiple SAP systems in one database requires some special processing on other
databases, it is no big difference to single installations on iSeries. Each component gets its own libraries
R3<sid>DATA and R3<sid>JRN, and they all reside in the same database. If you are running at V5R3M0
or later, you can have all data being journaled to the same journal as shown in the previous chart.
When sharing a common journal, you have to watch out for the total number of objects that are journaled
in the same journal, because V5R3M0 has a limit of 250.000 objects that can be journaled in the same
journal. SAP note 443925 explains the limitations and the setup.
© SAP AG
ADM525
SAP Architecture for iSeries - 9
DB2 UDB and SAP: EBCDIC/ASCII (Latin 1), Unicode
EBCDIC
ASCII
i5/OS only
SAP CP 0120
IBM CP 500
X‘C1‘
‘A‘
X‘F1‘
‘1‘
X’43’
‘ä’
i5/OS, Win, LoP
SAP CP 1100
ISO 8859-1
X‘41‘
‘A‘
X‘31‘
‘1‘
X’e4’
‘ä’
CPU:
=
RAM:
+ 10%
!
Rules
of
thumb
CCSID 500
X‘C1‘
‘A‘
X‘F1‘
‘1‘
X’43‘
‘ä‘
+ 60%
3.0C … 4.6C
Unicode
i5/OS, Win, LoP
CPU: 4102 (UTF16-BE)
+ 30% 4103 (UTF16-LE)
X‘0041‘ ‘A‘
RAM:
X‘0031‘ ‘1‘
+ 40%
X’00e4’ ‘ä’
!
Rules
of
thumb
CCSID 13488
X‘0041‘
‘A‘
X‘0031‘
‘1‘
X’00e4‘
‘ä‘
4.6C and higher
+ 10%
CCSID 13488
X‘0041‘
‘A‘
X‘0031‘
‘1‘
X’00e4‘
‘ä‘
6.20 and higher
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 10
The SAP software for AS/400 (the predecessor of the IBM eServer iSeries) was initially written based on
an EBCDIC database. On a standard Latin 1 installation (used in the USA or Western Europe), the
database objects are tagged with CCSID 500. Inside the application server, the data is handled with SAP
code page 0120, which is the equivalent to IBM‘s code page 500. With an EBCDIC database, the
application server can only run in i5/OS.
The ASCII database allows to run Windows and Linux on Power application servers besides i5/OS. The
data in the database is stored with CCSID 13488, which is Unicode based (UCS-2, using 2 bytes per
character). Within the application server, the data is treated as single-byte ASCII (SAP code page 1100).
The conversion of the data is done in the SAP database interface.
The Unicode database looks similar to the ASCII database, it is also tagged with CCSID 13488. The
difference between ASCII and Uincode databases can only be seen on non-Latin-1 installations (see next
slide). The Unicode application server supports i5/OS, Windows and Linux on Power. i5/OS and Linux on
Power are so-called „big endian“ platforms, and they run SAP code page 4102 (Unicode). Windows is a
„little-endian“ platform and uses SAP code page 4103.
Note that an ASCII installation needs more resources than an EBCDIC installation, and a Unicode
installation needs more resources than an ASCII installation. The numbers given in the slide are just rough
guesses; for a reliable sizing you need to contact IBM.
© SAP AG
ADM525
SAP Architecture for iSeries - 10
DB2 UDB and SAP: EBCDIC/ASCII (Latin 2), Unicode
EBCDIC
ASCII
Unicode
SAP CP 0410
IBM CP 870
X‘C1‘
‘A‘
X‘F1‘
‘1‘
X‘BA‘ ‘Ł’
SAP CP 1401
ISO 8859-2
X‘41‘
‘A‘
X‘31‘
‘1‘
X‘A3‘
‘Ł’
4102 (UTF16-BE)
4103 (UTF16-LE)
X‘0041‘ ‘A‘
X‘0031‘ ‘1‘
X‘0141‘ ‘Ł’
CCSID 500
X‘C1‘
‘A‘
X‘F1‘
‘1‘
X‘BA‘
‘¬’
CCSID 13488
X‘0041‘
‘A‘
X‘0031‘
‘1‘
X’00A3‘
‘£’
CCSID 13488
X‘0041‘
‘A‘
X‘0031‘
‘1‘
X’0141‘
‘Ł’
Single code page
MDMP supported
up to SAP NW04
One code page
for all
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 11
This picture is showing how the database looks when languages other than Latin 1 are installed on iSeries
with SAP. For the standard characters you do not see a difference, but special characters (like the Ł – L
Stroke Capital or Lslash) experience a different handling. In all cases, the database objects keep the same
tagging as with Latin 1. In EBCDIC and ASCII systems, only the application servers know the installed
code page and treat the characters properly. If you access the data through a non-SAP interface, you may
see incorrect data (as shown in the red objects). Only Unicode stores the data in a way that you always see
the right character.
The ASCII installation of SAP supports Multi Display/Multi Processing code pages (MDMP). However, if
your installation requires the support of multiple code pages, you should always consider Unicode rather
than MDMP. As of mySAP ERP 2005, MDMP is no longer fully supported by SAP (see SAP note
79991).
© SAP AG
ADM525
SAP Architecture for iSeries - 11
DB2 UDB and SAP: Codepage Conversion (4.6C)
EBCDIC-ASCII conversion: export/import method
EBCDIC
Database
Export /
Conversion
Import
Export files
(ASCII)
ASCII
Database
EBCDIC-ASCII conversion: inplace method (latin 1 only)
Inplace Conversion
EBCDIC
Database
→ ASCII
Transparent
tables
Export /
Conversion
Export files
(ASCII)
Import
Pool and cluster
tables
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 12
There are two ways to convert an existing EBCDIC system at release 4.6C into ASCII. The first method is
the standard method that is used also for migrations between different platforms: The whole database is
exported into flat files, and these files are then imported into the new database. The second method is
called inplace conversion. Here all transparent tables are directly converted on the database, and only
tables that need special treatment in SAP, such as pool and cluster tables, are exported and then imported
again. This method is faster than the traditional export/import method, but it can only be used with latin 1
systems. More information about the codepage conversion can be found in the SAPNet through quick link
(alias) /IBM in path IBM eServer Technology -> iSeries (AS/400) Codepage Conversion.
© SAP AG
ADM525
SAP Architecture for iSeries - 12
DB2 UDB and SAP: Codepage Conversion (as of 6.20)
ASCII-Unicode conversion: export/import method
ASCII
Database
Export /
Conversion
Import
Export files
(ASCII)
Unicode
Database
ASCII-Unicode conversion: inplace method (latin 1 only)
Transparent
tables do not
need conversion
ASCII
Database
→ Unicode
Export /
Conversion
Import
Export files
(ASCII)
Pool and cluster
tables
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 13
Similar to the EBCDIC to ASCII conversion, there is also a simplified ASCII to Unicode conversion
available for latin 1 systems. For latin 1 languages, character data in the ASCII database looks exactly the
same as Unicode data, so transparent tables do not need to be touched at all. Only pool and cluster tables
need to be converted. The special inplace conversion for iSeries is explained in the attachment of SAP
note 800791.
© SAP AG
ADM525
SAP Architecture for iSeries - 13
DB2 UDB and SAP: SQL Packages
1.
OPEN <Statement ID> or FIND <Statement ID>
SQL Package not found?
=> Create SQL Package
Statement not found?
=> PREPARE <Statement ID>
2.
FETCH (SELECT) or EXECUTE (INSERT,
UPDATE, DELETE, …)
SELECT *
FROM MARA
WHERE ...
ABAP
SQL Package (*SQLPKG)
created „on the fly“ Sta
tem
T", ...
"MAND TA/
T
C
E
L
DA
SE
IJBAIK
3<SID> ...
R
M
O
PJHCL
R
E
OIHFO F ARA” WHER
"M
SQL PACKAGES
ent ID:
R3<SID>nnnnn
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 14
An SQL package contains all the access information needed by the SQL optimizer for DB2 UDB for
iSeries. It is used for two purposes:
1. It is used as a reference when using an SQL statement in multiple steps, such as opening a cursor and
multiple fetches. The library, the package name, and the statement ID within the SQL package
uniquely identify a statement.
2. It contains the access plan for the database optimizer. Optimizing an SQL statement is quite complex
and time consuming, especially when the query is joining multiple tables. In order to reduce the
overhead, the access plan is saved in the SQL package and reused when the same statement is
executed again. There are checks to verify that the implementation is still valid, for example that the
number of rows in the used tables did not change significantly since the optimization. If an access plan
is found to be no longer valid, it is automatically reoptimized.
The SAP application starts after installation without SQL packages. Whenever an SQL statement is
executed for the first time, the SQL package is created (if necessary) and the statement is prepared into
the package. When is later executed again, it is simply used from the SQL package.
SAP uses a quite complex algorithm to calculate the names of libraries, SQL packages, and statement
ID’s within the packages. The libraries always start with ‘R3’ and the three-digit SAP system ID (“SID”).
The names of the SQL packages often contain the name of the table that they are accessing, or the name
of the ABAP program that is executing the statements.
© SAP AG
ADM525
SAP Architecture for iSeries - 14
DB2 UDB and SAP: Deleting SQL Packages
SAP Code (LIB_DBSL):
IBM Code (DB2/400):
• Store access plan
• Remember file size
and available indexes
• Parameter marker
conversion
• Map ABAP statement
to library, package and
statement id
...
NDT",
T "MA DATA/
C
E
L
E
S
>
IJBAIK
R3<SID
PJHCL
FROM WHERE ...
OIHFO
”
"MARA
Statem
ent ID:
New LIB_DBSL patch
New DB2/400 code (PTF)
→ DLTR3PKG SID(<sid>) JOBS(…)
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 15
There are some dependencies between the SQL packages and the code that uses them. The SAP database
interface is responsible for mapping the ABAP statement uniquely to a library name, SQL package name
and statement id within the package, so that the combination of the three elements always refers to the
same SQL statement. The IBM database code stores information like the access plan, statistics about the
file size, and available indexes in the SQL package. When an SQL statement contains literals, the database
replaces them with parameter markers and keeps the literal in the package information as well to increase
reuseability of a statement.
Whenever SAP code or IBM code in this area is modified, there is a chance that existing SQL packages
become invalid. These changes are usually installed as a LIB_DBSL patch in case of the SAP code or as
Program Temporary Fixes (PTF’s) in case of the IBM code. Because it is hard to find out in detail whether
critical code has changed, SAP recommends to delete all SQL packages for an SAP system after installing
a LIB_DBSL patch or PTF’s.
In order to delete the SQL package, you need to stop you SAP system, then you can use the command
DLTR3PKG from the kernel library to delete the packages on your system. You can specify a number of
jobs to process the deletion in parallel. At the next restart of the SAP application, the packages will be
recreated as needed using the new code.
It is not recommended to delete SQL packages while SAP is up and running, because some information is
cached within SAP, and the deletion of an SQL package “on the fly” can result in unexpected exceptions.
© SAP AG
ADM525
SAP Architecture for iSeries - 15
DB2 UDB and SAP: Open Data Paths (ODP‘s)
OPEN SFLIGHT
FETCH SFLIGHT
OPEN SBOOK
FETCH SBOOK
COMMIT
ODP SFLIGHT
1
OPEN SFLIGHT
ODP SFLIGHT
ODP SBOOK
2
3
FETCH SFLIGHT
COMMIT
ODP CLEANUP
ODP SFLIGHT
ODP SFLIGHT
(Threshold: 800)
ODP SBOOK
ODP SBOOK
ODP SFLIGHT
4
5
6
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 16
The access to a database table or view is organized in a so-called Open Data Path (ODP). In case of a
read-only statement (SELECT), a cursor is opened and assigned to an ODP, and then data can be fetched
from the open cursor. Also SQL statements that modify data (INSERT, UPDATE, DELETE) use an ODP
to access the data. A cursor can be closed either explicitly through the CLOSE statement or implicitly
during a COMMIT or ROLLBACK. When a cursor is closed or a data modifying statement is completed,
the ODP usually does not get deleted, but it goes into a pseudo-closed state. This helps the performance
because reopening a pseudo-closed ODP is much faster than creating a new ODP.
Over time, a work process or its database shadow process collects more and more pseudo-closed ODP‘s.
Each ODP allocates some temporary storage, and over time the maintenance of the ODP‘s can become
quite expensive. That‘s why the SAP code is counting the number of ODP‘s in a work process and
requests an ODP cleanup when a certain threshold is exceeded. During the cleanup, the least recent
pseudo-closed ODP‘s are closed down to a threshold of 800. Usually the ODP cleanup requests are issued
after a COMMIT statement, but if many statements are executed or cursors are opened without a commit,
the ODP cleanup can also be requested right after an OPEN in the middle of a transaction.
© SAP AG
ADM525
SAP Architecture for iSeries - 16
DB2 UDB and SAP: Object and Record Locks
SELECT <field list> FROM <table>
WHERE <column> = <value>
WITH UR
File
Member
UPDATE <table> SET …
WHERE <column> = <value>
WITH UR
Data Space
ALTER TABLE <table>
ALTER COLUMN <column>
SET DATA TYPE …
Legend:
*SHRRD
*SHRUPD
*EXCL
Rec. lock
ta
Da
rds
o
rec
Lock
*EXCL *EXCLRD *SHRUPD *SHRNUPD *SHRRD
X
X
X
X
X
*EXCL
X
X
X
X
*EXCLRD
*SHRUPD
X
X
X
*SHRNUPD X
X
X
*SHRRD
X
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 17
When the database code works with data in tables, it can place locks at both the object level and record
level. At object level, locks are placed on the file, the member, and the data space. SQL statements that
read or modify data usually have a Shared Read lock on both the file and the member, while statements
that modify the table structure need an Exclusive lock on these objects. This ensures that no read or update
request can be active at the same time as the table structure gets altered.
At the default isolation level UR (Uncommitted Read), a SELECT statement does not place a lock at
record level. Isolation level RS (Read Stability) would also place a record lock on the rows that are
actually selected. UPDATE statements place a record lock on the rows that are being updated, and they
need a Shared Update lock on the data space.
The table at the bottom is showing whether lock requests can be resolved if certain locks from other jobs
already exist (Exclusive, Exclusive allow Read, Shared Update, Shared No Update, Shared Read). If a
lock request cannot be resolved immediately, the system waits for the default wait time (2 minutes in an
SAP application) before it sends an error message.
© SAP AG
ADM525
SAP Architecture for iSeries - 17
DB2 UDB and SAP: Query Options File QAQQINI
Used for BW
(EVI stage 2)
as described
in SAP note
501572
Used when
recommended by
IBM/SAP support
*FILE QAQQINI
QQPARM (Parameter) QQVAL (Value)
OPTIMIZATION_GOAL *ALLIO
STAR_JOIN
*COST
FORCE_JOIN_ORDER *DEFAULT
QUERY_TIME_LIMIT
*DEFAULT
…
…
Profile parameters for
library of QAQQINI file:
dbs/db4/qaqqinilib
dbs/db4/alternate_qaqqinilib
Create:
CRTDUPOBJ FROMLIB(QSYS) DATA(*YES)
Modify with STRSQL or SQLUTIL:
INSERT INTO QAQQINI VALUES(‘…‘, ‘…‘)
UPDATE QAQQINI SET QQVAL = ‘…‘
WHERE QQPARM = ‘…‘
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 18
The query options file QAQQINI is used to control the behaviour of the SQL optimizer in specific
situation. For example, certain settings can be used as a temporary workaround in case of a database error.
In such a case, the IBM or SAP support would advice what options to change or set. The query options file
is also used in a Business Warehouse installation to get the best performance for BW typical queries. The
details about this configuration are described in SAP note 501572.
The name of the query options file is always QAQQINI, but you can have different versions in different
libraries. The „master“ is in library QSYS, and you can copy that one to your own library in order to
modify it. Use the command CRTDUPOBJ to copy the file from library QSYS into your own library,
because that command copies the complete file structure including the attached trigger information. In an
interactive environment, you can choose the library to pick the QAQQINI file from with the command
CHGQRYA QRYOPTLIB(<your library>). In the SAP environment, this selection is done in general with
profile parameter dbs/db4/qaqqinilib. You can also have a second file in a different library that is specified
in profile parameter dbs/db4/alternate_qaqqinilib. This file is then only used for SQL statements that use
the optimizer hint ALTERNATE_QAQQINILIB (see SAP note 485420). If you do not specify a library
for your own QAQQINI file, library QUSRSYS is assumed as the default.
© SAP AG
ADM525
SAP Architecture for iSeries - 18
DB2 UDB and SAP: Enhanced Vector Indexes (EVI‘s)
CREATE ENCODED VECTOR INDEX … ON … WITH <n> DISTINCT VALUES
1
3
4
3
1
3
4
2
3
1
4
3
Table
Key value
Code
First
Last
Count
‘Paris‘
1
1
10
3
‘Rome‘
2
8
8
1
‘Berlin‘
3
2
12
5
‘London‘
4
3
11
3
Vector
+ Less storage required
+ Better build times
+ More accurate statistics
Symbol table
- Unusable for ORDER/GROUP
- Limited use in joins
- Maintenance idiosyncrasies
Used in BW (see SAP note 501572)
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 19
The Enhanced Vector Index (EVI) is a special type of index on DB2 UDB for iSeries. While „normal“
indexes consist of a binary tree of the key values and pointers to the rows in the table, the EVI consists of
two parts: The vector and the symbol table. The symbol table has one entry for each distinct key value
containing the key value, a 1 to 4 byte long unique code, and some statistics information about the
distribution of key values in the table. The vector is an array of codes listed in the same ordial position as
the rows in the table. The vector does not contain any pointers to the actual rows in the table.
EVI‘s have advantages if the table contains relatively few distinct key values that do not change often.
Especially in the Business Warehouse application they can help speeding up the performance. The user or
system administrator does not need to worry about whether to use EVI‘s or traditional indexes. The usage
of EVI‘s has been integrated to the Business Warehouse application, the setup is described in SAP note
501572.
© SAP AG
ADM525
SAP Architecture for iSeries - 19
SAP Architecture for iSeries – Directory Structures
Directory
Structures
usr
sap
<SID>
trans
for SAP
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 20
© SAP AG
ADM525
SAP Architecture for iSeries - 20
IFS Structures: SAP WebAS ABAP
data
log
data
bin
log
buffer
sec
cofiles
DVEBMGS<nn> work
config
sec
Dialog Instance
Central Instance
D<nn> work
data
tmp
…
trans
trans
usr sap <sid> SYS profile
sapmnt <sid> profile
global
global
Legend:
exe
tmp
physical path
run
symbolic link
run
exe
run_nt
Kernel library
link target
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 21
This picture is showing the directories that are used in an ABAP-only installation. Please note that
different SAP releases may show slightly different structures The directories „usr“ and „sapmnt“ start in
the root, and all other directories are setup underneath /usr/sap or /sapmnt. The directory /usr/sap/trans and
the subdirectories underneath /usr/sap/<sid>/SYS are symbolic links, so they can point to a common
directory in a distributed environment. For example, in a 3-tier installation all remote application servers
could share a common profile directory. Usually the /usr/sap/trans directory is shared between the
development, test, and production systems. The kernel library cannot be accessed remotely but has to
reside on the same system as the application server. Prior to kernel release 6.40, most executables where
objects of type *PGM or *SRVPGM in the kernel library. Starting with 6.40, a lot of the executables have
been moved into directory /sapmnt/<sid>/exe, but there are still some executables left in the kernel library.
The subdirectory /usr/sap/<sid>/SYS/exe/run_nt is used for the executables of a Windows application
server for iSeries.
© SAP AG
ADM525
SAP Architecture for iSeries - 21
IFS Structures: SAP Web AS ABAP and Java
…
data
log
igs
os_libs
sec
j2ee
cluster
Central Services SCS<nn> work
SDM
SAPJ2EE<nn>
Kernel library
…
Central Instance DVEBMGS<nn> work
trans
trans
usr sap <sid> SYS profile
sapmnt <sid> profile
global
global
tmp ABAP path
(physical/
tmp symbolic)
j2ee Java path
(physical/
jdbc symbolic)
link target
exe
exe
run
jdbc
jdbc
ntv db2_classes.jar
j2ee
j2ee
tbx
jt400.jar
<user defined> jt400.jar
QIBM
…
db2_classes.jar
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 22
This picture is showing some key paths that are used in a combined ABAP and Java SAP WebAS. In
comparison to the previous ABAP-only picture, some paths were left out so that the structure would fit on
one page. When using Java services, you have a Central Services instance that provides message server
and enqueue functions for Java. The J2EE engine itself is running in the ABAP central instance or a dialog
instance. The symbolic link /usr/sap/<sid>/SYS/jdbc is pointing to the JDBC drivers. There are two JDBC
drivers available, the „Native“ driver (db2_classes.jar) and the „Toolbox“ or „JTOpen“ driver (jt400.jar).
While the Native driver is always in a fixed location
(/QIBM/ProdData/OS400/Java400/ext/db2_classes.jar), the Toolbox or JTOpen driver (jt400.jar) can be
downloaded to any user-defined location. The Java instance uses another i5/OS library with executables,
which is called SAPJ2EE<nn> (<nn> being the instance number). The path
/usr/sap/<sid>/DVEBMGS<nn>/j2ee/os_libs contains native executables and symbolic links pointing to
objects in that library. The path /usr/sap/<sid>/DVEBMGS<nn>/SDM has data for the Software
Deployment Manager, and path The path /usr/sap/<sid>/DVEBMGS<nn>/igs has data for the Internet
Graphic Server.
© SAP AG
ADM525
SAP Architecture for iSeries - 22
IFS Structures: Transport Landscape
ServerDEV
ServerQAS
ServerPRD
Development
system
Quality assurance
system
Production
system
QFileSvr.400
QFileSvr.400
cofiles
ServerPRD
ServerPRD
sapmnt trans config
bin
buffer
data
sapmnt trans
sapmnt trans
usr sap trans
usr sap trans
usr sap trans
…
Production system: /usr/sap/trans → /sapmnt/trans
Development, quality assurance system
or appl. server: /usr/sap/trans → /sapmnt/trans →
/QFileSvr.400/ServerPRD/sapmnt/trans
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 23
In a transport landscape, it may be desired to share one common directory between the development,
quality assurance and production system. In this example, the data is physically located on the production
system (ServerPRD), because that server is usually the most stable one and imports are typically twice as
fast if the transport directory is accessed locally. In all three systems, /usr/sap/trans is a symbolic link. On
the production system, it simply points to /sapmnt/trans, on the other two servers it accesses the remote
server through the rempote filesystem QFileSvr.400.
The file system QFileSvr.400 needs the following to work correctly:
1. The host server *FILE must be started with the command STRHOSTSVR SERVER(*FILE). This is
usually done automatically in the system startup program.
2. The target host must be added as link under QFileSvr.400 with the command MD
DIR(‘/QFileSvr.400/<target host>‘). This link is lost when restarting the server, so it is recommended
to add that command to the system startup program as well.
3. A user profile with the same name and password must exist on the target host. This is also described in
SAP note 67213.
© SAP AG
ADM525
SAP Architecture for iSeries - 23
IFS Structures: Windows Dialog Instance
tmp ABAP path
(physical/
tmp symbolic)
j2ee Java path
(physical/
jdbc
symbolic)
trans Win share
iSeries DB Host
tmp
trans
usr sap <sid> SYS profile
global
Converting share saptext
link target
\\centralhost\sapmnt
exe
run
Binary share sapmnt
<sid> SYS
run_nt
os_libs
exe run_nt
profile
\\saptranshost\sapmnt trans
…
j2ee cluster
…
D<nn> work
Windows Dialog
usr sap <sid> SYS
jdbc tbx
jt400.jar
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 24
When running a Windows application server, it shares the executables, profiles, and the transport directory
with the central instance or the central transport system. On the iSeries, there are two shares for directory
/usr/sap: sapmnt as a binary share that does not convert data, and saptext as a share that converts text data
from EBCDIC to ASCII. The saptext share is not used in a default installation, but can be used when
EBCDIC data needs to be accessed from the Windows server. The shares are created during the
installation by the command CRTSAPSHR (in the kernel library). The other directories are pretty much
the same as on an iSeries application server, except that the kernel executables are now taken from
subdirectory run_nt.
© SAP AG
ADM525
SAP Architecture for iSeries - 24
IFS Structures: Setup for Independent ASP
Detailed documentation:
SAP note 568820
R3<sid>DATA
R3<sid>400
SAP kernel library
R3400
exe
<sid>
global
sapmnt trans
<sid> profile
sapmnt trans
trans
aspdev
usr sap <sid>
…
usr sap <sid> SYS profile
…
System ASP (ASP 1)
Independent ASP (IASP)
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 25
If your system is setup for Independent ASP, most data can reside in the separate independent ASP. The
libraries R3<sid>400 and R3400 contain object types that cannot be in an independent ASP (such as a job
queues and output queues), so they have to be in the system ASP. All path names in in independent ASP
start with the ASP device name, such as /aspdev/sapmnt/trans. The SAP directory structure starts hard
coded with /usr/sap, so a solution was found to store all IFS data in the independent ASP and point to the
data through symbolic links as shown in the picture. A detailed description about the setup of independent
ASP can be found in SAP note 568820.
© SAP AG
ADM525
SAP Architecture for iSeries - 25
SAP Architecture for iSeries – Work Management
Security and
Work Management
for SAP
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 26
© SAP AG
ADM525
SAP Architecture for iSeries - 26
Work Management: SAP System Administrator
iSeries
i5/OS
<SID>OFR
<SID>OWNER
Kernel library
Owner
R3OWNER
SAP system
administrator
R3<SID>DATA
Owner
<SID>GROUP
<SID>ADM
R3SYS, R3400
Primary
group
R3GROUP
Windows
Linux
/usr/sap
<SID>
IFS
Group profiles
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 27
The user id of the SAP system administrator at operating system is <SID>OFR for iSeries andi5/OS or
<SID>ADM for Windows or Unix application servers. The user profile <SID>ADM also exists at i5/OS
level, but when working with an iSeries installation, <SID>OFR is usually preferred. In the future, the
<SID>OFR user profile may get replaced by <SID>ADM on iSeries in order to get a common naming
across platforms.
Both user profiles have four group profiles: R3OWNER, R3GROUP, <SID>OWNER, and
<SID>GROUP. This allows access to all objects to which the four group profiles are authorized. All
objects that can be shared between multiple SAP systems are owned by R3OWNER, for example the
libraries R3SYS and R3400 or the directory /usr/sap. Objects that are specific to one SAP system are
owned by <SID>OWNER, for example the database library R3<SID>DATA or the directory
/usr/sap/<SID> and all directories and files underneath. IFS objects also have a primary group profile,
which is comparabale to group authority in Unix. There is a primary group profile R3GROUP for IFS
objects that are shared between SAP systems and a primary group profile <SID>GROUP for all IFS
objects that belong to one SAP system.
The initial password for user profiles <SID>OFR and <SID>ADM is „SAPOFR“, and it should be
changed immediately after installing SAP.
© SAP AG
ADM525
SAP Architecture for iSeries - 27
Work Management: SAP Operator
Can start/stop/save SAP system
<SID>OPRGRP
<SID><nn>
R3GROUP
<SID>GROUP
Work Processes
R3ADMAUTL
<SID>OPR
Cannot look at SAP database
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 28
The user profile <SID>OPR is designed to allow someone to start, stop, or save the SAP system, but not
to look at any of the SAP data through native methodes (like STRSQL or SQLUTIL). Note that this user
does not have R3OWNER and <SID>OWNER as group profiles. The necessary authority to objects in the
kernel is obtained through the group profile <SID>OPRGRP and the authorization list R3ADMAUTL.
User profile <SID>OPR has group profiles R3GROUP and <SID>GROUP, so it can access all IFS data
including log files.
In older SAP releases, the default password for user profile <SID>OPR is „SAPOFR“, in newer releases it
will be *NONE, so that noone can signon with this user, until a password has been actively set by
QSECOFR or a similar user.
© SAP AG
ADM525
SAP Architecture for iSeries - 28
Work Management: ABAP and JDBC User Profiles
<SID>ADM
SAPSE<SID>
<SID><nn>
INLMNU
*SIGNOFF
R3GROUP
R3OWNER
<SID>GROUP
<SID>OWNER
Owner
OBJAUT *ALL
SAP<SID>DB
INLMNU
*SIGNOFF
DB object
DB object
R3<SID>DATA
SAP<SID>DB
JDBC
ABAP
Owner
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 29
The processes of the SAP WebAS ABAP server and the SAP WebAS Java server on iSeries are running
under user profiles that are named <SID><nn> with <SID> being the three digit SAP system ID and <nn>
being the instance number. These user profiles also have the group profiles <SID>OWNER,
<SID>GROUP, R3OWNER, and R3GROUP with all their authorities. These user profiles must be
enabled and have a valid password. The default password after an installation is SAP<nn>PWD, but
because of the setting INLMNU(*SIGNOFF), you cannot signon with that user profile to an interactive
session. On Windows and Linux application servers, the work processes are running with the users
<SID>ADM or SAPse<SID>. These user profiles have the same group profiles as <SID><nn>.
On an iSeries SAP WebAS ABAP server, the database access is done with user profile <SID><nn>. The
database access of a Windows application server prior to release 6.40 is done with user profile
<SID>ADM. Starting with 6.40, the database access is done by a user named SAPSE<SID>. The database
access from a Linux application server is done with user <SID>ADM. Objects that are created by these
users are owned by <SID>OWNER, so that the instance users <SID><nn> or SAPSE<SID> as well as the
administrators <SID>OFR or <SID>ADM can access the data. On an SAP WebAS Java server, the access
is done through JDBC with user profile SAP<SID>DB. Because of the SQL conventions in JDBC, objects
that are created by this user must also be owned by SAP<SID>DB. In order to allow <SID>OFR or
<SID>ADM to access the data, an additional object authority *ALL is granted for user <SID>OWNER
for each object that is created by SAP<SID>DB.
© SAP AG
ADM525
SAP Architecture for iSeries - 29
Work Management: Environment Variables
LEVEL:
*JOB, *SYS
*USRPRF
<SID>OFR, <SID>ADM:
Initial program
R3<SID>400/R3INLPGM
SAPSYSTEMNAME
SAPSYSTEM
SAPDBHOST
dbms_type
…
CALL
R3<SID>400/R3INLPGM
ADDENVVAR
CHGENVVAR
WRKENVVAR
QIBM_COMPONENT_TRACE_LEVEL
QIBM_SQL_SERVICE
…
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 30
Environment variables can be used to control the behaviour of applications or operating system functions.
The SAP applications uses them among others to query the name of the installation (system ID and
instance number), as well as the type of the database and the name of the database host. In addition,
environment variables can be used by support to control trace level information or specific behaviour in
case of an error. The support person SAP or IBM) will then direct you what variable to set and what value
to set it to.
In general, environment variables on i5/OS can be specified with the commands ADDENVVAR,
CHGENVVAR, or WRKENVVAR. You can specify environment variables at job level (*JOB) or at
system level (*SYS). If you specify environment variables at system level, they stay valid after a restart of
the system. Environment variables at job level are usually inherited by jobs that are spawned from the job.
Please note that environment variables (both the names and the values) are case-sensitive.
SAP provides a program (R3INLPGM in library R3<SID>400) that is setting all necessary environment
variables for an SAP system. This program is executed automatically when the user <SID>OFR or
<SID>ADM is signing on because it is specified as initial program in the user profile. You can also
execute the program manually by calling it when you are signed on as a different user (such as
QSECOFR) and want to start an SAP system.
© SAP AG
ADM525
SAP Architecture for iSeries - 30
Work Management: SAP Processes - Overview
Client
(SAP GUI)
Internet
Client (Web browser)
SAP WebAS ABAP
Database
Java
disp.
RFC
HTTP
IGS
Server
ICM
Update 2
Spool
Background
Enqueue
Update
Dialog
Gateway
ABAP dispatcher
JCo
Message
server
Enqueue
server
SDM
Message
server
SAP WebAS Java
Central
services
Database
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 31
This picture is showing a combined a central instance of an SAP WebAS server combining ABAP and
Java with the possible processes. The ABAP and Java servers have different databases and communicate
with each other through the Java Connector (JCo).
The central instance of SAP WebAS ABAP consists of the following processes:
y The message server controls communication between instances within the same SAP system and
processes incoming requests from the SAP GUI clients.
y The gateway controls communication with external programs through RFC.
y The dispatcher manages the work processes. Work processes are used as dialog work processes (DIA),
background work processes (BGD), spool work processes (SPO), the enqueue work process (ENQ), and
update work processes (UPD and UP2).
y The internet communication manager (ICM) processes requests coming from Web browsers.
The SAP WebAS Java server consists of two instances: A central services instance with the message
server and the enqueue server, and an instance with the dispatcher, the J2EE server, the software
deployment manager (SDM). If SAP WebAS Java and ABAP are combined in an AddIn installation, the
Java dispatcher, J2EE server, SDM, and IGS are in the same instance as the ABAP processes.
In addition you will see the internet graphics server (IGS). It is a standalone server that is shipped with
both the ABAP and Java servers and communicates through RFC or HTTP.
© SAP AG
ADM525
SAP Architecture for iSeries - 31
Work Management: ABAP Work Processes and Jobs
WRKPID
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 32
In the SAP WebAS ABAP server, transaction SM50 is giving you an overview of work processes. Each
work process in an SAP server has a unique process id (PID). For each work process in the SAP system,
you will see a corresponding job on the iSeries. The job names in WRKACTJOB indicate what work
process the jobs are representing. You can also use the command WRKPID, that is provided in the SAP
kernel library, to map a process id to a specific job.
Besides the work processes (WP00, WP01, …), you can also see other processes that are not shown in
transaction SM50. DISP_WORK (the dispatcher), GWRD (the gateway), ICMAN (the internet
communication manager), and MSG_SERVER (the message server) have been explained in the previous
foil. In addition you will see the jobs SAPOSCOL (operating system performance data collector),
RSLGCOL and RSLGSEND (used for the central system log), WATCHDOG (cleanup of abnormally
ended jobs), and SAPSTART (the job that actually started the SAP system) in the subsystem that is used
by the instance.
© SAP AG
ADM525
SAP Architecture for iSeries - 32
Work Management: Java Processes
Work processes for SAP WebAS Java (Central Instance)
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 33
These are the jobs that you can see for an SAP WebAS Java instance. There are two subsystems (in the
example R3_37 and R3_38), one for the central services with the message server and the enqueue server,
and another one for the central instance with the dispatcher, the internet graphic server, the software
deployment manager (SDM) and the J2EE server (SERVER0). You also have SAPSTART jobs, that
started the instances, and WATCHDOG jobs, that cleanup data from abnormally terminated jobs.
JCONTROL is the job that starts the Java virtual machine (JVM) for the services DISPATCHER, SDM,
and SERVER0.
Most jobs are running multi-threaded (indicated by status THDW), and you can use option 12 to work
with the threads of a process. Other than with ABAP, an easy mapping between the Java work and the
associated thread is not possible.
© SAP AG
ADM525
SAP Architecture for iSeries - 33
Work Management: Job Status
WRKACTJOB:
Subsystem/Job
R3_30
DISP_WORK
GWRD
ICMAN
MSG_SERVER
RSLGCOLL
RSLGSEND
SAPOSCOL
SAPSTART
WATCHDOG
WP00
WP01
WP02
WP03
WP04
WP05
Function
PGM-disp+work
PGM-gwrd
PGM-icman
PGM-MSG_SERVER
PGM-rslgcoll
PGM-rslgsend
PGM-SAPOSCOL
PGM-sapstart
PGM-disp+work
PGM-disp+work
PGM-disp+work
PGM-disp+work
PGM-disp+work
PGM-disp+work
PGM-disp+work
Status
DEQW
SELW
SELW
SELW
SELW
SELW
SELW
THDW
EVTW
SELW
RUN
TIMW
LCKW
MTXW
END
SEMW
Select wait (sockets)
Multithreaded (opt. 12)
Running (using CPU)
Wait for DB request
Lock or mutex wait
Job ending (WP restart)
Idle work process
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 34
This picture is showing a few typical examples for the status that a job can have in the WRKACTJOB
display. The complete explanation of all possible status values can be found by positioning the cursor over
the status column in the WRKACTJOB display and pressing the F1 key for help.
Typically a work process is in status SEMW when it is idle. As soon as it gets work to do, it can be in
status RUN when it is actually using CPU, or it can be in several wait states. LCKW and MTXW usually
happen as result of conflicts with other work processes. If they don‘t go away quickly, you can use option
11 for locks or option 14 for mutexes to see who is holding the lock or mutex and to check what that job is
doing. If a job is requesting data from the database in a remote connection (3-tier) or in a secondary
connection on a local installation, the work process is in TIMW status while it is waiting for the data to be
returned from the database. Depending on the complexity of the operation, the job can be in TIMW for
quite a while. When a work process is restarted (either intentionally or because of an error), it will show
status END while performing cleanup operations. If a job indicates THDW, it consists of multiple threads.
You can use option 12 to get a list of threads and check the status for each thread individually.
© SAP AG
ADM525
SAP Architecture for iSeries - 34
Work Management: Job Run Priority
WP00 (DIA)
WP01 (DIA)
WP08 (UPD)
WP11 (BGD)
SEMW →
User request
received
TIMW →
Data from DB
received
LCKW →
Record lock
got released
TIMW →
Data from DB
received
Limit: activity level in pool
Order: job run priority
Profile parameters (SAP note 45335):
rdisp/prio/upd = [ H | M ]
rdisp/prio/btc = [ M | L ]
rdisp/prio/spo = [ M | L ]
Change to
‘L‘ in small
installations
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 35
Whenever a work process returns from a wait state to an active state, it is queued for processing based on
its run priority. The run priority is a numeric value that can go from 1 to 99, where a lower number means
higher priority. Note that the absolute value of the job run priority does not matter, only the relative
numbers between multiple competing jobs matter, and the jobs with the lower value (that is higher
priority) get system resources first.
In a standard SAP installation, all work processes have the same run priority of 20, which is the same
priority as interactive workload on iSeries. The dispatcher, message server, gateway, internet
communication manager, and the enqueue server have a higher priority of 12, so that long running work
processes cannot block these key services. You can modify the run priority of some work process classes
by the profile parameters that are described in SAP note 45335. A value of ‚H‘ means a run priority of 16
instead of 20 (‚M‘), and a value of ‚L‘ means a run priority of 24. By reducing the run priority of your
background workprocesses (rdisp/prio/btc=L) you can ensure that dialog work processes are not seriously
impacted by long running background processes. This is especially recommended for small installations.
© SAP AG
ADM525
SAP Architecture for iSeries - 35
SAP Architecture for iSeries – 3-Tier Installations
SAP WebAS
3-tier
scenarios
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 36
© SAP AG
ADM525
SAP Architecture for iSeries - 36
SAP 3-Tier Installation: Supported Application Servers
All
SA
P
rele /iSer
ase ies
s
.40
ease 6
l
e
r
l
e
ern
SAP k S V5R3M0
i5/O
SA
Pk
er n
i5/O el re
S V leas
5R3 e 6.
40
M0
C
4.6
e
s
0
a
rele 4R5M
P
SA /400 V
OS
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 37
In 3-tier, an iSeries database can have application servers running i5/OS, Linux on Power, Windows 32-
bit, or Windows 64-bit for EM64T/AMD64 technologie. While iSeries application servers can run in all
supported SAP and iSeries releases, Windows and Linux application servers have some restrictions. Both
Windows and Linux application servers require an ASCII or Unicode database and do not support
EBCDIC databases. Windows 32-bit requires at least OS/400 V4R5M0 and SAP release 4.6C, Linux on
Power and Windows 64-bit requires at least i5/OS V5R3M0 and SAP kernel release 6.40.
© SAP AG
ADM525
SAP Architecture for iSeries - 37
SAP 3-Tier Installation: Communication Methods
dbs/db4/opticonnect = 1
HSL OptiConnect
Virtual OptiConnect
+ 5722SS1 Option 23
SPD OptiConnect
dbs/db4/opticonnect = 0
Gigabit Ethernet (TCP/IP)
Virtual Ethernet (TCP/IP)
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 38
iSeries Application servers can communicate with the database server through two methods: OptiConnect
and TCP/IP. The preferred communication method can be configured through profile parameter
dbs/db4/opticonnect.
Older hardware supported the SPD OptiConnect link as physical connection, newer hardware supports the
HSL OptiConnect link, and in case of multiple logical partitions (LPAR‘s) in the same box you can use
Virtual OptiConnect. In addition, you will need option 23 of the operating system, which is a chargeable
feature.
To use a TCP/IP connection, you can use a Gigabit Ethernet link or Virtual Ethernet in case of logical
partitions (LPAR‘s). You do not need separate software to use a TCP/IP connection. When using
application servers other than iSeries, TCP/IP over Gigabit Ethernet is the only supported connection
method.
© SAP AG
ADM525
SAP Architecture for iSeries - 38
SAP 3-Tier Installation: Shadow Processes
Subsystem/Job
R3_30
DISP_WORK
GWRD
ICMAN
MSG_SERVER
WP00
WP01
…
User
QSYS
CHB30
CHB30
CHB30
CHB30
CHB30
CHB30
Subsystem/Job
R3_60
DISP_WORK
GWRD
ICMAN
MSG_SERVER
WP00
WP01
…
User
QSYS
CHB60
CHB60
CHB60
CHB60
CHB60
CHB60
OptiConnect
TCP/IP
Monitor tool:
CHKXDA
(note 450351)
Subsystem/Job
QSOC
SOCMGR
APIA000001
APIA000002
…
QSYSWRK
…
QXDAEDRSQL
QXDARECVR
QXDARECVR
…
User
QSYS
QSOC
CHB30
CHB30
QSYS
QUSER
QUSER
QUSER
Database
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 39
In 3-tier configurations, each work process has at least one shadow process on the database server. If a
work process opens more than one connection, it can have more than one shadow process, one for each
connection. For example, the Business Warehouse application often works through a secondary
connection. Note that the controlling jobs, such as the dispatcher, do not have a database connection.
When using an OptiConnect configuration, all shadow processes are running in subsystem QSOC.
Subsystem QSOC in library QSOC must be started after starting the iSeries server, and usually this will be
done automatically in the system startup program. When the subsystem starts, the control job SOCMGR
gets automatically started as well. It receives the connection requests from the database server and starts a
job named APIA<nnnnnn> for each work process. These jobs are started under the same user profile as
the remote instance.
When connecting through TCP/IP, the shadow processes are running in subsystem QSYSWRK. This
subsystem gets started automatically during startup. The controlling job QXDAEDRSQL is also started
automatically or by the command STRTCPSVR SERVER(*EDRSQL). This controlling process is
spawning a job named QXDARECVR for each connection request. The QXDARECVR jobs are started
under user profile QUSER, but switch to the instance user after the start.
You can download a monitor tool for the shadow processes as attachment to SAP note 450351. The tool is
called CHKXDA and provides functions to map shadow processes to work processes and end shadow
processes that are no longer needed because the related work process got restarted.
© SAP AG
ADM525
SAP Architecture for iSeries - 39
SAP 3-Tier Installation: Matching User Profiles
i5/OS appl. server
<SID>OFR
<SID><nn>
Windows appl. server
<SID>ADM
SAPse<SID>
password
password
ntlogon
password .inf
password
<SID>OFR
<SID><nn>
Linux appl. server
<sid>adm
sapsys
password
uid
gid
ntlogon
.inf
SAPSE<SID> <SID>ADM
R3GROUP
File access
DB access
SAP notes:
password
password
password
password
uid
Database server
gid
173579 (iSeries)
705886 (Windows)
818091 (Linux)
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 40
When running SAP WebAS ABAP in 3-tier, some user attributes have to match between the application
server and the database server to allow access from the remote application server. When connecting from
an iSeries application server to the database, the passwords of the instance user profile <SID><nn> must
be the same on both servers. The passwords for <SID>OFR must also be the same because a remote file
access through /QFileSvr.400 requires identical passwords on both sides. SAP note 173579 explains the
user profiles on iSeries.
Up to SAP release 6.20, Windows application servers were connecting as user <SID>ADM to the
database. Starting with release 6.40, the user that is connecting to the database is SAPse<SID>. In both
cases, the passwords must be the same on the application server and the database server. The Windows
password information is stored in an encrypted password file ntlogon.inf, which is located in the profile
directory. After changing the password, you must update the password file with a tool setdb4pwd as
described in SAP note 705886.
Also with a Linux application server, password file ntlogon.inf is used to store the password of user
<sid>adm for the database access. For file access, the uid values of the Linux user <sid>adm and the
iSeries user profile <SID>ADM as well as the gid values of sapsys on Linux and R3GROUP on iSeries
have to match. In addition, <sid>adm on Linux must be member of group sapsys. Prior to Linux, the uid
and gid values of iSeries user profiles were not relevant, so it may be necessary to change them to
something meaningful when installing Linux application servers. SAP note 818091 explains how to
change existing user profiles for Linux.
© SAP AG
ADM525
SAP Architecture for iSeries - 40
SAP Architecture for iSeries – Printing on iSeries
SAP Printing
on iSeries
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 41
© SAP AG
ADM525
SAP Architecture for iSeries - 41
SAP Printing on iSeries: Information Flow
User action
SAP System
Document
Hello
World
Create document
Print
Spool Request
Spool Data
TemSe
Output
Output Request
SAP
Spool System
Access method:
C, F, S, U, …
Operating system spool
Hello
World
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 42
When a request is made to print a document in SAP, a spool request is created. It consists of
administrative information (origin, date, author name, logical printer), which is stored in the SAP database,
and the data to be printed which is stored in a repository called the temporary sequential database
(TemSe). The SAP Spool System uses generic representations of printer formatting commands and the
SAP internal character set to represent the characters to be printed.
TemSe data can be stored inside the SAP database or at operating system level. Profile parameter
rspo/store_location (see SAP Note 20176) determines where TemSe is located: db stores the data in the
database (default), and G stores the data in an operating system file in the global directory.
The preparation of a spool request for printing is an output request. In SAP, you can either print
immediately (an output request is generated immediately) or delay printing (the spool request does not
lead immediately to an output request). A spool request can correspond to several output requests. These
can be sent to different output devices.
The access method defines how the printer is accessed. Commonly used access methods are C (Direct
operating system call), F (Printing on Front End Computer), S (Print Using SAP Protocol), or U (Print
Using Berkeley Protocol). Access method L (Print Locally Using LP/LPR) is no longer supported on
iSeries, as described in SAP note 693802.
Access method C uses the iSeries specific spooling system and will be discussed in the following pages.
SAP spooling and printing in general is covered in the class ADM100.
© SAP AG
ADM525
SAP Architecture for iSeries - 42
SAP Printing on iSeries: Configure Access Method C
Host printer:
Output queue (*OUTQ)
on iSeries server
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 43
When configuring a printer through access method C, you need an output queue on your iSeries server,
which is an object of type *OUTQ. You will see later, how that output queue is being created on iSeries
by using the CRTOUTQ command. Below access method C, you specify the name of the output queue as
host printer. The other configuration elements are the same as for other access methods and platforms.
© SAP AG
ADM525
SAP Architecture for iSeries - 43
SAP Printing on iSeries: Printer Data Streams
SAP WebAS ABAP
Supported printers: SAP note 8928
…
Traditional application
Host Print
Transform
AFP (text, graphic, loadable fonts)
Postscript
IPDS (text and graphic)
PCL 5
PCL 6
SCS (text only)
ASCII based data stream
EBCDIC based data stream
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 44
Traditionally, the iSeries supported three EBCDIC based printer data streams. SCS is a very simple, text
based datastream that allows only few formatting options such as bold, underline or different values for
characters per inch (CPI). IPDS allows including graphics or bar codes and selecting different fonts from
the printer. AFP is the most advanced data stream and allows downloading software fonts and including
predefined overlays or form definitions. These data streams are downward compatible so that an AFP
printer can also print SCS data stream. Traditional applications can also print on ASCII based printers by
using the Host Print Transform functionality. However, the number of supported data streams is limited,
and the conversion of the data stream needs resources (CPU and memory) on the iSeries server.
The SAP WebAS ABAP server supports a wide variety of ASCII based data streams. The list of supported
printers or data streams can be found in SAP note 8928. It is updated as new printers are introduced to the
market and supported by SAP. You can also create SCS data stream (with its restrictions) by using the
device type IBMSCS. To create AFP data stream from within SAP is no longer supported since IBM
withdrew support for the product 5798-AF3 (see SAP note 693802).
© SAP AG
ADM525
SAP Architecture for iSeries - 44
SAP Printing on iSeries: Creating an Output Queue
Create Output Queue (CRTOUTQ)
Output queue . . . . . . . . . . > P516
Library . . . . . . . . . . . >
QGPL
Remote system . . . . . . . . . > DEWDFPR05
Remote printer queue . . . . . . > P516
Writers to autostart . . . . . . > 1
Connection type . . . . . . . . > *IP
Destination type . . . . . . . . > *OTHER
Host print transform . . . . . .
*YES
Manufacturer type and model . . > *INFOPRINT1352
Workstation customizing object
*NONE
Library . . . . . . . . . . .
Print separator page . . . . . . > *NO
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 45
This picture is showing some important parameters for creating an output queue:
Output queue and library: Define the name of your output queue. You should specify a library that is in
the library list of all jobs on the system, such as QGPL.
Remote system and Remote printer queue: Remote system is the name of a network printer or a print
server. The default *NONE is used for a local printer or an output queue that has no printer assigned. In
the Remote printer queue parameter, you specify the printer name on the print server.
Writers to autostart: If the output queue actually represents a printer, it is recommended to specify a
writer job to be started automatically at system startup.
Connection type and Destination type: Specify *IP and *OTHER here as shown in the picture.
Host print transform: By leaving the default *YES here, you allow EBCDIC based spooled file data to
be printed on an ASCII based printer.
Manufacturer type and model: This parameter is used when Host print transform is set to yes. Function
key F4 provides a list of supported printer models.
Workstation customizing object and library: If you don‘t find your printer in the list supported types
and models, you can create your own conversion object using the command CRTWSCST.
Print separator page: The default for this parameter is set to *YES, but you may want to change that to
*NO and let SAP create the separator page.
© SAP AG
ADM525
SAP Architecture for iSeries - 45
SAP Printing on iSeries: Configuration Alternatives
Default paper size A4
RTVWSCST
DEVTYPE(*TRANSFORM)
MFRTYPMDL(<your type>)
SRCMBR(<your wscst>)
SRCFILE(*LIBL/QTXTSRC)
Device description
instead of remote OUTQ
CRTDEVPRT DEV(<printer>)
DEVCLS(*LAN)
TYPE(3812) MODEL(1)
LANATTACH(*IP)
PORT(9100) FONT(11)
TRANSFORM(*YES)
MFRTYPMDL(*WSCSTA4)
RMTLOCNAME(<network name>)
SYSDRVPGM(*HPPJLDRV)
WSCST(<your wscst>)
CRTWSCST
WSCST(<your wscst>)
CHGOUTQ
OUTQ(<your outq>)
MFRTYPMDL(*WSCSTA4)
WSCST(<your wscst>)
OUTQ QUSRSYS/<printer>
created automatically
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 46
The remote output queue that was shown in the previous slide is probably the easiest way to configure a
network printer for the iSeries server. In this slide, two modifications are described that may be useful in
some cases.
Per default, the i5/OS printer drivers assume that your printer has letter format paper loaded. If you print to
a printer that has A4 size paper loaded, you may see a message at the printer telling you to load letter size
paper. You can ignore this message, but it is annoying. To solve this problem, you can create your own
workstation customization object (type *WSCST) and specify *WSCSTA4 in the „manufacturer type and
model“ (MFRTYPMDL) parameter as shown in the left part of the slide. First you need to retrieve the
source of an existing type, such as *INFOPRINT1352, to a member in a source file QTXTSRC. Then you
compile the source without changes to create an object of type *WSCST. Finally you specify this object in
your remote output queue and set the MFRTYPMDL parameter to *WSCSTA4.
Instead of a remote output queue, you can also create a device description as shown in the right part of the
slide. The advantage is a better feedback handling in case of errors. When printing native i5/OS data, you
can also specify a page range to print, for example to restart your printout at a certain page after a paper
jam. The slide is showing an example configuration, depending on your printer type you may have to use
different port numbers (parameter PORT) or system driver program (parameter SYSDRVPGM). When
you create a printer device description, an output queue with the same name is created automatically in
library QUSRSYS.
© SAP AG
ADM525
SAP Architecture for iSeries - 46
SAP Printing on iSeries: i5/OS Spooling
Hello
World
Spool request
Remote writer job
Output device:
Access method C
Host printer
(output queue)
Output queue
IBMIP12
Network
Device type
QSYSPRT
Printer file
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 47
When a spool request is printed in SAP, the spool work process considers the device type and the access
method of the output device to process the request. When an output device is configured for access
method C in transaction SPAD, you specify the name of an output queue (object type: *OUTQ) on your
iSeries server. Based on a printer file QSYSPRT (object type: *FILE, file attribute: PRTF), the spool work
process creates a spooled file in that output queue. If a writer job is started for that output queue, the
spooled file is processed and sent to the attached printer. The printer can be somewhere in the network, as
shown in the example, or it can be physically attached to the iSeries server. If the printer is locally attached
to the iSeries server, you will see a printer writer job instead of a remote writer job.
© SAP AG
ADM525
SAP Architecture for iSeries - 47
SAP Printing on iSeries: WRKOUTQ Command
Output queue name (host printer name in SAP)
Processing option
Output queue on hold
User data = SAP spool request number
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 48
You can use the WRKOUTQ command on iSeries to see spooled file entries in an output queue. The name
of the output queue is specified as „host printer name“ when selecting access method ‚C‘. In order to get
the screen shot with two entries, the output queue was held with the command HLDOUTQ. To release the
output queue, you can use the command RLSOUTQ. You can see the status in the upper right part of the
screen. WTR is indicating, that a writer job has been started for that output queue. The user data for each
spooled file in the output queue is corresponding with the spool request number in SAP, so you can map
SAP spool requests with entries in the output queue. You have many options to process the spooled files,
including holding (3), deleting (4), and displaying the attributes (8). Option 5 (display) only works when
the data stream is EBCDIC based, which is true when the device type IBMSCS was specified in the SAP
system.
If your print requests on a printer with access method C are completed in SAP without error but don‘t
appear on your printer, the WRKOUTQ command is a good start. Verify in the upper right part of the
screen that a writer job is started and that the output queue is released.
© SAP AG
ADM525
SAP Architecture for iSeries - 48
SAP Printing on iSeries: Access Method U
Use access method U instead of C to print without output queue!
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 49
Instead of using an output queue and access method C, you can also access a network printer through
access method U directly, as on any other platform. Using access method U has the following advantages
over access method C:
y
You get direct feedback from the printer in your list of spool requests (transaction SP01).
y
You do not have duplicate maintenance by checking both the SAP spooling system and the output
queues and writers on i5/OS.
If a printer that is accessed through access method U is temporarily not available, the spool work process
may wait some time before it assumes a timeout. In order to avoid bottlenecks in the SAP spooling
system, you should configure sufficient spool work processes to process spool requests even if a spool
work process is waiting for feedback from a non-available printer.
© SAP AG
ADM525
SAP Architecture for iSeries - 49
SAP Architecture for iSeries: Using Java on iSeries
Using Java
on iSeries
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 50
© SAP AG
ADM525
SAP Architecture for iSeries - 50
Java on iSeries: Java Development Kit
> java -version
java version "1.4.2"
$
===> java –Djava.version=1.3 ...
5722SS1 option 30: Qshell
5722JV1 option 5: Java Developer Kit 1.3
/QIBM/ProdData/Java400/jdk13/bin/java
5722JV1 option 6: Java Developer Kit 1.4
/QIBM/ProdData/Java400/jdk14/bin/java
interpreter (qsh)
Java Virtual
Machine
Minor releases:
Java Group PTF‘s
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 51
Different versions of the Java Development Kit (JDK) for iSeries are installed as options of licensed
program IBM Developer Kit for Java (5722JV1). Currently in use by SAP are JDK 1.3, which is installed
as option 5, and JDK 1.4, which is installed as option 6. Minor release changes are implemented through
the so-called Java group PTF, which called is SF99169 in OS/400 V5R2M0 and SF99269 in i5/OS
V5R3M0. PTF‘s (Program Temporary Fixes) will be explained in more detail later.
In order to execute Java in an interactive session, you need to install the Qshell interpreter, which is option
30 of the operating system. The Qshell interpreter is started by entering the command QSH in a command
line and provides a Unix like command interface. To execute a Java program, you can use the command
„java“. If you need to execute a specific version of the JVM, you can set the property java.version on the
java command as shown in the picture. SAP uses one of the two links for JDK 1.3 and 1.4 that allow to
execute different versions by specifying different path names. Both links point to a script that starts the
same JVM with different java.version properties.
© SAP AG
ADM525
SAP Architecture for iSeries - 51
Java on iSeries: Supported JDBC Drivers
IBM Developer Kit
for Java (5722JV1)
IBM Toolbox for
Java (5722JC1)
Native Driver
Toolbox Driver
/usr/sap/<SID>/SYS/jdbc/
ntv/db2_classes.jar
Type 2: Native calls
SAP notes:
654800
809693
826449
Shared Memory
Shadow process
QSQSRVR
/usr/sap/<SID>/SYS/jdbc/
tbx/jt400.jar
Type 4: Java only
TCP/IP
SAP<SID>DB
Shadow process
QZDASOINIT
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 52
Java on iSeries supports two JDBC drivers: the Native Driver and the Toolbox Driver. The Native Driver
can be used only when the Java server and the database are on the same iSeries server in the same
partition, but it provides better performance than the Toolbox Driver. The Toolbox Driver can be used on
any platform that connects to an iSeries database, but it is a little slower than the Native Driver.
The picture is showing the iSeries software products that are providing the drivers, the typical links and
the names of the driver classes, and the names of the shadow processes on the database server. A detailed
description of the two driver types and usage considerations can be found in SAP note 654800. SAP note
809693 explains the driver locations, and SAP note 826449 explains the necessary changes to switch
JDBC drivers in an existing SAP WebAS installation.
© SAP AG
ADM525
SAP Architecture for iSeries - 52
Java on iSeries: Configuration Elements for JDBC
Config Tool
Driver class
Key
Value
Secure
store
Connection URL
Driver path
Dispatcher
SDM
Bootstrap
Server
Config Tool
Key
Value
sdmrepository.sdc:
<Param … name=“jarPaths“…
CDATA[/usr/sap/<SID>/sys/jdbc/…]
bootstrap.properties:
rdbms.driverLocation =
/usr/sap/<SID>/sys/jdbc/…
SAP<SID>DB
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 53
The main configuration elements for a JDBC driver are the driver class name, the connection URL, and
the path to the JDBC driver jar file. For the Native driver, the driver class is
com.ibm.db2.jdbc.app.DB2iSeriesDriver, the connection URL starts with
„jdbc:db2iSeries:*LOCAL/SAP<SID>DB“, and the driver path for an SAP installation is
/usr/sap/<SID>/sys/jdbc/ntv/db2_classes.jar. For the Toolbox driver, the driver class is
com.ibm.as400.access.AS400JDBCDriver, the connection URL starts with „jdbc:as400://<host
name>/SAP<SID>DB“, and the driver path for an SAP installation is
/usr/sap/<SID>/sys/jdbc/tbx/jt400.jar.
The driver class and the connection URL for all servers and tools are encrypted and stored in a „Secure
Store“. This secure store can be maintained with the SAP J2EE Config Tool only and is located in the
global directory of an SAP system. The driver path is stored in a variety of properties files and in the
database. OSS note 826449 explains all the necessary changes to switch from one JDBC driver to the
other.
© SAP AG
ADM525
SAP Architecture for iSeries - 53
Java on iSeries: Config Tool for JDBC Access
1.
2.
3.
Map iSeries share rootbin to drive letter (e.g. D:)
Execute D:\usr\sap\<SID>\<Instance>\j2ee\configtool\configtool.bat
Select secure store
Secure Store Data
Key
Value
admin/host/<SID>
<hostname>
admin/password/<SID>
**********
admin/port/<SID>
5<inst. no.>04
admin/user/<SID>
Administrator
jdbc/pool/<SID>/ClassName
com.ibm.db2.jdbc.app.DB2iSeriesDriver
jdbc/pool/<SID>/Password
**********
jdbc/pool/<SID>/Url
jdbc:db2iSeries:*LOCAL/SAP<SID>DB;…
jdbc/pool/<SID>/User
SAP<SID>DB
jdbc/pool/<SID>_REMOTE/ClassName
com.ibm.as400.access.AS400JDBCDriver
jdbc/pool/<SID>_REMOTE/Password
**********
jdbc/pool/<SID>_REMOTE/Url jdbc:as400://<hostname>/SAP<SID>DB;...
jdbc/pool/<SID>_REMOTE/User SAP<SID>DB
Config Tool Others
Toolbox
Native
SAP J2EE Engine – Config Tool
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 54
The SAP J2EE Engine Config Tool allows you to set certain parameters for the JDBC connection, such as
the JDBC driver class name, the connection URL, and the user id and password for the user profile on
iSeries that is used to establish the database connection. You will usually execute the Config Tool on your
Windows workstation as shown at the top of the picture, and in the Secure Storage area, you can see the
configuration parameters. While the keys admin/… are the same on all platforms, the keys jdbc/pool/…
are specific for each database.
On iSeries you have two sets of parameters. The upper one (jdbc/pool/<SID>/…) is used by all Java
servers and tools except for the Config Tool. It can be configured for the Native Driver, as shown in the
picture, or for the Toolbox Driver. The second set of parameters (jdbc/pool/<SID>_REMOTE) only exists
for installations on iSeries and is used for the Config Tool itself. It must always be configured for the
Toolbox Driver, because the Config Tool is running on Windows or another remote platform that does not
support the iSeries Native Driver. The use of the second set of parameters can be configured in the file
/usr/sap/<SID>/<Instance>/j2ee/configtool/config.properties by setting property rdbms.connection to
jdbc/pool/<SID>_REMOTE and rdbms.driverLocation to the path of the Toolbox Driver (jt400.jar). The
Toolbox Driver can be accessed either on the iSeries through a share, or on the workstation as a local
copy.
The Url parameters allow some configuration of the JDBC connections, for example you could start traces
here. The recommended set of properties is documented in SAP note 654800.
© SAP AG
ADM525
SAP Architecture for iSeries - 54
Java on iSeries: Exit Programs for JDBC
getConnection()
getConnection()
WRKREGINF
Native Driver
Toolbox Driver
QIBM_QSQ_CLI_CONNECT
QIBM_QZDA_INIT
*PGM R3SYS/CLIEXIT
*PGM R3SYS/ZDAEXIT
/usr/sap/AS4_EXIT_CONFIG:
CLI
ZDA
SAP<SID>DB
SAP<SID>DB
*PGM <kernel>/CLIEXIT1:
Setup job library list
Start database monitor
Job QSQSRVR
<kernel>/CLIEXIT1
<kernel>/ZDAEXIT1
More info:
SAP note
654794
*PGM <kernel>/ZDAEXIT1:
Setup job library list
Start database monitor
Job QZDASOINIT
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 55
In order to setup the JDBC shadow processes, SAP provides a few programs in the kernel library that get
automatically installed when applying a kernel. The i5/OS operating system allows to register so-called
exit programs at predefined exit points by using the command WRKREGINF. There are two exit points
for the two different JDBC drivers as shown in the picture. Because each exit point only allows one exit
program to be registered, SAP provides generic exit programs for the two drivers that read the
configuration file /usr/sap/AS4_EXIT_CONFIG and execute the appropriate programs, based on the userid SAP<SID>DB that is trying to connect. If other exit programs were installed at these exit points prior to
the SAP installation, their names will be added to the AS4_EXIT_CONFIG file automatically during the
installation of the SAP system. More details about the JDBC exit programs can be found in SAP note
654794.
© SAP AG
ADM525
SAP Architecture for iSeries - 55
SAP Architecture: Unit Summary
You should now be able to:
z Explain the database objects used by SAP
z Describe the integrated file system structure used by
SAP
z Identify SAP user profiles and work management
objects
z Define a 3-tier configuration for SAP
z Configure printers for SAP on iSeries
z Recognize JVM versions and JDBC drivers on i5/OS
SAP AG 2004, ADM525 SAP Architecture on iSeries / Christian Bartels / 56
© SAP AG
ADM525
SAP Architecture for iSeries - 56
Exercises
Unit: SAP Architecture for IBM eServer iSeries
Topic: Work with CCSIDs and IFS structures on iSeries
At the conclusion of this exercise, you will be able to:
• Select the appropriate CCSID for your job and user profile
• Locate and work with important objects for SAP in the IFS
Sometimes you need to work SAP data through the 5250 emulation, for
example if you cannot start your SAP system because of incorrect profile
parameters. In order to view SAP data, such as tables or stream files,
from a 5250 emulation, your interactive job must run under the same
CCSID as your workstation emulation.
1-1
Sign on to the iSeries server
1-1-1 On your workstation, start the 5250 Emulation to the class server.
1-1-2 Sign on with user name ADM525## and password PWADM525##.
1-2
Identify the CCSID of your workstation emulation and your job
1-2-1 On your workstation emulation, select the menu path Communication ->
Configure..., then select “Session Parameters”.
Value of the “Host Code-Page” setting: ________
Cancel the configuration.
1-2-2 In your interactive job, enter the command DSPJOB and select option 2
“Display job definition attributes”. Scroll down until you find the text
“Coded character set identifier”.
Value of the coded character set identifier: ________
Exit this screen with function key F3.
1-3
Display SAP data with incorrect CCSID settings
1-3-1 If the value that you have obtained in step 1-2-2 was different from 65535,
change the CCSID of your interactive job to 65535. To do that, enter the
command: CHGJOB CCSID(65535). This value indicates that no CCSID
conversion will take place.
1-3-2 Start an interactive SQL session, using the command STRSQL. Display
the contents of table SFLIGHT in the database library of the classroom
system. To do that, type the SQL statement SELECT and prompt it using
function key F4, then enter R3<sid>DATA/SFLIGHT as the file (table)
name (with <sid> being the SAP system Id of the classroom system) and *
for the SELECT fields. Is the resulting data readable?
_____
1-3-3 Leave the SQL session with function key F3. On exit, choose option 1
“Save and exit session”.
1-3-4 To understand the reason for the results that you saw, take a look at the
column description of the table SFLIGHT in library R3<sid>DATA. Use
the command DSPFFD to display the file field (or column) description.
What type and Coded Character Set Identifier (CCSID) do you see for
field MANDT?
_____________________________________
1-4
Display SAP data with correct CCSID settings
1-4-1 Change the CCSID of your interactive job to the value that you found for
your “Host Code-Page” setting in step 1-2-1. The command to do that is
CHGJOB CCSID(<value>). Now CCSID conversion will take place from
any CCSID that an object is tagged with to the CCSID of your job.
1-4-2 Start an interactive SQL session, using the command STRSQL. Display
the contents of table SFLIGHT in the database library of the classroom
system. To do that, prompt the SQL statement SELECT, enter
R3<sid>DATA/SFLIGHT as the table name (with <sid> being the SAP
system Id of the classroom system) and * for the SELECT fields. Is the
resulting data now readable?
_____
1-4-3 Leave the SQL session with function key F3. On exit, choose option 1
“Save and exit session”.
1-4-4 Change your user profile to use the proper CCSID each time you sign on.
To do that enter the command CHGPRF CCSID(<value>), replacing
<value> with the value that you found for your “Host Code-Page” setting
in step 1-2-1.
1-5
Look at important SAP files using the 5250 emulation
1-5-1 Prompt the i5/OS command WRKLNK (type the command name on a
command line and press function key F4 instead of Enter). Type
‘/usr/sap/<sid>/*’ into the “Object” parameter, replacing <sid> with the
SAP system id of the classroom system. Look at the parameters “Detail”
and “Display option” and use the help key (function key F1) to understand
their meaning. Select “*EXTENDED” for the “Detail” parameter and
*ALL for the “Display option” parameter, then hit Enter.
1-5-2 Select option 5 (“Display”) in front of subdirectory SYS and hit Enter.
What is the type of /usr/sap/<sid>/SYS/profile?
__________________
1-5-3 In the upper half of the screen, you see several options. Press function key
F23 (shift F11) to see additional options that are not shown initially. Use
option 12 in front of /usr/sap/<sid>/SYS/profile in order to display the
destination of this symbolic link. What directory does the symbolic link
point to?
________________________________________________
1-5-4 Hit Enter to back out of the screen with the symbolic link information. Use
option 5 in front of /usr/sap/<sid>/SYS/profile to display the contents of
the target directory. Locate the default profile, the instance profile, and the
start profile and display their contents using option 5.
Name of the default profile:
_______________________________
Name of the instance profile:
_______________________________
Name of the start profile:
_______________________________
An arrow (‘>’) to the right of a name indicates that the name is longer than
the available space on the screen. To see the full name, position the cursor
on the name and hit function key F22 (shift F10).
1-5-5 Use function key F12 to go back until you are in directory ‘/usr/sap/<sid>’.
Select option 5 again to branch into ‘/usr/sap/<sid>/DVEBMGS<nn>’
(with <nn> being the instance number of the central instance), and then
into ‘/usr/sap/<sid>/DVEBMGS<nn>/work’. Scroll down until you see
dev_w0. What type does dev_w0 have?
__________________
1-5-6 Select option 5 in front of ‘/usr/sap/<sid>/DVEBMGS<nn>/work/dev_w0’
to look at the contents of the developer trace for workprocess 0. Try to
identify the release and patch level of the kernel and write down the results
below:
Kernel release:
_____________
Patch number:
_____________
Exercises
Unit: SAP Architecture for IBM eServer iSeries
Topic: Configure printers for SAP on iSeries
At the conclusion of this exercise, you will be able to:
• Create an output queue at operating system level
• Define a printer in SAP based on the output queue
• Create a test printout in SAP and locate it in the output queue
When you configure a new printer on iSeries for your SAP system, you
can use and output queue on iSeries, so that the printer can be used by
both the SAP application and printouts that are created at operating
system level.
2-1
Sign on to the iSeries server
2-1-1 On your workstation, start the 5250 Emulation to the class server.
2-1-2 Sign on with user name ADM525## and password PWADM525##.
2-2
Create an output queue in i5/OS
2-2-1 Create an output queue named ADM525## in library QGPL. Use the
command CRTOUTQ to create the output queue. Use function key F4 to
prompt the command and leave the Remote system (RMTSYS) parameter
at the default value *NONE.
2-2-2 Make sure that user profile R3OWNER is authorized to the output queue.
Use the command EDTOBJAUT to display the current authority (the
object type is *OUTQ). Use function key F6 to add *CHANGE authority
for user profile R3OWNER.
2-2-3 Change your user profile ADM525## to use the new output queue as
default output queue. Use the command CHGPRF and press function keys
F4 and F10, then scroll down until you see the Output queue (OUTQ)
parameter. Specify ADM525## as output queue and QGPL as library. This
change will only take effect when signing off and on again.
2-3
Define your printer in the SAP system with device type IBMSCS
2-3-1 Bring up a SAPGUI screen to the education system.
2-3-2 Sign on as user ADM525## with the password INIT. Change your
password as requested.
2-3-3 Execute transaction SPAD by entering the transaction code into the OKcode field, or follow the menu path Tools → CCMS → Print → Spool
Administration.
2-3-4 Select the button “Full Administration”, then select “Output devices”.
2-3-5 Switch to change mode by selecting the symbol with the pencil in the
upper left part of the screen.
2-3-6 Select the “Create” symbol or follow the menu path Output Device →
Create.
2-3-7 Specify ADM525## as the Output Device name. Select “IBMSCS : IBM
SCS Printer” as the device type from the list of available device types.
Select a spool server from the list of available spool servers.
2-3-8 Select the “Access Method” tab and select “C: Direct operating system
call” for the Host Spool Access Method. Specify ADM525## (the name of
your output queue) as the Host printer.
2-3-9 Save the data. Accept the option to automatically generate a short name for
the output device. Then go back to the entry screen (titled “SAP Easy
Access”).
2-4
Test your printer with device type IBMSCS
2-4-1 Display the developer trace file of a work process. One way to do that is
via transaction SM50 (Process overview). Pick a process, then follow the
menu Process → Trace → Display file.
2-4-2 Create a spool file by selecting System → List → Print.
2-4-3 On the Print Screen List, specify the Output device that you have created
in the previous steps (ADM525##). Select “Continue” to submit the spool
request.
2-4-4 Display your own spool files by selecting menu path System → Services
→ Output control. On the selection screen, select the Execute button in the
upper left. This is giving you a list of your spool requests (at this time
probably only one request).
2-4-5 Select the spool request and click on the print symbol (“Print directly”) in
the upper left. This sends the spool request to your output queue.
2-4-6 Activate your 5250 emulation to the server and sign on as user ADM525##
if you are not already signed on.
2-4-7 Enter the command WRKOUTQ ADM525##. This displays your output
queue, and you should see a spooled file named QSYSPRT in it.
2-4-8 Use option 8 in front of the spool file QSYSPRT to display its attributes.
Locate the parameter “Printer device type” on the second page. Note the
device type here:
Printer device type: ________
2-4-9 Return to the list of spool files and use option 5 to display its contents.
Solutions
Unit: SAP Architecture for IBM eServer iSeries
Topic: Work with CCSIDs and IFS structures on iSeries
1-2
Solution to Step “Identify the CCSID of your workstation emulation and your job”
1-2-1 Value of the “Host Code-Page” setting: The value varies, depending on the
language of the installation. Typical values are 037, 500, 273, …
1-2-2 Value of the coded character set identifier: The value varies, depending on
the setting in the user profiles or system value QCCSID (37, 500, 273, …).
1-3
Solutions to Step “Display SAP data with incorrect CCSID settings”
1-3-2 Is the resulting data readable: No
1-3-4 What type and Coded Character Set Identifier (CCSID) do you see for
field MANDT: Type GRAPHIC, CCSID 13488
1-4
Solution to Step “Display SAP data with correct CCSID settings”
1-4-2 Is the resulting data readable: Yes
1-5
Solutions to Step “Look at important SAP files using the 5250 emulation”
1-5-2 What is the type of /usr/sap/<sid>/SYS/profile: SYMLNK->DIR
1-5-3 What directory does the symbolic link point to: /sapmnt/<sid>/profile
1-5-4 Name of the default profile: DEFAULT.PFL
Name of the instance profile: <sid>_DVEBMGS<nn>_<host>
Name of the start profile: START_DVEBMGS<nn>_<host>
1-5-5 What type does dev_w0 have: STMF
1-5-6 Kernel release: Answer varies, look for “relno” (for example: 6400)
Patch number: Answer varies, look for “patchno (for example: 115)
Unit: SAP Architecture for IBM eServer iSeries
Topic: Configure printers for SAP on iSeries
2-4
Solution to Step “Test your printer with device type IBMSCS”
2-4-8 Printer device type: *SCS
Backup and Recovery
Contents:
z Backup and Recovery Concepts
z Backup Strategies
z Recovery Steps
z High Availability Solutions
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 1
© SAP AG
ADM525
Backup and Recovery - 1
Backup & Recovery: Unit Objectives
After completing this unit, you will be able to:
z Discuss backup concepts for SAP on iSeries
z Design a backup strategy for your SAP system
z Perform recovery of your SAP system after data
loss
z Understand high availability solutions for iSeries
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 2
© SAP AG
ADM525
Backup and Recovery - 2
Backup & Recovery: Course Overview Diagram
1 Course Overview
2 Concepts of IBM eServer
iSeries and i5/OS
3 SAP Architecture for IBM
eServer iSeries
4 Backup and Recovery
5 Maintenance and Install
6 Problem and Performance
Analysis
7 Conclusion
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 3
© SAP AG
ADM525
Backup and Recovery - 3
Backup & Recovery: Business Scenario
z As system administrator you are responsible for
performing regular backups of your SAP system. In
case of data loss, you are responsible for restoring
the data up to the point of failure.
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 4
© SAP AG
ADM525
Backup and Recovery - 4
Backup & Recovery: iSeries Data to be Saved
Backup command
SAVSYS
SAVSECDTA
SAVCFG
SAVLIB
*IBM
SAVLIB
*NONSYS
SAVLIB
*ALLUSR
SAVDLO
SAV
Restore command
Licensed Internal Code
i5/OS objects in QSYS
User profiles
Private authorities
Configuration objects
i5/OS optional libraries
QHLPSYS, QIWS, …
Licensed program libraries
QJAVA, QSQL, …
IBM libraries with user data
QGPL, QUSRSYS, …
User libraries
R3<SID>DATA, …
Documents and folders (DLO)
IBM-supplied directories
/QIBM/*, …
User objects in directories
/usr/sap/*, /sapmnt/*, …
D-IPL, install
RSTUSRPRF
RSTAUT
RSTCFG
RSTLIB
*IBM
RSTLIB
*NONSYS
RSTLIB
*ALLUSR
RSTDLO
RST
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 5
The picture is giving a raw overwiev about data that needs to be saved on iSeries, and the commands to
save and restore the data. Documents and folders were used in the past, they are no longer used in general
and have never been used in an SAP on iSeries environment. Please note that the order of restore
commands on the picture is not exactly the order of execution in a recovery situation. The RSTAUT
command (restore private authorities) must be used at the end of the process, after all other objects have
beed restored to the system.
There is no command for restoring the licensed internal code and operating system, because the command
interpreter may not be available when you need to restore that code. Instead of that, you will load your
backup media to an alternate IPL device (tape unit) and „IPL on D“, which means to start the system with
the tape data rather than data on disk. After the licensed internal code has been loaded, you get an option
to install the operating system.
© SAP AG
ADM525
Backup and Recovery - 5
Backup & Recovery: The Menu SAVE
SAVE
Select one of the following:
Save
Save Data
1. Files
2. Libraries
…
6. Changed objects only
7. Licensed programs
8. Security data
9. Storage
10. Configuration
11. Objects in directories
Save System and User Data
20. Define save system and user data defaults
21. Entire system
22. System data only
23. All user data
…
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 6
You can reach the Save menu by entering the command GO SAVE. It offers a variety of menu options to
select the proper command for your task. You can see some options that do not match commands from the
previous overview, such as option 7 (Licensed programs) with the command SAVLICPGM or option 9
(Storage) with the command SAVSTG. These commands can be seen as different views of parts of the
system data, but they are not necessary for a complete system backup.
© SAP AG
ADM525
Backup and Recovery - 6
Backup & Recovery: Save Entire System
i5/OS command
Step
End all jobs to avoid
lock conflicts
Save LIC, i5/OS, user profiles
and configuration objects
ENDSBS SBS(*ALL) OPTION(*IMMED)
SAVSYS
Save all libraries, both
IBM and user libraries
SAVLIB LIB(*NONSYS) ACCPTH(*SYSVAL)
Save documents and
folders (DLO‘s)
SAVDLO DLO(*ALL) FLR(*ANY)
Save directories and
stream files (IFS)
SAV OBJ(('/*') ('/QSYS.LIB' *OMIT)…
Start controlling subsystem,
which starts all others
STRSBS SBSD(<sys. value QCTLSBSD>)
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 7
These are the steps that are executed when you save the entire system through option 21 in the menu
SAVE. You can see this when using the Help key F1 for function 21. Saving the system with the
SAVSYS command requires a dedicated system, so all subsystems and jobs must be ended, except for the
one job that performs the save operation. You must be signed on to the console in order to end all
subsystems. Ending all other job also ensures that there will be no lock conflicts.
The parameter ACCPTH on the SAVLIB command is used to decide whether access paths (indexes) of
tables are completely saved. If it is set to ACCPTH(*NO), only the descriptions of the indexes are saved,
and the index entries must be reconstructed from the tables after restoring the data. Using
ACCPTH(*YES) needs more space on the backup media and more time during the backup, but allows
faster restore times. The default ACCPTH(*SYSVAL) indicates that system value QSAVACCPTH is
used for the decision (the shipped value is to save access paths).
On the SAV command, you need to specify (‘/QSYS.LIB‘ *OMIT) and (‘/QDLS‘ *OMIT) (not shown in
the picture), because the contents of those two directories have been saved already with the previous
SAVLIB and SAVDLO commands. Note that the SAV command requires a special form of the Device
(DEV) parameter: While the other save commands simply use the name of the backup device (such as
TAP01), SAV requires the device name in the form ‘/QSYS.LIB/TAP01.DEVD‘.
When the listed save commands are executed as shown, all system and user data is backed up. Starting the
controlling subsystem causes the system startup program to be executed, and this starts all other
subsystems on the system.
© SAP AG
ADM525
Backup and Recovery - 7
Backup & Recovery: Save While Active (SWA)
Save in offline mode - SAVACT(*NO):
File lock:
*SHRNUP
Data lock: *SHRNUP
Save while active - SAVACT(*SYNCLIB):
File lock:
*SHRNUP
none
Data lock: *SHRRD
none
Row update
after
checkpoint
Checkpoint
processing:
Locking
objects,
setting
checkpoints
Save
Checkpoint reached
Table
Data
page
with unchanged
rows
Save
post
process.
Delete
checkpoint
images
Backup complete
Time
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 8
If you do not want to shut down your system completely for a backup, you can use the Save While Active
(SWA) functionality, which is controlled by the SAVACT parameter in many save commands, such as
SAVLIB. Saving in offline mode requires a „Shared No Update“ lock (*SHRNUP) on both the file and
the data for the whole time that the save operation is running. This means for example, that no INSERT,
UPDATE, or DELETE operations can be executed on tables while the backup is running.
When specifying another value than SAVACT(*NO), for example SAVACT(*SYNCLIB), you request a
save in an active state (SWA). First the system tries to reach a checkpoint in order to set locks on all
objects that are included in the save, and to set checkpoints on all tables. During this time it only requires a
„Shared Read“ lock (*SHRRD) on the data, so that INSERT, UPDATE, and DELETE operations could
still be performed. After the checkpoint has been reached, the locks on the file and the data are released.
However, there are still some restrictions that we will discuss later.
When a row is changed while the save operation is running, the memory pages with the original data
image are copied to a separate area before the update is actually performed in the table. When the save
operation reaches the table with the changed pages, it uses the separately stored pages in the original
version instead of the modified pages in the table, so that the saved table on the backup media has the state
that it had when the checkpoint was reached. When all the data is saved, the chekpoint images are cleaned
up in the post processing phase.
© SAP AG
ADM525
Backup and Recovery - 8
Backup & Recovery: SWA Transaction Boundaries
SAVACT(*SYNCLIB) SAVACTWAIT(3600)
WP10
UPD
T2
WP14
UPD UPD
T5
T6
INS
T3
CMT
UPD INS
T2
T3
UPD INS
CMT
T5
T6
Save request
UPD INS
CMT
T2
T3
UPD
T5
UPD
T5
Checkpoint reached
Time
in
w
Ne 3M0 SAVACT(*SYNCLIB) SAVACTWAIT(3600 *NOCMTBDY)
R
V5
WP10
UPD
T2
WP14
UPD UPD
T5
T6
INS
T3
CMT
UPD INS
T2
T3
UPD INS
CMT
T5
T6
UPD INS
CMT
T2
T3
UPD INS
T5
T6
UPD
T5
Save request (processed immediately)
Time
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 9
This picture is showing what happens when you save your database library by using the save while active
function. The upper half of the picture is showing the default save while active function, which can run
while the SAP system is active but still requires all work processes to be at a transaction boundary at the
same time. As you can see, WP10 and WP14 process data independent from each other, so by the time the
save request is started, WP14 is at a commit boundary while WP10 is in the middle of a transaction. In
order to reach a common transaction boundary, the database code is delaying new requests in WP14 that
would start a new transaction until the common checkpoint is reached. When the last work process (WP10
in this case) reaches a commit boundary, the checkpoint processing is done. Afterwards, all pending
update requests and new requests can be processed. As you can see, it can take a while until the
checkpoint is reached, and if you have very long running batch transactions, you can even reach a timeout
before the checkpoint is reached. On the other hand, this method ensures that the database is in a
consistent state.
The lower half is showing a feature that came new in i5/OS V5R3M0: By specifying the value
*NOCMTBDY in the SAVACTWAIT parameter, you request that the save operation is executed
immediately without waiting for a common transaction boundary. This function takes a snapshot of the
database, which is not in a consistent state, because it contains open transactions. In the example, WP10
started a new transaction and updated T2 when the backup was taken. The subsequent updates in T3 and
T2 are not part of the backup. In order to get to a consistent state after restoring the database library, you
need to save and restore the journal receivers along with the database library and apply journal changes
after the restore.
© SAP AG
ADM525
Backup and Recovery - 9
Backup & Recovery: Parameters on Save Commands
Save Library (SAVLIB)
Library
. . . . . . . . . . . .
+ for more values
Device . . . . . . . . . . . . .
+ for more values
Target release . . . . . . . . .
*CURRENT
Object pre-check . . . . . . . . > *YES
Save active . . . . . . . . . . > *SYNCLIB
Save active wait time:
Object locks . . . . . . . . .
3600
Pending record changes . . . . > *NOCMTBDY
Other pending changes . . . .
*LOCKWAIT
Save access paths . . . . . . .
*SYSVAL
Output . . . . . . . . . . . . .
*NONE
Name,generic,…
Name,*SAVF,…
*CURRENT,*PRV,…
*NO,*YES
*NO,*SYNCLIB…
0-99999,…
0-99999,…
0-99999,…
*SYSVAL,*NO,…
*NONE,*PRINT,…
Save Object (SAV)
Device . . . . . . . . . . . . . > '/QSYS.LIB/TAP01.DEVD'
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 10
All save commands have a similar set of parameters. This picture is showing some important parameters
based on the SAVLIB command. You always have to specify the set of data that you want to save, for
example a library or a list of libraries, and the backup device. If you want to be able to restore the data in
an earlier release, you must specify the Target release (TGTRLS) parameter either as *PRV (previous
release) or explicitely, such as V5R2M0. With the Object pre-check (PRECHK) parameter you can define
that the backup should not be performed at all if it fails for one or a few objects. If you leave the pre-check
parameter at its default *NO, you may not notice if one object could not be saved and end up with an
incomplete backup.
The Save active (SAVACT) and Save active wait time (SAVACTWAIT) parameters are used to activate
the save while active function that was discussed in the revious charts. The Save active parameter allows
three different values when saving in active state: *LIB, *SYNCLIB, and *SYSDFN. The difference
between the values is based on the set of objects that are required to reach a common transaction
boundary. For an SAP installation, the value *SYNCLIB is recommended. The value *NOCMTBDY is
used for the Pending record changes parameter when you are saving without waiting for a common
transaction boundary. With the Save access paths (ACCPTH) parameter, you select to not only save the
index descriptions, but the complete index information.
The snapshot of the SAV command is showing how to specify the device name when saving IFS data. If
you want to save to a save file, you can specify it as ‘/QSYS.LIB/LIBRARY.LIB/SAVEFILE.FILE‘.
© SAP AG
ADM525
Backup and Recovery - 10
Backup & Recovery: Commitment Control
BKPF
Transaction
(Change
request)
BVOR
For example, different tables
constituting a financial
document:
BKPF: Document header
BVOR: Intercompany
posting procedures
(archive flag)
Failure
COMMIT
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 11
Commitment control ensures the consistency of a database. For example, if a database transaction consists
of a change operation comprising several tables, you must secure data consistency by ensuring that either
all or none of the tables are being changed. The prerequisite for Commitment Control is DB2/400 Journal
Management. This is automatically started when creating tables through SQL.
The above example shows a document from the area FI which consists of header data (BKPF) and
(dependent) item data (BVOR). While this transaction is modifying data, the changes are written to both
the tables and the journal receiver. When the transaction is closed with a COMMIT statement, the changes
to the database are made permanent. In case of an error (for example caused by a program termination or
power failure) the COMMIT statement would be missing and the database would automaticall roll back all
changes from all tables back to the beginning of the transaction.
The end of a transaction is always marked by a COMMIT or ROLLBACK operation. This is called a
commit boundary. As soon as a database operation is performed, a new transaction is started.
© SAP AG
ADM525
Backup and Recovery - 11
Backup & Recovery: Uncommitted Transaction
Application
Database Management System
1.
QSQJRN0057
Transaction
04711 19960731
SC
BKPF 4711 19960625 UB
BKPF 4711 19960731 UP
BVOR 4711 1
UB
BVOR 4711 1 X XX UP
BVOR 4711 2
UB
YY UP
BVOR 4711 2
2.
Rollback
will be started
No COMMIT reached!
BKPF
BVOR
04711 1
04711 2
XXX
YY
Journal
receiver
3.
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 12
This example is showing what happens if a transaction under commitment control ends abnormally
before it reaches the COMMIT statement. The application user wants to change an existing document.
The header (BKPF) and three item lines (BVOR) are to be replaced with new data. In the journal
receiver, the commit cycle starts with a journal entry SC for Start of Commit cycle.
The header data 4711 from file BKPF is found. An update in the field "last date of update/change," for
example, follows. Together with additional data such as the program name and job information, the
complete data of record 4711 is stored twice in the journal receiver:
(a) the contents of the record before the change (“before image”)
(b) the contents of the record after the change (“after image”).
The item data 4711 from file BVOR is found and changed as previously described. The entries in the
journal receiver have the following codes:
UB for update, before image
UP for update, after image.
An error occurs before the third record is updated in file BVOR. The application is terminated. Because
of this, DB2/400 does not receive a COMMIT confirming that the data has been recorded. Therefore the
database starts a rollback of the changes.
© SAP AG
ADM525
Backup and Recovery - 12
Backup & Recovery: Transaction Rollback
Database Management System
BKPF
QSQJRN0057
04711 19960625
Database
consistency
after
rollback
BVOR
04711 1
04711 2
-
BKPF 4711 19960731 BR
BKPF 4711 19960625 UR
BVOR 4711 1 XXX BR
BVOR 4711 1
UR
BVOR 4711 2 YY
BR
BVOR 4711 2
UR
RB
Rollback before image
Rollback after image
Rollback operation
Journal receiver
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 13
After the incomplete transaction was interupted, the database management system DB2/400 performs the
rollback by undoing the entries made into the journal receiver. This reseting of the changes is also
recorded in the journal receiver through the following entries:
BR: update, before image for rollback
UR: update, after image for rollback
The original data is restored, so that both tables now look like they did before the transaction started. At
the end of the rollback operation, the database manager writes an entry of type RB into the journal
receiver.
© SAP AG
ADM525
Backup and Recovery - 13
Backup & Recovery: Display Journal Entries
Display Journal (DSPJRN)
Journal . . . . . . . . . .
QSQJRN
Library . . . . . . . . .
R3<SID>DATA
Journaled physical file:
File . . . . . . . . . . .
*ALLFILE
Library . . . . . . . .
Starting date and time:
Starting date . . . . . . > 04282005
Starting Display
time . Journal
. . . . Entries
. > 150000
Journal
Opt
_
_
_
_
_
. . . :
Sequence
11656623
11656624
11656625
11656626
11656627
Code
C
R
R
R
C
QSQJRN
Type
SC
PT
UB
UP
CM
Library
. . . :
R3<SID>DATA
Object
Library
BKPF
BVOR
BVOR
RN
R3<SID>DATA
R3<SID>DATA
R3<SID>DATA
DSPJ
Job
WP25
WP25
WP25
WP25
WP25
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 14
To display the entries of the database management system in the journal receiver, use the AS/400
command DSPJRN. On the DSPJRN command, you can specify the following values to narrow down the
amount of information that you get:
Recorded files (tables) in the journal: either individual files or all files in a library
Positioning by a known sequence number
Positioning by date and time
Entries that have been made by a particular job or a particular program
Entries that have been made by a particular user
You can specify that the resulting output is written to an output file that can be analyzed with SQL or
Query/400. Journal code and type values are explained in the iSeries online documentation.
© SAP AG
ADM525
Backup and Recovery - 14
Backup & Recovery: Setting Up the Journal Receivers
Create Journal Receiver (CRTJRNRCV)
Don‘t change
when using
HA software
based on
journaling
Type choices, press Enter.
Journal receiver . . . . . .
Library . . . . . . . . .
ASP number . . . . . . . . .
Journal receiver threshold .
Change Journal (CHGJRN)
QSQJRN0001
R3<SID>JRN
*LIBASP
200000
Type choices, press Enter.
Journal . . . . . . . . . . . .
Library . . . . . . . . . . .
Journal receiver:
Journal receiver . . . . . . .
Library . . . . . . . . . .
Manage receivers . . . . . . . .
Delete receivers . . . . . . . .
Receiver size options . . . . .
+ for more values
QSQJRN
R3<SID>DATA
QSQJRN0001
R3<SID>JRN
*SYSTEM
*NO
*MAXOPT2
*RMVINTENT
See next
slide
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 15
These two pictures show how the journal receivers and the journal are defined in an SAP environment.
Usually you don‘t need to worry about it, because the SAP installation program is setting up the journal
automatically. Howver, if you need to need to perform manual operations (for whatever reason), you may
want to be familiar with the important parameters.
Journal receivers follow a naming convention that starts with the name of the journal (QSQJRN in case of
an SQL collection) and ends with a number. Whenever the threshold value (in KB) is exceeded, the
journal received is detached from the journal, and a new receiver is generated by increasing the number by
one.
On the journal, you should set the parameter Manage receivers (MNGRCV) to *SYSTEM, so that the
system generates a new journal receiver automatically when the threshold of the current one is reached. It
then attaches the new journal receiver and detaches the old one automatically. If the parameter Delete
receivers (DLTRCV) is set to *NO, the detached jounal receivers are kept, so that they can be saved. If
you do not need point-in-time recovery (for example in a test system), you can also set that parameter to
*YES. The system will then delete detached receivers automatically, so that you do not need to worry
about the space they occupy. The parameter Receiver size options (RCVSIZOPT) must have the value
*MAXOPT2 to allow journal entries for LOB type columns.
Note that some High Availability solutions are based on journaling and may change journal receiver
attributes according to their needs. If you use such a product, you should not change the attributes of a
journal or journal receiver manually.
© SAP AG
ADM525
Backup and Recovery - 15
Backup & Recovery: RMVINTENT and SMAPP
SMAPP: System Managed Access Path Protection
EDTRCYAP: System access path recovery time = 60 minutes
Estimated index rebuild time
Index1
Index2
Index1
15 min.
55 min.
Rebuild
required
Journal
Table1 Table2
Journal receiver
BEFORE
AFTER
*RMVINTENT
Internal
segment
Abnormal
system end
not all data
saved to disk
Index2
Immediately
usable
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 16
System Managed Access Path Protection (SMAPP) is a concept to keep recovery times after an abnormal
system end relatively short. If rows in a table were inserted, updated, or deleted when the system crashed,
it is unclear whether the indexes for that table are updated with the same changes, or if changes were only
made to the table, but not to an index. To avoid inconsistencies, the system has to rebuild all indexes over
a table that was in use during the abnormal end, unless the index (not just the table) was journaled. In
order to reduce administration overhead, SMAPP decides automatically what indexes need to be journaled
in order to keep the recovery time in a reasonable limit.
With the command EDTRCYAP, you can define a maximum index rebuild time after an abnormal system
end; the default in i5/OS V5R3M0 is 60 minutes. While rows in tables are modified, the system estimates
the rebuild time for related indexes. Starting at the most expensive index, SMAPP automatically journals
index changes until the sum of all estimated recovery times for non-journaled indexes stays below the
selected value (60 minutes).
If the underlying tables are journaled (as in the SAP application), journal entries for the indexes are written
to the same journal receiver as journal entries for table changes. In order to keep the journal receiver size
smaller, you can select the receiver size option *RMVINTENT. With this setting, journal entries for index
changes because of SMAPP are written to separate storage that is automatically maintained by the system.
You can do that without risk, because those index-related entries are only needed for the recovery after an
abnormal system end, not for recovering the database after loosing the database library.
© SAP AG
ADM525
Backup and Recovery - 16
Backup & Recovery: Status of Journal Receivers
WRKJRNA → F15
Work with Receiver Directory
Journal
. . . :
QSQJRN
Library
. . . :
R3<SID>DATA
Total size of receivers (in kilobytes)
. . . :
92836
Type options, press Enter.
4=Delete
8=Display attributes
Opt Receiver
Library
_ QSQJRN1042 R3<SID>JRN
_ QSQJRN1043 R3<SID>JRN
_ QSQJRN1044 R3<SID>JRN
_ QSQJRN1045 R3<SID>JRN
_ QSQJRN1046 R3<SID>JRN
_ QSQJRN1047 R3<SID>JRN
Attach
Number Date
Status
01042 04/26/05 SAVED
01043 05/01/05 SAVED
01044 05/01/05 ONLINE
01045 05/03/05 ONLINE
01046 05/03/05 ONLINE
01047 05/05/05 ATTACHED
Save
Date
05/03/05
05/03/05
00/00/00
00/00/00
00/00/00
00/00/00
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 17
To get an overview of the journal receivers, use command WRKJRNA, then press F15. All the journal
receivers belonging to the journal QSQJRN are displayed. The journal recievers have one of the following
statuses:
– ATTACHED: The receiver is currently attached to the journal.
– ONLINE: The receiver has not been backed up, and it has been detached from the journal.
– SAVED: The receiver was backed up after it was detached, but the receiver storage was not freed when
it was backed up.
– FREED: The receiver was backed up after it was detached, and the receiver storage was freed when it
was backed up.
– PARTIAL: Tthe receiver was backed up while it was attached, for example, with the command
SAVLIB.
– DELETED: The receiver was deleted. This status is shown after Option 4 (Delete) is complete. If you
refresh the list, deleted receivers are removed from the list.
The first two digits of the number associated with the journal receiver identify the journal chain number,
and the last three digits identify the receiver number within the chain. A chain identifies a group of
receivers that are contiguous allowing the system to process entries across receivers within the same chain.
© SAP AG
ADM525
Backup and Recovery - 17
Journal
message
queue
CPF7020
Backup & Recovery: Saving and Deleting Receivers
Journal monitor
program
(SAP note 82079)
4
QSQJRN0187
QSQJRN
6
1
MNGRCV(*SYSTEM)
2
BEFORE
QSQJRN0187
3
AFTER
Threshold 200000
5
QSQJRN0188
2.5 GB Data Cartridge
BEFORE
AFTER
Threshold 200000
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 18
This picture illustrates how the management of journal receivers can be automated. When the receiver has
grown up to the size of its threshold (1) and the Manage receivers parameter on the journal is set to
*SYSTEM, a new journal receiver is created automatically (2), and the old one is detached (3). If a journal
message queue was defined in the journal, then a message CPF7020 „Journal receivers … detached“ is
sent to that message queue (4). SAP note 82079 has an example program attached to it, that you can use to
monitor the message queue for this message. When the message CPF7020 is received, the journal receiver
is being saved to tape (5) and afterwards deleted. With that program you do not need to worry about
journal receivers filling up your system.
© SAP AG
ADM525
Backup and Recovery - 18
Backup & Recovery: BRMS for iSeries Overview
System and
Backup Policies
How to perform
the backup
Media Class
Grouping of
media by type
Locations
Where is the
media?
Media
Policy
Pulls together
all the media
pieces
Devices
Backup
Services
Drive your backup
processing
Move Policy
Rules for
moving media
to different
locations
Backup Control
Groups
What data
to backup
Standalone
or automatic
tape library,
server file, or
TSM server
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 19
The product IBM Backup Recovery and Media Services for iSeries (BRMS) can be used to automate
backups and organize the backup media. You can define policies for all aspects of your backup and run
the backup automatically. Along with backing up the system, BRMS creates a recovery report that guides
you through the recovery specifically for your system.
In addition to the BRMS standard software (product 5722BR1 option *BASE), you can install the BRMS
Network Feature (option 1) that allows to connect via a network to other BRMS systems and to share the
inventory and policies in the network. The BRMS Advanced Functions Feature (option 2) provides
hierarchical storage management (HSM) including archiving and retrieval of data that is less often used.
© SAP AG
ADM525
Backup and Recovery - 19
Backup & Recovery: BRMS Backup Control Group
WRKCTLGBRM
Backup
Items
*EXIT
*LOAD
*SETASPGRP
Library
Object list
IFS list
Spool list
Auxiliary
Storage
Pool Device
*SYSBAS
*SYSBAS
*SYSBAS
*ALLAVL
Weekly
Activity
SMTWTFS
FFFFFFF
FFFFFFF
FFFFFFF
FFFFFFF
FFFFFFF
FFFFF
F
Retain
Object
Detail
Save
While
Active
*YES
*YES
*YES
*SYNCLIB
*NO
*NO
SNDMSG MSG(…) TOUSR(*SYSOPR)
Attributes
Save active wait time:
Object locks . . . . . . 3600
Pending record changes . *NOCMTBDY
Other pending changes . . 3600
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 20
A backup control group allows to specify the details of the backup. First of all, you define the items that
you want to be saved. You can specify a library name or a name of a backup list here. Backup lists can
consist of objects, IFS data, or spool data for specific output queues or user profiles. In addition, you have
a set of special values for the backup items: *EXIT allows to specify any command to be executed when
the *EXIT entry is processed. You can have multiple *EXIT entries, for example to stop and start your
SAP system in order to perform an offline backup. A *LOAD entry causes a new tape to be loaded, and
*SETASPGRP allows you to specify your own indepentend ASP if you have configured one.
You also specify the weekly activity here based on the weekday (Sunday through Saturday). ‚F‘ represents
a full backup, while ‚I‘ would represent an incremental backup, that is a backup of only those objects that
have changed since the last backup. This is not really recommended because it makes recovery much
harder. The parameter Retain object detail is useful to keep records about the backup history in order to
make recovery easier. Finally you can specify if you want to save in active state or not. The detail
parameters for the Save while active can be specified in the attributes of the backup control group.
© SAP AG
ADM525
Backup and Recovery - 20
Backup & Recovery: Graphical Interface for BRMS
iSeries Navigator: Backup, Recovery and Media Services
MyPolicy Properties - Servername
Policy:
MyPolicy
Policy:
X
• Start servers
• Run command
• Power down system
• Release job queues
• Start subsystems
Backup policy for SAP
Description:
Last changed: 27.02.06 13:27:05
Changed by: Qsecofr
Backup activities
• Sign off users
• Shut down servers
• Run command
• Hold job queues
• End subsystems
x
x
x
Before
During
After
OK
Cancel
Backup Policies –
Properties
Help
?
• Items to save
• Save while active
• Media information
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 21
iSeries Navigator offers an easy way to configure BRMS backup policies through a graphical user
interface. When you create a new backup policy, you will be guided through a wizard, when modifying
the properties of an existing policy, you will see a window as the one shown in the slide.
The „Before“ button allows to specify activities that are executed before the actual backup takes place.
You can sign off interactive users, shut down a variety of servers (such as TCP/IP servers), hold job
queues, end subsystems, or run your own command.
The „During“ button allows to specify the objects to be saved, the save while active parameters, and
information about the media location and retention. The „After“ button finally allows to specify activities
that are executed after the backup has completed, such as starting servers or subsystems, releasing job
queues, powering off the server, or a user-defined command.
© SAP AG
ADM525
Backup and Recovery - 21
SAP Backup: What Objects Need to be Saved?
R3<SID>
DATA
SAP<SID
>D B
Database Libraries:
R3<SID>DATA, SAP<SID>DB
Journal Receivers:
Libraries R3<SID>JRN, SAP<SID>JRN
Sequential Objects in the IFS:
/usr/sap/<SID>/*, /sapmnt/<SID>/*,
/usr/sap/trans/*, /sapmnt/trans/*,
/<ASP>/usr/sap/<SID>/*, /<ASP>/sapmnt/<SID>/*
Kernel and work libraries:
R3SYS, R3<SID>400, …
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 22
In order to backup your SAP system only, this data has to be saved:
y the database libraries R3<SID>DATA for SAP WebAS ABAP and SAP<SID>DB for SAP WebAS
Java,
y the journal receivers from library R3<SID>JRN for SAP WebAS ABAP and SAP<SID>JRN for SAP
WebAS Java,
y directories and files in the integrated files system as shown in the picture (/<ASP>/* only when running
with independent ASP),
y the kernel libarary (user.defined name), the Java OS library SAPJ2EE<instance>, and SAP work
libraries such as R3SYS and R3<SID>400.
Note that it is not necessary to backup libraries that contain only SQL packages (their names start with
R3<SID>…). If the SQL packages get lost, they will be recreated automatically as needed.
© SAP AG
ADM525
Backup and Recovery - 22
SAP Backup: Backing Up the Entire System
Object
Backup
frequency
11
12
Mode
Backup
command
Tape
expiration
1
10
2
9
3
8
4
7
6
5
(Monthly)
132
Restricted
state
GO SAVE
Opt. 21
4 months
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 23
Once in a while, for example on a monthly base, you should backup your entire system including the
licensed internal code and operating system. It is important to save the entire system after installing a new
operating system release, PTF‘s or new SAP systems (because of the additional user profiles that are
created during the installation). The system needs to be in restricted state for the complete backup, that is
all subsystems have to be ended. The easiest way to perform the backup is option 21 from the menu SAVE
(entire system). If you set a tape expiration date, it should be long enough to keep several copies of the
entire system save. Older copies can be useful if the latest copy cannot be read due to a media error, or if
the latest copy contains a system code level that is causing problems.
© SAP AG
ADM525
Backup and Recovery - 23
SAP Backup: Backing Up Database Libraries
Object
Backup
frequency
11
12
Mode
Backup
command
Tape
expiration
1
10
2
9
3
8
4
7
6
5
R3<SID>DATA
SAP<SID>DB
Daily
28
Online or
offline
SAVLIB
28 days
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 24
The database libraries should be updated on a daily basis, at least in a production system. Even though you
can use journal receivers to apply all changes since the last backup up to the point of failure, you should
not have too many of those entries in order to keep the recovery times reasonable. You can perform online
or offline backups as discussed previously (save while active). The backup command to use is SAVLIB,
and you should keep multiple sets of tapes in order to be able to recover a media error.
© SAP AG
ADM525
Backup and Recovery - 24
SAP Backup: Backing Up Journal Receivers
Object
Backup
frequency
11
12
Backup
command
Tape
expiration
1
10
2
9
3
8
4
7
QSQJRNxxxx
Mode
6
5
4 hours
28
Online or
offline
SAVOBJ
28 days
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 25
Journal receivers should be saved frequently from their libraries R3<SID>JRN and SAP<SID>JRN. If you
do not use the previously described automated tool, you can save them for example every four hours with
the SAVOBJ command. Saving journal receivers is essential if you are using the save while active
function without requiring all work processes at a common transaction boundary.
© SAP AG
ADM525
Backup and Recovery - 25
SAP Backup: Backing Up IFS Data
Object
/
usr
Backup
frequency
11
12
<SID>
trans
Tape
expiration
2
3
8
sapmnt
Backup
command
1
10
9
sap
Mode
4
7
6
5
28
<SID>
Daily
Online or
offline
SAV
28 days
SAP
note
214369
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 26
Even though IFS data is not as critical as the database itself, it can contain spool or archiving data or
transports that you don‘t want to loose. That‘s why it is recommended to save the IFS data also on a daily
basis. If you perform an online backup of IFS data, you can experience conflicts with open files. SAP note
214369 explains this issue. You may want to exclude directories from the backup that contain only
temporary data and are heavily used, such as /usr/sap/<SID>/<Instance>/work/dev_*,
/usr/sap/<SID>/<Instance>/data/stat*, or /usr/sap/<SID>/SYS/global as well as /sapmnt/<SID>/global.
© SAP AG
ADM525
Backup and Recovery - 26
SAP Restore: Procedure Overview
Yes
Total system
data loss?
Install
licensed internal code
and operating system
No
Delete SQL packages
Delete database libraries
Restore
user profiles and
configuration data
Delete IFS data
Restore libraries
Restore IFS data
Example: SAP
database corrupted
by bad transports
Restore authorities
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 27
The following charts are giving you an overview about restoring your data to an SAP system. They are
only intended as an overview and cannot be complete. You should be aware that procedures for restoring
the licensed internal code and operating system are depending on the software release and hardware model
that you are using. For complete and accurate information, use the IBM manual „iSeries Backup and
Recovery“.
If you are restoring data because of a total system loss, for example because of a severe hardware failure,
you need to install the licensed internal code and operating system first, then the user profiles and
configuration data, before you can start restoring the SAP data. If you are just restoring the SAP data but
did not loose your total system, the database library and the SQL packages may still be on the system. In
order to avoid conflicts with existing data, you should delete the database library, the SQL packages, and
the IFS data before you restore the SAP data.
© SAP AG
ADM525
Backup and Recovery - 27
SAP Restore: Install Licensed Internal Code (1)
IPL source:
Keylock position:
D
Manual
IBM
2.5 GB Data Cartridge
Licensed Internal
Code
SAVSYS
===> PWRDWNSYS OPTION(*IMMED) RESTART(*YES) IPLSRC(*PANEL)
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 28
To install the licensed internal code, you choose IPL source D (IPL from an alternate IPL device) and
keylock position Manual on your system control panel or on the Hardware Management Console (HMC).
Then you load the tape that contains the SAVSYS data. On newer hardware models, you also need to load
the original IBM CD that contains the licensed internal code. Then you restart your system by entering the
command PWRDWNSYS as shown in the picture.
© SAP AG
ADM525
Backup and Recovery - 28
SAP Restore: Install Licensed Internal Code (2)
Install Licensed Internal Code
Disk selected to write the Licensed Internal Code to:
Serial Number
Type
Model
I/O Bus
Controller
xx-xxxxx
xxxx
xxx
x
x
Select one of the following:
1. Restore Licensed Internal Code
2. Install Licensed Internal Code and Initialize System
3. Install Licensed Internal Code and Recover Configuration
4. Install Licensed Internal Code and Restore Disk Unit Data
5. Install Licensed Internal Code and Upgrade Load Source
Option 1:
„Slip“ install (system and user data is kept)
Options 2 – 5: „Scratch“ install (data in system ASP is deleted)
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 29
When the system comes up, you have to select how you want to restore the licensed internal code. Option
1 is usually used if the licensed internal code got corrupted or a bad code fix was installed. In such a case,
you only want to restore the licensed internal code and keep all other data untouched.
If you are restoring your system after a total loss of your data, you select option 2 or 3 to initialize your
system prior to installing the licensed internal code. By doing so, you will loose all data in the system
ASP. If you have user ASP‘s configured that you want to keep for journal recovery, you must select
option 3 to recover the disk configuration. By doing so, you will not loose data in the user ASP‘s, only the
system ASP gets initialized. This is usually the option you will choose for restoring your SAP system.
© SAP AG
ADM525
Backup and Recovery - 29
SAP Restore: Install LIC and Operating System
„Scratch“
install
„Slip“
install
Recover LPAR
configuration
Recover disk
configuration
IPL or Install the System
Select one of the following:
1. Perform an IPL
2. Install the operating system
3. Use Dedicated Service Tools (DST)
4. Perform automatic installation of the operating system
5. Save Licensed internal code
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 30
If you are performing a scratch install, you must recover the configuration of logical partitions if you have
a partitioned system. You can also select to recover the disk configuration, which is essential if you are
using a separate ASP for your journal receivers.
When the licensed internal code is installed, you get the menu „IPL or Install the System“ that is shown
above. In order to recover your system, you select option 2 to install the operating system. Option 4 can
only be used when performing a complete installation of the system with installation CD‘s, not for
recovering a system after data loss.
© SAP AG
ADM525
Backup and Recovery - 30
SAP Restore: Operating System Install Options
Language feature: 2924 (English), 29xx (other languages)
Select:
•Keep current disk configuration
•Add non-configured disk units to system ASP
•Add non-configured disk units and balance data
Take default install options
•Restore program objects, language objects, or both?
•Restore system information (system values etc.)?
•Restore edit descriptions?
•Restore message reply list?
•Restore job descriptions?
•Restore subsystem descriptions?
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 31
After selecting to install the operating system, you need to specify a few more things. First, you have to
select a language feature for your primary language. Usually this value is already preselected with the
language on the save media. If you have non-configured disk units on your system, you can select to add
them to your configuration before installing the operating system. Finally you can select install options. It
is recommended to take the defaults for all options when you restore the backup of your system.
After selecting the install options, the operating system will be installed and the system will be started. At
some point during this process you need to signon to the system.
© SAP AG
ADM525
Backup and Recovery - 31
SAP Restore: Restore System and User Data (1)
CHGJOB LOG(4 00 *SECLVL)
JOBMSGQFL(*PRTWRAP)
CHGMSGQ MSGQ(QSYSOPR)
DLVRY(*NOTIFY)
===> RSTUSRPRF DEV(TAP…) USRPRF(*ALL)
===> RSTCFG OBJ(*ALL) DEV(TAP…)
===> RSTLIB SAVLIB(*NONSYS) DEV(TAP…) OMITLIB(R3<SID>DATA
R3<SID>JRN SAP<SID>DB SAP<SID>JRN)
2.5 GB Data Cartridge
SAP system data
(one day old)
2.5 GB Data Cartridge
Entire system
(one week old)
===> RSTLIB SAVLIB(R3<SID>DATA R3<SID>JRN SAP<SID>DB
SAP<SID>JRN) DEV(TAP…)
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 32
This picture and the next one describe the steps to restore your entire system and user data after the
licensed internal code and operating system have been installed. Before you start restoring objects, make
sure that your joblog can wrap (command: CHGJOB), and that messages in the QSYSOPR message queue
to not interrupt the restore process (command: CHGMSGQ).
You start with restoring the user profiles and configuration data. By restoring the user profiles first, you
ensure that all further objects can be assigned to the right owner, so that no authority problems happen
afterwards.
In the next step you restore all libraries. The SAVLIB parameter *NONSYS includes all IBM and user
libraries. Usually you get a backup of the entire system less often than the SAP system data. In order to get
the most current data, you can omit the SAP libraries on the first restore from the entire system backup.
Later you can load the tape with the latest SAP library backup and only restore the SAP libraries from that
one.
© SAP AG
ADM525
Backup and Recovery - 32
SAP Restore: Restore System and User Data (2)
===> RSTDLO DLO(*ALL) SAVFLR(*ANY) DEV(TAP…)
===> RST DEV('/QSYS.LIB/TAP….DEVD') OBJ(('/*' *INCLUDE)
('/usr/sap/*' *OMIT) ('/sapmnt/*' *OMIT))
2.5 GB Data Cartridge
Entire system
(one week old)
2.5 GB Data Cartridge
SAP system data
(one day old)
===> RST DEV('/QSYS.LIB/TAP….DEVD') OBJ(('/usr/sap/*'
*INCLUDE) ('/sapmnt/*' *INCLUDE))
===> RSTAUT USRPRF(*ALL)
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 33
The RSTDLO command is needed for the completeness of the data. SAP does not use this type of objects,
but there are still some system folders around. The next step is to restore all IFS data. Similar to the
libraries, you can split this operation up into two parts, one for the less frequently saved system paths, and
a second one for the more recently saved SAP paths.
As a final step you need to execute the RSTAUT command. Private authorities are stored with the user
profile, not with the objects. When the user profiles are restored in the beginning, the objects they point to
are not yet available. This final step restores the links between the user profiles and the objects for which
they have private authority.
© SAP AG
ADM525
Backup and Recovery - 33
SAP Recovery: Options to Recover Database Changes
Forward Recovery:
Backout Recovery:
to reapply changes after a
restore
to roll back recent changes
Command: APYJRNCHGX
(apply journaled changes)
Command: RMVJRNCHG
(remove journaled changes)
Restore Library
T1
(Backup)
T2
now
T1
T2
now
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 34
DB2/400 offers two different ways to recover a database to a specific point in time:
forward recovery and
backout recovery.
The usual way to perform a point in time recovery is to restore the database and then perform a forward
recovery. On DB2 UDB for iSeries, the forward recovery is performed by reapplying the database changes
that are monitored by the journal and written to the journal receivers. To perform a forward recovery, use
the i5/OS command APYJRNCHGX (apply journaled changes extended). There is also a command
APYJRNCHG (without X), but that one does not allow to recover changes that altered table structures (so
called DDL – Data Definition Language - statements). Because of this limitation, the command is not used
in an SAP environment.
In specific cases the backout recovery can be faster than a complete database restore including a forward
recovery. If a database corruption due to bad programming happened, it is and option for resetting the
database to a point in time before that corruption. You do not restore the database before a backout
recovery. The backout recovery undoes the changes to database table in reverse order, but it has the
limitation that it cannot undo DDL statements.
© SAP AG
ADM525
Backup and Recovery - 34
SAP Recovery: Journaled SQL Statements
SQL Statements
DML
INSERT
UPDATE
DELETE
DDL
ALTER TABLE
CREATE TABLE
DROP TABLE
Complete
information
about changes
Recoverable entries
Notification about
the changes
Journal
Partially recoverable entries
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 35
The SAP System changes the database using the SQL interface. SQL is a data manipulation language
(DML) as well as a data definition language (DDL). Both DML and DDL statements are used by the SAP
System.
All DML statements that change the contents of a table, INSERT, UPDATE, and DELETE are journaled.
The journal entries for these statements contain the complete information about the changes that were
made. This information is used by commitment control to perform a roll back of a logical unit of work, as
well as by the recovery procedure.
The DDL statements, such as CREATE TABLE, ALTER TABLE, or DELETE TABLE, lead to entries in
the journal that do not contain the full information on the changes that were made. In the past, DDL
statements could not be used for a forward or backout recovery. Starting with V5R1M0, it is possible to do
forward recovery for most of the DDL statements through a command named APYJRNCHGX. In
V5R1M0, PRPQ 5799-AJC is needed for that feature, as of V5R2M0 the function is integrated into the
base operating system.
© SAP AG
ADM525
Backup and Recovery - 35
SAP Recovery: Types of Journal Entries
Commitment
Commitmentcontrol
control (code
(codeC)
C)
Journal
Journalreceiver
receiveroperations
operations(code
(codeJ)
J)
SC
SC start
starttransaction
transaction
CM
commit
CM commitchanges
changes
RB
roll
back
RB roll back
PR
PR previous
previousreceiver
receiver
NR
next
receiver
NR next receiver
RS
RS receiver
receiversaved
saved
RD
receiver
RD receiverdeleted
deleted
RR
receiver
restored
RR receiver restored
Database
Databasefile
fileoperations
operations(code
(codeD)
D)
CG
CG
CT
CT
change
changefile(*)
file(*)
file
was
created(*)
file was created(*)
Record
Recordoperations
operations(code
(codeR)
R)
DB
DBfile
filemember
memberoperations
operations(code
(codeF)
F)
MS
MS
MR
MR
SR
SR
SA
SA
MC
MC
RG
RG
member
membersaved
saved
member
memberrestored(+)
restored(+)
start
RMVJRNCHG(+)
start RMVJRNCHG(+)
start
startAPYJRNCHG(+)
APYJRNCHG(+)
member
membercreated(*)
created(*)
member
reorganized(*)
member reorganized(*)
PT
PT record
recordwritten
writtento
tomember
member
PX
record
added
directly
PX record added directly
UB
UB updated
updated(before
(beforeimage)
image)
UP
updated
(after
image)
UP updated (after image)
DL
DL record
recorddeleted
deleted
DR
record
deleted
DR record deletedininrollback
rollback
BR
before
image
updated
BR before image updatedfor
forrollback
rollback
UR
after
image
updated
for
UR after image updated forrollback
rollback
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 36
A journal can contain entries with 12 different entry codes and 140 different entry types. For a detailed
description, refer to IBM Information Center.
Only a few different entries appear regularly in the journal of an SAP database:
– Code C entries mark the commitment boundaries of a logical unit of work on the database.
– Code J entries display all operations performed by the journal and the journal receivers.
– Code R entries contain the changes made to single records of the database tables (DML statements).
– Code D entries contain the information about changes made to the entire tables (DDL statements).
– Code F entries contain the information about changes made to database file members (DDL statements).
All entry types that are marked with an plus sign will cause a recovery to stop immediatedly. Entry types
marked with an asterisk require the APYJRNCHGX command and cannot be processed with
RMVJRNCHG.
© SAP AG
ADM525
Backup and Recovery - 36
SAP Recovery: Commitment Boudaries
Sequence Code Type Object
1765644 C
SC
1765645 R
UB DDPRH
1765646 R
UP DDPRH
1765647 C
SC
1765648 R
DL ZX389
1765649 C
SC
1765650 R
UB MARA
1765651 R
UP MARA
1765652 R
PX ZX390
1765653 R
PX ZX390
1765654 R
UB Y001
1765655 R
UP Y001
1765656 C
SC
1765657 C
CM
1765658 R
UB BTCCTL
1765659 R
UP BTCCTL
1765660 C
CM
1765661 C
CM
1765662 R
UB MARA
LUW 1
LUW 2
LUW 3
LUW 4
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 37
In an SAP database, several transactions of different work processes run simultaneously. These work
processes work with commitment control. The corresponding journal entries of all transactions are written
to the journal in the sequence they occur. Also, the journal entry that marks the commitment boundary of
one logical unit of work is in a sequence of journal entries that belong to other logical units of work.
For a database recovery, you must apply or remove all changes that belong to a logical unit of work. A
recovery that does not follow the commitment boundaries will make the database inconsistent.
© SAP AG
ADM525
Backup and Recovery - 37
SAP Recovery: Commit Cycle ID
Display Journal Entry Details
Journal
. . . . . : QSQJRN
Library
. . . . : R3CHBDATA
Sequence . . . . . : 2258650
Code . . . . . . . : R - Operation on specific record
Type . . . . . . . : UB - Update, before-image
Object . . . . . . : TST01
Member . . . . . . : TST01
Date . . . . . . . : 05/11/05
Library . . . . : R3CHBDATA
Flag . . . . . . : 1
Time . . . . . . : 11:22:13
Ref Constraint . : No
Count/RRN . . . . : 27235
Job . . . . . . . : 713288/CHB30/WP10
Commit cycle ID . : 2250824
User profile . . . : CHB30
Program . . . . : QP0ZPCP2
Ignore APY/RMV . . : No
Library . . . :
*OMITTED
Trigger . . . . . : No
ASP device . . :
*OMITTED
Sequence number of „Start Transaction“ entry
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 38
This is the screen that you get when you display journal entries with the DSPJRN command and select a
single entry with option 5 („Display entire entry“). Sometime you get the screen „Display Entry Specific
Data“ instead of this one, you can toggle between the views with funktion key F15.
The commit cycle ID for each journal entry is the sequence number of the journal entry that started the
logical unit of work. For example, if the first journal entry for a logical unit of work has the sequence
number 2250824, then the commit cycle ID for all entries that belong to this logical unit of work is
2250824.
© SAP AG
ADM525
Backup and Recovery - 38
SAP Recovery: Remove Journaled Changes
1765644
1765645
1765646
1765647
1765648
1765649
1765650
1765651
1765652
1765653
1765654
1765655
1765656
1765657
1765658
1765659
1765660
1765661
1765662
1765662
C
R
R
C
R
C
R
R
R
R
R
R
C
C
R
R
C
C
R
C
SC
UB
UP
SC
DL
SC
UB
UP
PX
PX
UB
UP
SC
CM
UB
UP
CM
CM
PX
CM
Always specify
CMTBDY(*YES)
RMVJRNCHG
RMVJRNCHG
JRN(R3<SID>DATA/QSQJRN)
JRN(R3<SID>DATA/QSQJRN)
FILE((R3<SID>DATA/*ALL)
FILE((R3<SID>DATA/*ALL)
FROMENTLRG(*LAST)
FROMENTLRG(*LAST)
TOENTLRG(1765647)
TOENTLRG(1765647)
CMTBDY(*YES)
CMTBDY(*YES)
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 39
When removing journaled changes, always start with the last entry or with the entry that preceded the last
backup. Always specify the parameter CMTBDY(*YES) to remove whole logical units. By specifying
parameter CMTBDY(*YES), only the journal entries that belong to a logical unit of work are removed, if
the entire logical unit of work is in the specified range of the journal receivers.
© SAP AG
ADM525
Backup and Recovery - 39
SAP Recovery: Apply Journaled Changes
1765644
1765645
1765646
1765647
1765648
1765649
1765650
1765651
1765652
1765653
1765654
1765655
1765656
1765657
1765658
1765659
1765660
1765661
1765662
1765662
C
R
R
C
R
C
R
R
R
R
R
R
C
C
R
R
C
C
R
C
SC
UB
UP
SC
DL
SC
UB
UP
PX
PX
UB
UP
SC
CM
UB
UP
CM
CM
PX
CM
APYJRNCHGX
APYJRNCHGX
JRN(R3<SID>DATA/QSQJRN)
JRN(R3<SID>DATA/QSQJRN)
FILE((R3<SID>DATA/*ALL)
FILE((R3<SID>DATA/*ALL)
FROMENTLRG(*LASTSAVE)
FROMENTLRG(*LASTSAVE)
TOENTLRG(1765660)
TOENTLRG(1765660)
CMTBDY(*YES)
CMTBDY(*YES)
Always specify
CMTBDY(*YES)
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 40
To apply journaled changes, you must always specify the parameter CMTBDY(*YES). This parameter
applies complete logical units of work. The journal entries that belong to a logical unit of work are only
applied if the entire logical unit of work is in the specified range of journal entries.
© SAP AG
ADM525
Backup and Recovery - 40
SAP Recovery: Example for Database Recovery
QSQJRN1040 QSQJRN1041 QSQJRN1042
QSQJRN1043
Journal
receivers
Journal
entries
Commitment
boundary for all jobs
March 25
23:17:03
“Save active time”
of last database
backup
Error
March 26
12:30:00
Target time
for database
recovery
Last
journal entry
Time
March 26
15:20:15
Shutdown of SAP
and all database
interfaces
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 41
You must perform the following steps in order to recover the database from a logical error which recently
occurred:
1. Decide on a strategy for the recovery. The expected total recovery time is one factor, but the
complexity of the recovery procedure is also an important factor.
2. Examine the journal entries you want to remove or apply.
3. Make sure that all journal receivers that were attached from the last backup are present in the library
R3<SID>JRN.
© SAP AG
ADM525
Backup and Recovery - 41
SAP Recovery: Non-Recoverable Journal Entries
Display Journal Entries
Journal
. . . :
QSQJRN
Sequence
11656624
11656625
Code
F
F
Type
RG
RM
Library . . . :
Table was
Object
Library
reorganized
BVOR
R3<SID>DATA
with
RGZPFM
BVOR
R3<SID>DATA
R3<SID>DATA
11656701
11656702
11656703
11656704
11656705
11656706
F
F
D
D
F
D
CH
EJ
EF
JF
JM
CG
BVOR
BVOR
BVOR
BVOR
BVOR
BVOR
Table
structure
R3<SID>DATA
was
altered
R3<SID>DATA
through
SE11
R3<SID>DATA
R3<SID>DATA
R3<SID>DATA
R3<SID>DATA
WP25
WP25
WP25
WP25
WP25
WP25
12656889
12656890
12656891
12656892
D
F
F
D
JF
JM
MR
DZ
BVOR
BVOR
BVOR
BVOR
Database
table
R3<SID>DATA
wasR3<SID>DATA
restored
R3<SID>DATA
R3<SID>DATA
RSTLIB
RSTLIB
RSTLIB
RSTLIB
Job
RGZPFM
RGZPFM
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 42
The following types of entries with code F cause the backout recovery procedure to terminate. Forward
recovery does not fail with the APYJRNCHGX tool:
JM - Journaling for physical file member started
CE - Change end of data for physical file
RG - Physical file member reorganized
CH - Change file
SS - Start of save while active of physical file member
MS - Physical file member saved
MD - Member removed from physical file
The following entries with code F will cause a termination in any case:
AY - Journaled changes applied to a physical file member
EJ - Journaling for physical file member ended
MF - Physical file member saved with storage freed
MR - Physical file member restored
RC - Journaled changes removed from physical file member
SA - The point at which the APYJRNCHG command started running
SR – The point at which the RMVJRNCHG command started execution
© SAP AG
ADM525
Backup and Recovery - 42
SAP Recovery: Conditions for Backout Recovery
QSQJRN1040 QSQJRN1041 QSQJRN1042
QSQJRN1043
Journal
receivers
Journal
entries
Commitment
boundary for all jobs
Last
journal entry
Error
March 25
23:17:03
March 26
12:30:00
March 26
15:20:15
Time
Check for journal entries
of code D and F in range!
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 43
Before you perform a backout recovery, check all the journal entries with codes ‚D‘ or ‚F‘ in the specified
range. A backout recovery is the fastest way to reset the database, but it stops when journal entries for
object level changes exist, for example ALTER TABLE or RGZPFM.
© SAP AG
ADM525
Backup and Recovery - 43
SAP Recovery: Performing the Backout Recovery
Remove Journaled Changes (RMVJRNCHG)
Journal . . . . . . . . . . . .
Library . . . . . . . . . . .
Journaled file identification:
Journaled physical file . . .
Library . . . . . . . . . .
Member . . . . . . . . . . . .
Range of journal receivers:
Starting journal receiver . .
Library . . . . . . . . . .
Ending journal receiver . . .
Library . . . . . . . . . .
Starting sequence number . . . .
Ending sequence number . . . . .
Commitment boundary
. . . . . .
QSQJRN
R3<SID>DATA
Always recover all
the database tables.
*ALL
R3<SID>DATA
*ALL
*CURRENT
R3<SID>JRN
QSQJRN1042
Remember to
R3<SID>JRN
enable the
*LAST
commitment
1893072
boundary check.
*YES
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 44
The backout recovery can be performed with the command RMVJRNCHG. Always recover *ALL tables,
although the command RMVJRNCHG allows you remove journaled changes for single tables. Enable the
commitment boundary check by specifying CMTBDY(*YES).
© SAP AG
ADM525
Backup and Recovery - 44
SAP Recovery: Backout Recovery Error Analysis
===> RMVJRNCHG JRN(R3<SID>DATA/QSQJRN) FILE(R3<SID>DATA/
*ALL) FROMENTLRG(*LAST) TOENTLRG(1893072) CMTBDY(*YES)
Change not applied or removed to object type *QDDS, …
F1
Additional Message Information
Message ID . . . . . . :
Message type . . . . . :
CPD7016
Diagnostic
Message . . . . :
Change not applied or removed to object
type *QDDS, reason code X'09'.
Cause . . . . . :
The operation to apply or remove
journaled entries failed at sequence number 1893095 with
reason code X'09' and additional entry code 1. The object
associated with the entry is BVOR in library R3<SID>DATA …
Reason codes:
X'09' - Journal entry 1893095 describes a valid change to
the object, but the APYJRNCHG and RMVJRNCHG commands do not
process the change described by that entry.
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 45
If the RMVJRNCHG command fails, you will get an error message at the bottom of the screen, and the
command remains in the command line. By positioning the cursor on the error message and using function
key F1, you can see the detailed information about the error message. There might be more than one error
message. To see them all, you can either enter the command DSPJOBLOG in a command line, or you can
use function key F10 on the Additional Message Information display.
© SAP AG
ADM525
Backup and Recovery - 45
SAP Recovery: Backout Recovery Termination
The database is inconsistent,
because the backout recovery
does not terminate at a commitment
boundary.
X
MD
Journal
Target
time
Table
deleted
LUW
Perform a database restore and a forward recovery.
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 46
When a backout recovery terminates abnormally, the database is inconsistent. For example, a backout
recovery terminates at the journal entry ‘MD’ (delete member) or ‘RG’ (table reorganized). These journal
entries can not be removed. In order to get the database into a consistent state, you must restore the
database and perform a forward recovery.
© SAP AG
ADM525
Backup and Recovery - 46
SAP Recovery: Conditions for Forward Recovery
QSQJRN1040 QSQJRN1041 QSQJRN1042
QSQJRN1043
Journal
receivers
Journal
entries
Commitment
boundary for all jobs
Error
March 25
23:17:03
March 26
12:30:00
Last
journal entry
March 26
15:20:15
Time
Check journal entries
F/MR, F/SR, and F/SA!
RSTLIB
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 47
To perform a forward recovery, you must restore the entire database first. When you perform a forward
recovery, check all the journal entries with code F in the specified range using DSPJRN JRN(QSQJRN)
JRNCDE((F)) ENTTYP(MR SR SA).
© SAP AG
ADM525
Backup and Recovery - 47
SAP Recovery: Performing a Forward Recovery
Apply Journaled Changes Extend (APYJRNCHGX)
Journal . . . . . . . . . . . .
Library . . . . . . . . . . .
Journaled file identification:
Journaled physical file . . .
Library . . . . . . . . . .
Member . . . . . . . . . . . .
+ for more values
Range of journal receivers:
Starting journal receiver . .
Library . . . . . . . . . .
Ending journal receiver . . .
Library . . . . . . . . . .
Starting large sequence number .
Ending date and time:
Ending date . . . . . . . . .
Ending time . . . . . . . . .
Commitment boundary . . . . . .
QSQJRN
The only allowed
R3<SID>DATA
value is *ALL!
*ALL
R3<SID>DATA
*ALL
*LASTSAVE
QSQJRN1042
R3<SID>JRN Remember to
*LASTSAVE
enable the
03/26/2005
12:30:00
*YES
commitment
boundary check.
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 48
The forward recovery is performed by the APYJRNCHGX command. Make sure you apply all journaled
changes, starting from the checkpoint of the corresponding save operation. Enable the commitment control
check by specifying CMTBDY(*YES).
Note: To check the format for the ending date and time, you can enter CHGJOB, press F4, and then F10.
The parameters „Date format”, “Date separator” and “Time separator” show you how date and time values
are fomratted in your job.
© SAP AG
ADM525
Backup and Recovery - 48
SAP Recovery: Forward Recovery Termination
Recovery continues
for other tables
X
Journal
Save
time
Target
time
ENDJRNPF
for one table
LUW
To avoid inconsistencies as much as possible, the forward
recovery continues for all other tables when an error occurs
with one table. This is controlled with the APYJRNCHGX
parameter “Object error option” OBJERROPT(*CONTINUE)
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 49
An interruption of the forward recovery because of an unrecoverable journal entry would leave the
database in an inconsistent state because the termination would not occur at a transaction boundary. With
the default value *CONTINUE in parameter OBJERROPT, the forward recovery continues for all other
tables if a problem is encountered with one or multiple tables. This leaves most of the database in a
consistent state, only the few affected tables need special attention. If the affected tables are important to
your business and the error situation is not easy to fix, you should contact the IBM or SAP support for
help.
© SAP AG
ADM525
Backup and Recovery - 49
SAP Recovery: SWA with Partial Transactions
QSQJRN1040 QSQJRN1041 QSQJRN1042
QSQJRN1043
Journal
receivers
Journal
entries
SAVACT(*SYNCLIB)
SAVACTWAIT(3600 *NOCMTBDY)
Time
RMVJRNCHG
CMTBDY(*YES)
APYJRNCHGX
CMTBDY(*YES)
LUW
RSTLIB leaving database inconsistent (SQL7008)!
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 50
If you use the save while active function and specify *NOCMTBDY on the SAVACTWAIT parameter,
your database is saved without waiting for all processes to reach a transaction boundary. This feature came
new in i5/OS V5R3M0. While this allows to take a backup without disrupting your SAP operations, it
requires to apply or remove journal changes after restoring the data in order to get to a consistent state. If
you try to use the database after restoring it without getting it to a commitment boundary first, you will get
error messages CPF428D and SQL7008 with reason code 17. Please note that you have to keep journal
receivers along with your backup in order to be able to recover to a consistent state.
© SAP AG
ADM525
Backup and Recovery - 50
High Availability: Switchable Independent Disk Pool
Switchover /
failover
HSL
Production
system
IASP
External
or internal
storage
Backup
system
(development
system)
Using clustering with SAP:
see SAP note 568820
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 51
If your business requires high availability of your SAP system, you can setup a cluster that connects
external disk devices (configured as independent ASP) to a production server and a backup server through
a high speed link (HSL). Usually the disk devices are connected to the production system, and you can use
the backup server for example as your development system.
In case of a planned outage of the production server, for example when performing software maintenance,
you initiate a switchover to the backup server. In case of an unplanned outage, for example a hardware
failure, a failover to the backup server is performed automatically.
SAP note 568820 explains how SAP can be configured to use the clustering configuration. Note that this
setup does not protect you from an outage because of the loss of the external storage, for example in case
of a fire.
© SAP AG
ADM525
Backup and Recovery - 51
Disaster Recovery: Cross-Site Mirroring
Production
Location A
Vary
off
Backup
Location B
Vary
on
IASP
Cross-site
mirroring
i5/OS V5R3M0
5722SS1 Opt. 41
IASP
External
or internal
storage
Using clustering
with SAP:
See note 568820
External
or internal
storage
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 52
Disaster recovery for a system can be obtained with cross-site mirroring. The following prerequisites are
required:
y i5/OS V5R3M0 or higher,
y Option 41 of the operating system („HA Switchable Resources“),
y The SAP system is stored in an independent ASP on internal storage or on external storage in a
switchable I/O tower.
Typically the independent ASP is connected to the production system. While the production system is
active, the disk data is copied to the remote location. If the production system goes down (intentionally or
due to an error), you can attach the remote copy of the disks to the backup system and continue work
there. You can also detach the mirrored copy in order to create reports or run an offline backup. The
mirrored copy will be synchronized with the production copy when reattached.
SAP note 568820 explains how SAP can be configured to use the clustering configuration.
© SAP AG
ADM525
Backup and Recovery - 52
High Availability: Third-Party Products
Production
Location A
Backup
Location B
Internal or
external
storage
Internal or
external
storage
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 53
You can also obtain high availability or disaster recovery by using third-party products to mirror your
system data from your production system to the backup system. These third-party products are based on
journaling and object auditing: Whenever journal entries are written or objects are changed, these changes
are reported to the remote system and applied there as well.
Other than cross-site mirroring, these products allow read access to the data on the backup system while
the production system is up and running. For example, you could use the backup data for saving your data
to tape or produing a homogenious system copy while the production system keeps running.
For more information about the products, visit the web sites of their manufacturers:
y www.lakeviewtechnology.com (Mimix)
y www.datamirror.com
y www.visionsolutions.com
© SAP AG
ADM525
Backup and Recovery - 53
Backup & Recovery: Unit Summary
You should now be able to:
z Discuss backup concepts for SAP on iSeries
z Design a backup strategy for your SAP system
z Perform recovery of your SAP system after data loss
z Understand high availability solutions for iSeries
SAP AG 2004, ADM525 Backup and Recovery / Christian Bartels / 54
© SAP AG
ADM525
Backup and Recovery - 54
Exercises
Unit: Backup and Recovery
Topic: Perform backup and recovery or sample data
At the conclusion of this exercise, you will be able to:
• Save a library
• Restore a library
• Recover journaled changes
As system administrator you are responsible for performing regular
backups of your SAP system. In case of data loss, you are responsible for
restoring the data up to the point of failure.
1-1
Sign on to the iSeries server
1-1-1 On your workstation, start the 5250 Emulation to the class server.
1-1-2 Sign on with user name ADM525## and password PWADM525##.
1-2
Create an SQL collection with the journal in a separate library
1-2-1 Start an interactive SQL session, using the command STRSQL. In the SQL
entry screen, enter the command to create a collection named
R3A##DATA:
CREATE COLLECTION R3A##DATA
1-2-2 Exit the SQL session with function key F3. On the exit screen, select the
option to save your session contents. This allows you to retrieve previous
commands when you return to SQL.
1-2-3 Create a separate library R3A##JRN to hold journal receivers. To do that,
enter the i5/OS command CRTLIB R3A##JRN.
1-2-4 Create a journal receiver named QSQJRN0001 in your library R3A##JRN.
Use the command CRTJRNRCV and prompt it with F4. Specify a
threshold of 200,000 for the receiver.
1-2-5 Change the journal R3A##DATA/QSQJRN to use the new journal
receiver QSQJRN0001 in library R3A##JRN. Use the command CHGJRN
for it and prompt it. Make sure that “Manage receivers” is set to
*SYSTEM, and that the “Receiver size option” is set to the two values
*RMVINTENT and *MAXOPT2. If you want to know more about the
meaning of a parameter, you can position the cursor on that parameter and
press function key F1 for help.
1-2-6 Delete the old journal receiver QSQJRN0001 in library R3A##DATA.
This can be done with the DLTJRNRCV command. You will get a
warning message because this receiver was never saved. Answer “I” (for
ignore) to this message. We have now a setup similar to an SAP setup
(R3<sid>DATA and R3<sid>JRN).
1-3
Create a table and fill it with data
1-3-1 Start an interactive SQL session with the STRSQL command. First we
want to change our session to use commitment control (the default is, not
to use it). This can be done by changing the session attributes. To do so,
press function key F13 (Shift+F1) and select option 1 “Change session
attributes”. On the next screen, change “Commitment control” to *CHG
and return to your SQL input screen by pressing Enter twice. This is the
level that SAP usually uses.
1-3-2 Create a table named TESTTABLE in your collection R3A##DATA. The
table should have two fields: A numeric column named NUMFLD (type
DECIMAL, length 5), and a character column named CHRFLD (type
CHAR, length 20). If you don’t know the SQL syntax, type in the
command CREATE TABLE and press function key F4. Then follow the
menu. Otherwise you can type in the SQL statement directly:
CREATE TABLE R3A##DATA/TESTTABLE (NUMFLD DECIMAL
(5) NOT NULL WITH DEFAULT, CHRFLD CHAR (20) NOT NULL
WITH DEFAULT)
At this point, you can decide whether you want to confirm the operation on
the database (“commit”) or to undo the table creation (“rollback”). Type
the SQL statement COMMIT to confirm your changes.
1-3-3 Add a primary key to table TESTTABLE over field NUMFLD. This
ensures unique values for each row. The SQL statement to do that is:
ALTER TABLE R3A##DATA/TESTTABLE ADD PRIMARY KEY
(NUMFLD)
You could also just type ALTER TABLE and then use F4 to prompt the
statement. Afterwards you should commit your changes by entering
COMMIT.
1-3-4 Insert a row into the table, using the SQL statement:
INSERT INTO R3A##DATA/TESTTABLE VALUES(1, ‘Row number
1’)
Try to insert the same row again. What is the error message? You can
retrieve the last SQL statement with function key F9. Do so and modify
the inserted values, counting up to 10 and inserting 10 rows that way.
Don’t forget to commit your changes.
1-3-5 Leave your SQL session with the function key F3.
1-4
Save your SQL collection
1-4-1 Create a “save file” that will hold the saved data. Usually you would save
your data to a tape library or a tape, but for the purpose of this class it is
sufficient to save it to a save file in another library. Name the save file
SAVEFILE and place it into your library R3A##JRN. The command is:
CRTSAVF R3A##JRN/SAVEFILE.
1-4-2 Save your SQL collection (library R3A##DATA) into the save file that
you just created. To do so, type the command SAVLIB and prompt it
using function key F4. Fill in “R3A##DATA” as the library name and
“*SAVF” as the device. When you hit the enter key, additional parameters
will appear. Specify the name and library of the save file that you created
in the previous step. Press function key F10 and look at additional
parameters that you can specify. For this exercise, it is okay to leave all
other values as their defaults.
1-4-3 Verify that the save was successful. First look at the joblog. Enter the
command DSPJOBLOG (it defaults to your current job) and press F10
(“Display all messages”) on the next screen. Then scroll backwards and
look at the messages between the SAVLIB command and the
DSPJOBLOG command. Another way to check is to look at your save file
with the command:
DSPSAVF R3A##JRN/SAVEFILE
It should list the objects that you just saved. If you get a text “no records in
save file”, you did something wrong in the previous steps. If you were
saving to tape, you could use the command DSPTAP in a similar way.
1-5
Change some data after performing the save
1-5-1 Start an interactive SQL session with the STRSQL command.
1-5-2 Check the current number of rows in your table TESTTABLE. The SQL
statement to display the number of rows is:
SELECT COUNT(*) FROM R3A##DATA/TESTTABLE
What is the current number of rows at the time of the backup? ____
1-5-3 Insert a row into the table, using the SQL statement:
INSERT INTO R3A##DATA/TESTTABLE VALUES(20, ‘Row number
20’)
Confirm your changes on the database with the COMMIT statement.
1-5-4 Check the number of rows in your table again, using the same statement as
in step 2. What is the number of rows now? ____
1-5-5 Exit your SQL session.
1-6
Delete your SQL collection to simulate data loss
1-6-1 You can delete your SQL collection by using the i5/OS command
DLTLIB. Enter the command:
DLTLIB R3A##DATA
Do not delete library R3A##JRN because it will be needed for recovery.
1-7
Restore your backup and apply journal changes
1-7-1 Restore your library R3A##DATA from the save file SAVEFILE in your
library R3A##JRN. To do so, type the command RSTLIB and prompt it
with F4. Fill in the name of the saved library (R3A##DATA) and *SAVF
as the device. Press enter and fill in the name and library of the save file
(SAVEFILE in library R3A##JRN). Hit enter again to execute.
1-7-2 Start an interactive SQL session with the STRSQL command. Find out the
number of rows with the statement:
SELECT COUNT(*) FROM R3A##DATA/TESTTABLE
You should notice that the row is missing, that we inserted after the save.
1-7-3 When journal QSQJRN was restored with library R3A##DATA, a new
journal receiver got created and associated with the journal. We now need
to associate the journal with the old journal receiver QSQJRN0001 in
library R3A##JRN. To do that, enter the command WRKJRN without
parameters. On the next screen, enter QSQJRN as the name of the journal,
and R3A##DATA as the name of the library. This should bring up a
display “Work with Journals”, listing your journal. Select option 9 to
associate all previous receivers in library R3A##JRN with your journal.
When completed, leave this screen with function key F3.
1-7-4 We now want to find out, what the last journal entry was before the library
got deleted, because we want to only apply changes up to that point. Use
the DSPJRN command to see the entries in the journal. Because the
defaults in DSPJRN only display the current receiver, we need to specify
the range of journal receivers we are interested in. Type the command
DSPJRN and prompt it with F4. Enter QSQJRN and library R3A##DATA
for the journal name. Enter QSQJRN0001 and library R3A##JRN for both
the starting and the ending journal receiver.
1-7-5 Scroll down the list until you find the first entry with a code “D” and a
type “DT”. This entry is for a file delete. Write down the sequence number
of the previous entry (probably code “C”, type “CM” for commit): ___
1-7-6 Now we apply the journal changes. Type the command APYJRNCHGX
and prompt it with function key F4. You need to fill in the following
values:
Journal / Library:
QSQJRN / R3A##DATA
Journaled physical file / Library
*ALL / R3A##DATA
two pages down:
Starting journal receiver / Library
QSQJRN0001 / R3A##JRN
Ending journal receiver / Library
QSQJRN0001 / R3A##JRN
Starting large sequence number
*LASTSAVE
Ending large sequence number
<use the answer for step 1-7-5>
Once all values are typed in, hit enter to execute. You should get a
message informing you about the success of the operation.
1-7-7 To verify your results, start an interactive SQL session with the STRSQL
command. Find out the number of rows with the statement:
SELECT COUNT(*) FROM R3A##DATA/TESTTABLE
You should notice that we now have the number of rows that we had right
before we deleted the library R3A##DATA.
Solutions
Unit: Backup and Recovery
Topic: Perform backup and recovery on sample data
1-5
Solution to Step “Change some data after performing the save”
1-5-2 Number of rows: 10
1-5-4 Number of rows: 11
1-7
Solution to Step “Restore your backup and apply journal changes”
1-7-5 The previous entry and the sequence number can vary. On two internal
tests, code “C”, type “CM” was found with entry number 35, and code
“C”, type “SC” with entry number 34.
Maintenance and Installation of SAP on iSeries
Contents:
z Maintenance i5/OS and DB2 UDB for iSeries
z Installation Considerations for SAP on iSeries
z Installing SAP Patches
z Homogeneous System Copy
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 1
© SAP AG
ADM525
Maintenance and Installation - 1
iSeries Maintenance: Unit Objectives
After completing this unit, you will be able to:
z Perform initial program loads (IPL‘s)
z Apply program temporary fixes (PTF‘s)
z Describe i5/OS-specific steps during the installation
of an SAP system
z Install SAP patches
z Perform a homogeneous system copy by saving
and restoring the database library
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 2
© SAP AG
ADM525
Maintenance and Installation - 2
iSeries Maintenance: Course Overview Diagram
1 Course Overview
2 Concepts of IBM eServer
iSeries and i5/OS
3 SAP Architecture for IBM
eServer iSeries
4 Backup and Recovery
5 Maintenance and Install
6 Problem and Performance
Analysis
7 Conclusion
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 3
© SAP AG
ADM525
Maintenance and Installation - 3
iSeries Maintenance: Business Scenario
z As a system administrator you are responsible for
system maintenance, including updates to the
operating system, other IBM software products, and
the SAP application. As a consultant, you are
installing new SAP systems or copies of existing
SAP systems, for example to setup a test system as
a copy of a production system.
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 4
© SAP AG
ADM525
Maintenance and Installation - 4
iSeries Maintenance: The Control Panel
Function/Data display
Increment and
decrement buttons
Function/Data
01
B
01 Display Selected IPL
02 Select IPL
Enter
03 Start IPL
04 Lamp Test
11 System Reference Code
Manual
Normal
Auto
Secure
Mode
Power
button
Power on
indicator
System
attention light
Enter
button
Mode
button
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 5
Depending on your hardware, you can have a remote or virtual control panel, or a physical control panel.
They all have similar buttons, lights and indicators as shown in the picture. When using a physical control
panel, you can have a keystick that needs to be plugged in to allow changing the mode.
The function/data display is used for a variety of settings together with the increment and decrement
buttons and the enter button. It is also used to display the system status during the initial program load
(IPL) and to show error information if the system found a severe problem. In that case, also the yellow
system attention light is on.
The mode button is used to select the IPL mode. Only the manual mode allows the complete selection of
functions, in the other modes (normal, auto, or secure) only a limited set of functions can be selected). The
power button can be used to switch off the power if the system does not react to any input. However, it
should be used only if anything else fails because it can cause the loss of data in the system caches. The
power button is also used to turn on the system if it is powered off.
© SAP AG
ADM525
Maintenance and Installation - 5
iSeries Maintenance: Initial Program Load (IPL)
Power on
button
IPL
source:
A, B, or D
Command:
PWRDWNSYS
RESTART(*YES)
IPL
mode
Normal
(unattended)
Manual
IPL options:
• set system date/time
• clear job queues, ...
• set system options
• define or change system
Menu POWER:
change power on and
off schedule
Automatic
execution of
startup program
(QSTRUPPGM)
Control panel:
function 03
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 6
The initial program load (IPL) can be started in different ways. If the server is powered off, you simply
use the power button. If you want to restart your server for maintenance reasons, you can either use the
command PWRDWNSYS (Power Down System) with the option RESTART(*YES), or you can use the
menu POWER (command: GO POWER) to schedule power off and power on times through a calendar. If
you cannot enter commands, you can also use function 03 on the control panel to start an IPL. However,
this causes an abnormal system end, so this option should only be used if it is impossible to enter the
command PWRDWNSYS.
The IPL source can be selected prior to the IPL, either on the control panel or in the PWRDWNSYS
command. A and B represent two copies of the licensed internal code on disk, with B being the more
current level after installing fixes. Typically you will IPL on B, but if that fails after installing licensed
internal code fixes, you can try to IPL on A to bring up your system and remove bad fixes. IPL source D
represents external media (CD drive or tape device) and is used to load or upgrade licensed internal code.
If you have selected an unattended IPL (mode normal, automatic, or secure), the IPL will run
automatically without any further user intervention. If you have selected a manual IPL, you get screens
where you can set system options. This is usually needed for error recovery only and will often be guided
by the IBM support.
Towards the end of the IPL, the user-defined startup program is executed automatically. It‘s name and
library are stored in system value QSTRUPPGM.
© SAP AG
ADM525
Maintenance and Installation - 6
iSeries Maintenance: Working with Logical Partitions
Work
Work with
with Partition
Partition Status
Status
Type
Type options,
options, press
press Enter.
Enter.
1=Power
3=IPL
1=Power on
on
3=IPL restart
restart
9=Mode
normal
10=Mode
9=Mode normal 10=Mode manual
manual
A=Source
B=Source
A=Source AA
B=Source BB
7=Delayed
7=Delayed power
power off
off
11=Mode
auto
11=Mode auto
D=Source
D=Source DD
Partition
IPL
IPL
Partition
IPL
IPL
Opt
Source
Mode
State
Opt Identifier
Identifier Name
Name
Source
Mode
State
00
PRIMARY
BB
Manual
On
PRIMARY
Manual
On
11
AS0012
B
Normal
On
AS0012
B
Normal
On
Server and Partition: Server Management
Name
State
STRSST
Server-9406-570-SN5C363E
-
-
Partitions
LPAR 1 AS0018
√
LPAR 1 AS 400
LPAR 2 AS0012
√
LPAR 1 AS 400
-System
Profiles
-
-
HMC
Console
(Power5)
Ready
Running
Properties
Running
Create
Restart Partition
Shutdown Partition
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 7
If you are using logical partitions, you are controlling your partitions by software functions rather than a
control panel. If you are using older hardware, you have a primary partition and optional secondary
partitions. You can use the system servive tools (command: STRSST) on the primary partition to work
with the other partitions. The screen shot is showing how you can power on and set options on the
partitions in the system service tools.
If you are using Power5 hardware, a primary partition is no longer needed. Instead of it you have a
hardware management console that you can use to manage your partitions. The lower picture is showing a
screen shot of the hardware management console (HMC) with options on your partitions.
© SAP AG
ADM525
Maintenance and Installation - 7
iSeries Maintenance: Program Temporary Fixes
Product 5722SS1
i5/OS Operating System
PTF SI17836
(5722SS1)
Product library: QSYS
Pre-req: MF34938
Co-req: SI17824
SI15451
*PGM QDBAPPDDL
*PGM QDBCHGFI
*PGM QDBCRTME
…
*PGM QDBCRTME
PTF SI17824
(5722SS1)
Pre-req: SI15901
Co-req: SI17836
SI17219
…
*PGM QDBAPPDDL
*PGM QDBCHGFI
…
Product 5722999
Licensed Internal Code
##MACH#A ##MACH#B
PTF MF34938
(5722999)
#CFDAMST #CFDAMST
#DBCCR
#DBCCR
#DBGNFRG #DBGNFRG
…
…
Module #DBCCR
Module #DBGNFRG
…
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 8
Program Temporary Fixes (PTF‘s) are used to correct bugs or to add new features between release
boundaries. They replace objects that are part of the Licensed Internal Code (LIC), the operating system,
or a licensed program. Each PTF has a unique number that starts with MF for the LIC and with SI for all
other products. A PTF can replace one or multiple objects.
The operating system and additional licensed programs consist of objects that are stored in the product
library of that product, for example QSYS for the operating system. The Licensed Internal Code does not
consist of regular objects, but of LIC modules. The system keeps two copies of the LIC that are called „A“
and „B“. When LIC PTF‘s are installed temporarily, so that they can be removed again, they are only
installed on the B copy. When LIC PTF‘s are installed permanently, they are installed on both A and B.
There can be dependencies between PTF‘s. If a PTF is a pre-requisite PTF to another one, such as
MF34938 to SI17836 in the picture, it must be installed on the system before the dependent PTF can be
installed. If PTF‘s are co-requisite, such as SI17836 and SI17824 in the picture, they must be installed at
the same time.
© SAP AG
ADM525
Maintenance and Installation - 8
iSeries Maintenance: Cumulative and Group PTF‘s
Backup recovery
solutions
SF99185
DB2 UDB for iSeries
SF99503
Group HIPER
SF99529
Java
SF99269
Cumulative PTF
package C5102530
SF99530
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 9
Important PTF‘s are bundled together as so-called PTF groups. There are groups for high impact/pervasive
(HIPER) PTF‘s, database PTF‘s, Java PTF‘s, PTF‘s for backup and recovery, and more groups that are
not shown in the picture. In addition there is a cumulative PTF package that combines all important PTF‘s
of all groups. However, the cumulative PTF package is updated less frequently than the group PTF‘s, so in
order to get all important PTF‘s, you need to install the cumulative PTF package as well as the group
PTF‘s.
The PTF numbers shown in the picture are the PTF numbers that you need to specify to get the group PTF
for i5/OS V5R3M0. The equvalent numbers for other releases can be found if you go to web page
http://www.ibm.com/servers/eserver/support/iseries/fixes and select „Group PTFs“, „Recommended
fixes“, or „Preventive Service Planning – PSP Database“. There is only one order number for each release,
but you will always get the latest level of the PTF. The information on the web page is showing you the
level that is currently available, and the i5/OS command WRKPTFGRP is showing you what level is
installed on your system. Cumulative PTF packages have a numbering schema that starts with „C“,
followed by the last digit of the production year („5“ for 2005), the production day (102 for April 12th),
and the release level (530 for V5R3M0).
© SAP AG
ADM525
Maintenance and Installation - 9
iSeries Maintenance: Installing PTF‘s
Address: http://www.ibm.com/eserver/support/fixes/
Order PTF
Fix Central
Feedback
Fix Central
SNDPTFORD
SNDPTFORD
Load PTF
PTF
Save file
PTF
Server
IBM
FTP
PTF package
Apply PTF
Delayed
PTF
Image
Immediately
IPL the server
PTF active
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 10
If you want to install PTF‘s, you first need to order the PTF. If you have one or few PTF‘s to order, you
can download them from the Internet with your browser (address:
http://www.ibm.com/eserver/support/fixes) or with the i5/OS-command SNDPTFORD, if you have a
modem connected to your server and the connection set up properly. If you are maintaining multiple
servers, you can download the PTF image via FTP from a PTF server to your machine and then burn your
own CD or use the PTF image through an image catalog (see command CRTIMGCLG - Create Image
Catalog). You can also call the IBM support center and order a CD with the PTF‘s, especially when you
need to order a large PTF package. When you order PTF‘s, the pre- and co-requisite PTF‘s will be
automatically shipped with your order. This can make an order pretty large, even if you ordered only one
or a few PTF‘s.
Once the PTF‘s are there, you can load them from the save file (if you downloaded them) or from the
optical device. At this stage, the PTF is not yet in effect, the old code is still running on your system. In
order to activate the new code in the PTF, you need to apply the PTF. Most PTF‘s can be applied
immediately. Some PTF‘s that replace system critical code cannot applied immediately, but only during an
IPL. For those, you set the delayed-flag on the apply command, and they will be installed automatically
when you restart the server. You can see from the PTF cover letter whether your PTF can be applied
immediately or delayed only. All PTF‘s that can be applied immediately can also be applied delayed.
© SAP AG
ADM525
Maintenance and Installation - 10
iSeries Maintenance: The PTF Menu
PTF
Program Temporary Fix
Select one of the following:
1. Load a program temporary fix
2. Apply a program temporary fix
3. Copy a program temporary fix
4. Remove a program temporary fix
5. Display a program temporary fix
6. Order a program temporary fix
7. Install a program temporary fix from a list
8. Install program temporary fix package
9. Copy PTF Cover Letter
10. Display PTF Cover Letter
11. Delete a program temporary fix
12. Work with PTF groups
13. Copy PTF group
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 11
The PTF menu offers a list of all commands that are important when working with PTF‘s. You can invoke
it by entering the command GO PTF. If you got a CD with PTF‘s, the easiest way to install them is to use
option 8. This will load all necessary PTF‘s from the media, mark them to be applied delayed, and restart
the system (if requested). You can also load and apply the PTF‘s with options 1 and 2. As you can see,
there are more options such as copy, display, or remove PTF‘s. There are also commands for PTF groups,
that will be discussed in the next slide.
© SAP AG
ADM525
Maintenance and Installation - 11
iSeries Maintenance: SAP Info APAR‘s
APAR#:
II13868
Component: INFOAS400 – AS/400 Information
Release(s):
R530
Abstract
SAP SUPPORT REQUIRED PTF LIST FOR V5R3M0
Error Description
VRM = 530
IAV=1
**************PLEASE READ CAREFULLY*************************
*** Last Updated 10 Jun 2005 ***
SAP customers are reminded to …
…
Customer is required to load at a minimum CUM C5102530
and the following PTF's:
(5722SS1)
TC05102 CUMPKG
SI18077
SI18061
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 12
IBM maintains a so-called info APAR for each release that contains all PTF‘s that are required to run SAP
on iSeries without error. These info APARs are updated whenever PTF‘s are newly built that solved
problems in the SAP environment, so they list individual PTF‘s in addition to the cumulative PTF package
and the group PTFs. They also give some technical hints that may be helpful when running SAP on
iSeries. The info APAR numbers are II13868 for i5/OS V5R3M0, II13337 for OS/400 V5R2M0, and
II12833 for OS/400 V5R1M0.
You can access the info APAR‘s through the web at
http://www.ibm.com/servers/eserver/iseries/service/erp/support.htm. This web page allows you to display
the current versions of the info APAR‘s for all supported operating system releases. It also allows you to
fill in a form so that you get automatically notified when an info APAR is changed.
© SAP AG
ADM525
Maintenance and Installation - 12
iSeries Maintenance: SAP PTF Check Tools
Display Program Messages
PTF SI22347 of product 5722SS1 is not installed on this
system. (C I R)
I
Ignoring PTF check errors must be confirmed. (G R)
Type reply, press Enter.
Reply . . . . G
APYR3FIX
SAVF(DW) …
PTF Check on Server
Transaction
DB4PTFCHK
CHKR3PTF INFOAPAR
('/usr/sap/trans/config/infoapar.530')
Status Product PTF Nu...Comment
5722SS1 TC05298 CUMPKG
5722SS1 SI22384
5722SS1 SI22347
5722SS1 SI22285
5722SS1 SI22230
5722SS1 SI21954
5722SS1 SI21660
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 13
SAP is providing several test tools to check if all the recommended PTF‘s are installed. Whenever a new
kernel patch (disp+work package) is being installed, the info APAR is copied into a file
/usr/sap/trans/config/infoapar.<vrm>, where <vrm> is replaced by the version, release, and modification of
the operating system. The info APAR version is the one that was current when the patch was built.
On the 5250 emulation, a comparison between the info APAR and the installed PTF‘s happens
automatically when the disp+work package is applied through the APYR3FIX command. It can also be
executed manually by using the CHKR3PTF command. If PTF‘s are found to be missing, the tool will
send an inquiry message for each PTF. You can reply ‚I‘ to ignore the check, even though this is not
recommended. If you ignored at least one missing PTF, you have to confirm your decision at the end by
replying ‚G‘ for go.
Through the SAP GUI, you can execute transaction DB4PTFCHK to get a list of all PTF‘s that are
required, and the ones that are missing (indicated by a red „traffic light“). This transaction is also executed
if you select the menu path Diagnostics -> PTF Check in transation DB4Cockpit.
© SAP AG
ADM525
Maintenance and Installation - 13
iSeries Maintenance: Special Downloads for SAP
Database interface for SAP WebAS ABAP:
http://www.ibm.com/servers/eserver/iseries/access/xda/download.htm
qxdaedrs_v5r3.exe, qxdaedrs_v5r2.exe, …
http://www.ibm.com/servers/eserver/iseries/access/linux/downloads.html
iSeries Access for Linux 64-bit EDRS Driver
Database interface for SAP WebAS Java:
http://www.ibm.com/servers/eserver/iseries/toolbox/downloads.htm
JTOpen
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 14
For some database interfaces, fixes are usually created in quite large intervals only. This affects the ABAP
interface for Linux and Windows application servers as well as the Toolbox JDBC driver for Java. In
order to get fixes short-termed when needed, IBM provides downloads with the current fixes at the web
pages listed in the picture. The text underneath each web address indicates the piece of code that you need
to download.
Note that the JDBC driver for toolbox refers to the download of IBM‘s open source JDBC driver, called
JTOpen. Basically the JTOpen driver and the Toolbox driver share a common source. While the Toolbox
driver is only updated every couple of months, the JTOpen driver always contains the latest level of the
code with the most current fixes, so it is the recommended driver.
A reference to the given web pages can also be found in the SAP Info APAR‘s.
© SAP AG
ADM525
Maintenance and Installation - 14
iSeries Maintenance: Reclaim Storage
RCLSTG
Select: *ALL, *DBXREF
Omit: *NONE, *DBXREF, *DIR
/
usr
sap
Restricted state needed.
May take long time.
sapmnt
11
10
<SID>
trans
12
1
2
9
3
8
4
7 6
5
QReclaim
SYSTABLES, …
Rebuild cross-reference
files and catalog views
Library QRCL
Check and repair
IFS directory
structures
Walk through all pages on disk and
identify orphaned objects
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 15
The Reclaim Storage command (RCLSTG) is used to clean up the system after any abnormal condition,
such as abnormal system ends because of a hardware failure. The SAP or IBM support or an error
message may request you to run it. RCLSTG provides three major functions:
1. It walks at a low level over all attached disk units and inspects the pages on disk. If the page header
information does not match the virtual address that RCLSTG is working on, the page is marked as
corrupted. Whenever a page represents the header of an object, it is checked if the object resides in a
valid library and has a valid owner. Objects that are found to be orphaned or damaged are moved to
library QRCL. The output of the PRTDSKINF command is telling you how much storage can be
recovered by RCLSTG.
2. It checks all IFS directories and files. If inconsistencies are found, it tries to repair the directory, or it
moves it contents to directory /QReclaim (not case sensitive) or /QOpenSys/QReclaim (case sensitive).
3. It rebuilds the system cross reference files as basis for the database catalog files by collecting
information about all database objects on the system. This is the most commonly used function and
can be executed alone by specifying RCLSTG SELECT(*DBXREF).
In order to execute RCLSTG, the system needs to be in restricted state. You must signon to the system
console, enter ENDSBS SBS(*ALL) OPTION(*IMMED) and wait for all subsystems to end before you
can execute the RCLSTG command. The command can run for multiple hours. The time is unpredicatble
and depends on the amount of storage, number of objects, disk and processor speed.
© SAP AG
ADM525
Maintenance and Installation - 15
iSeries Maintenance: Reuse Deleted Records
DELETE FROM SCARR WHERE MANDT = ‘100‘ AND CARRID = ‘SR‘
MANDT CARRID
CARRNAME
MANDT CARRID
CARRNAME
100
AA
American Airl.
100
AA
American Airl.
100
AC
Air Canada
100
AC
Air Canada
100
AF
Air France
100
AF
Air France
100
BA
British Airways
100
BA
British Airways
100
LH
Lufthansa
100
LH
Lufthansa
100
NW
Northwest Airl.
100
NW
Northwest Airl.
100
SR
Swiss Air
100
LX
Swiss
100
UA
United Airlines
100
UA
United Airlines
100
OS
Austrian
INSERT SCARR FROM TABLE <itab>
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 16
When rows (or records) are deleted from a table, the space that they occupy is not actually freed, but the
rows are only marked as deleted. SQL tables are always created with the file attribute REUSEDLT(*YES)
(„Reuse deleted records“), so whenever new rows are inserted to the table, the database first checks if
there is space filled by deleted rows that can be reused. Only when all deleted rows are reused by new
rows, the new data will be appended to the end of the table. Please note that the rows in the table are
physically not in the order that the primary key defines, but in random order. So if your application needs
the data in a specific order, you must always specify an ORDER BY clause, otherwise you can get the
rows in any random order.
Usually this concept works well and does not require maintenance, as long as the number of inserted rows
is roughly the same or higher than the number of deleted rows. However, after removing a client or data
archiving you may want to free the space that is occupied by the deleted rows. The command RGZPFM
can be used to reorganize the table.
© SAP AG
ADM525
Maintenance and Installation - 16
iSeries Maintenance: Reorganizing Tables
Offline:
RGZPFM FILE(…) MBR(…)
KEYFILE(*FILE)
ALWCANCEL(*NO)
Copy all rows into
temporary object
Delete original table
and rename temp. object
Move rows from end of
table into deleted row space
Truncate table
at the end
Online (as of V5R3M0):
RGZPFM FILE(…) MBR(…)
KEYFILE(*RPLDLTRCD)
ALWCANCEL(*YES)
LOCK(*SHRUPD)
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 17
Starting with i5/OS V5R3M0, the command Reorganize Physical File Member (RGZPFM) supports an
online mode. Prior to that release, you could only perform an offline reorganization, and the
ALWCANCEL parameter did not exist. The command is explained in SAP note 84081.
When doing an offline reorganization, the system is copying all valid rows into a temporary object, then it
deletes the original table and moves the temporary object into its place. The offline reorganization requires
an exclusive lock on the table, and you need the extra space for the temporary object. For tables containg
varying length data columns (VARCHAR, VARGRAPHIC, CLOB, DBCLOB, and BLOB), the offline
reorganization may result in better compression than the online reorganization.
When doing an online reorganization, you do not need an exclusive lock on the table, so the SAP system
can stay up while reorganizing. You can still see locking conflicts if you run a backup in parallel or try to
alter the table structure. During an online reorganization, rows are moved from the end of the table into
gaps that result from deleted rows. When all rows are moved, the table is truncated by freeing up the
unused space at the end of the table.
On productive SAP systems, table reorganization is usually not necessary. You can use transaction DB02
with the function „Deleted row analysis“ to find out how much space is wasted by deleted rows.
© SAP AG
ADM525
Maintenance and Installation - 17
SAP Installation: Client Server Concept for iSeries
TMKSVR<nn>
SAPinst/TMKSVR
User Profile SAPINST
Password ******
<?xml …?>
<tables>
…
<\tables>
DISPATCH
SAPINST
TCP/IP Sockets
Kernel
SAPCAR
SAPAPPL0
Database
Share „rootbin“
/usr/sap/SAPinst
/tmp/<SID>/CD…
Copy
SAP
SAP WebAS
6.40 SR1
Installation Client:
• User dialogs
• XML script execution
TMK Server:
• Perform OS operations
• Unpack kernel
• Load database
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 18
The SAP installation on iSeries consists of a client that is running on a Windows PC and a server (so-
called „TMK server“) on the iSeries. If multiple installations are running in parallel, there can be multiple
instances of the TMK server, each represendet by a subsystem TMKSVR<nn> with <nn> being the
instance number of the TMK server. When the TMK server is started, subsystem TMKSVR<nn> is started
along with a job named DISPATCH. If a SAPinst client connects to the server, a job SAPINST is started.
It spawns multiple jobs to perform the different tasks that are needed during an installation. The TMK
server is installed as the first part of the installation.
The installation client is responsible for the user dialogs. Based on XML scripts and the user input it drives
the installation and requests different operations from the TMK server. These include certain checks,
executing operating system commands to setup the system and executing the load routines to load the
database. The client communicates with the server through TCP/IP sockets and reads the installation files
through a binary share („rootbin“). The installation files must reside on the iSeries server so that both the
client (through the share) and the server can access the data.
Please note that this installation concept started with SAP releases 6.x. In earlier releases (4.6D and
earlier), the R3SETUP tool was used directly on the iSeries server.
© SAP AG
ADM525
Maintenance and Installation - 18
SAP Installation: Obtain Information
s
note n
P
SA allatio
nst
for i
IB
M
AP I n
AR fo
SAP Installation Guide
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 19
The first step in any installation is collecting information. In the following charts, a short overview over
the installation steps for SAP WebAS 6.40 SR1 will be given, but these should not be used as reference.
Use the official installation guide(s) instead, that can be downloaded from
http://www.service.sap.com/instguides. Please note that you may need multiple guides. For example, if
you install a complete SAP WebAS release 6.40 SR1, you need four documents: „Planning and
Preparation“ and „Installation and Post-Installation“ for both ABAP and Java.
The installation guides refer to some SAP notes with last minute information as well as the IBM info
APAR‘s with current information about the PTF‘s needed for your system. The SAP notes can be viewed
at http://service.sap.com/notes, the info APAR‘s can be viewed at
http://www.ibm.com/servers/eserver/iseries/service/erp/support.htm.
© SAP AG
ADM525
Maintenance and Installation - 19
SAP Installation: Preparation
Install required
licensed programs
Install PTF‘s
as listed in
info APAR
Install Java
runtime
Configure TCP/IP
Configure
auxiliary
storage pools
(ASP‘s)
Modify startup program
to start important
services automatically
Install secondary
language English
Adjust system
values and
timezone
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 20
These are typical preparation tasks that you need to do before you can start an installation. The complete
list of preparation tasks is given in the SAP installation documentation. Some of the tasks, such as
configuring TCP/IP and installing the required licensed programs, may already have been done, especially
if another SAP system had been installed prior to this. It is always required to check the info APAR for the
latest PTF‘s, because this information changes frequently.
Please note that you have to install the PTF‘s after the licensed programs have been installed. PTF‘s can
only be loaded for products that are already installed, so if you install a licensed program after the PTF‘s,
it is running without PTF‘s.
Installing English as secondary language (for non-English systems) is optional. It is not really required to
run SAP, but it helps the SAP support organization if problems happen and error messages must be
understood.
There may be more preparation steps, always refer to the installation guide for a complete list.
© SAP AG
ADM525
Maintenance and Installation - 20
SAP Installation: High-level Overview (1)
Example: Installing SAP WebAS 6.40 SR1
1
Create SAPINST user on PC and iSeries
2
Install TMK server or create rootbin share
3
Copy CDs/DVDs onto iSeries directories
4
Install ISERPACK if needed (note 707805)
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 21
This and the following two slides show at a high level the steps that you need to perform if you install
SAP WebAS 6.40 SR1. For this and other releases, you need to refer to the installation documentation to
get the complete description of all steps that you need to perform. iSeries-specific steps are indicated by a
striped background pattern.
Before you can start with the installation, you must create a user profile on iSeries with the special
authorities of the QSECOFR (user class *SECOFR) and a corresponding user account on Windows with
administrator rights. Both users must have the same password. The next step is to create a „rootbin“ share
on the iSeries, so that the Windows PC can access the root directory on iSeries. This share must be binary,
so that no character conversion happens between iSeries and Windows. Instead of creating the share
manually, you can also install the TMK server by loading the installation CD onto your PC and execute
SETUP.EXE in subdirectory SAPINST\OS400\AS400\TMKSVR.
Once the rootbin share is available, you must copy the CD or DVD data that is needed for your installation
into directories on the iSeries, so that they can be accessed on both the PC and the iSeries. It is
recommended to copy the data into subdirectories under /tmp/<sid> with <sid> being the designated
system Id for the system to be installed. Note that the path names must not contain spaces.
If fixes are needed for the installation tools, they are provided as „ISERPACK“. The installation note for
your release (for example 789188 for SAP Web AS 6.40 SR1) are telling you if an ISERPACK is needed,
and what number (for example ISERPACK7). SAP note 707805 describes how to install the ISERPACK.
© SAP AG
ADM525
Maintenance and Installation - 21
SAP Installation: High Level Overview (2)
5
Install TMK server from new codebase
6
Install ABAP database (SAPinst)
7
Install ABAP central instance (SAPinst)
8
Post installation steps for ABAP
9
Client copy to productive client
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 22
After the ISERPACK has been applied to your local copy of the CD or DVD, you must install the TMK
server, even if you had installed it already in step 2. This is needed, so that the client and server code
match.
After that, you can start the installation of the ABAP database by executing SAPINST.EXE in
subdirectory SAPINST\OS400\AS400. This will bring up several windows to enter parameters for your
installation before it starts loading the database. Most dialogs are self-explaining, some iSeries-specific
dialogs will be explained later.
Once the database is installed, you can install the ABAP central instance, again by executing
SAPINST.EXE. This also requires several entries before the installation starts. At the end, you can execute
the described post-installation steps, such as granting authority to the operating system command
CHGSYSLIBL and executing several ABAP reports in case of a Unicode installation.
Before you continue with the Java installation, you should perform a client copy (transactions SCC4,
SCCL) with profile SAP_UCSV to setup your productive client. By doing this, the Java user management
is setup correctly for your productive ABAP system.
© SAP AG
ADM525
Maintenance and Installation - 22
SAP Installation: High Level Overview (3)
10 Copy Toolbox JDBC driver
11 Install cryptographic software and policies
12 Create users (SAPJSF, J2EE_ADM, …)
13 Install Java Add-in (SAPinst)
14 Remove SAPinst installation files
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 23
If you are running your Java instance with the Toolbox JDBC driver, it is highly recommended that you
do not use the driver (jt400.jar) from the default IBM directory, but your own copy, for example in
directory /sapmnt/jdbc/Toolbox. By doing so, you ensure that a newer version that was downloaded from
the Internet is not automatically being replaced by an older version that is coming with a PTF package
(such as cumulative PTF package).
If you want to install the J2EE Engine with strong encryption, you need to download the encryption
software from SAP (http://service.sap.com/swdc → SAP Software Distribution Center → Download →
SAP Cryptographic Software) and the JCE policy files from IBM
(http://www.ibm.com/developerworks/java/jdk/security/index.html). The JCE policy files need to be
copied into directory \QIBM\ProdData\Java400\jdk14\lib\security.
In order to allow the J2EE server accessing the ABAP server, you must create several user ids in the
ABAP server, such as SAPJSF_<sid>, J2EE_ADM_<sid>, and J2EE_GST_<sid>. Now you can install
the Java Add-in by starting SAPINST.EXE in subdirectory SAPINST\OS400\AS400, filling in the
(mostly self-explaining) user dialogs and starting the installation.
Once the installation is finished successfully, you can delete the temporary directories that were needed
during the installation. If you use the recommended defaults, this would be /tmp/<sid> with the copies of
the CDs or DVDs and /usr/sap/SAPinst with the temporary SAPinst files.
© SAP AG
ADM525
Maintenance and Installation - 23
SAP Installation: TMK Server Installation Dialog
Server name
for SAP
installation
SAPINST
user profile
and
password
Select
to create
a TMKSVR
instance
SAPINST\OS400\AS400\TMKSVR\SETUP.EXE
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 24
This is the first screen that you get when you start installing the TMK Server. If you created a SAPINST
user profile for both Windows and iSeries, you should specify that profile and its password here. You
should also select the box to create a TMKSVR instance. The instance number of the TMK server is not
related to the instance number of your SAP instance, so you can pick any number here. Only if you run
multiple installations – maybe in different SAP releases – on the same system, you need to be careful
when selecting the TMKSVR instance number, so that you get unique instances and ports for each
installation.
© SAP AG
ADM525
Maintenance and Installation - 24
SAP Installation: SAPinst Start Dialog
Drive letter of „rootbin“ share, for example I: \\as0030\rootbin
Port number
must match
TMK server
port (see
previous
slide)
SAPINST
user profile
and
password
SAPINST\OS400\AS400\SAPINST.EXE
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 25
When you execute the SAPINST executable, you have to connect to the TMK server first. Usually you
can use the default port, unless you changed the port number when installing the TMK server. If you
cannot connect to the TMK server, you can check if subsystem TMKSVR<nn> is active (with <nn> being
the instance number of your TMK server, for example 01), and if a job named DISPATCH is active in that
subsystem. After you have connected successfully, you should also see a job named SAPINST in that
subsystem.
© SAP AG
ADM525
Maintenance and Installation - 25
SAP Installation: Kernel Library
SAPinst SAPINST@as0030.wdf.sap.corp
ABAP System > Kernel Library for System SID
Specify the SAP kernel library parameters
SAP Kernel Library
Kernel Library Name R3640UOPT
Library Location
Load a new kernel library from DVD / CD
Use existing library
Additional Information
The system needs a library that contains executables and other …
Recommendation:
Use separate kernel library for each SAP system
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 26
This and the following pictures are showing iSeries-specific screens that you will see during the
installation. The screens should be mostly self-explaining. If you do not know what to enter, you can read
the „Additional Information“ section or use the F1 key on input fields.
When specifying the kernel library, you can use an existing library or copy the kernel from the DVD or
CD into a new library whose name you can define here. Even though it is possible to share kernel libraries
between multiple SAP, it is not recommended to do so. Whenever you replace the kernel with a newer
patch level, you need to shut down all SAP systems that use this kernel, and the change(s) will affect all
SAP systems that share the kernel.
© SAP AG
ADM525
Maintenance and Installation - 26
SAP Installation: PTF Check
SAPinst SAPINST@as0030.wdf.sap.corp
IBM DB2 UDB for iSeries > PTF Level Check
Specify whether you want the installation to check your current system PTF level
PTF Check
If you select this option, the installation checks your current PTF
level against the IBM INFOAPAR. INFOAPAR must exist in
/usr/sap/trans/config.
Execute PTF Check √
INFOAPAR Source
Copy INFOAPAR from Kernel DVD
Keep existing INFOAPAR
Additional Information
Checking against the IBM INFOAPAR delivered with the Kernel …
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 27
In order to ensure that your system is up to date with PTF‘s, the installation is comparing the PTF‘s that
are installed on your system with the PTF‘s that are listed in the IBM info APAR for your operating
system release (for example, II13337 for OS/400 V5R2M0 or II13868 for i5/OS V5R3M0). On the kernel
DVD, SAP is shipping versions of the info APARs that were current when the shipped SAP release ran
through final verification, so the installation should run successfully at that level. However, you may want
to check your PTF level agains a newer version that you downloaded from IBM. In that case you need to
copy the info APAR into directory /usr/sap/trans/config manually. The name must be INFOAPAR.vrm
with vrm being the version, release and modification of the operating system, such as INFOAPAR.530 for
i5/OS V5R3M0.
© SAP AG
ADM525
Maintenance and Installation - 27
SAP Installation: Secondary Language Library
SAPinst SAPINST@as0030.wdf.sap.corp
IBM DB2 UDB for iSeries > Language Options
Enter the SAP codepage of the system and specify a secondary language library, if required
SAP System Language Options
SAP Codepage
4102
Secondary Language Library QSYS2924
Additional Information
The SAP codepage for an ASCII Latin-1 system is 1100; the SAP codepage
for a Unicode system is 4102.
If English is not your primary language, you must install an English
secondary language library on your iSeries host. This is necessary for SAP
to provide support. Install this library before you continue the installation. …
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 28
If your iSeries has been installed with a primary language other than English, it is highly recommended to
install English as a secondary language in order to make problem determination easier for the world wide
support organizations of SAP and IBM. Objects for a secondary language are stored in libraries named
QSYS<xxxx>, with <xxxx> being replaced by the language code. For English, you would use QSYS2924
on an operating system with Single Byte Character Set or QSYS2984 on an operating system with Double
Byte Character Set. Note that the operating system character set is completely independent from the SAP
character set or codepage.
If you specify the name of a secondary language library, the installation makes shure that this library is in
the first position of the library list of all SAP work processes. That ensures that messages in the joblog are
all in English.
Attention! If you have a secondary language installed and upgrade your operating system to a higher
release level, you must also upgrade your secondary language to the same release. Otherwise you may
encounter a wide variety of errors when trying to start your SAP system (see SAP note 805447).
© SAP AG
ADM525
Maintenance and Installation - 28
SAP Installation: Auxiliary Storage Pools
SAPinst SAPINST@as0030.wdf.sap.corp
IBM DB2 UDB for iSeries > SAP Database Library ASPs
Enter the SAP database library ASPs
Attention
The Database Library ASP and the Journal Receiver Library ASP must exist in
your system.
SAP System ASPs
The journal receiver library R3<SAPSID>JRN is associated with the database
library R3<SAPSID>DATA. Keep the libraries that contain the data objects and
their associated journal receivers in different ASPs. This enables data recovery
after disk failures, and improves performance.
Database Library ASP
1
Journal Receiver Library ASP 2
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 29
As part of the installation preparation you should have configured your disk units into one or multiple
Auxiliary Storage Pools (ASPs) by using the System Service Tools (SST). During the SAP installation
you must specify the ASP numbers where the database library and the journal receiver library are going to
be installed. For a production system it is highly recommended to store the database and the journal
receives in different ASPs, for a test system you could also specify the same ASP for both.
© SAP AG
ADM525
Maintenance and Installation - 29
SAP Installation: Viewing Log Files
I:\usr\sap\SAPinst\NW04SR1\WEBAS_ABAP_DB4_UC\DB\log…
EBCDIC
ÙóöôðäÕôäaÙóÓÖÁÄÄÂôz@âãÁÙã@ÖÆ@ÓÖÇz@òððõð÷ð÷ñðõòôõ%%
ÙóöôðäÕôäaÙóÓÖÁÄÄÂôz@¢ƒƒ¢‰„@|M{]@[É„z@aa‚ ¢aöôðmÙÅÓ
a¢™ƒaÙó“„aÙó“– „aÙó“„” ‰•Kƒ{÷@[@âÁ×%ÙóöôðäÕôäaÙóÓÖÁ
J:\usr\sap\SAPinst\NW04SR1\WEBAS_ABAP_DB4_UC\DB\log…
ÄÄÂôz@¥…™¢‰–•@ÙöKôðaåñKô@ºäÕÉÃÖÄÅ»%ÙóöôðäÕôäaÙóÓÖÁÄ
ÄÂô@`ƒ£†@É@a£”—aÕôäaŧ—–™£aÕæðôâÙñäÅç×aÅç×òaÄÁãÁaâÁ
R3640UN4U/R3LOADDB4: START OF LOG: 20050707105238
×Á××ÓñKâãÙ@a£”—aÕôäaŧ—–™£aÕæðôâÙñäÅç×aÅç×òaÄÂaÄÄÓÄ
ÂôKã×Ó@a¤¢™a¢ —aâÁ׉•¢£aÕæðôâÙñaæÅÂÁâmÁÂÁ×mÄÂômäÃaÄ
R3640UN4U/R3LOADDB4: sccsid @(#) $Id: //bas/640_R…
ÂaâÁ×Á××ÓñKãâÒ@ÄÂô@`“@a¤¢™a¢ —aâÁ׉•¢£aÕæðôâÙñaæÅÂÁ
R3640UN4U/R3LOADDB4: version R6.40/V1.4 [UNICODE]
âmÁÂÁ×mÄÂômäÃaÄÂaâÁ×Á××ÓñK“–‡@%%%ÙóöôðäÕôäaÙóÓÖÁÄÄÂ
R3640UN4U/R3LOADDB4 -ctf I /tmp/N4U/Export/NW04SR…
ôz@‘–‚@ƒ–”—“…£…„%ÙóöôðäÕôäaÙóÓÖÁÄÄÂôz@ÅÕÄ@ÖÆ@ÓÖÇz@ò
/usr/sap/SAPinst/NW04SR1/WEBAS_ABAP_DB4_UC/DB/SAP…
ððõð÷ð÷ñðõòô÷%%ÙóöôðäÕôäaÙóÓÖÁÄÄÂôz@âãÁÙã…
R3640UN4U/R3LOADDB4: job completed
R3640UN4U/R3LOADDB4: END OF LOG: 20050707105242
…
Share
without
text
conversion
(rootbin)
Share with text conversion
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 30
If you choose defaults for log file generation, SAPinst is writing log files into subdirectories of
/usr/sap/SAPinst. The log files that are created during the database load phase are coded and tagged as
EBCDIC files, so when you try to read them over your rootbin share, you will only see garbage displayed.
The rootbin share is created as binary share, so no text conversion is performed. In order to read the log
files from your PC, you need to use a second share that performs text conversion. Alternatively you can
use EDTF or DSPF on the iSeries 5250 emulation.
© SAP AG
ADM525
Maintenance and Installation - 30
SAP Installation: R3SETUP Tool (up to Release 4.6D)
===>
===> LODRUN
LODRUN DEV(*OPT)
DEV(*OPT)
DIR('/OS400/AS400/INSTALL')
DIR('/OS400/AS400/INSTALL')
Library R3SETUP
===>
===> ADDLIBLE
ADDLIBLE LIB(R3SETUP)
LIB(R3SETUP)
===>
===> CD
CD '<install
'<install directory>'
directory>'
SAP
SAP R/3
4.6D EXT
Copy
GATEWAY.R3S
DIALOG.R3S
DBR3CP.R3S
DBEXPORT.R3S
DATABASE.R3S
CENTRAL.R3S
CENTRDB.R3S
===>
===> R3SETUP
R3SETUP '–f
'–f CENTRDB.R3S'
CENTRDB.R3S'
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 31
Up to SAP release 4.6D, the installation and related tasks were performed by a tool called R3SETUP. This
tool also provides a graphical user interface running on a PC, but it can as well be used standalone on the
5250 emulation of the iSeries. For a new installation, you first need to copy the library R3SETUP with it‘s
objects from the installation CD to your iSeries server. This can easily be done by the LODRUN
command. The LODRUN tool restores a program named QINSTAPP from the CD into library QTEMP
and executes it. The program QINSTAPP then restores the library R3SETUP with a command and a menu
object named R3SETUP.
The installation is controlled by control files that contain the necessary steps for the different installation
types. You can copy them from the CD to a local directory and then execute the command R3SETUP with
the name of the control file and follow the dialogs on the screen. Through the dialogs, you can specify the
System ID and all the other information that is needed to install a system.
© SAP AG
ADM525
Maintenance and Installation - 31
SAP Installation: Start and Stop SAP
Sign on as
QSECOFR
or other user
Sign on as
<sid>OFR
===>
===> CALL
CALL PGM(R3<sid>400/R3INLPGM)
PGM(R3<sid>400/R3INLPGM)
===>
===> STARTSAP
STARTSAP SID(<sid>)
SID(<sid>)
INSTANCE(*ALL)
INSTANCE(*ALL)
===>
===> STOPSAP
STOPSAP SID(<sid>)
SID(<sid>)
INSTANCE(*ALL)
INSTANCE(*ALL)
Start SAP
system
Stop SAP
system
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 32
The STARTSAP and STOPSAP commands in the SAP kernel library are used to start or stop SAP
instances. The require the SAP system ID (<sid>) and the instance number or *ALL, if you want to start
all local instances. There are a few more parameters, but those can usually be left as their defaults. The
commands require a certain set of environment variables that are automatically set when you sign on as
<sid>OFR. If you sign on with another user profile, you can set them by executing program R3INLPGM
in library R3<sid>400 (this is also specified as initial program in user profile <sid>OFR).
If you sign on as <sid>OFR, you will see the menu R3MAIN as initial menu. If you select option 1
„General SAP Tasks“, you will get the menu R3TASKS displayed that offers STARTSAP and STOPSAP
as menu items 1 and 3.
© SAP AG
ADM525
Maintenance and Installation - 32
SAP Maintenance: Concept for Binary Patches
*PGM
R3INSTFIX
Patch
specific
data
*SAVF
SAPCAR
<filename>.SAR
CPYTOSTMF
FTP
<filename>.SVF
<filename>.STM
Download
<filename>.SAR
<filename>.SVF
<filename>.STM
*LIB PCH<SID>
APYR3FIX
SAP
C
AR
FTP
F
STM
M
R
F
CPY
*SAVF
e
cut
e
x
E
*PGM
R3INSTFIX
Unp
ack
Patch
specific
data
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 33
Binary patches for SAP WebAS on iSeries are packaged in save files. In order to be downloadable from
the SAP Service Marketplace (http://service.sap.com/patches), the save file must be converted into a flat
file (i5/OS: „stream file“). Depending on the SAP release and patch type, there are three different ways to
convert the save file object which are identified by the file name extension: SAR indicates that the
SAPCAR tool was used, SVF indicates that FTP was used, and STM indicates that CPYTOSTMF was
used.
In order to apply a patch, you must first download the flat file from the SAP Service Marketplace to a
directory that can be reached from the iSeries, usually shared with the PC that you are downloading with.
Then you signon as <SID>OFR and use the command APYR3FIX to unpack the patch. This tool performs
the appropriate action to convert the stream file into a save file and restore the contents of the save file to a
temporary library. You can specify your own library there, otherwise the APYR3FIY tool will create a
library named PCH<SID> and restore the objects to it. It then executes the program R3INSTFIX, which
installs the patch specific data to the kernel library.
© SAP AG
ADM525
Maintenance and Installation - 33
SAP Maintenance: Applying Binary Patches
Download patches to
local directory on iSeries
Create copy of kernel library
• Signon as QSECOFR
• SAVLIB DEV(*SAVF)
• RSTLIB DEV(*SAVF) RSTLIB(new lib)
• ADDLIBLE LIB(new lib)
• FIXR3OWNS LIB(new lib) OBJ(*ALL)
Signon as <SID>OFR
Shutdown all local instances
Replace old kernel libray in
library list with copied library
Run RMVR3KRN to remove
current kernel from SAP system
Run APYR3FIX on copied library
for each patch separately
Run APYR3KRN to apply copied
kernel library to SAP system
SAP Note 49365
Start all instances
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 34
When you apply binary patches, you should operate on a copy of a kernel library. For certain patches,
such as DW or LIB_DBSL, this is a requiremend, for others it is highly recommended. To create a copy,
you must signon as QSECOFR or a user with similar authorities because some program authorities will be
lost during the save/restore operations and need to be restored with the FIXR3OWNS command. The
FIXR3OWNS command is available from release 4.6D onward, prior to that release you must call the
program named FIXR3OWNS with the library name and ‘*ALL‘ as parameters.
The activities on the left side of the slide can be done at any time while the SAP system is active. Only the
RMVR3KRN and APYR3KRN commands require the SAP system to be ended. The procedure for
applying binary patches on iSeries is described in SAP note 49365, which covers all supported releases.
If you want to distribute the kernel library with the new patches to other systems in your landscape, you
can use SAVLIB/RSTLIB to copy the kernel library to the other systems. After that, you must run
FIXR3OWNS to correct the authorities. In order to use the kernel, you must apply it with APYR3KRN.
This command copies all necessary objects from the kernel library into directory
/usr/sap/<SID>/SYS/exe/run and creates symbolic links to the objects in the kernel library as needed.
© SAP AG
ADM525
Maintenance and Installation - 34
SAP Maintenance: The APYR3FIX Command
Apply R/3 Fix (APYR3FIX)
Type choices, press Enter.
SAP system ID . . . . . . . . . > SID
From save file . . . . . . . . . > DW
Library . . . . . . . . . . . >
YOURLIB
Saved library . . . . . . . . . > GEN640UOPT
Kernel library to be processed
> MYKRNCPY
Executable Path To Be Updated .
*SYSEXERUN
Install Program . . . . . . . .
R3INSTFIX
Get save file from stream file
*YES
Stream file host . . . . . . . .
*LOCAL
Stream file directory . . . . . > '/tmp/download'
Stream file name . . . . . . . . > DW_82-20000565.SAR
Only allow SIDOFR to patch . . .
*YES
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 35
When using the APYR3FIX command, the following parameters are required or recommended:
SAP system ID: Enter the system ID that you want to apply the patch for. This parameter is required.
From save file and Library: This is the name of the save file that the patch is extracted to. It must be the
same name as the patch, that is the stream file name without the patch number and the suffix, for
example DW in the example above. If the save file does not exist, it is being created, otherwise it‘s
content is overwritten. You can speficy any library except QTEMP.
Saved library: This name depends on the kernel release and code page, in the example it is 6.40 Unicode.
You can find the correct entry for your release in SAP note 49365.
Kernel library to be processed: If you are working on a copy of the kernel library (recommended), you
must specify the name of your library here.
Stream file directory: This is the directory where you downloaded the patch file.
Stream file name: The default (*SAR) or other special values (*SVF, *STM) are not recommended here,
because those values require the save file specified above to have the same name as the stream file
excluding the extension (for example: DW.SAR). Instead, you should specify the stream file name as
you downloaded it from the SAP Service Marketplace.
The other parameters of the command can and should be left at their default values.
© SAP AG
ADM525
Maintenance and Installation - 35
Homogeneous System Copy: Methods for iSeries
Standard process:
Homogeneous
system copy
System PRD
DB Export
Simplified process:
Homogeneous system
copy on iSeries
SAVLIB
R3PRDDATA
Export files
SAP WebAS ABAP
2.5 GB Data Cartridge
System QAS
DB Import
R3QASDATA
RSTLIB
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 36
Usually a homogeneous system copy is performed by exporting the database from the source system and
importing the database into the target system. With SAP WebAS ABAP on iSeries, you can save and
restore the database library, even if the target system has a different SID than the source system. This
works for most applications, as long as there are no dependencies on the system name within the database.
Applications that cannot be copied by the save/restore method, such as CRM, can still be copied using the
standard process. Also SAP WebAS Java must be copied using the standard process. Using the
save/restore method can save a significant amount of time, especially when the SAVLIB step is
considered part for your regular backup operation.
© SAP AG
ADM525
Maintenance and Installation - 36
Homogeneous System Copy: Selecting the Method
SAPinst SAPINST@as0030.wdf.sap.corp
ABAP System > Database
Select the database installation method
Database Installation
Installation Method
Standard Installation
Standard System Copy / Migration (R3load-Based)
IBM DB2 UDB for iSeries-Specific: Homogeneous
System Copy (SAVLIB/RSTLIB Method)
IBM DB2 UDB for iSeries-Specific: ASCII to Unicode
Codepage Conversion
Additional Information
To install a new SAP system database, choose Standard Installation. The …
SAP note 585277
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 37
When you perform a homogeneous system copy with the SAPinst tool, you start as if you were installing a
database instance. As one of the first steps you can choose to perform a homogeneous system copy, and
you can select the method that you want to use. SAP note 585277 contains some more information about
the homogeneous system copy on iSeries.
Note that this screen also offers a selection to perform an optimized ASCII to Unicode codepage
conversion for Latin-1 systems. Additional information about that conversion can be found in SAP note
800791.
© SAP AG
ADM525
Maintenance and Installation - 37
Homogeneous System Copy: Parameters for Copy
SAPinst SAPINST@as0030.wdf.sap.corp
IBM DB2 UDB for iSeries > System Copy Parameters
Enter the old SAP system ID and the save file that you want to restore
System Copy Parameters
Original SAP System ID
PRD
Original Save File
Additional Information
The SAP system ID of your original system and the name of the save file (for
example, MYLIB/R3SAVF) that contains the original system‘s data library are
used to compute the restore command.
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 38
If you selected to perform the homogenous system copy by using the SAVLIB/RSTLIB method, you must
now specify the SID of the system that you have saved. Here it is assumed that you saved the database
library into a save file, but the save file name is only used to build the proper RSTLIB command. If you
are using a backup tape, you can leave the save file name blank and adopt the RSTLIB command later.
© SAP AG
ADM525
Maintenance and Installation - 38
Homogeneous System Copy: Restore Command
SAPinst SAPINST@as0030.wdf.sap.corp
IBM DB2 UDB for iSeries > Restore Command
Confirm the restore command for restoring the SAP database library
Homogeneous System Copy Restore Command
Restore Command RSTLIB SAVLIB(R3PRDDATA) DEV(*SAVF) SAVF() RSTL
Additional Information
This restore command is used to restore your saved database library.
Suggested restore command:
RSTLIB SAVLIB(<source_database_library>)
DEV(*SAVF) SAVF(<lib>/<file>) OPTION(*NEW)
RSTLIB(R3<target_SID>DATA) OUTPUT(*PRINT)
MBROPT(*ALL) ALWOBJDIF(*ALL)
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 39
Based on your previous input, the installation tool suggests a RSTLIB command to use for restoring the
library. If you want to restore from a save file, the suggested command can be used without change. If you
restore from a tape, you specify the tape device name in the parameter DEV and omit the parameter
SAVF. The parameter OPTION(*NEW) is important if you rename the SAP system ID during the copy. If
you leave it out, your catalog views will be incorrect after the restore.
The parameters MBROPT(*ALL) and ALWOBJDIF(*ALL) are needed when the library is restored over
an existing library without renaming the SAP system ID. They are without effect when specified together
with OPTION(*NEW).
© SAP AG
ADM525
Maintenance and Installation - 39
System Copy: Pitfalls During Save/Restore Method
*JRNRCV
QSQJRN0245
*LIB R3PRDJRN
PRDOWNER
*JRN QSQJRN
*JRN QSQJRN
SYSTABLES
SYSTABLES
… DBXLIB =
‘R3PRDDATA‘
… DBXLIB =
‘R3PRDDATA‘
QDFTOWN
TABLE /
VIEW /
INDEX
TABLE /
VIEW /
INDEX
*LIB R3PRDDATA
*LIB R3QASDATA
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 40
When copying the database library without using SAPinst, there are a few pitfalls, especially when the
SID is changed during the copy. These are the most common problems:
1. When restoring a library to another name, the journal QSQJRN cannot be restored to that new library.
If the journal is not available, journaling cannot be started for the tables that are restored to the library.
This makes it impossible to work with the SAP system later, because journaling is required to run
under commitment control.
2. The system catalog views in the database library, such as SYSTABLES or SYSINDEXES, contain a
hard-coded reference to the library name. When you restore the database library to a different name,
the hard-coded names in the catalog views will not be changed to reflect the new library name.
3. Usually, all database objects of an SAP WebAS ABAP system are owned by group profile
<SID>OWNER. If user profile PRDOWNER does not exist on the target system while restoring the
library, object ownership gets automatically transferred to a default owner called QDFTOWN.
Otherwise the objects in library R3QASDATA will be owned by PRDOWNER as on the source
system. Both cases will most likely result in authority problems when trying to start the SAP system
QAS.
© SAP AG
ADM525
Maintenance and Installation - 40
System Copy: Preventing and Fixing Pitfalls
Prevent problem
Fix problem
QDFTOWN
AS4FIXFILE
DBLIB(R3QASDATA)
CHGOWN(*YES)
Wrong owner
SAPinst taking care of all!
*JRN QSQJRN
Missing journal
STRSQL/SQLUTIL:
CREATE COLLECTION
R3QASDATA
prior to restore
RSTLIB OPTION(*NEW)
RSTLIB(R3QASDATA)
CRTJRN
JRN(R3QASDATA/QSQJRN)
AS4FIXFILE
DBLIB(R3QASDATA)
STRJRN(*YES)
SYSTABLES
… DBXLIB =
‘R3PRDDATA‘
CALL
PGM(QSYS2/QSQXRLF)
PARM(DLT R3QASDATA)
CALL
PGM(QSYS2/QSQXRLF)
PARM(CRT R3QASDATA)
Wrong catalog views
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 41
The three mentioned pitfalls can be prevented by using SAPinst in order to do the homogeneous system
copy. If you want to execute the copy manually, for example because you simply want to refresh the
quality assurance system with the latest copy of the production system, you need to make sure that the
SQL collection (the library R3<SID>DATA with the journal QSQJRN and the catalog views) exists prior
to restoring the library. You would then use the RSTLIB command with OPTION(*NEW) to restore the
remaining database objects. After that you will have to execute AS4FIXFILE in order to change the owner
to QASOWNER and start journaling for all tables.
If something went wrong and you want to correct the situation, you can use the tools that are shown on the
right side of the slide. AS4FIXFILE is a tool that is provided by SAP and allows to perform certain actions
for all objects in the database library. Program QSQXRLF in library QSYS2 is provided by IBM and can
be used to delete and recreate the broken catalog views.
© SAP AG
ADM525
Maintenance and Installation - 41
iSeries Maintenance: Unit Summary
You should now be able to:
z Perform initial program loads (IPL‘s)
z Apply program temporary fixes (PTF‘s)
z Describe i5/OS-specific steps during the installation
of an SAP system
z Install SAP patches
z Performing a homogeneous system copy by saving
and restoring the database library
SAP AG 2004, ADM525 Maintenance and Installation / Christian Bartels / 42
© SAP AG
ADM525
Maintenance and Installation - 42
Exercises
Unit: Maintenance and Installation of SAP on iSeries
Topic: PTF Installation and Homogeneous System Copy
At the conclusion of this exercise, you will be able to:
• Identify the current PTF levels for the system or a specific program
object
• Describe main PTF attributes
• Recognize and repair problems during a homogeneous system copy
As a system administrator you will have to load and apply program
temporary fixes (PTFs). It is important to understand the concepts of PTF
pre- and co-reqs in order to apply PTFs correctly. Performing a
homogeneous system copy through save/restore has some pitfalls,
especially when you simply restore and rename the database library rather
than using the SAPinst tool. It is important to recognize these potential
pitfalls and to know how to fix them.
1-1
Sign on to the iSeries server
1-1-1 On your workstation, start the 5250 Emulation to the class server.
1-1-2 Sign on with user name ADM525## and password PWADM525##.
1-2
Find the current PTF levels for the system
1-2-1 Identify the newest installed cumulative PTF package by using the
command DSPPTF for product 5722SS1. The top entry in the list starts
with “TC0”, followed by a four digit number. The first digit in that number
is the production year of the cumulative PTF package, the remaining 3
digits are the production day in that year.
In what year was the newest installed cumulative package created: ___
At what day was the newest installed cumulative package created: ______
What is the status of that package: ________________________________
1-2-2 Identify PTF groups that are installed on your system. Use the command
WRKPTFGRP to display installed PTF groups. In the resulting display,
you can use function key F11 to toggle between the installed level and the
text description. Find the PTF group with the text “DB2 UDB FOR
ISERIES”.
What is the PTF group name: __________________
What is the PTF group level: ______
1-2-3 You can also identify the PTF level of individual objects by using the
command DSPOBJD with parameter DETAIL(*SERVICE). You must
scroll to the second page to see the current PTF level. In order to get two
PTF numbers for the next exercise, write down the PTF levels for the
objects QSQSTATS and QQQIMPLE. Both objects are located in library
QSYS and of type *PGM.
What is the PTF level for QSQSTATS: __________________
What is the PTF level for QQQIMPLE: __________________
1-3
Describe the main attributes of a PTF
1-3-1 Enter the command DSPPTF for product 5722SS1 and the PTF number
that you wrote down for program QSQSTATS. Try the different menu
options to fill in the requested information below:
What is the PTF status: ___________________________________
Is this an immediate or delayed PTF: ________________________
Does the PTF have pre-/co-reqs: ______
Is option 3 “Prerequisite Licensed Internal code fixes” displayed: ______
How many objects are included in this PTF: _________
1-3-2 Enter the command DSPPTF for product 5722SS1 and the PTF number
that you wrote down for program QQQIMPLE. Try the different menu
options to fill in the requested information below:
What is the PTF status: ___________________________________
Is this an immediate or delayed PTF: ________________________
Does the PTF have pre-/co-reqs: ______
Does the PTF require Licensed Internal Code fixes: ______
How many objects are included in this PTF: _________
1-4
Simulate a bad homogeneous system copy
1-4-1 Verify that you still have the SQL collection R3A##DATA and the save
file SAVEFILE in library R3A##JRN from the previous exercise. Clear
save file R3A##JRN/SAVEFILE with the CLRSAVF command.
1-4-2 Save your SQL collection (library R3A##DATA) into the save file that
you just cleared. To do so, type the command SAVLIB and prompt it
using function key F4. Fill in “R3A##DATA” as the library name and
“*SAVF” as the device. When you hit the enter key, additional parameters
will appear. Specify the name and library of the save file
(R3A##JRN/SAVEFILE).
1-4-3 Delete your SQL collection R3A##DATA with the DLTLIB command.
1-4-4 Restore the saved library R3A##DATA from save file
R3A##JRN/SAVEFILE into a different library to simulate a homogeneous
system copy. To do that, prompt the command RSTLIB. Specify
R3A##DATA for the saved library and *SAVF for the device, then press
function key F10 for additional parameters. Type in the save file name and
library, and scroll down until you see the parameter “Restore to library”.
Type in R3B##DATA here (make sure the name is different from the
original one!). Notice the error message at the end. If you place the cursor
at the message line and hit F1, you can see the complete error message. If
you hit F10 on this screen, you also get preceding messages in the joblog.
1-5
Identify problems with the bad copy
1-5-1 Start an interactive SQL session with the STRSQL command. To verify
that we have still the correct commitment control level, press function key
F13 (Shift+F1) and select option 1 “Change session attributes”. If the
commitment control is not *CHG, change it to *CHG. Return to your SQL
session.
1-5-2 Try to insert another row into your table TESTTABLE, using the SQL
statement: INSERT INTO R3B##DATA/TESTTABLE VALUES(30,
'Row number 30'). What is the error message:
___________________________________________________________
1-5-3 Place the cursor on the error message and hot F1. This will give you the
complete error message. At the top you should see the message ID
SQL7008.
What is the reason code: ___
1-5-4 Try to find table TESTTABLE in the catalog view SYSTABLES by using
the SQL statement: SELECT * FROM R3B##DATA/SYSTABLES
WHERE TABLE_NAME = 'TESTTABLE'
How many rows to you see: ______
1-5-5 Leave the interactive SQL session with function key F3. On the command
line, use the command DSPFD to look at the description of catalog view
SYSTABLES in library R3B##DATA. Scroll down to see the view create
statement. The catalog view is limited to a specific library by checking a
specific value in field DBXLIB in the WHERE clause. What is the value
for the library:
DBXLIB = ___________________________
1-6
Simulate a correct homogeneous system copy
1-6-1 First delete the bad copy by using the DLTLIB command for library
R3B##DATA.
1-6-2 Start an interactive SQL session, using the command STRSQL. In the SQL
entry screen, enter the command to create a collection named
R3B##DATA:
CREATE COLLECTION R3B##DATA
1-6-3 Commit the creation of the collection and leave the SQL session with
function key F3.
1-6-4 Restore all additional objects from your saved library R3A##DATA over
the newly created collection R3B##DATA by prompting the RSTLIB
command. Type in R3A##DATA for the saved library and *SAVF for the
device and hit F10 for additional parameters. Specify SAVEFILE and
R3A##JRN as the name and library of the save file. Select *NEW for the
option parameter and *ALL for the “database member option”. Scroll
down one page and type in R3B##DATA for the parameter “restore to
library“. Hit enter to restore the library. You will still see an error because
journaling could not be started.
1-6-5 Add an SAP kernel library to your library list. Use the command
ADDLIBLE and ask the instructor for the name of the SAP kernel library.
1-6-6 Execute the command AS4FIXFILE for your data library R3B##DATA
and select to start journaling.
1-6-7 Verify that your library is useable now by starting interactive SQL again
(STRSQL). Try to insert a row with SQL statement: INSERT INTO
R3B##DATA/TESTTABLE VALUES(30, 'Row number 30')
Does this work now: _____
1-6-8 Check the catalog views with the SQL statement: SELECT * FROM
R3B##DATA/SYSTABLES WHERE TABLE_NAME = 'TESTTABLE'
How many rows do you see: _____
Solutions
Unit: Maintenance and Installation of SAP on iSeries
Topic: PTF Installation and Homogeneous System Copy
1-2
Solution to Step “Find the current PTF levels for the system”
1-2-1 The year and day may vary; for example if DSPPTF 5722SS1 is showing
“TC05102”, then the year is 2005 (from the “05” after TC), and the day is
102 (the last three digits), that is April 12th. The status is typically
“Temporarily applied”.
1-2-2 The PTF group name depends on the release level of the operating system,
for i5/OS V5R3M0 it is SF99503. The level is varying and depends on the
system installation.
1-2-3 The PTF levels of QSQSTATS and QQQIMPLE also vary, you need to
check on the classroom system.
1-3
Solution to Step “Describe the main attributes of a PTF”
1-3-1 The answers can vary and depend on the release and PTF level of the
system. When this course was developed (V5R3M0, SI17610), the
following answers applied:
PTF status: Permanently applied
Immediate or delayed: Immediate
Pre-/co-requisites: Yes
Required LIC fixes: No
Objects included: 1
1-3-2 The answers can vary and depend on the release and PTF level of the
system. When this course was developed (V5R3M0, SI17883), the
following answers applied:
PTF status: Permanently applied
Immediate or delayed: Immediate
Pre-/co-requisites: Yes
Required LIC fixes: Yes
Objects included: 9
1-5
Solution to Step “Identify problems with the bad copy”
1-5-2 “TESTTABLE in R3B##DATA not valid for operation.”
1-5-3 Reason code: 3
1-5-4 Number of rows: 0
1-5-5 DBXLIB = R3A##DATA
1-6
Solution to Step “Simulate a correct homogeneous system copy”
1-6-7 Does this work now: Yes
1-6-8 How many rows do you see: 1
Problem and Performance Analysis for SAP on iSeries
Contents:
z I5/OS Diagnosis and Performance Analysis Tools
z Platform Specific SAP Tools for Performance Analysis
z Database Performance Analysis Fundamentals
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 1
© SAP AG
ADM525
Problem and Performance Analysis - 1
Problems & Performance: Unit Objectives
After completing this unit, you will be able to:
z Analyze problems by using i5/OS logs
z Identify performance bottlenecks by using i5/OS
tools
z Identify performance bottlenecks by using SAP
transactions ST06 and DB4COCKPIT
z Analyze slow database requests and design
indexes to improve performance
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 2
© SAP AG
ADM525
Problem and Performance Analysis - 2
Problems & Performance: Course Overview Diagram
1 Course Overview
2 Concepts of IBM eServer
iSeries and i5/OS
3 SAP Architecture for IBM
eServer iSeries
4 Backup and Recovery
5 Maintenance and Install
6 Problem and Performance
Analysis
7 Conclusion
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 3
© SAP AG
ADM525
Problem and Performance Analysis - 3
Problems & Performance: Business Scenario
z As a system administrator you need to analyze
problems or poor performance. Based on the
analysis, you need to decide if you can fix the
problem yourself, or if you need to involve the
support organizations of SAP or IBM.
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 4
© SAP AG
ADM525
Problem and Performance Analysis - 4
Problem Analysis: SAP Logs
System log
Edit
Goto
Environment
H Å
√
î
X
System
Help
Runtime Errors
H H+ ↑ ↑ ↓ ↓
System Log: Local Analysis of server
Sys log doc. ↑ Section ↓ Section ↓ Contents
SM21
Ty. Nr
Cl. User
18:40:50 DP
18:40:55 UP2 014
18:40:57 DP
18:41:02 SPO 013
18:41:35 DIA 000 000 SAPSYS
18:42:01 DP
18:43:21 DIA 004 000 SAPSYS
18:43:21 DIA 004 000 SAPSYS
18:46:15 DIA 002 000 SAPSYS
Goto
H Å
System
î
Help
X
H H+ ↑ ↑ ↓ ↓
List of selected Runtime Errors
=
++
A V H H
System Log: Local Analsysis of server
Time
Edit
√
Y =
Σ = Z =
ST22
= =
Runtime Errors
Tcod Mno Text
Q0K Connectio
Q01 Start Wor
Q1C MsgServer
Q01 Start Wor
A10 Initializ
Q0G Request (
D01 Transacti
R68 Perform r
GC2 RSDB4DMP
Current DaTime Host
03.08.200518:32 server
03.08.200511:19 server
03.08.200510:26 server
03.08.200509:34 server
03.08.200508:10 server
Name
Cl...K Name o runtime error
USER1 000C LOAD_PROGRAM_CLAS
SAPSYS 000C SYNTAX_ERROR
SAPSYS 000C SYNTAX_ERROR
SAPSYS 000C SYNTAX_ERROR
USER2 000C DBIF_RSQL_SQL_ERRO
I:\usr\sap\SID\DVEBMGS11\j2ee\admin\go.bat
Trace Edit Goto System Help
…\j2ee\admin\logviewer_standalone\logviewer.bat
√
H Å î X
ST11
H H+ ↑ ↑ ↓ ↓
Trace Data: server_SID_11 dev_w2
Log Viewer
+
Local Logs (localhos Find:
SID (server :51104)
Time Category Message
Server 0 11_1117 10:13:20 /Application get data so
usr\sap
10:10:06 /System/Se Originated
ccms\SID_11 10:10:05 /System/Se com.Sapm
SID\DVEBMG 10:10:05 /System/Se javax.mana
Dispatcher 0 11_1 10:10:05 /System/Se java.lang.re
08:02:55
<--- exiting
usr\sap
08:02:55
<--- exiting
08:02:55
-> 08:02:55
08:02:55
<--- exiting
08:02:55
Found the f
Text:
08:02:55
<--- exiting
In column Message
08:02:55
hashval: -13
-
V A Display Components
trc file: “dev_w2“, trc level: 1, release: “640“
*
* ACTIVE TRACE LEVEL
1
* ACTIVE TRACE COMPONENTS
all,M
*
M sysno
11
M sid
SID
M systemid
324 (IBM iSeries with OS/400)
M relno
6400
M patchlevel 0
M patchno
82
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 5
Problem analysis usually starts with SAP logs. For SAP WebAS ABAP, you can use primariy the system
log (transaction SM21), the developer traces (transaction ST11), and so-called short dumps (transaction
ST22). When it comes to problems with the operating system or database, the developer trace usually
provides the most detailed information.
SAP WebAS Java provides a log viewer tool to look at logs that are written by any Java application. There
is an online viewer, that requires the SAP WebAS Java instance to be up and running, and an offline tool
that can be used if the instance does not start. The log viewer can be started by mapping the rootbin share
of the iSeries server to a driver letter on your workstation. You find both log viewers as well as the
documentation in subdirectories of the instance directory.
© SAP AG
ADM525
Problem and Performance Analysis - 5
Problem Analysis: Process Information in Dev. Trace
Trace Data: server_SID_11 dev_w0
…
C
C
C
C
C
C
C
C
…
C
C
C
C
C
C
C
C
Connection to database done without problems.
DbSl EGO Structure
SAPSYSTEMNAME
Character encoding
process class
workprocess id
= SID
= UNICODE
= dialog process
= 0
Connect type
pid
dbjobname
dbjobuser
dbjobno
wpjobname
wpjobuser
wpjobno
= TCPIP SOCKETS
= 27563
= QXDARECVR
= QUSER
= 453056
= WP00
WRKJOB
= SID11
= 203434
WRKPID
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 6
Whenever a work process connects to the database for the first time with its default connection, the
internal structure that keeps all important information about this connection is written to the developer
trace file. You can use this information to find out the information that you need to identify the work
process, and in 3-tier also the database shadow process, at operating system level. The pid (process-id) is
only given for the work process, not the database shadow process. It can be mapped to a job at i5/OS level
by the tool WRKPID, which is provided in the kernel library. Job name, user and number of the work
process or the database shadow process can be entered directly into the i5/OS-command WRKJOB, which
provides a menu to get a wide variety of information about the process.
If a work process gets restarted, the trace file remains the same, but a new work process and database
shadow process will be created. So when you try to get the information about the current jobs that are
assigned to a process, you have to look for the last occurance of the DbSl EGO structure in the developer
trace file. In a 2-tier connection (connect type LOCAL), the work process and the database shadow
process are the same.
© SAP AG
ADM525
Problem and Performance Analysis - 6
Problem Analysis: Mapping Java Server to Process
Error Log File
Selection or command
===> WRKPID PID(49888)
Name: dev_server0
trc file: “/usr/sap/SID/DVEBMGS11/work/dev_server0“, …
node name
: ID111117850
pid
: 49888
system name : SID
system nr. : 11
started at : Fri Aug 5 15:08:02 2005 Work with Job (WRKJOB)
…
Type choices, press Enter.
DMPJVM
Job name . . . . . . . . . . . . > SERVER0
User . . . . . . . . . . . . . >
SID11
Number . . . . . . . . . . . . >
225864
Output . . . . . . . . . . . . .
*
Option . . . . . . . . . . . . .
*SELECT
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 7
For SAP WebAS Java, you can also find trace files in the work directory of your instance. These contain
the process id (pid) of the Java server. To map the pid to an i5/OS job name, you can use the command
WRKPID from the kernel library (this is automatically available when you signon as <sid>OFR). Pressing
enter on the WRKPID command will prompt the WRKJOB command with the qualified job name of the
process that is related to the Java server. Note that the process is running multithreaded. From the
WRKJOB menu, you can use option 20 to display all the threads for the process.
You can use the DMPJVM command to get Java-specific information about your server. The DMPJVM
command needs the qualified job name as input ans produces a spool file as output. In the spool file, you
can find the classpath, garbage collector information, class loader information, and the Java stack of all
threads in the server.
© SAP AG
ADM525
Problem and Performance Analysis - 7
Problem Analysis: Java Thread Analysis
JVM Information 225964/SID11/SERVER0
java.version=1.4.2
sun.boot.class.path=/QIBM/ProdData/Java400/jd…
. Garbage Collection
DMPJVM
Garbage collector parameters
Initial size: 16384 K …
. Thread information
Thread: 00000054 SAPEngine_Application_Thread
Stack:
WRKJOB option 20
com/sap/engine/lib/util/WaitQueue.dequeue…
„Work with threads“
com/sap/engine/core/thread/impl3/SingleTh…
Work with Threads
Job:
SERVER0
User:
SID11
Number:
225964
Aux
I/O
822
9
49
Run
Priority
12
18
22
Type options, press Enter.
Opt
Thread
00000054
00000106
000000C9
Status
JVAW
TIMW
RUN
Total
CPU
.904
.005
12.237
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 8
If you have identified the job that is executing the Java engine, you can use option 20 from the WRKJOB
menu to display the active threads in the job. Here you can see the thread status, such as waiting or
running, how much CPU it is using, and whether a thread is in a lock wait or mutex wait. Threads are
identified by an eight digit hexadecimal number.
The output of DMPJVM contains information about the JVM in general, such as the class path, garbage
collector, or heap settings. It also contains information about each thread, for example the thread function,
the status, the Java stack, and wait information. If the thread information from WRKJOB is showing a
thread that is suspicious, you can find the thread information in DMPJVM by scanning for the thread ID.
© SAP AG
ADM525
Problem and Performance Analysis - 8
Problem Analysis: Get Information from the Joblog
ABAP Runtime Errors
Runtime Errors
Exceptn
Date and Time
DBIF_RSQL_SQL_ERROR
CX_SY_OPEN_SQL_DB
Selection or command
10.08.2005 10:17:40
===> DSPJOBLOG JOB(012345/
SID11/WP23)
How to correct the error
Database error text........: "Row or object SFLIGHT
in R3SIDDATA type *FILE in use. MSGID=
Job=012345/SID11/WP23.
Internal call code.........: "[RSQL/UPDT/SFLIGHT ]“
…
Display Job Log
Job . . : WP23
User . . : SID11
Number . . . : 012345
Prepared statement JyLYeBTKCA not found.
Prepared statement JyLYeA+wCA not found.
Record 13 in use by job 012340/SID11/WP18.
Record 13 in use by job 012340/SID11/WP18.
Row or object SFLIGHT in R3SIDDATA type *FILE in use.
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 9
If you get an ABAP short dump because of a database error, you can see the qualified job name of the job
that caused it. In a 2-tier installation, this would be the work process (such as 012345/SID11/WP23), in a
3-tier installation you would see the database shadow process (such as 123456/QUSER/QXDARECVR).
It can be helpful to look at the joblog of that job, because it often contains more detailed information. To
show the joblog, you can either use the DSPJOBLOG command and specify the qualified job name, or
you can use WRKJOB with the qualified job name and select option 10 from the menu.
In the example shown in the slide, the ABAP short dump only indicates that we had some sort of a locking
issue for a row or a table. Only by looking at the joblog you can see that this was a row locking problem
(„record 13“), and who the holder was (job 012340/SID11/WP18, which would be another work process
of the same instance). You can now look at the job that held the lock to see if it was poorly performing, or
what other reason for the lock existed.
© SAP AG
ADM525
Problem and Performance Analysis - 9
Problem Analysis: Typical Messages in a Joblog
Display Job Log
Job . . : QXDARECVR
User . . : QUSER
Number . . . : 012345
Current library changed to R3SIDDATA.
Information
Library KERNEL not removed from the library list.
only
Library KERNEL added to library list.
Connect from workprocess w9 on server_SID_11
Don‘t
Library R3SYS added to library list.
worry…
…
WBCROSSGFG in R3SID32010 type *SQLPKG not found.
Ownership of object WBCROSSGFG in R3CHB32010 type *SQLPKG …
Prepared statement JyLYeA+wCA not found.
Duplicate key on access path.
Duplicate key value specified.
Worry!
Duplicate record key in member ALGRPCUSGE.
…
Function error X’1720’ in machine instruction. Internal du…
Internal failure occurred in query processor.
SQL system error.
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 10
This slide is showing some typical messages that can appear in the joblog of a database shadow process. In
the beginning of the joblog, you will find some informational messages that do not indicate problems. You
will find a message that is telling you what server and workprocess this shadow process is related to. This
information can be useful in some cases, for example if a database shadow process is holding a lock and
you want to know what SAP user is executing what transaction at the current time.
You will find a lot of messages that you can simply ignore. These include messages „Prepared Statement
… not found“ (SQL0514, SQL0516, or SQL0518), „… in … type *SQLPKG not found“ (SQL0204), and
messages related to duplicate keys (such as SQL0803). The messages related to prepared statements or
SQL packages result from the fact that SQL packages are only created when needed. If the SAP database
interface tries to locate a prepared statement in a specific SQL package and the statement or package does
not exist, it will be prepared or created automatically. So there is no real problem, but you can still see the
messages in the joblog. In the same way you see messages about duplicate keys when SAP tries to insert
rows. When the application does not know whether a specific row exists, it sometimes tries to insert the
row first, and if that fails due to duplicate keys, it updates the existing row. That‘s why you see the
messages in the joblogs while the application continues normal work.
Besides that there can be messages that really indicate an error. Often the SAP logs (SM21, short dump)
only show the last error message („SQL system error, SQL0901), while the joblog is showing more
detailed messages prior to that one.
© SAP AG
ADM525
Problem and Performance Analysis - 10
Problem Analysis: Get Joblog Details
Selection or command
===> DSPJOBLOG OUTPUT(*PRINT)
• Command WRKSPLF
• Display QPJOBLOG
Selection or command
===> DSPJOBLOG OUTPUT(*)
• Position cursor on message
• Press function key F1
CPF5009
Diagnostic
08/05/05
To module . . . : QSQINS
Additional Message Information
To procedure . : SQL_Insert
Statement . . . : 9764
Message ID . . . . . . :
CPF5009
Message . . . . : Duplicate
Date sent . . . . . . :
08/05/05
record key in member …
Cause . . . . . : … MemberMessage . . . . : Duplicate record
number 1 record number 87 key in member ALGRPCUSGE.
format ALGRPCUSGE…
Cause . . . . . : … Member number 1
record number 87 format ALGRPCUSGE
has the same record key as member
number 1 record number 0 format …
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 11
In many cases it will be helpful to look at certain messages in the joblog in more detail. Besides the first
level message text, you will find a second-level text that has more details about the problem and may
explain possible causes. You can also see the message ID, which consists of a 3-digit prefix (such as CPF,
MCH, or SQL) and a 4-digit number. The message ID can be useful if you want to search for known
problems.
Besides that you can see the time stamp when the message was issued, and the programs that were issuing
the message. The programs are shown in the spooled output if you issued DSPJOBLOG
OUTPUT(*PRINT). If you are looking at the joblog interactively, you can use function key F9 on the
„Additional Message Information“ screen to see the sending and receiving program.
© SAP AG
ADM525
Problem and Performance Analysis - 11
Problem Analysis: i5/OS History Log
Command
DSPLOG:
IPL, PTF, and
installation
information
Comm. status
information
Subsystem
and job
information
Backup
information
System
changes
Display History Log Contents
PWRDWNSYS command in progress.
PWRDWNSYS command issued by user QSECOFR…
Unattended IPL in progress.
IPL from machine area ##MACH#B.
PTFs applied or removed during IPL.
Vary on completed for line GIGALINE.
Line ETHLINE vary on failed.
Subsystem R3_11 started.
Job 203929/QUSER/QXDARECVR started on 08/03/05…
Job 203929/QUSER/QXDARECVR ended on 08/03/05 at…
20971 objects saved from library R3SIDDATA
Object QSQJRN in R3SIDJRN type *JRNRCV deleted
Save-while-active request prevented by pending…
System value QPFRADJ changed from 3 to 0.
Default values changed for command SBMJOB.
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 12
The i5/OS history log provides a good overview about important events on your system, such as system
restarts (IPLs), hardware status, subsystem and job information, backup information, and information
about important system changes. Usually it does not contain direct error information, but you can check if
the system environment had changed shortly before an error happened for the first time. The history log
can be displayed with the command DSPLOG. If you position the cursor on a message and press the F1
key, you get additional message information such as the second level message text (which often contains
useful information) and the qualified job name of the job that has issued the message.
© SAP AG
ADM525
Problem and Performance Analysis - 12
Problem Analysis: Selecting History Log Entries
Display Log (DSPLOG)
Type choices, press Enter.
Log . . . . . . . . . . . . . .
Time period for log output:
Start time and date:
Beginning time . . . . . . . .
Beginning date . . . . . . . .
End time and date:
Ending time . . . . . . . . .
Ending date . . . . . . . . .
Output . . . . . . . . . . . . .
QHST
QHST
*AVAIL
*CURRENT
Time,…
Date,…
*AVAIL
*CURRENT
*
Time,…
Date,…
*, …
Additional Parameters
Jobs to display . . . . . . . .
User . . . . . . . . . . . . .
Number . . . . . . . . . . . .
Message identifier . . . . . . .
*NONE
*ALL
Name,…
Name
000000Name,
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 13
Because the history log can contain a huge amount of messages, the DSPLOG command allows you to
narrow down the selection, either by a certain time frame, or by specifying jobs or message Id‘s to look
for. The default for the time range is the current day only. If you want to look at older messages, you need
to specify a beginning date or *BEGIN for the beginning date. By default, messages that are older than 7
days are removed from the history log by the automatic cleanup function (-> GO CLEANUP).
If you want to look for specific events, you can specify a message Id. For example, to find out when the
system was IPL‘ed, you can use the command: DSPLOG PERIOD((*AVAIL *BEGIN))
MSGID(CPI0C04). Other interesting messages for problem analysis might be: CPF35CA “PTFs applied
or removed during IPL”, CPF377F „Save-while-active request prevented by pending record changes“, or
CPF1805 „System value <name> changed from <old value> to <new value>”.
© SAP AG
ADM525
Problem and Performance Analysis - 13
Problem Analysis: i5/OS Expert Service Tools
DBOP Trace
Database monitor
Automatically created:
/tmp/sqe/errors/
<user><job number>/
STRDBMON JOB(…)
ENDDBMON JOB(…)
…
Visual Explain
DBOPTRACE<time>.dbop
Job trace
System Service Tools
STRSRVJOB JOB(…)
TRCJOB SET(*ON)
…
TRCJOB SET(*OFF)
Licensed int. code log
Product activity log
Comm. and LIC traces
Main storage dump
Problem
XDA Trace
PEX Trace
ADDENVVAR QIBM_…
CHGUSRTRC JOB(…)
…
DMPUSRTRC JOB(…)
ADDPEXDFN
STRPEX
…
PRTPEXRPT (5722PT1)
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 14
There are several service tools that can help the IBM or SAP support to narrow down problems that are
located in the SAP kernel or i5/OS.
The Job Trace is tracing the module flow within a job, including program calls and messages that are
being sent. You cannot specify a job name in the TRCJOB command, but you have to use STRSRVJOB.
The XDA Trace is tracing EDRSQL APIs, which SAP WebAS ABAP uses for database access. It is
controlled by environment variable QIBM_COMPONENT_TRACE_LEVEL. The trace data is stored in
user spaces named QP0Z<job number> in QUSRSYS and can be dumped with the DMPUSRTRC
command.
The DBOP Trace (database optimizer trace) is automatically written to subdirectories in /tmp/sqe/errors
when the SQL optimizer encounters problems.
The File Based Database Monitor can be used to analyze slow running SQL requests. It is controlled by
the commands STRDBMON and ENDDBMON, and the data can be evaluated using the Visual Explain
function in iSeries Navigator.
The System Service Tools are invoked by the i5/OS command STRSST and may be needed by the IBM
support. You need a user profile with special authorities *SERVICE and *ALLOBJ as well as a separate
service tools user and password in order to invoke the tools.
The Performance Explorer Trace (PEX trace) can be used for many purposes. To analyze the data, the
Performance Tools product (5722PT1) is required.
© SAP AG
ADM525
Problem and Performance Analysis - 14
Performance Analysis: Concept of a Balanced System
Memory
faulting
CPU
utilization
Disk
utilization
Network
Load
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 15
When optimizing performance, you must make sure that you balance between all components that affect
performance. On iSeries, these are the CPU utilization, the memory faulting, the disk utilization, and the
network load. It does not help performance to add more memory when the CPU is your bottleneck. After
you have identified a bottleneck, you can either add the necessary hardware to remove the bottleneck, or
you can optimize your SAP system so that it needs less resources. In general, the i5/OS performance tools
focus on identifying bottlenecks in the hardware, while the SAP performance tools help to locate
application parts that consume many resources.
© SAP AG
ADM525
Problem and Performance Analysis - 15
Performance Analysis: Management Central Monitors
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 16
The Management Central function in the iSeries Navigator offers a good selection of monitors that allow
you to look at the key performance data of your system. You first need to define a central system, which
collects data for all your system in the network. In the „System“ section of the monitors, you can define
your own monitors to collect information about CPU utilization, disk load, network performance, and
memory consumption. If you select a monitor by a double-click, you get a graphical representation of the
collected values for the last hour.
© SAP AG
ADM525
Problem and Performance Analysis - 16
Performance Analysis: i5/OS Command WRKSYSSTS
CPU Utilization
> 100 % possible with uncapped partitions
Work with System Status
% CPU used . . . . . . . :
% DB capability . . . . :
Elapsed time . . . . . . :
Jobs in system . . . . . :
% perm addresses . . . . :
% temp addresses . . . . :
35.0
1.4
00:37:10
3150
.010
.047
Auxiliary storage:
System ASP . . .
% system ASP used
Total . . . . .
Current unprotect
Maximum unprotect
Type changes (if allowed), press Enter.
System
Pool
1
2
Pool
Size (M)
345.70
7845.35
Max
Active
+++++
162
-----DB----Fault Pages
.0
.0
.6
18.1
Main storage usage (faulting)
---Non-DB--Fault Pages
8.7
9.1
7.1
29.4
> 4 flt/s too high!
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 17
The i5/OS command WRKSYSSTS can be used as a quick method to get a feeling whether the current
CPU load or paging could be responsible for bad performance. The shown data is averaged over the
elapsed time. You can refresh the data with function key F5, and you can start a new measurement interval
with function key F10 (which resets the elapsed time to 0). Note that the CPU data is an average over all
CPUs that are active in you partition, so if the WRKSYSSTS display is showing 50 % CPU used, and
your partition has 2 CPUs, it can mean that either both CPUs are used at 50 % each, or that one CPU is
used 100 % and the other one is idle, or anything between those two extremes.
If you are using a partitioned system with so-called uncapped partitions, it is possible to see more than 100
% CPU utilization. This indicates that your current partition uses temporarily more CPU than configured.
This can happen if there are other uncapped partitions available that have unused CPU capacity.
A faulting rate larger than 4 faults/second in system pool 1 (the machine pool) is considered too high. If
you see a value like 8.7, you may consider increasing the machine pool, otherwise you could see a
performance degradation. You can enter the desired machine pool size directly into the related field in the
WRKSYSSTS screen.
© SAP AG
ADM525
Problem and Performance Analysis - 17
Performance Analysis: i5/OS Command WRKDSKSTS
Work with Disk Status
Elapsed time:
Unit
1
2
3
4
5
6
7
8
9
10
Type
4327
4327
4327
4327
4327
4327
4327
4327
4327
4327
00:01:05
Size
(M)
52923
52923
52923
52923
61744
61744
61744
61744
52923
52923
%
Used
78.5
78.5
78.5
78.5
78.5
78.5
78.5
78.5
78.5
1.5
How full?
Potential „hotspot“?
I/O
Rqs
33.4
33.0
32.0
34.3
39.0
39.9
38.1
44.9
33.6
37.1
Request
Size (K)
13.9
14.9
15.4
14.6
15.4
14.7
15.8
13.4
14.0
13.6
…
…
…
…
…
…
…
…
…
…
…
%
Busy
16
23
14
8
35
15
13
30
23
24
How frequently accessed?
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 18
The i5/OS command WRKDSKSTS allows you to get an overview how much your disk units are used.
Usually the i5/OS storage management functionality ensures that data is spread evenly over all available
disk units. However, if you add disk units to an existing system, these units start empty. The algortihm to
distribute data over all disk units is placing some type of data preferably onto the disk units that have the
most available space. If all data of one kind is stored onto the same unit, the disk arm response times are
higher than usual, because whoever wants to access the data needs to wait for the arm positioning on this
one unit. This is called a „hotspot“. You can balance the data by using the command STRASPBAL or by
saving, deleting and restoring your SAP database.
For performance analysis, you are mostly interested in the „% Busy“ values, that indicate how often the
disk units were accessed in the observed timeframe. If these values are too high, you may consider adding
more disk arms (to distribute the workload) or balancing your data over the disks (this may be helpful if
you see a few arms with very high % Busy rates).
© SAP AG
ADM525
Problem and Performance Analysis - 18
Performance Analysis: i5/OS Command WRKACTJOB
Place cursor underneath CPU % and use
function key F16 to order jobs by CPU usage
Work
Work with
with Active
Active Jobs
Jobs
CPU
62.9
Elapsed
00:00:10
CPU %:
%:
62.9
Elapsed time:
time:
00:00:10
Subsystem/Job
Subsystem/Job Type
Type CPU
CPU %% Function
Function
SAPOSCOL
BCI
.0
PGM-SAPOSCOL
SAPOSCOL
BCI
.0 PGM-SAPOSCOL
SAPSTART
BCH
.0
SAPSTART
BCH
.0 PGM-sapstart
PGM-sapstart
WATCHDOG
BCI
.0
WATCHDOG
BCI
.0 PGM-disp+work
PGM-disp+work
WP00
BCI
8.3
PGM-disp+work
WP00
BCI
8.3 PGM-disp+work
WP01
BCI
3.5
WP01
BCI
3.5 PGM-disp+work
PGM-disp+work
WP02
BCI
.0
PGM-disp+work
WP02
BCI
.0 PGM-disp+work
WP03
BCI
.1
WP03
BCI
.1 PGM-disp+work
PGM-disp+work
WP04
BCI
2.1
WP04
BCI
2.1 PGM-disp+work
PGM-disp+work
WP05
BCI
.0
PGM-disp+work
WP05
BCI
.0 PGM-disp+work
Max. 100 / number CPUs
Status
Status
THDW
THDW
EVTW
EVTW
SELW
SELW
RUN
RUN
RUN
RUN
LCKW
LCKW
MTXW
MTXW
RUN
RUN
SEMW
SEMW
Lock conflicts?
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 19
The WRKACTJOB command can be used to look at the individual CPU usage of jobs. Even though the
overall CPU usage may be in a reasonable range, there may be single processes that use one CPU on a
multi-processor system to its limit. On a 12-way system, 8.3 % CPU usage for one process over a longer
period of time could indicate a CPU bottleneck. You can position the cursor in the „CPU %“ column and
use function key F16 to see the processes with the largest CPU usage on top of the list. Function key F5
can be used to refresh the data, function key F10 resets the counters and the „elapsed time“.
Another information you can get from WRKACTJOB is whether there is any contention due to locks or
mutexes. It is normal to see work processes in LCKW or MTXW once in a while. However, if a process
stays in LCKW or MTXW for longer time (several minutes), this may indicate a problem. You can use
option 5 in front of the process, and then option 12 for locks or option 19 for mutexes to get more
information about the lock or mutex. A long lock wait usually indicates an application problem, while long
mutex waits usually indicate a problem in the kernel or the operating system. The status SEMW indicates
that the work process is idle.
Note that the CPU usage of all the shown processes may not add up to the total CPU usage that is shown
in the upper left. The reason can be internal tasks that consume CPU but do not show up in
WRKACTJOB. You can only see them if you have the Performance Tools product (5722PT1) installed. It
provides a command named WRKSYSACT that also shows internal tasks.
© SAP AG
ADM525
Problem and Performance Analysis - 19
Performance Analysis: Performance Tools Product
Command WRKSYSACT
• Show internal tasks
• Show CPU capacity in
active partition
• Show max., min., and
average CPU utilization
Performance
data
collection
Display Performance Data
Print Performance Report
Advisor
• Average CPU, pool, disk,
and communication data
• Data by interval
• Data by job, job type,
or subsystem
• System report
• Component report
• Job report
• Pool report
• Resource report
• Recommendations
and conclusions
based on collected
performance data
and guidelines
IBM Performance Tools for iSeries (5722-PT1)
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 20
The optional software product IBM Performance Tools for iSeries provides a set of tools to help analyzing
performance. The base operating system provides the option to collect performance data while the system
is active. With the Performance Tools, the collected data can be analyzed later. You can look at specific
data, print reports, and you can look at advice that is given based on the collectecd data and iSeries
performance guidelines. While the previously described i5/OS commands only allow you to get a snapshot
of the current situation, the Performance Tools product provides the option to look at and compare
historical data.
Another helpful tool in the Performance Tools product is the command WRKSYSACT. It provides more
detailed CPU usage information than WRKACTJOB, especially it includes internal task information.
There are more tools in the product, such as the Performance Explorer (PEX) trace, which can be used by
experienced analysts.
© SAP AG
ADM525
Problem and Performance Analysis - 20
Performance Analysis: Rules of Thumb
Paging:
Machine pool: < 4 faults/sec
Base pool: DB + non-DB flts
< # CPUs * CPU %
CPU:
utilization < 95%
Network:
FTP speed >
10 % line speed
both directions
Disk:
% busy < 40%
Bottleneck?
• Optimize application to reduce workload
• Verify sizing and add hardware as needed
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 21
There are some rules of thumb to tell quickly if you have a bottleneck in one component of your system.
The CPU utilization should stay below 95 % most of the time, the disk units should not be more than 40 %
busy. In the machine pool, the total paging should be below 4 page faults per second. The acceptable
paging rate for the base pool can be calculated by adding DB faults and non-DB faults on the one side and
multiplying the number of CPUs with the average CPU utilization on the other side. For example, if you
have 12 CPU‘s that are in average used at 60 %, a paging rate of 720 pages per second (DB plus non-DB)
is considered acceptable.
The network is usually not a bottleneck for SAP, except if it was setup incorrectly. OSS note 484548
explains some of these problems. You can check the overall speed of your network by using FTP to
transfer a large file over your network. At the end, you can calculate the data transfer rate for FTP based
on the amount of data and the time it needed. The FTP speed should be faster than 10 % of the theoretical
network speed (for example, 1 Gigabit per second). Also, the FTP speed should be about the same in both
directions (put/get).
If you identified a bottleneck in one component, you can either tune the application to reduce the load on
that (and other) hardware resources, or you can add more hardware. Adding more hardware may be the
only solution if the original sizing was based on much smaller numbers than the current activity.
© SAP AG
ADM525
Problem and Performance Analysis - 21
Performance Analysis: Operating System Monitor
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 22
The Operating System Monitor in SAP WebAS ABAP can be reached through transaction code ST06 or
by following the menu path Tools -> CCMS -> Control/Monitoring -> Performance -> Operating System > Local -> Activity. You get first an overview screen, that is showing the the current values for some key
indicators. By selecting the function „Detail analysis menu“ you get the second screen with detail
information for the current data or the last 24 hours. The key information for the previously discussed
resources can be found under „CPU“, „Pool“, „Disk“, and „LAN“.
© SAP AG
ADM525
Problem and Performance Analysis - 22
Performance Analysis: ST06 CPU Snapshot
Display average over all 6 CPUs
Local (server) / CPU Snapshot
Refresh display
Tue Aug 16 14:44:28 2005 interval
CPU
User in %
System in %
0
1
2
3
4
5
64
N/A
N/A
N/A
N/A
N/A
59
sec.
Idle in %
2
N/A
N/A
N/A
N/A
N/A
34
N/A
N/A
N/A
N/A
N/A
Other processes
(SAP and non-SAP)
This SAP system (SID)
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 23
The CPU snapshot is one example from the operation system monitor that needs to be looked at in more
detail. The display is showing you the number of installed CPUs, but it cannot break down the CPU usage
to the individual CPUs. Instead, you will see an average over all CPUs. On the other hand, the CPU usage
is split up into CPU that is used within the current SAP system, and CPU that is used outside of it. You
will find the same kind of information in the „previous hours“ display.
© SAP AG
ADM525
Problem and Performance Analysis - 23
Performance Analysis: ST06 Pool History
Attention! Pool 1 is machine pool!
Local (server) / Pool No.:
Pool--
Pool++
Tue Aug 16 14:44:28 2005
Hour
max.Act
Size
14
13
12
11
10
9
8
1 Last 24 Hours
0
0
0
0
0
0
0
Mach.resv.
819.200
819.200
819.200
819.200
819.200
819.200
819.200
197.456
197.452
197.452
197.500
197.448
197.440
197.464
DB-Flt non-DB-F
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.87
9.85
0.96
0.72
0.47
1.66
18.12
Excellent values?
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 24
When looking at the data that was collected for the last 24 hours, you need to be aware that the pool data
and the disk data is organized in a way, that you only get the history data for the first main storage pool or
disk unit on the first screen. You will get a button to navigate to additional pools or disk units. When you
look at main storage pool information, the pool 1 (machine pool) follows different rules than the pool 2
(base pool), where your SAP system typically is running in. While 18.12 non-database faults per second
may be a good value for the base pool, it is significantly too high for the machine pool (should be below
4). You can use the „Pool++“ button to reach the history data for the next pool.
© SAP AG
ADM525
Problem and Performance Analysis - 24
Performance Analysis: SAP Workload Monitor (ST03)
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 25
In order to find performance problems in the application, the SAP workload monitor (transaction ST03)
should be used. To get the most information out of the tool, you should switch to „Expert mode“ in the
upper left. You can then select a single server or a selection of multiple application servers for your
analysis, as well as a period of time.
From the screen as shown above, you can first of all get an impression what the average response time in
your dialog processes is (this is mostly what end users complain about). Depending on your end-users
expectations you may consider an average response time of 400 ms, 600 ms, 800 ms, or one second as
acceptable.
If the average response time is too high, you can drill down the average value either by time („Time
Profile“) or by transaction („Transaction Profile“ or „Ranking Lists“). Often the poor average response
time is caused by a few transactions or hours during the day, which you want to look at closer. If you have
identified a smaller subset, you can look at the parts that make up the response time to find out whether
you have a database problem, or a problem in another area.
© SAP AG
ADM525
Problem and Performance Analysis - 25
Performance Analysis: Response Time Components
GUI time
Wait time (for free work process)
Roll in and roll wait time (RFC)
Load and generation time
Enqueue time
ABAP processing time
Database time
CPU time
Data
base
Response time
SAPGUI frontend
Recommendations for ECC:
Application server
DB server
Response time < 600 ms .. 1 s for dialog processes
Database time ~ 50 % of response time
Wait time near 0
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 26
The typical measurement for performance is the response time, either individually for one transaction or as
an average for a certain group of transactions. In a well tuned system, most of the response time consists
of ABAP time and database time at roughly the same share. Note that the database time in 3-tier also
includes the network overhead (line speed and protocol).
A high wait time can be seen if all work processes are busy at the time when a new user request arrives.
Adding more work processes to the configuration is not always the right answer in such a case. Sometimes
the problem is caused by too slow operations that keep the available work processes busy longer than
necessary.
The CPU time that is shown in the various reports is based on the overall CPU used in the measured work
process. It includes CPU used for ABAP processing, load and gerneration, and roll in operations. In 2-tier
installations, where the database requests are processed in the work process directly, the CPU even
includes the amount of CPU used for database operations.
The recommendations are valid for a well-tuned production system running SAP ECC (formerly known as
R/3). Other SAP applications, such as BW, can show significantly higher response times and database
times, depending on the amount of data and type of queries. You may also see significantly higher
response time on a development system, because programs need to be compiled more often, and buffers
are not used as efficiently as in production.
© SAP AG
ADM525
Problem and Performance Analysis - 26
Performance Analysis: Group Data by Profiles
Transaction profile: Report or transaction, job
Task type
Aggregation
Single Records
Times; T Total time (s), Ø Time/step (ms)
# Steps T Resp.Time Ø Time T CPU~ Ø CPU~ T DB Time Ø DB Time
8,453
5,739 677.7
1,904
225.2
3,549.4
419.9
3,263
2,878 881.9
1,379
421.6
2,042.6
626.0
4,543
1,985 437.0
752
165.6
925.9
203.8
1,384
927 669.6
229
165.1
715.0
516.6
1,174
666 567.5
195
166.0
498.3
424.5
858
349 407.0
167
194.9
192.3
224.2
909
175 192.1
60
65.8
103.4
113.7
620
117 188.0
32
51.0
82.6
133.3
Time profile: intervals 10-11, 11-12, 12-13, …
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 27
This is some of the information that you get when you group the performance data by transaction
(„Transaction Profile“). For each transaction or report, you can see how often it was executed (# steps),
and what the response time, CPU time and database time was. For your analysis, you may want to focus
on those transactions that have high average response times or database times. However, you should
always keep in mind how often the transaction was called to make a proper decision whether it is worth to
spend effort on optimizing this transaction.
You can restrict the analysis to a specific task type, for example if your primary goal is to improve
response times on dialog transactions. In the transaction profile, you can also aggregate the data by
application, subapplication or package, and you can even display single statistical records. This may
sometimes be helpful to find out if a specific transaction is always slow, or sometimes slow and sometimes
fast.
Another view at the data would be the time profile. You get similar information, but this time the data is
grouped by the hour. You can also restrict that view to a certain task type, such as dialog or batch. The
time profile can be helpful to decide whether the system is slow in general, or only at peak workload
times.
Note that the sum of DB time and CPU time can be larger in than the response time, because in 2-tier the
CPU time is counted for both ABAP and DB work.
© SAP AG
ADM525
Problem and Performance Analysis - 27
Performance Analysis: Buffer Analysis
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 28
In order to achieve best performance, SAP is buffering many objects that are usually read often but
changed rarely in the database. The central transaction to administrate these buffers is ST02 (shown in the
picture). The buffer sizes are controlled through profile parameters. The appropriate size depends on many
factors as the number of installed applications, the number of users, and the size of the buffered objects, so
it is hard to predict what an appropriate size would be.
If your buffers are too small, additional database workload is created on your server because data has to be
retrieved from the database instead of the SAP buffer. That‘s why you should check buffer sizes as part of
your performance analysis. As a rule of thumb, all buffers should have 0 swaps on a 64 bit operating
system such as i5/OS (on Windwows 32bit you have to accept swaps because the address range for SAP
storage is limited). If the swaps are larger than 0, the field will be marked red. If buffers are swapping, you
need to decide whether the swap happened due to a shortage in free space, or not enough directory entries.
Based on the result, you need to increase the related profile parameter. Having buffer swaps is adding
database workload and can result in longer database times than usual.
© SAP AG
ADM525
Problem and Performance Analysis - 28
Performance Analysis: Roadmap for DB Performance
Long average
DB times
User reporting
slow transaction
with high DB time
Buffer swaps (ST02)?
Yes
Adjust buffer sizes
No
Yes
Specific time of day?
Specific transactions?
No
Yes
Analyze overall
system performance
No
Reproducible?
Yes
No
Yes
Analyze DB perform.
with ST05/Explain
Sizing sufficient?
No
Analyze DB perform.
with DB4COCKPIT
Add hardware or
optimize application
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 29
If you notice long database times or an end user reports poor response time for specific transactions, you
can follow this roadmap in order to isolate the problem. For a general problem with DB times, you should
first check for buffer swaps and ajust the buffers if necessary. Then you should check if you can narrow
down the problem to specific transanctions. The transaction profile view in the workload monitor
(transaction ST03) can help you with that.
If you cannot isolate specific transactions, or if the problem happens only in specific time periods during
the day (usually during peak hours, for example between 10.00 am and noon, and between 1.00 pm and
3.00 pm), you should perform an overall performing analysis for these hours. You can use i5/OS tools or
the operating system monitor (transaction ST06) to find out where the bottleneck is. After that, you should
compare the installed hardware and the workload with the sizing information that was used by IBM or
your business partner. If you do not have sufficient hardware, you can add more hardware or try to reduce
the workload by optimizing your applications.
If the performance problems are really in the database, you should check whether you can reproduce it
with one or a view specific transactions consistently. If the problem can be reproduced, you can collect an
SQL trace (transaction ST05) in order to find and analyze the longest running database operations. If you
cannot reproduce the problem, or if it only happens during certain hours, you can use the general database
monitor to search for long running statements in general. In previous SAP releases this was done in
transaction ST04, as of SAP basis release 6.40 you should use DB4COCKPIT instead.
© SAP AG
ADM525
Problem and Performance Analysis - 29
Performance Analysis: SQL Trace and DB Monitor
SQL Trace / Explain (ST05)
DB monitor (DB4COCKPIT)
Start/stop manually as needed
Always active (profile parameter
as4/dbmon/enable = 1), dumped
periodically
Re-prepare statement for explain
(SELECT statements only)
Aggregate execution times of
identical statements, explain
most expensive execution
No explain for JDBC statements
(list of statements only)
JDBC monitoring possible if
J2EE database on same host
(remote monitoring planned)
Direct reference to ABAP
program source and statement
ABAP
No reference to ABAP source
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 30
The SQL trace is started and stopped when needed. When executing it for SAP WebAS ABAP, the
explain function re-prepares the statement and opens the cursor (without fetching data) in order to collect
information about the implementation of that statement. Because the statement is re-executed, explain
function can only be used for read-only statements, not for INSERT, UPDATE, or DELETE operations. It
is also possible, that the statement is implemented differently during the explain compared to the original
implementation. It is possible to map the SQL statements to the place in the ABAP source where they
were executed, which may help if you want to tune the application by modifying the SQL statement. For
SAP WebAS Java, the SQL trace can only list the statements, an explain function is not implemented.
The database monitor is usually active whenever the SAP system is up. It can be controlled through profile
parameter as4/dbmon/enable. In order to keep the amount of collected data in a reasonable size, the
database monitor aggregates the run times of identical statements and only keeps implementation details of
the most expensive execution. You will see the implementation that was actually used, but if you add
indexes for a specific statement and improve runtime significantly, you will still see the old, slow
implementation for the most expensive statement. SAP note 727078 explains how you can clear the
database monitor cache, so that the current implementation of a statement turns out to be the most
expensive one. The database monitor is also activated for a SAP WebAS Java server and can be analyzed
from the associated SAP WebAS ABAP server through transaction DB4COCKPIT if the Java database is
on the same host (in the same partition) as the ABAP database. Support for remote Java databases will be
added in SAP releases after 6.40.
© SAP AG
ADM525
Problem and Performance Analysis - 30
Performance Analysis: Using the ABAP SQL Trace
Session 1 (slow transaction)
3
Session 2 (SQL trace)
1
Performance Analysis (ST05)
2
Activate Trace or
Activate Trace with Filter
4
Deactivate Trace
5
Display Trace
6
Trace List -> Summarize
Trace by SQL Statement
Execute slow transaction
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 31
If you want to analyze a specific slow running transacion, you can use the SQL trace (transaction ST05).
First you activate the trace, then you execute the slow transaction. After that you can deactivate and
display the trace. When activating the trace, you can set a filter to only trace data for a specific user,
specific transactions, or requests for specific tables. Also when displaying the trace, you can specify a
selection and exclude data that you consider „noise“. Note that the trace area can only hold a limited
amount of data and will wrap when more data needs to be collected. Step 6 in the instructions (Trace List > Summarize Trace by SQL Statement) is the fastest way to get to the SQL statements that need the most
time.
© SAP AG
ADM525
Problem and Performance Analysis - 31
Performance Analysis: Typical ABAP Trace List
Transaction ZTST Work process no 0 Proc.type
HH:MM:SS.MS
Duration Obj. Name
Op.
DIA Client
Recs.
15:40:44.632
110 DDNTT
EXECSTA
15:40:44.632
624 DDNTT
OPEN
15:40:44.633
24.667 DDNTT
FETCH
15:40:44.896 216.208 V_LTDX
OPEN
15:40:45.113
89.695 V_LTDX
FETCH
15:41:28.146 1032.713 ?????????? OPEN
15:41:29.179 180.740 ?????????? FETCH
15:41:29.374
50.863 ?????????? FETCH
15:41:29.439
70.206 ?????????? FETCH
Native SQL
15:41:29.522
42.768 ?????????? FETCH
(EXEC SQL)
15:41:29.600
85.643 ?????????? FETCH
15:41:29.714
106
EXECSTA
15:41:30.161
8.332 MONI
EXECSTA
15:41:30.170
86.349 MONI
EXECSTM
15:41.31.715
63.566
EXECSTA
0
0
0
468
468
468
468
321
0
0
1
0
RC
000
Statement
0 CHECK PREPARE
0 SELECT WHERE
100
0 SELECT WHERE
100
0 SELECT FROM R
0
0
Closing
0
unused
0
cursors
0
0 ODP cleanup
0 CHECK PREPARE
0 INSERT VALUES
0 COMMIT WORK
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 32
This extract from the SQL trace list is showing some typical examples for entries when running on DB2
UDB for iSeries. The typical sequence for a SELECT statement consists of 3 parts: „check prepared
statement“ (try to find the statement in the SQL package), open, and one or multiple fetches. In some
cases, the entry for „check prepared statement“ is left out from the SQL trace, because the SAP database
interface uses a cache for some statements.
An entry of „??????????“ in the column that holds the table or view name indicates that the name is not
known to the SAP data dictionary. Typically this is an indication for the usage of native SQL („EXEC
SQL“), for example when accessing the system catalog views. Once in a while you may see an entry for
statement „ODP cleanup“. Usually the system is cleaning up open cursors at commit time, but if many
new cursors are opened within the same transaction, you may also see that entry between two regular
database operations. Long ODP times usually indicate a shortage in main memory (high page fault rates).
© SAP AG
ADM525
Problem and Performance Analysis - 32
Performance Analysis: ABAP SQL Trace Explain
Database Performance: Explain
Choose
Expand All
Compress All
System Table Names
SELECT
TABNAME, BLOCKNR, FIELDSLG, FIELDS
FROM
R3SIDDATA/“DDNTF“
WHERE
TABNAME =
?
Details
+ Statement Info
+ Execution Time (ms)
ODP Implementation
R Query implemented as…
Host Variable Implementation
I (Interface supplied …
+ Host Variables Values
- MAIN LEVEL
- SUBSELECT 1
+ Index R3SIDDATA/“DDNTF+0“ was used by Query…
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 33
When you use the explain function in the SQL trace on a statement, you will see a picture similar to the
one shown in this slide. On the top, you will see the SQL statement that was actually sent to the database,
which may look different from the statement that was coded in ABAP. For technical reasons, the
statement text is limited to 8000 characters in this place. To see the full statement text, go back to the SQL
trace list and double-click on the statement.
Sections that are marked with a „+“ can be expanded to get more information. The „Statement Info“
contains information about the used SQL package, the statement and cursor name, and the SAP statement
ID. For the SQL trace this information is not very important, because the statement will be re-prepared
into an SQL package in library QTEMP for explain. The same is valid for the „Execution Time“, it is not
really useful when calling explain from the SQL trace.
The „Host Variables“ replace the question marks in the statement text. In order to make statements more
reusable, values in the WHERE-clause are usually not sent to the database as part or the statement text, but
as a variable. If you expand the „Host Variables“, you can see the actual values in hexadecimal
representation.
Underneath the „MAIN LEVEL“ section, you can see the actual implementation of the statement. The
amount and type of information depends on the statement and the implementation that was acually chosen.
© SAP AG
ADM525
Problem and Performance Analysis - 33
Performance Analysis: Using the Java SQL Trace
Address: http://server:51100/SQLTrace/index.html
Welcome to SQLTrace
SQLTrace is an on-demand trace of selected Jdbc methods. This page is the entry point to SAP…
• Switch on and off SQLTrace and view the current status.
• List all available Traces directly in order to evaluate a trace
• Use SQLTrace File Administration to delete or download (in XML format, see DTD)…
SQLTrace On
SQLTrace Off
Trace Evaluation
File Administration
Add backtrace information based on:
• Method name
• Execution time
Filter information based on:
• User name
• Application
• System/non-system thread
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 34
Similar to the SQL trace in ABAP, the SAP WebAS Java SQL trace can be used to trace database access
in Java. You can reach the entry page through the address http://<server>:5<inst.no>00/SQLTrace. The
SQL trace is written to a set of files that are stored in XML format. Other than in ABAP, you cannot limit
the SQL trace to a specific user when collecting the data. Only when you select to add backtrace
information (that is the complete method call stack when calling JDBC methods), you can limit the data by
certain method names or execution times.
When you evaluate the trace data, you can set filters, so that you have a better overview over the data that
is interesting for you. It is your responsibility to delete SQL trace files that are no longer needed. The „File
Administration“ function is helping you with that task. In addition, it allows you to download the files in
XML format.
© SAP AG
ADM525
Problem and Performance Analysis - 34
Performance Analysis: Java SQL Trace Output
Address: http://server:51100/OpenSQLMonitors/servlet/SQLTraceCtrl?btnFilter_EVALUATE=
SQLTrace Evaluation: List for trace id 20050823140341754 from node 704243650.
Filter
Duration J2EE user
[microsec] Application
Time
14:05:54,9
14:05:54,9
14:05:55,0
14:05:55,0
14:05:55,0
14:05:55,2
Trace Status
List of Traces
Jdbc method
Id
Refresh
No. Result Statement
Administrator Connection.commit()
1913 sap.com/com.s
Administrator PreparedStatement.executeQuery()
85499 sap.com/com.s STMT:7634850,RS:665444180
Administrator ResultSet.next()
12 sap.com/com.s RS:665444180
1
Administrator ResultSet.close()
48 sap.com/com.s RS:665444180
Administrator PreparedStatement.executeUpdate()
146239 sap.com/com.s STMT:1106538834
Administrator Connection.commit()
Click on
792 sap.com/com.s
statement
for details
commit()
SELECT “INC_VAL
false
next()
close()
1
UPDATE “J2EE_KE
commit()
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 35
This is an example for the output that you get from the Java SQL trace. Long execution times are
highlighted, and you can see the JDBC functions with their related SQL statements as they are executed
by the applications. If you click on a statement text, you get the statement details, including the stack of
methods down to the JDBC method if you selected to collect backtrace information. Currently you will not
get any implementation background („Explain“) from here.
© SAP AG
ADM525
Problem and Performance Analysis - 35
Performance Analysis: Transaction DB4Cockpit
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 36
Transaction DB4Cockpit is the entry to a selection of analysis tools for database performance. On the left,
you can select your system (SAP WebAS ABAP or SAP WebAS Java if installed), and you can select a
function from the navigation tree. The default selection is the Performance Overview, which shows you a
summary about the number of statement types and access methods that have been collected by the
database monitor. Before you start with a detailed analysis, you should verify in the upper right that the
analysis was done recently. If the date and time of the „Last Analysis“ appears to be too old, you should
select „Database Monitor Activity“ in the navigation tree on the left to check if monitoring is active.
© SAP AG
ADM525
Problem and Performance Analysis - 36
Performance Analysis: DB4Cockpit Overview (1)
Diagnostics
Backup and Recovery
Space
Performance
System SID_JAVA
System SID
Slowest SQL statements
Table scans
Sorts
Temporary Files
Can be slow!
(check table and
result set size)
Created Indexes
Used Indexes
Advised Indexes
!
Only looking at
WHERE clause!
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 37
The „Performance“ section in transaction DB4Cockpit covers the functionality that is often referred to as
„database monitor“. In previous releases this functionality was provided through transaction ST04, and
this transaction is till available in SAP release 6.40. However, with transaction ST04 you cannot look at
the data that was collected for your SAP WebAS Java server.
You will find multiple selections that can be used to identify SQL statements that may be worth a closer
look in order to optimize performance. These are the 300 statements using the longest total runtime
(„Slowest SQL statements“), and statements that did not use indexes („Table scans“, „Sorts“, „Temporary
Files“, and „Created Indexes“). Please note that not using an index does not necessarily mean poor
performance; if result sets are very small, or a significant number of rows is retrieved from the table
without ordering, using an index may be slower than using temporary objects or scanning the whole table.
While the „Index advised“ section seems to be pretty helpful even for non-experts, it should be used with
care. The database monitor only looks at the WHERE clause of an SQL statement when advising indexes,
not at ORDER BY or GROUP BY. While such an index may still be somehow helpful, it is often not the
perfect index for a particular query.
© SAP AG
ADM525
Problem and Performance Analysis - 37
Performance Analysis: DB4Cockpit Overview (2)
System SID_JAVA
System SID
Performance
Space
State on Disk (→ DB02)
Backup and Recovery
Backup Overview (→ DB12)
Diagnostics
PTF Check (→ DB4PTFCHK)
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 38
Besides the performance analysis, transaction DB4COCKPIT has some more functions. The section
„Space“ starts transaction DB02 („Database Performance: State on Disk“) that we will see later. „Backup
and Recovery“ provides an overview over attached journal receivers and the backup history (partial or full
backups). The „Diagnostis“ sections allows you to perform a PTF check based on the IBM info APAR file
in directory /usr/sap/trans/config.
© SAP AG
ADM525
Problem and Performance Analysis - 38
Performance Analysis: Slowest SQL Statements
Default order:
Total time of all
executions
Consider sorting
by average time
Reusable
ODPs
SQL Statements: Since Database Start
Stmt. Text
Total Time Executions AvResSize Av. Time Min.Time Max.Time
SELECT TABNAME, 125.761
6.619
1
19
3
1.018
INSERT INTO DB4T
52.584
8
6.932
6.573
159
16.369
SELECT DISTINCT
22.036
4
0
5.509
188
7.809
SELECT QQKEY,Q
14.817
11
0
1.347
26
3.128
SELECT CUSGRPN
14.108
3.527
12
4
3
728
UPDATE BTCCTL S
9.130
4.565
1
2
1
450
DELETE FROM SQ
2.799
1
3.454
2.799
2.799
2.799
SELECT TOOLNAM
2.128
8
377
266
28
705
Large result sets
justify long
execution times
Double-click on
statement for Explain
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 39
If you select „SQL Statements“ from the DB4Cockpit navigation tree, you get a list of the 300 SQL
statements that needed the longest overall execution time, thus having the largest impact on your database
performance. The list is initially ordered by the total time (in milliseconds). Statements that are used very
often may show up on top of the list, even though their average execution time may be short, so you may
want to consider reordering the list by the average execution time in order to get really slow statements on
top of the list. Please note that a long execution time may be justified, if the statement processes a lot of
data. That‘s why you need to keep an eye on the average result set size as well. Large differences between
the minimum time and maximum time for the same statement may be caused by reusing ODPs. Only the
first execution is slow then, subsequent executions of the same statement can be much faster.
In order to get detailed explanation about how a statement was implemented, you can double-click on a
statement that you are interested in. This will bring up an Explain screen that looks very similar to the
explain function in the ABAP SQL trace.
© SAP AG
ADM525
Problem and Performance Analysis - 39
Performance Analysis: Analyzing Access Methods
System SID_JAVA
System SID
Performance
Explain
Sort by table
size or result
set size
Table scans
List of tables
Sorts
List of statements
Temporary Files
List of statements
Used Indexes
List of indexes
Created Indexes
List of statements
Advised Indexes
List of base tables
List of statements
List of statements
List of statements
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 40
In order to identify statements that cause performance problems, you can have a closer look at specific
access methods that may be inefficient under some conditions. For example, table scans can be inefficient
if the table is large, but only few rows are selected. Also temporary sorts or index creations can be slow if
the underlying table is large. In such cases you can often improve the performance by building an
appropriate index.
© SAP AG
ADM525
Problem and Performance Analysis - 40
Performance Analysis: State on Disk (DB02)
Database consistency
Database size
Detailed object analysis:
• Table and index sizes
• Table size history
Consistency checks:
• Tables w/o prim. key
• DB ↔ Dictionary
• Kernel ↔ Dictionary
List damaged files
Database
library
R3<sid>DATA
Deleted row
analysis
Space statistics:
Changes in bytes
and rows per day/
week/month
Missing indexes
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 41
Transaction DB02 provides a set of functions to check the database for inconsistencies and size. Usually
you should not see any inconsistencies, but if your system is showing strange behaviour, for example after
a system crash, you can use the functions „Consistency checks“, „List damaged files“, and „Missing
indexes“ to look for problems.
The size functions allow you to identify large or rapidly growing tables. If you see tables with many
„deleted rows“, you can use the command RGZPFM („Reorganize physical file member“) to free up the
space that is occupied by rows that have been deleted. Especially when you delete a client from your SAP
system, you may encounter many deleted rows. The RGZPFM command and its usage within an SAP
system is explained in SAP note 84081.
If you see tables that are growing quickly without showing many deleted rows, you need to analyze the
application. Sometimes automatic cleanup functions are provided but do not work properly, in other cases
you need to implement an archiving function in order to keep the table sizes reasonable.
© SAP AG
ADM525
Problem and Performance Analysis - 41
Query Optimization: Tuning DB2 UDB for iSeries
Tuning area
Responsible
Tuning activities
Physical layout of data
on disk and in storage
i5/OS
Hardware resources,
memory pool sizes
Database statistics
i5/OS (SQE)
Create indexes for
additional statistics
Query optimization
i5/OS,
DB admin
Keep i5/OS current,
create indexes for
faster access methods
Low level programming:
Reusable ODPs, SQL
packages, database flags
SAP kernel
Keep kernel level
current
Application programming
SAP application
programmers
Reduce data amount,
create indexes
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 42
There are multiple factors that influence database performance, such as the management of the physical
data, the maintenance of database statistics, and many programming considerations. When using DB2
UDB for iSeries, you do not need to worry about the physical layout of the data on disk and in the main
storage, because the Storage Management component of the operating system takes care of that as long as
you provide enough hardware resources. You also do not need to worry about low-level programming
considerations, because this is all handled in the SAP kernel. If performance problems are encountered
that can be solved in the low-level programming, this will be handled by SAP. That‘s why you should
keep the kernel (especially the LIB_DBSL patch) current.
In other areas, such as statistics collection, query optimization, or application development, the database
administrator can help getting better performance by creating appropriate indexes. The previous slides
were focussing on identifying those statements that can be improved, the following slides will give a short
introduction how to improve those statements.
© SAP AG
ADM525
Problem and Performance Analysis - 42
Query Optimization: SELECT Statement in ABAP
SELECT f~carrid f~fldate SUM( f~seatsmax ) AS seats
INTO CORRESPONDING FIELDS OF wa
Join
FROM ( spfli AS p
INNER JOIN sflight AS f ON p~carrid = f~carrid AND
Record
p~connid = f~connid
)
selection
WHERE p~cityfrom = 'FRANKFURT'
AND p~cityto
= 'NEW YORK'
Grouping
AND f~fldate
BETWEEN '20050801' AND '20050831'
GROUP BY f~carrid f~fldate
ORDER BY f~fldate seats DESCENDING.
Ordering
SPFLI (flight schedule):
MANDT, CARRID, CONNID,
CITYFROM, CITYTO,
DEPTIME, ARRTIME, …
SFLIGHT (flights):
MANDT, CARRID, CONNID,
FLDATE, SEATSMAX,
SEATSOCC, PRICE, …
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 43
The shown SQL sample statement is used to demonstrate some elements of the SQL language that you
need to understand in order to optimize your queries. Assume that you are a travel agency and want to
arrange a trip from Frankfurt to New York some time in August. You want all of the participants to use the
same airline, and you want them all to fly on the same day, but they don‘t need to fly all on the same
connection. You are looking for the airline and day with the most offered seats.
The flight data is spread over multiple tables. In this example, you need table SPFLI to find the departure
and destination city, and you need table SFLIGHT to find the flight dates and the number of seats for each
flight. If the same airline offers several flights on the same day, you sum up the available seats.
The statement is showing key elements that you need to understand in order to optimize the execution:
Join (combining the data from two or more tables), record selection (the WHERE CLAUSE), grouping,
and ordering. The output of the statement could look like this:
UA
22.08.2005
385
LH
22.08.2005
380
LH
27.08.2005
280
LH
28.08.2005
660
UA
28.08.2005
385
© SAP AG
ADM525
Problem and Performance Analysis - 43
Query Optimization: SELECT Statement in Database
Statement
Table names
qualified with
library (schema)
SQL Statement
SELECT
T_01."CARRID", T_01."FLDATE",
Join condition in
SUM( T_01."SEATSMAX" ) "SEATS"
WHERE clause
FROM
R3SIDDATA/"SPFLI"T_00, R3SIDDATA/"SFLIGHT"T_01
WHERE
(T_01."MANDT" = ? AND T_00."CARRID" = T_01."CARRID" AND
T_00."CONNID" = T_01."CONNID") AND T_00."MANDT" = ? AND
T_00."CITYFROM" = ? AND T_00."CITYTO" = ? AND
Column
T_01."FLDATE" BETWEEN ? AND ?
Constants
MANDT
GROUP BY
replaced
by
added
T_01."CARRID", T_01."FLDATE"
variables
ORDER BY
T_01."FLDATE", "SEATS" DESC WITH UR
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 44
If you compare the SQL statement that is actually sent to the database with the ABAP syntax of the
statement, you will notice a few differences:
y Table names are qualified by a library (or schema) name.
y The join conditions are moved to the WHERE clause of the statement.
y Column MANDT is added to the WHERE clause and compared to the current client.
y Constants in the statement are replaced by variables, which are represented by ‚?‘ in the statement text.
y Not shown here: For ABAP constructs like „WHERE … IN <itab>“ or „FOR ALL ENTRIES IN
<itab>“, the internal table is converted to valid SQL syntax on the database.
y For Pool and Cluster tables, the SQL statement on the database will be completely different from the
ABAP statement.
For your query optimization, you must always use the database syntax, not the ABAP syntax. The SQL
trace (ST05) and the database monitor (DB4Cockpit) are always showing the database syntax.
© SAP AG
ADM525
Problem and Performance Analysis - 44
Query Optimization: Cost Based Optimizer
SQL statement
Query
optimizer
Available
indexes
Disk and
CPU speed
Table sizes
„Fair share“ of
main storage
Fastest access
plan
Optimization
goal (first I/O
or all I/O)
Amount of
data returned
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 45
The query optimizer for DB2 UDB on iSeries is a cost based optimizer, it is basing its decisions on many
environmental factors. The goal of the optimization is always to come up with the fastest possible
implementation. For traditional applications, you can set an optimization goal „first I/O“, so that the first
„screen“ of data (the first 30 rows) will be returned as quickly as possible, even though the total runtime
may be slower. SAP uses the optimization goal „all I/O“ because the SAP application usually requests
only the data it needs to show on the display.
As a result of the cost based optimizer, you will sometimes see that indexes were not used even though
they seemed to be helpful. If the table size is relatively small, or if a significant percentage of the data in
the table is returned to the application, it may be faster to read the whole table in large blocks than using
an index and reading the data row by row.
Starting with OS/400 V5R2M0, IBM has introduced a new query optimizer (called SQE, „SLIC Query
Engine“), which is replacing the old optimizer (called CQE, „Classic Query Engine“) step by step. Both
CQE and SQE are cost based optimizers, and both use indexes to obtain statistical information about the
tables. SQE is also using additional statistics that are not bound to indexes and collected automatically.
SQE provides significant enhancements for certain types of SQL statements, but at the current level (i5/OS
V5R3M0), not all SQL statements can go through SQE, some still have to go through CQE. In future
releases, SQE will be enhanced further, so that more statements can go through SQE.
© SAP AG
ADM525
Problem and Performance Analysis - 45
Query Optimization: Record Selection
Statement
Possible implementation:
SQL Statement
• Table scan
• Index access
SELECT
T_01."CARRID", T_01."FLDATE",
SUM( T_01."SEATSMAX" ) "SEATS"
FROM
R3SIDDATA/"SPFLI"T_00, R3SIDDATA/"SFLIGHT"T_01
WHERE
(T_01."MANDT" = ? AND T_00."CARRID" = T_01."CARRID" AND
T_00."CONNID" = T_01."CONNID") AND T_00."MANDT" = ? AND
T_00."CITYFROM" = ? AND T_00."CITYTO" = ? AND
T_01."FLDATE" BETWEEN ? AND ?
GROUP BY
T_01."CARRID", T_01."FLDATE"
ORDER BY
T_01."FLDATE", "SEATS" DESC WITH UR
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 46
Record selection limits the amount of returned data by allowing only certain values for selected columns,
such as „FRANKFURT“ for column CITYFROM in table SPFLI. The query optimizer can choose to
perform a so-called table scan. In this case, the whole table is read from the database into memory, and in
memory those records that do not match the selection are thrown out. If an index exist for the column or
columns in the WHERE clause, the optimizer can also locate matching rows quickly through the index and
only return rows that match the selection. The optimizer may choose not to use an index, even though it
exists, if the table is small or if a large percentage of the rows in the table are returned.
© SAP AG
ADM525
Problem and Performance Analysis - 46
Query Optimization: Join Condition
Statement
The order of tables can be
changed by the optimizer for
„inner join“.
SQL Statement
Implementation methods:
• Nested loop via index
• Nested loop via hash table
• Nested loop via sorted list
SELECT
T_01."CARRID", T_01."FLDATE",
SUM( T_01."SEATSMAX" ) "SEATS"
FROM
R3SIDDATA/"SPFLI"T_00, R3SIDDATA/"SFLIGHT"T_01
WHERE
(T_01."MANDT" = ? AND T_00."CARRID" = T_01."CARRID" AND
T_00."CONNID" = T_01."CONNID") AND T_00."MANDT" = ? AND
T_00."CITYFROM" = ? AND T_00."CITYTO" = ? AND
T_01."FLDATE" BETWEEN ? AND ?
GROUP BY
T_01."CARRID", T_01."FLDATE"
ORDER BY
T_01."FLDATE", "SEATS" DESC WITH UR
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 47
If the required data results from more than one table, you must join 2 or more tables. The most common
join is the so-called „inner join“: you combine all rows in the first table with all rows in the second table
(and subsequent tables) where the join fields match. Rows in one table that do not have corresponding
rows in the other table(s) are not returned. Open SQL in ABAP also supports the „left outer join“, where
all rows of the first table are returned, and the values from the second table are either filled with values
from the second table – if a matching row was found – or set to null. In case of an inner join, the query
optimizer can change the order of the tables if it estimates a shorter execution time.
„Nested loop“ is a concept where the database reads all rows from the first table (reduced by the record
selection if one exists) and tries to find matching rows in the second table. If an index exists over the join
columns (in the example: CARRID and CONNID), the nested loop can be implemented by using the
index, which is usually quite fast. If no index exist over the join columns, the optimizer can either create a
temporary index, a hash table, or a sorted list (in case of inequality) to locate matching rows in the second
table. All three methods take some time, depending on the table size, so you can usually improve join
performance significantly by creating indexes over the join columns.
© SAP AG
ADM525
Problem and Performance Analysis - 47
Query Optimization: GROUP BY and ORDER BY
Statement
Sum up column SEATSMAX
for all rows with the same
CARRID and FLDATE.
SQL Statement
Implementation methods:
• Index
SELECT
• Temporary hash table
T_01."CARRID", T_01."FLDATE",
SUM( T_01."SEATSMAX" ) "SEATS"
FROM
R3SIDDATA/"SPFLI"T_00, R3SIDDATA/"SFLIGHT"T_01
WHERE
(T_01."MANDT" = ? AND T_00."CARRID" Implementation
= T_01."CARRID"
AND
methods:
T_00."CONNID" = T_01."CONNID") AND T_00."MANDT"
= ? AND
• Index (if table columns)
T_00."CITYFROM" = ? AND T_00."CITYTO"
= ?ofAND
• Sort
results (if no
T_01."FLDATE" BETWEEN ? AND ?
index available or result
GROUP BY
of calculation)
T_01."CARRID", T_01."FLDATE"
ORDER BY
T_01."FLDATE", "SEATS" DESC WITH UR
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 48
The GROUP BY clause in an SQL statement is used to aggregate values for all rows that have the same
„key“. This includes summing up the values (SUM), finding the minimum or maximum value (MIN or
MAX), calculating the average (AVG), or counting rows (COUNT). In order to process the data, the
optimizer needs to group all rows with the same values in the columns that are specified in the GROUP
BY clause. If an index is available over those columns, it can be used for the implementation. If not index
is available, the optimizer can choose to build a temporary index or a temporary hash table to implement
the GROUP BY. Both methods take some time and require resources, so it is usually helpful to have an
index.
The ORDER BY clause is used to return rows in a specific order. Without it, the order of rows is
unpredictable. If an index over the specified columns exists, it can be used to implement the ORDER BY
request. If no index exist, the optimizer can decide to build a temporary index. Another option is to first
fetch all rows in random order and then sort the result set. This is necessary if the ORDER BY clause
contains calculations, such as SUM or AVG.
© SAP AG
ADM525
Problem and Performance Analysis - 48
Query Optimization: Combine Columns to One Index
Reason
Record selection
Join
Columns in
table SPFLI
Columns in
table SFLIGHT
Comparison
MANDT
FLDATE
=
=
=
=
BETWEEN
CARRID
CONNID
=
=
MANDT
CITYFROM
CITYTO
CARRID
CONNID
GROUP BY
CARRID
FLDATE
ORDER BY
FLDATE
Key columns for SPFLI:
MANDT, CITYFROM, CITYTO, CARRID, CONNID
Key columns for SFLIGHT:
or:
MANDT, CARRID, CONNID, FLDATE
MANDT, CARRID, FLDATE
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 49
When the query gets executed, the optimizer can pick a maximum of one index per table to implement
record selection, join conditions, group by, and order by. So you need to combine columns that would be
helpful for the different parts into one index. Often it is impossible to build one index that covers all the
different elements, so you have to make assumptions which parts of the index have the biggest impact to
performance. This does not only depend on the SQL statement, but also on the amount and distribution of
the data in the tables. The best way to find out which of the possible indexes works best is to create them
all, collect an SQL trace over the statement, use Explain to find out which one is picked, and drop the
other ones again. Having too many indexes can cause a slowdown of INSERT, UPDATE, or DELETE
operations because it adds index maintenance costs.
If you look at join conditions, group by, or order by columns in order to design an index, you can always
preceed those columns by columns from the where clause that return exactly one value („=“ comparison
without „OR“). Because of this, the ideal index on table SPFLI for the given statement combines
MANDT, CITYFROM, and CITYTO from the where clause with CARRID and CONNID from the join
condition.
For SFLIGHT, multiple indexes could be helpful. If you assume that SPFLI is used in join position 1 and
SFLIGHT in join position 2, then the index with MANDT (for record selection), CARRID, CONNID (for
the join), and FLDATE (for further record selection) could be useful. If you assume that SFLIGHT is used
in join position 1, then the index with MANDT (for record selection), CARRID and FLDATE (for group
by and order by) would be useful. Which join order and index is actually chosen depends on the data in
the tables, so you can only try which one works best.
© SAP AG
ADM525
Problem and Performance Analysis - 49
Query Optimization: Working with Views
View
Table / join
conditions
View
fields
Selection
conditions
Transform into statement based on tables
Optimize
like join
of tables
Not relevant
for optimization
Optimize
like where
clause
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 50
If the statement that you are analyzing contains a view, you can transform that statement into a statement
that only uses tables and the elements that were discussed before. A view in the SAP dictionary consists of
three elements: the tables and their join conditions, the view fields (usually a subset of the underlying
tables), and the selection conditions (optional). While the view fields are not relevant for the optimizer,
you can convert the table/join conditions into a simple join, and you can add the selection conditions to the
where clause of your statement. This is basically what the query optimizer does as well. After this
conversion, you can design the best indexes for your query as before.
© SAP AG
ADM525
Problem and Performance Analysis - 50
Query Optimization: Star Join / Snowflake Schema
Cust. dim.
C
Customer no.
Chain
Branch
Head office
Time dim.
T
Time period
Fiscal year
Fact table
C
P
T
Revenue
Discount
Sales overhead
Non-cum. val.
Prod. dim.
P
Product no.
Prod. group
Brand
Art. group
Prod. text
Product no.
Language
Description
Special optimization techniques: QAQQINI options, EVIs, SMP (SAP note 501572)
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 51
Especially in the environment of the Business Warehouse application (including APO/SCM and SEM)
you can see very complex joins that follow the „star“ or „snowlflake“ schema. Typically you have one
very large „fact“ table that contains all the key figures, and then many smaller „dimension“ tables that
contain additional values for the data. For example, you can see customer keys only in the fact table, and
then you get the customer details from the customer dimension table.
In order to help the query optimizer making the best decision for accessing the data in a star join or
snowflake schema, SAP is using several special techniques, such as enhanced vector indexes (EVIs) on
the fact table and special options in the query options file QAQQINI. The required setup is described in
SAP note 501572 and can be verified by using a „Sanity check“ tool that is described in SAP note 541508.
Please note that the settings can be dependent on the i5/OS release, so if you upgrade to a newer release,
you must check the note for potential changes. Additional tuning beyond the contents of those notes is not
necessary. If you have the feature „DB2 Symmetric Multiprocessing“ (option 26 of the operating system)
installed and enough hardware resources, you can also use parallelism to improve performance.
© SAP AG
ADM525
Problem and Performance Analysis - 51
Problems & Performance: Unit Summary
You should now be able to:
z Analyze problems by using i5/OS logs
z Identify performance bottlenecks by using i5/OS
tools
z Identify performance bottlenecks by using SAP
transactions ST06 and DB4COCKPIT
z Analyze slow database requests and design indexes
to improve performance
SAP AG 2004, ADM525 Problem and Performance Analysis / Christian Bartels / 52
© SAP AG
ADM525
Problem and Performance Analysis - 52
Exercises
Unit: Problem and Performance Analysis SAP on iSeries
Topic: SQL Trace and Query Optimization
At the conclusion of this exercise, you will be able to:
• Identify slow SQL statements in your application by using the SQL
trace (transaction ST05)
• Describe the query implementation as displayed by the Explain
function
• Design an index to improve performance of a slow SQL statement
If an end-user complains about the high response time of a transaction
and you do not have overall performance problems, you will often see
few long running SQL statements being responsible for this. As a system
administrator or consultant you can analyze the transaction with the SQL
trace, identify slow SQL statements, and optimize them to improve
performance.
1-1
Sign on to the SAP system
1-1-1 Start the SAP Logon software on your workstation
1-1-2 Logon to the SAP education system. The instructor is going to tell you the
connection information. Sign on with user name ADM525##. If you did
not change the password in a previous exercise, the initial password is
INIT.
1-2
Activate the SQL trace
1-2-1 Start a second session to execute transaction ST05. You can either enter
the command “/nST05” into the so-called “ok-code” field of your first
session, or you can create a new session by using the icon “Create a New
Session” and then follow the menu path Tools → ABAP Workbench →
Test → SQL Trace.
1-2-2 Select the function “Activate Trace” from the entry screen. Note that this
is activating the trace for your user-id only. If you want to activate the
trace for another user-id or all user-ids, you can select “Activate Trace
with Filter”.
1-3
Execute the sample program
1-3-1 In the first session, start the ABAP editor. You can either enter transaction
code SE38 directly or follow the menu path Tools → ABAP Workbench
→ Development → ABAP Editor.
1-3-2 Specify ZADM525LAB as the program name. Select the Execute button to
execute the program or follow the menu path Program → Execute →
Direct processing (F8). You should see a list with the results of the query
on your first session.
1-4
Stop and display the SQL trace
1-4-1 On the second session, you should still see the SQL trace entry screen
where you have activated the trace. If not, execute the SQL trace
transaction again (ST05). You should see a status line: “SQL trace is
For User ADM525## Activated”.
1-4-2 Stop the trace by using the function “Deactivate Trace”. The trace status
should change to “All Traces are Switched Off - Progress Display On”.
1-4-3 Display the trace data by selecting the function “Display Trace”. This will
bring up a selection screen where you can set restrictions. Make sure that
you select the “Extended Trace List” option. Note that the “Trace Period”
is already set to the times when you started and stopped the trace, and that
the user is set to your current user. Hit Enter to display the trace list.
1-5
Locate and explain the SQL statement for tables SPFLI and SFLIGHT
1-5-1 On the trace list, follow the menu path Trace List → Summarize Trace by
SQL Statement. You will get a summarized list with the longest running
statements on top. Towards the right you can see a column “Obj. name”.
Locate table SPFLI in that column.
1-5-2 Position the cursor on the line where SPFLI is shown as the object name
and OPEN as the operation, then select the Explain function. In the upper
part of the Explain screen, you can see the SQL statement that was sent to
the database.
What tables are used in the statement: ___________________________
What columns are used for the join: ____________________________
__________________________________________________________
What columns are used for in the record selection:
__________________________________________________________
__________________________________________________________
What order by /group by columns are used: _____________________
1-5-3 In the “Details” section of the Explain output, you get more information
about the implementation of the statement. You can expand all sections
that have a “+” in front. Underneath the “MAIN LEVEL”, you find the
implementation details.
What table was used in join position 1: _______________________
What table was used in join position 2: _______________________
How was the “order by” implemented: _______________________
What indexes were used to implement the query:
_______________________________________________________
1-6
Design an index to implement the “order by”
1-6-1 The clause ORDER BY T_01.”PRICE” refers to a column in table
SFLIGHT. In order to build an index over SFLIGHT that can help the
“order by”, we need to find out what other columns could be needed in
that index.
Can the optimizer use an index over table SFLIGHT to implement the
“order by” when table SFLIGHT is in join position 2:
_________
What columns of SFLIGHT are used for record selection with “=”
comparison:
____________________________________________
1-6-2 The record selection (where clause) is comparing the columns to equality,
so only one value is returned for those columns. This allows you to place
those columns in the index prior to the column that is needed to implement
the “order by”. Based on that, what columns should an index have to
implement the “order by”:
_________________________________________________________
1-6-3 After you have designed an index, you should verify if such an index exist.
To do that, you can use transaction SE11 (ABAP dictionary) and display
the table that you want to look at. What columns are in the primary key of
table SFLIGHT:
__________________________________________________________
What other indexes exist over table SFLIGHT:
__________________________________________________________
Solutions
Unit: Problem and Performance Analysis SAP on iSeries
Topic: SQL Trace and Query Optimization
1-5
Solution to Step “Locate and explain the SQL statement for tables SPFLI and
SFLIGHT”
1-5-2 What tables are used: SPFLI, SFLIGHT.
What columns are used for the join: SPFLI.CARRID =
SFLIGHT.CARRID; SPFLI.CONNID = SFLIGHT.CONNID.
What columns are used in the record selection: SPFLI: MANDT,
CITYFROM, CITYTO; SFLIGHT: MANDT, FLDATE.
What order by / group by columns are used: SFLIGHT.PRICE (order by).
1-5-3 Please note that the answers for this part of the exercise could vary if the
query optimizer had chosen a different implementation. The answers given
here were the ones that were seen when preparing the class.
What table was used in join position 1: SPFLI.
What table was used in join position 2: SFLIGHT.
How was the “order by” implemented: Sort of temporary result set.
What indexes were used to implement the query: SPFL0001 (short name
for index SPFLI+001), SFLIGHT (primary key index of table SFLIGHT).
1-6
Solution to Step “Design an index to implement the “order by”
1-6-1 Can the optimizer use an index over table SFLIGHT to implement the
“order by” when table SFLIGHT is in join position 2: No (the order of
rows returned from table 2 is primarily defined by the order in which rows
are returned from table 1).
What columns of SFLIGHT are used for record selection with ‘=’
comparison: MANDT, FLDATE.
1-6-2 What columns should an index have to implement the “order by”:
MANDT, FLDATE, PRICE.
1-6-3 What columns are in the primary key of table SFLIGHT: MANDT,
CARRID, CONNID, FLDATE.
What other indexes exist over table SFLIGHT: None (in the default setup).
Conclusion
1 Course Overview
2 Concepts of IBM eServer
iSeries and i5/OS
3 SAP Architecture for IBM
eServer iSeries
4 Backup and Recovery
5 Maintenance and Install
6 Problem and Performance
Analysis
7 Conclusion
SAP AG 2004, ADM525 Conclusion / Christian Bartels / 1
© SAP AG
ADM525
Conclusion - 1
Course Objectives
You should now be able to:
Explain i5/OS data structures and their usage by
the SAP software
Perform operating system and database
administration tasks
Prepare and implement a backup strategy
Perform data recovery
Analyze problems by using operating system logs
Improve database performance by using SAP
tools for DB2 UDB for iSeries
SAP AG 2004, ADM525 Conclusion / Christian Bartels / 2
© SAP AG
ADM525
Conclusion - 2
Recommended Follow-Up Activities
Go through the exercises using IDES data or your own data.
Read the online documentation.
Read the Implementation Guide (IMG).
Read Release Notes.
SAP AG 2004, ADM525 Conclusion / Christian Bartels / 3
© SAP AG
ADM525
Conclusion - 3
0
You can add this document to your study collection(s)
Sign in Available only to authorized usersYou can add this document to your saved list
Sign in Available only to authorized users(For complaints, use another form )