quinta-feira, 12 de janeiro de 2012

SM21 - How to enable the Central Syslog for and ASCS or SCS

The Central Syslog structure in SM21 provide you with access for the syslog information of all available instances in the system.

Transaction SM21 and select System log -> Choose -> Central System logs.

Every SAP application server has its own shared memory with the syslog created by the kernel. The goal of the Central Syslog Information is concentrate logs from SAP application servers in a Central file that is determined by the parameter "rslg/central/file".
The SAP created 2 external tools called "rslgcoll" and "rslgsend" deamon that are responsible to read the local shared memory for every SAP applicaiton server and store the log information in the central file.

To this work the Collector (rslgcoll) must run in one instance (usually the central instance) and for every application server the Sender (rslgsend) have to be configured.
The Sender is responsible to read the shared memory and forward the logs to the Collector
through TCP protocol and the Collector is responsible to writte these logs in the central file. The SAP note 25526 has further information about this configuration with its TCP ports for the Collector and the Sender.
This configuration with the Collector and the Sender is usually configured in the instalation process of the SAP system and this works very well.

However, for standalone instances like ASCS and SCS the Sender is not configured and you are not able to check the logs from Message Server and Enqueue.
Altough these standalone instances are not a normal dialog instance they have the internal shared memory with the logs. In such way you can start the Sender for every standalone instance and it will solve the problem.

The goal of this "How to" if configure the Sender in a standalone SAP instance in some steps.
In my example I am going to configure in a SCS instance release 700

1) Make sure that the DIR_EXECUTABLE has the rslgsend

2) Set the start up configuration in the start profile

_SE = se.sap$(SAPSYSTEMNAME)_$(INSTANCE_NAME)
Execute_11 = local rm -f $(_SE)
Execute_12 = local ln -s -f $(DIR_EXECUTABLE)/rslgsend $(_SE)
Start_Program_02 = local $(_SE) pf=$(_PF) -F


Note that "Start_Program_XX" must be in a sequencial order of all others Start_Program_XX in the start profile, so you have to use the XX with a high number of the last one.

3) Stop the SCS instance

sapcontrol -nr -function Stop

4) Restart the sapstartsrv service

sapcontrol -nr -function RestartService

5) Start the SCS instance

sapcontrol -nr -function Start









PS1:
The Central Syslog do not work for Windows Enviroment.

PS2:
For detailed information about the Central Syslog check the SAP documentation in this link:
http://help.sap.com/saphelp_nw73/helpdata/en/4b/61d17b6b812e00e10000000a421937/content.htm

PS3:
As from 720 the Central Syslog is running under Web Services (sapstartsrv) instead of Sender and Collector.

quarta-feira, 4 de janeiro de 2012

Does AL11 truncate the content of file?

The transaction AL11 is used to display files and folders. It call the report RSWATCH0.
If you want to display a file, there is a limit in the databuffer that do not display more than 512 charachter in a single line. If the line is bigger of 512 charachter, it is truncated.

You can change the report to increase the line size until 1024 charachters.
Below you do find and example in how to do it and the code that you have to change to take in place this change.

Edit the report RSWATCH0 and perform these changes. I am not providing the line number for each change because this can change as per the Support Pakcage and kernel release.

Change from:
program rswatch0 message-id s1 no standard page heading line-size 512.

[...]
data buffer type c length 512

[...]
new-line.
write at 1(512) buffer.
else.


To:
program z_rswatch0 message-id s1 no standard page heading line-size 1023.

[...]
data buffer type c length 1023.

[...]
new-line.
write at 1(1023) buffer.
else.

segunda-feira, 2 de janeiro de 2012

Much enqueue work process

If you are running an classical ABAP CI with the message server in and dialog instance and the enqueue running in work process, the standard recommendation is to increase the number of ENQ processes up to 3.
Having 4 or more processes does not add any value, since they start block each other in the critical section.


what to do with hanging work process

Work Process Status

Work Process are needed to handle tasks in ABAP instances. In case of an SAP Application Server without available work process no much is possible and the applicaiton server cannot be used.
For this reason the Dispatcher and Taskhandler component are responsible for the work process behavior in the SAP Application Server ABAP.
They are responsible for the main executable disp+work them the lifecycle of workprocesses.

Sometime the work process can hangs, for distinct reason like a bug, error condition, remote execution or fail in the execution.
To check the work process status you can use some ways:

1) From R3 side with transaction SM50 or SM66;

2) From Operating System side with dpmon:
"dpmon pf=<instance profile> l"

3) From Operating System side with sapcontrol:
"sapcontrol -nr <instance number> ABAPGetWPTable"


Identifying an hanging work process

You do find an hanging work process if it is doing nothing for a long time, as you can see in the figure 1. I such way the time may be find in the "Time" column of work process table status. The work process is "Running" for a long time in the same report, this process probably is an hanging Work Process.

Figure 1. Work Process status in SM50

Back it to normal

You can try to cancel the Work Process in some ways:

1) Go to transaction SM50
- select the work process
- click in Process
- Cancel with/without Core

2) Kill it from Operating System side:
"kill -2 <PID> "
"kill -9 <PID> " (critial way)

Root Cause Analysis

The correct way to find out the root cause of the issue is getting further information with the Work Process trace file.
What must be performed in that situation:

1) Save screenshots of the Work Process table status;

