Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
csaba_goetz
Contributor

Imagine, what if you have a classic or highly available SAP system and it either crashes more than twice or you have to restart it at least two times or due to an issue the HA software does it automatically (a.k.a. switchover or failover)? Well, in this case all the developer traces and logs will be gone including all the important information. These traces and logs are necessary for root cause analysis.

How to overcome the above situation?
I've just tested it in one of my test systems and found a way to save these information instead of loosing them.

What to consider before doing anything?

Pro

  • SAP saves work folder automatically while startup
  • No 3rd party tool involved
  • Compression
  • Date and time of saving is part of filename

Con

  • File system may overflow
  • You have to manually delete unnecessary archives later on
  • Some delay while startup procedure

You want more?
Follow the white rabbit instructions:

  1. Check in /usr/sap/<SID>/<instance>/work/sapstart.log what profile is responsible for starting up SAP.
    Example: Startup Profile: "/usr/sap/<SID>/SYS/profile/<SID>_D<VEBMGS><NR>_<hostname>"
  2. Find a suitable Execute_<NR> line entry for this profile where <NR> is a unique, two-digit number in this profile. Increase the highest available Execute_<NR> by one.
    Example:
    • highest available Execute_<NR> entry is: Execute_08 = <command>
    • next entry will start therefore with: Execute_09 = <command>
  3. Add the following line: Execute_<NR> = <command>
    Example:
    Execute_09 = immediate $(DIR_CT_RUN)/SAPCAR -cfi $(DIR_INSTANCE)/work_`date +%Y%m%d_%H%M%S`.SAR -C $(DIR_INSTANCE)/work . -F "core*"

Explanation:

  • Execute_09 = immediate executes the command immediately at startup. Check Starting SAP Services by Making an Entry in the Instance Profile -  Configuration in the CCMS - SAP ... out.
  • $(DIR_CT_RUN)/SAPCAR -cfi $(DIR_INSTANCE)/work_`date +%Y%m%d_%H%M%S`.SAR defines the name of archive file with timestamp and ignores files in use.
  • -C $(DIR_INSTANCE)/work . creates an archive with only the files of a directory.
  • -F "core*" excludes all core files (which may quite large). -F won't work with all of SAPCAR releases; run SAPCAR without arguments to get more information about known options.

Result:

ls -al /usr/sap/<SID>/<instance>/ | grep -i work

drwxr-xr-x 3 <sid>adm sapsys    12288 Oct 14 15:19 work

-rw-r--r-- 1 <sid>adm sapsys 83832120 Oct 14 15:18 work_20151014_151738.SAR


If you have an SAP system on Windows, check Autosave of SAP instances' work folder (on Windows)

Enjoy.

1 Comment