Saturday, 28 March 2020

Few calculation for Performance tuning

  1. R/3 workload monitor (ST03N)       
                  wait time > 10% of response time

                        Solution: General performance problem, can ignore.
       2.High database time: database time > 40%(response time- wait time)
                        Solution: detailed analysis of the database
       3.Processing time > cpu time *2
                        Solution: Detail analysis of hardware bottlenecks
       4. load time > 50 ms
                        Solution: Detailed analysis of R/3 memory configuration( is the program buffer too small?)
       5. Roll- wait time or GUI time > 200 ms
                      Solution: Detailed analysis of interfaces and GUI communication
                                                   -->OS logs.
      6. T-code OS06-->  for network speed check.
      

Wednesday, 25 March 2020

SUM Update plan for reference


workload analysis (ST03) - different types of times

Different types of times in performance tuning:

  1. Front end or GUI time: time taken to process the request from presentation layer(GUI) to dispatcher of application.
  2. wait time: After reaching in to Dispatcher, Dispatcher sends that request to dispatcher queue,which works with mechanism FIFO- first in first out.
                        - based on no. of previous requests & work process number the request need to wait  
                          in the dispatcher queue for some time, this time is called wait time.
      3. Roll- in- time- Time taken to assign user request from dispatcher queue to dialog wp.
                                   once the availability of wp is called roll-in-time.
      4. Database time: time taken for dialog work processor to collect data from database.
      5.Load time: time taken to provide inputs by the user.once after login.
      6. Processing time: Time taken to process the request with in the application layer.
      7.RFC time: Time taken by rfc connection to communicate to target server, only need if the user                                request consists of RFC communication.
      8. Roll-out-time: time taken for user request to sign out from the server.
      9.CPU time: if the request is based on OS file system.then time taken by CPU is called CPU time 
      10.Response time: Time taken by all the above times.
      
Analysis:

Large wait time: communication problem with GUI or external system.
Large load time: program buffer, CUA buffer, or screen buffer too small.
Large database request times: CPU/memory bottleneck on database server, network problems,expensive SQL statements,database locks,missing indexes,missing statistics,small buffers
Large CPU times: Expensive ABAP processing. for example, processing large tables,frequently accessing of R/3 buffers
processing CPU bottlenecks,network problems,communication problems

Performance analysis -1

Major reasons for the performance issues:
1. Long running programs may cause system bottlenecks
2. High utilization of cpu (ST06)
3. High utilization of RAM (ST06)
4. High utilization of i/o (ST04)
5. High utilization of Network (ST06)
6. Configuration (Memory / buffer) configuration.

Who are responsible for performance tuning:
  1. BASIS Consultant.
  2. ABAP Consultant.

BASIS tuning:

1. Optimize system parametrs
    - R/3 paramters (for example, No. of dialog workprocess).
    - Database parameters (for example, Database buffer sizes).
    - Operating system
    - network parameters
2. Optimize database disk layout through I/O balancing.
3. Optimization of workload distribution
    - Number of workprocess
    - Number of background process
    - log -on groups
4.Verify hardware sizing by detecting hardware bottlenecks

Brief intro to Performance tuning in SAP BASIS

Monitoring of performance can be done with the below T-codes.

ST01   - system trace
ST02   - Tune summary
ST03/ST03N/ST03G - workload analysis
ST04   - DB monitoring
ST05   - SQL trace
ST06   - OS monitoring
ST07   - Application monitoring
ST11   - Developer trace
ST22   - ABAP dump analysis

Hence from the above list of T-codes, they are 3 types of traces

1. System trace
2. Developer trace
3. SQL trace

Saturday, 21 March 2020

Sed - stream editor


                                        Sed-Stream Editor

A Stream is data that travels from:
  • One process to another through a pipe.
  • one file to another as a redirect.
  • one device to another.
What Sed do:

Sed Performs text transformations on streams.

Examples:
  • Substitute some text for other text.
  • Remove lines.
  • Append text after given lines.
  • Insert text before certain lines.
Note: Sed is used programmatically, Not interactively.


Let's get hands dirty:

#!/bin/bash
echo "John is the assistant regional manager." > manager.txt

  1. To exit the text @ only terminal level,but not on the actual file.

  • sed 's/assistant/assistant to the' manager.txt

                here s - substution.

      2. Sed is case sensitive by default.

          echo 'my name is naveen' > name.txt