2) Increase the work process trace level to get the C-stack from Operating System side:
"kill -USR2 <PID> " or
"sapntkill -USR2 <PID> " (for Windows environment)
The C-stack is the main important because it will be writen in the work process trace file and you do find the called kernel functions when the work process stopped/hangs, with the C-stack is possible to find the component responsible for the situation.

3) If possible, try to reproduce the error increasing the trace to a high trace level. In such way is possible to understand what was happening before the work process got the hanged situation. So, try to idenfity the steps to reproduce the issue.


Others causes

1) Specific reason

The Work Process can hangs for some specific reason that is find in the "Reason" column of Work Process Table Status. These are special conditions and the analysis should be as per the reason.
The figure 2 show an example of hanging work process for RFC reason.

Figure 2. Transaction SM50

The possible reasons are:
1. Session waits for debugger input
2. Session waits for RFC response
3. Session waits for enqueue response
4. Session waits for update response
5. Session waits for spool
6. Session waits for adm message response
7. Session waits for number range buffer response
8. Session waits for gui input
9. Session is hold because of private memory
10. Session waits for update admin message response
11. Session reads the server list
12. Session waits for gateway monitor response
13. Session waits for return of blocking snc call
14. Session is locked for a dedicated user
15. Session sleeps
16. Session waits for a message to be send
17. Session waits for execution of an operation system command
18. Session waits for execution of an msg server action
19. Session waits for ARFC execution
20. Session waits for response of an remote action
22. Session waits for update 2 response


2) A semaphore

The semaphores are another reason for the hanging situation. You do find this situation in the "Sem" column. For example the figure 3.

Figure 3. Work Process with semaphore

The reasons for the semaphores are in the SAP note 33873.

1: PXA-Semaphore (ABAP program buffer)
2: WP_CA_ADM-Semaphore (workprocess/dispatcher communication )
3: APPC_CA_ADM-Semaphore (workprocess/gateway(gwrd) communication)
4: TM_ADM-Semaphore (workprocess/dispatcher communication )
5: COMM_ADM-Semaphore (workprocess/dispatcher communication )
6: ROLL_ADM-Semaphore (roll administration)
7: PAGING-Semaphore (paging administration)
8: NO_BUFFER-Semaphore (number range buffer)
9: STAT-Semaphore (statistics buffer)
10: GW_REQ_IND-Semaphore (gateway request)
11: CALI_BUFFER-Semaphore (calendar buffer)
12: CCC-Semaphore (character conversion buffer)
13: Verbucher-Semaphore (update startup)
14: PRES_BUF-Semaphore (presentation buffer)
15: SHM_ADM_AREA-Semaphore (shared memory administration)
16: DB_TBUFF-Semaphore (DB generic key table buffer)
17: DB_SYNC-Semaphore (DB buffer syncronization)
18: DB_TTAB-Semaphore (DB nametab buffer)
19: DB_SNTAB-Semaphore (DB nametab buffer)
20: DB_IREC-Semaphore (DB nametab buffer)
21: DB_FTAB-Semaphore (DB nametab buffer)
22: LOGFILE-Semaphore (batch input logfile)
23: REQ_QUEUE-Semaphore (dispatcher request queue)
24: DB_TBUFF_P-Semaphore (DB single key table buffer)
25: ENQ_REQ-Semaphore (enqueue request/local server)
26: ENQ-TABLE-Semaphore (enqueue table)
27: SAPCOMM_1-Semaphore (sap-comm)
28: SAPCOMM_2-Semaphore (sap-comm)
29: FIXADR-Semaphore (VMS fix addresses)
30: DB_CUA_BUFFER-Semaphore (CUA(=Menu) buffer)
31: RSPO_ADMIN-Semaphore (spool administration)
32: EM_ADM-Semaphore (memory management, extended memory admin)
33: ES-Semaphore (memory management, extended segm. admin)
34: MSBUF-Semaphore (messageserver buffer)
35: SEM_DB_OBJ_BUFFER (Export/Import buffer)
36: SEM_ES_USER_KEY (Estended Segments User Lis )
37: SEM_SEM2MTX_KEY (global mutex for sem2 / mt )
38: SEM_CCMS_AS_MONI_KEY (CCMS monitoring for appl.s)
39: SEM_EG_ADM (Extended Global Memory )
40: SEM_TEST_1 (reserved for test programs)
41: SEM_TEST_2 (reserved for test programs)
42: SEM_STAT_BUF (shared statistic buffer)
43: SEM_RSPO_CACHE (rspo cache)
44: SEM_AUDIT_SHM (basis audit shm protectio )
45: SEM_ASTAT_KEY (application statistics bu )
46: SEM_PROFILE___DUMMY (profile parameter buf)
47: SEM_RSPO_RFC-Semaphore (spool async rfc calls)
48: SEM_ENQID_KEY (EnqId )
49: SEM_PRIVATE_KEY_MAX (maximum private key number)
50: SEM_THRUN_ADM (taskhandler runtime)
51: SEM_ATRA_KEY (protect atra memory)
52: SEM_MPI_ADM (memory pipes adm. (MPI))
53: SEM_COV_KEY (shbuf of coverage analyzer)
54: SEM_ZDATE_TIMEINFO (WP-independ. time sync info)
55: SEM_DB_OTR_BUFFER (Online Text Repository Buf.)
56: SEM_DB_ESM_BUFFER (Export/Import Memory)
57: SEM_RTM_KEY (shbuf of runtime monitor)
58: SEM_JAVA_1 (sem 1 for java)
59: SEM_ABAP_SHO (ABAP shared objects)
60: SEM_JCONTROL_ADMIN (JControl Administration)