Você está na página 1de 9

Is my SAP job hang

Posted on September 13, 2012

A SAP job is running longer than normal and SAP job log in SM37 has no new
output for long time. Is the SAP job dead? Is my SAP job hang? You are running a
SAP program online, there is no expected result returned by the SAP system
after the normal wait time, is the SAP program hung? This post would use SAP
background job as example to show how we can check whether a SAP
job/program is truly hung or dead.
1 Overview on how to verify whether a SAP job is hung
A sap background job is always engaging SAP background work process. A
normal running SAP background process should be executing either ABAP logic
or database operation. ABAP logic operation (include table buffer access at
application server level) is consuming CPU power of an application server.
Database operation(read, insert, update or commit) activities can be seen via
database process/session monitoring tool. If a job is not consuming CPU power
and database process/session monitoring tool shows no activities then the
transaction is hung. Following are the summary of check steps:

Identify corresponding SAP work process related to the SAP job via SAP
transaction SM37.

Examine status of the SAP work process related to the job via SAP
transaction SM50/SM51.

Verify database activities in database process monitor via SAP transaction


DB02/ST04.

Review database block situation via SAP transaction DB01.

Not all above steps/checks has to be executed and in above sequence. This
depends on your case. But after all above checks, a decision on whether the SAP
job/program is still running or truly hung can be reached for subsequent
action.
2 Details on how to verify whether a SAP job/process is hung

2.1 Verify the sap background job and Identify corresponding SAP work
process.
Assuming that you already know name of the SAP background job, you can use
SM37 to monitor the job status to make sure the job is still in active status like
below

To get the corresponding SAP background work process info for a job, you can
double click on the job entry in SAP SM37, then click job details icon on the
subsequent screen

Upon clicking job details icon, the information needed is showed in the
Detailed Information window:

From the above screen, information needed for the next step check can be
found SAP work process number such as 53,
OS level Process ID such as 26,688 and

Executing server Server name is masked here per security requirement.


2.2 Check the SAP background process status via SAP work process
overview
In this step, we check SAP work process overview, SAP work process details view
which has CPU time and database operation progress status.

2 . 2 . 1 C H E C K S A P W O R K P R O C E SS OV E R V I E W

Based on SAP work process number or PID number and the server information
from SM37, SAP transaction SM51/SM50 can be used to locate the specific SAP
background process in SAP Process Overview window. SAP transaction SM51 lists
all available servers/instances in a SAP system and so switching to the server
where the sap background process is running is possible.
Following is a part of SM50 Process Overview screen.

SAP background work process in SM50 could be in different status. This post
would focus on SAP background process which is in running status when
Action column is blank or a database operation like Sequential
Read/direct read/Insert /Delete/Update/commit .
Following is a sample of SAP50 Process Overview screen showing Background
process which has a status Running with a blank Action or sequential read
data operation

If content in Action and/or Table columns is changed upon refreshing screen,


then the background process is not hung. Otherwise, further check is needed to
see whether the SAP work process is hung.

2 . 2 . 2 R U N N I N G S A P B A C K G R O U N D P R O C E SS W I T H B L A N K A C T I O N I N S A P S M 5 0

SAP process in this status should be executing ABAP logic which is using CPU
power. SAP SM50 records CPU time which a work process spends since it starts.
CPU time is in Process details screen which can be seen upon double clicking the
work process in SAP SM50 Work Process Overview. Following is a part of SAP
SM50 work process detail screen

If it is found that CPU time is increased together with response time after the
SAP SM50 screen is refreshed, then the SAP work process is not hung and the
SAP job is running normally from system point view. This is true to the above
example as showed in following screen

You can see both CPU time and response time is increased.
If CPU time is not increased, then this process is hung.

2 . 2 . 3 R U N N I N G S A P B A C K G R O U N D P R O C E S S W I T H D ATA B A S E O P E R AT I O N A C T I O N

At this stage, SAP background process is checked to see whether it is hung at


database operation.
Refreshing SM50 screen again and again nothing changed except the time in the
following screen. Is this SAP background process hung at Sequential Read at GLPCA?

To answer that question, work process details needs to be checked.

Refreshing above screen in reasonable interval to see whether any number


related to database operation is changed, if yes, then the SAP background
process is not hung and corresponding SAP background job is running normally.
If no number changed in above screen, is this process hung? Not necessary.
Since it is a database operation, further check is needed to see whether it is
hung at database level.

2.3 Verify database activities in database process monitor via SAP


transaction DB02/ST04
ST04 database process monitor is to find what is going on oracle level. Number
in Logical read, physical read and/or Block changes column should be
increased in process/session monitor when the screen is refreshed while the sap
work process is in sequential reading.
PID field in transaction sm50 screen is uniquely mapped to client process in
Oracle session, so corresponding oracle process/session can be located via PID
such as 20221 in my case.

If there is a change on the number, then the SAP background process is not
hung and the SAP job is running normal.
If there is no change on any of the number, then what is next step? If it is a
read operation, then the SAP job is hung. If it is not a read operation, then
further check is needed via database lock monitor SAP transaction DB01.
2.4 Review database block situation via SAP transaction DB01
SAP transaction DB01 would show who is holding a lock and who is waiting for
the lock

You can use PID to check whether your background process is appeared in above
screen in a status of _WAIT. If your background process ID is waiting for a lock
which is being held by another process, your process is not hung but having a
contention with other process and being blocked. You need to refresh the DB01
screen several times based on how long the process has been blocked in DB01.
Your job would be moving again after the lock is released.
After all those checks, a running background process is hung if it is not
consuming CPU time, incurring no database activities ,and it is not being
blocked in database lock monitor. So the corresponding SAP background job is
hung. Otherwise, it is running even it seems hung.
3 Further clarification
There are rare cases where SM37 job status is not synchronized with SAP
SM50 work process. You cannot find the associated PID in SAP SM50 for the job.
You just need to run SM37 job Synchronization command to fix this.
SAP dialog process and updating process can be long running as well. You can
use similar approach covered in this post to find out whether they are hung
when needs arise.
This post focuses on SAP work process which is at Running status. There are
other statuses like On Hold or Stopped related to a running job/program.
SAP work process should be briefly in On hold unless there is a resource

bottle-neck or programmed wait situation. When SAP work process is in on


hold status, you can using info from Reasn column to figure what is waiting
for like RFC, Upd, ENQ, SLEEP etc.
The database operations which change table data status should be a brief
operation if the process is not being held due to lock contention. Long operation
is normally with sequential read on big table or massive table data updating.
Database process could have inactive status in ST04 as well. But I have not
seen a inactive status process(Shadow or agent) in SAP ST04 related to a
running job/program.
To find out what the program is actually doing, you can trace the process using
SAP ST12 transactions. If program seems hung on ABAP operation, you can
verify it via process debug option available in Work Process Overview screen
of SAP SM50. In my experience, I have seen many cases where SM50 reports no
database operation change for over half hour on a running work process which
seems hung in Sequential Read but it is actually moving in Oracle session
monitor and actually the job is moving slowly as well.
This type of verification only happens that the job has been running over normal
run-time range. Root causes of this I have seen are volume, contention, system
status or/and a change in table access strategy. But the job itself is not truly
hung.
I have seen SAP work process hung due to system kernel.

Você também pode gostar