sed '/s/NAVEEN/praveen/' name.txt

output:
my name is naveen ( No change)

To solve above problem use:

sed 's/naveen/praveen/i' name.txt          # here i for eliminating case sensitive in sed statement.

or 
sed 's/naveen/praveen/I' name.txt

    3. To change the global entries in the file using sed.

              sed 's/my wife/my life/g' love.txt


     4.To delete the line with specific key word 

              sed '/This/d' love.txt

here the line starting with This will be deleted automaticallay. and result will obtained in the actual file.




9C9D6D00AB6300- Registration code





Rsync and csync in linux


Today, a typical user has several computers: home and workplace machines,a laptop, a smartphone or a tablet. This makes the task of keeping files and documents in sync across multiple devices all more important.


Rsync offers a reliable method of transmitting only changes within files.
Eg:
suppose 2 job scheduled in crontab job at 10:00 am  & 11:00am (at hour intervel of time).
New folder is the folder need to move from source system to target system. and newfolder consists of 4 files at 10:00am, at 10:35 new file created, so total number of files available now in new folder is 5. When crontab job schedules at 11:00am only 5th file will move from source system to target system with Rsync tool.
This applies not only to text files but also binary files. To detect the differences between files.

Few important Facts about rsync:


  1.  Rsync can be particularly useful when large amounts of data containing only minor changes need to be transmitted regularly.
  2.  Rsync is a tool that copies data only in one direction at a time. (for source to target system only).
  3.  If you need a bidirectional tool which is able to synchronize both source and destination, use Csync.
  4.  The SOURCE and DEST placeholders can be paths, URLs, or both.
  5. When working with Rsync, you should pay particular attention to trailing slashes. A trailing slash after the directory denotes the content of the directory. No trailing slash denotes the directory itself.

Pre-requsites:

  • current user has write permissions to the directory in the target system.
  • Ensure that rsync service already installed in both source and target systems.
                                   yum install rsync   
different rsync commands:

  1. Moving the files with in the system to different directory:
               source-dir> rsync -avz backup.tar.gz  /var/backup/

Here: 
  • source_dir - is the source directory where the backup.tar.gz (which file need to move to target) exist.

  • -avz:

-v Outputs more verbose text 
-a Archive mode; copies files recursively and preserves timestamps, user/group ownership, file permissions, and symbolic links.
-z Compresses the transmitted data 
  • backup.tar.gz is the file which needs to move to target.
  • /var/backup/ is the target directory.
2. To sync directories:

tux > rsync -avz tux /var/backup/ 

tux is the directory.

3.Copying Files and Directories Remotely

pre-requisites: for remote system.
  • The Rsync tool is required on both machines.
  •  To copy files from or to remote directories requires an IP address or a domain name.
  •  A user name is optional if your current user names on the local and remote machine are the same. 
  • Make sure that target server user used in rsync is having with write access.
cmd:

tux > rsync -avz  file.tar.xz    tux@192.168.1.1:X:/path in the destination server





 Configuring and Using an Rsync Server

Rsync can run as a daemon ( rsyncd ) listing on default port 873 for incoming connections. This daemon can receive “copying targets”. 







Wednesday, 11 March 2020

select the sort order in sybase


Selecting the Sort Order

Different languages sort the same characters differently. SAP ASE uses sort orders to create indexes, store date into indexed tables, and specify an order by clause.
For example, in English, Cho is sorted before Co, whereas in Spanish, the opposite is true. In German, β is a single character, however in dictionaries it is treated as the double character ss and sorted accordingly. Accented characters are sorted in a particular order so that aménité comes before amène, whereas if you ignored the accents, the reverse would be true. Therefore, language-specific sort orders are required so that characters are sorted correctly.
Each character set comes with one or more sort orders that SAP ASE uses to collate data. A sort order is tied to a particular language or set of languages and to a specific character set. The same sort orders can be used for English, French, and German because they sort the same characters identically, for example, AaBb, and so on. Or the characters are specific to one of the languages—for example, the accented characters, Ã© , Ã , and Ã¡, are used in French but not in English or German—and therefore, there is no conflict in how those characters are sorted. The same is not true for Spanish however, where the double letters ch and ll are sorted differently. Therefore, although the same character sets support all four languages, there is one set of sort orders for English, French and German, and a different set of sort orders for Spanish.
In addition, a sort order is tied to a particular character set. Therefore, there is one set of sort orders for English, French, and German in the ISO 8859-1 character set, another set in the CP 850 character set, and so on. The sort orders available for a particular character set are located in sort order definition files (*.srt files) in the character set directory.


1860413 - How to change character set or sort order of SAP ASE

Symptom


  • How to change the default character set and sort order of ASE?
  • Steps to change character set or sort order in ASE.

Environment

SAP Adaptive Server Enterprise (ASE)

Resolution

Below 2 examples of how to change character set and sort order.

EXAMPLE 1 Change from iso_1 character set to UTF8 character set, keeping binary sort order
=============================================================================
  1. Run sp_helpsort to check current character set & sort order (output truncated for clarity) :
sp_helpsort
go
Sort Order Description

Character Set = 1, iso_1ISO 8859-1 (Latin-1) - Western European 8-bit character set.
Sort Order = 50, bin_iso_1Binary ordering, for the ISO 8859/1 or Latin-1 character set (iso_1).
  1. Check which character sets and sort orders are installed:
select type, id, csid, name from syscharsets
go
Note: For 'type' columns, numbers from 1001 to 1999 represent character sets. Numbers from 2000 to 2999 represent sort orders.
  1. Add a UTF8 charset with binary sort order to ASE, using 'charset' utility which can be found in $SYBASE/ASE-1*_0/bin:
charset -Usa -SASE binary.srt utf8
.....
Finished loading file 'binary.srt'.
1 sort order loaded successfully
  1. Change default character set:
sp_configure 'default character set id', 190   --  character set # 190 is utf8
go
  1. Restart ASE twice.
On first restart, ASE will detect character set change and will shutdown automatically after these log messages :
Default Sort Order successfully changed.
ASE shutdown after verifying System Indexes.
  1. Run sp_helpsort to check changed character set:
sp_helpsort
go
Sort Order Description

Character Set = 190, utf8
Unicode 3.1 UTF-8 Character Set
Class 2 Character Set
Sort Order = 50, bin_utf8
Binary sort order for the ISO 10646-1, UTF-8 multibyte encoding character set (utf8).
         
EXAMPLE 2 Change from iso_1 with binary sort order to cp1250 with noaccents sort order==========================================================================
The second example is similar to the first. Please refer to Example 1 for explanations / more detailed outputs.
  1. Run sp_helpsort to check current character set & sort order (output truncated for clarity) :
sp_helpsort
go
  1. Check which character sets and sort orders are installed:
select type, id, csid, name from syscharsets
go
  1. Add the cp1250 charset with binary AND noaccent sort orders to ASE, using 'charset' utility:
charset -Usa -SASE binary.srt cp1250
charset -Usa -SASE noaccents.srt cp1250
  1. Change default character set:
sp_configure "default character set id", 22  --  character set # 22 is cp1250
go
sp_configure "default sortorder id", 54       --  sort order id # 54 is noaccents
go
  1. Restart ASE twice.
  1. Run sp_helpsort to check that the new character set has been changed successfully.
sp_helpsort
go
Sort Order Description

Character Set = 22, cp1250
Microsoft Windows Code Page 1250, Eastern Europe
Sort Order = 54, noaccents_cp1250
Polish Windows dictionary sort order. Uses the Polish and EE Windows code page 1250 character set and is case and accent insensitive.
  1. Run dbcc reindex when needed, see KBA 2496376 - Index is marked as suspect after sort order has been changed. SAP ASE

Tuesday, 10 March 2020

Login message in Linux server

Vi  /etc/mofd

*mofd - message of the day

Check file system space script


Method - 1:

Disk Space Check
=================
# Check the filesystem
df -h
# Remove un-wanted rows
df -h | egrep -v "Filesystem|tmpfs"
# Get 5th and 6th column
df -h | egrep -v "Filesystem|tmpfs" | awk '{print $5, $6}'
df -h | egrep -v "Filesystem|tmpfs" | awk '{print $5}' | cut -d'%' -f1`
--------------------------------------------
First For loop script
vi checkdisk
#!/bin/bash
a=`df -h | egrep -v "tmpfs|devtmpfs" | tail -n+2 | awk '{print $5}' | cut -d'%' -f1`
for i in $a
do
        if [ $i -ge 50 ]
        then
        echo Check disk space $i `df -h | grep $i`
        fi
done
--------------------------------------------


Method - 2:


#!/bin/sh
df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{print $5,$1}' | while read output
do
        usep=$(echo $output | awk '{print $1}' | cut -d'%' -f1  )
        partition=$(echo $output | awk '{print $2}' )
       
        if [ $usep -ge 90 ]
        then
        echo "Running out of space \"$partition ($usep%)\" on $(hostname) as on $(date)"
        fi
done
--------------------------------------------


Method - 3 (simple method):
#Write a script to awk only those rows with the value

#!/bin/sh
df -h | awk '0+$5 >= 10 {print}'
To make it presentable
echo
echo Following is the disk space status
echo
df -h | awk '0+$5 >= 10 {print}' | awk '{print $5, $6}'

Saturday, 7 March 2020

Backup of file system using scripts and moving the backup file to remote server.

 #!/bin/bash
# This script is used to take backup of mount point /var and /etc

tar -cvzf /tmp/backup.tar.gz /var /tmp
find /tmp/backup.tar.gz -mtime +1 -type f -print &> /dev/null
If [ $? -eq 0 ]
        then
        echo backup completed successfully
        echo
 echo moving backup file to backup  server...
   echo .
   echo ..
   echo ...
scp /tmp/backup.tar.gz  root@192.168.1.1 x:/backup/
else
echo backup failed
echo
echo troubleshoot the script
fi

:wq!

Friday, 6 March 2020

Delete old files through scripts

# To delete old files older then 90 days
find /home/scripts/    -mtime +90 -exec rm ( )\;

#To add .old extension to older files from more then 90 days
find /home/scripts/ -mtime +90 -exec mv {} {}.old ( ) \;

#To list all the files older then 90 days

find /home/scripts/ -mtime +90 -exec ls -l ( ) \;

Thursday, 5 March 2020

How to include linux commands in scripts, effectively with echo command - Basic OS monitor script



#/bin/bash
echo hi!!! Naveen
echo
echo welcome to basic os monitoring script
echo
echo top 10 processes running now
top | head -10
echo
echo mount point size
df -h
echo
echo free memory in the system now
free -m
echo
echo output of uptime command
uptime
echo
echo io statistics
iostat
echo
echo

OUTPUT :

Hostname:/install # ./basic_mon.sh
hi!!! Naveen

welcome to basic os monitoring script

top 10 processes running now
top - 11:10:05 up 79 days,  2:20,  1 user,  load average: 0.19, 3.69, 3.22
Tasks: 425 total,   1 running, 424 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.3 us,  0.3 sy,  0.0 ni, 99.4 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:  13201688+total, 66643632 used, 65373244 free,   593712 buffers
KiB Swap: 20971516 total,    78036 used, 20893480 free. 29159464 cached Mem

  PID USER      PR  NI    VIRT    RES    SHR S   %CPU  %MEM     TIME+ COMMAND
 1962 root      20   0  425120   1596    508 S  6.250 0.001 331:15.05 tuned
20580 pl0adm    20   0 13.934g 9.828g 640468 S  6.250 7.806   8:37.73 hdbindexserver
27050 root      20   0   41340   3260   2208 R  6.250 0.002   0:00.02 top

mount point size
Filesystem                                   Size  Used Avail Use% Mounted on
/dev/xvda1                                    40G  4.8G   33G  13% /
devtmpfs                                      64G     0   64G   0% /dev
tmpfs                                        110G     0  110G   0% /dev/shm
tmpfs                                         64G  800K   64G   1% /run
tmpfs                                         64G     0   64G   0% /sys/fs/cgroup
/dev/xvdd                                    2.9G  771M  2.0G  28% /opt/bmc
/dev/xvdc                                    2.0G   21M  1.8G   2% /tmp
/dev/xvdb                                    2.0G  1.3G  536M  72% /var
/dev/xvde                                    7.8G  6.9G  471M  94% /usr/sap
:/vol1_XY0_PL0/q_sysfiles/sapmnt  100G   23G   78G  23% /sapmnt/PL0
:/vol2_XY0_PL0/q_dbdata           3.5G  1.9G  1.7G  52% /hana/data/PL0
:/vol1_XY0_PL0/q_sysfiles/db      100G   23G   78G  23% /usr/sap/PL0
:/vol3_XY0_PL0/PL0                1.0G  4.8M 1020M   1% /hana_backup/PL0/log
:/vol1_XY0_PL0/q_install          100G   23G   78G  23% /install
:/vol1_XY0_PL0/q_dbhome           100G   23G   78G  23% /sybase/PL0
:/vol3_XY0_PL0/HDB_PL0            1.0G  4.8M 1020M   1% /hana_backup/PL0/data
:/vol1_XY0_PL0/q_dblog            100G   23G   78G  23% /hana/log/PL0
:/vol1_XY0_PL0/q_sysfiles/hana    100G   23G   78G  23% /hana/shared/PL0
:/vol3_XY0_PL0/q_dbarch           1.0G  4.8M 1020M   1% /sybase/PL0/saparch_1
:/vol1_XY0_PL0/q_dbdump           100G   23G   78G  23% /sybase/PL0/shmdump
:/vol1_XY0_PL0/q_dblog            100G   23G   78G  23% /sybase/PL0/saplog_1

free memory in the system now
             total       used       free     shared    buffers     cached
Mem:        128922      65081      63841        607        579      28476
-/+ buffers/cache:      36025      92897
Swap:        20479         76      20403

output of uptime command
 11:10am  up 79 days  2:20,  1 user,  load average: 0.19, 3.69, 3.22

io statistics
Linux 3.12.74-60.64.107.1.17187.0.PTF.1126890-default (hec01v031100)    03/05/2020      _x86_64_        (40 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.72    0.00    0.29    0.01    0.00   98.97

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
xvda              1.39         2.06        20.03   14072349  136903676
xvdb             12.40         1.46        71.67    9971369  489811208
xvdc              0.69         0.09         8.26     623249   56442324
xvdd              0.07         0.38         0.28    2618305    1939448
xvde              0.63         1.66         4.22   11356101   28809664
xvdy              0.75         1.51         0.00   10313048          0
xvdz              0.19         1.16         2.43    7896116   16575008


Access data from file in linux scripts

instead of search for one particular word line by line in file using the below command in scripts

In manual way of running Linux command, more command is useful to search for key word.

The follow method can be used to search for a key word in file in script point of view.

  1. To grep error messages from log file.
                  grep -i error /usr/sap/sid/work/dev_disp.log
      2.To grep warming messages from log file.
                 grep -i warning /usr/sap/sid/work/dev_disp.log
      3. To grep  for fail  key word in the file.
                grep -i fail /usr/sap/sid/work/dev_disp.log


Output to file:To send output  of above cmd to one file use syntax as below:



grep  -i error /usr/sap/sid/work/dev_disp.log > /install/error.log

Wednesday, 4 March 2020

ST02

My reference: https://itsiti.com/st02-tune-summary



ST02: Tune Summary

Transaction code ST02 is used to display the current status of  memory resource usage for a specific SAP application server.
1. The hit ratio for the R/3 buffers should be 98% or better. Hit ratio less than 98% can be regarded as acceptable only for the Program buffer, the single record buffer and export/import buffer. There should be no swaps in the buffers. If there are swaps the buffer size or the max. numbers of entries should be increased.(appr. 10000 swaps per day represents an acceptable number of buffer displacements)
Hint:
• HitRatio – The percentage of data accesses that are satisfied by the buffer and do not require database accesses. HitRatio for each buffer > 98%.
• Check the free space & the free directory for each buffer.
• Check Hits, program buffers should be 10000 hits/day & for other buffers it should be 1000 hits/day.
Solution:
• Amend the Buffer parameter values by increasing the old value by adding approx 10% and then restart the system. Buffer swapping is normal as long as the HitRatio > 98% , then nothing need to be change.
2. If R/3 extended memory is full (when max.used > 80% in memory) -> Go to Detail analysis menu -> SAP memory -> Mode list Individual users consuming a lot of memory -> Analyze user actions. Enlarge the R/3 extended memory if there is enough main memory. Hint: Current usage of Extended memory < 80%.
3. Hint: Hit ratio > 95% for “Select” and “Select Single”.
Additional note:
• Hitratio : The percentage of data accesses that are satisfied by the buffer  and do not require database accesses.
• Allocated : Max. amount of memory area that can be occupied by the respective buffer as defined by the parameter limiting the buffer size.
• Free Space : Currently unoccupied memory space in the respective buffer.
• Dir. Size Entries : Max. number of objects that can be stored in the buffer.
• Swaps : Number of buffer objects displaced from the buffer.
• Database access : Number of database access. (data transfers from the database into the buffer)
• Free Directory Entries : Difference between the current number of objectsstored in the buffer and the max. possible number of objectes.

Monday, 2 March 2020

T-code SMMS: SAP Message Server Monitor


SMMS: SAP Message Server Monitor


You can use the message server monitor to closely monitor the functioning of the message server. The initial screen is identical to the SAP Application Server Overview (SM51). All SAP servers that have logged on to the message server are displayed. To monitor the message server, you can use the Message Server Monitor (transaction SMMS) in the SAP System. You can check and change all the important settings, create and view traces, read statistics, and so on.

Prerequisites

You are logged onto the SAP system, and the message server is running.

Features

The menu option Goto contains all of the functions of the message server monitor.

Display Details

To view detailed information about the client on which the cursor is positioned, choose Goto > Display  details.

Information about the Release

To view detailed information about the release of the message server, choose Goto > Release Notes. The release notes provide information on the version of the SAP Message Server, and on the release and Support Package level of the SAP kernel. Kernel information tells you the release of the SAP kernel. Besides kernel release and compile information, this screen provides the following information:
• Update level specifies with which kernel releases the kernel can run in an SAP System. If different application servers are to run with different kernel patch levels in one system, they must all have the same update level.
• Patch number specifies the last Support Package level that is relevant for the component message server.
• Source ID indicates the actual kernel patch level (the number after the full stop).

Hardware Key

You can display the hardware key of your SAP system, which you need to install the SAP license, by choosing Goto > Hardware Keys.

Parameters

You can view all the parameters associated with the Message server by choosing Goto > Parameters > Display. Some of these parameters can be changed dynamically while the system is running; to do this, choose Goto > Parameter > Change. You can display the RZ11 documentation for every parameter. To do this, place your cursor on the parameter name and choose Documentation.

Statistics

You can activate, display, deactivate, or reset Message server statistics. To do this, choose Goto > Statistics. The statistics include information on, among other things, the number of logins, requests received, bytes written and read.

Trace

You can access the following functions of the message server trace by choosing Goto > Trace:
• Display trace file (dev_ms)
• Reset trace file
• Increase or decrease trace level

Services

To display the open ports on the message server choose Goto > Services. On these ports you can access the message server, if you want to Monitor the Message Server from the Browser.

Logon Data

You can display the logon data for the individual SAP application servers that are currently logged on to the message server. To do so, select a server and choose Goto > Logon data > Display.
The number of dialog work processes (in the dialog mode) that the message server needs for load distribution is displayed under Additional data. The relevant dispatcher sends this data to the message server when the server is started.

Expert Functions

These functions are required for analysis performed by SAP, and are not described further here. Exceptions to this are the server functions Shut Down Server (Hard), Shut Down Server (Soft,) Terminate connection, Deactivate and Activate. These functions control the state of the application server.
My Reference:  

Sunday, 1 March 2020

How many ways a background job can be scheduled in SAP

Based on general data:

priority 1: Class A job with target servers(group).
priority 2: Class A job without target server (group).
priority 3: Class B job with target server (group).
priority 4: Class B job without target server (group).
priority 5: Class C job with target server( group).
priority 6: Class C job without target server (group).


  • in some situation very long running Background jobs need to be schedule in "CLASS C"
 Note: if at a time all the job from priority 1 to priority 6 are scheduled. first job will be executed is Priority1 --> followed by -->  priority 2 --> followed by --> priority 3 --> followed by --> priority 4 --> followed by --> priority 5 --> followed by --> priority 6.

Based of steps data:


  1. ABAP program as background job.
  2.  ABAP program with variant.
  3. External command.
  4. External program.



Based on start period:
  1. Immediate background job.
  2. Scheduled (At a particular date and time).
  3. Periodic job. eg: every day at 4pm.
  4. After job.
  5. After event.
  6. At operation mode.
  7. periodic job with some exceptions based on company calender

From SAP point of view, background jobs are of 2 types:

  1. standard job or house keeping jobs.
  2. customizing  jobs.