SMAINTENANCE – Automation Of Regular Maintenance Tasks
Being a SAP Admin you need to frequently deal with various maintenance activities involving application database or operating system. SAP has come up with tcode – SMAINTENANCE to make SAP application ramp down/up activity easy for us.
SMAINTENANCE tcode can be used to monitor and control the status of the system in terms of the so called “Maintenance Mode”.
For using smaintenance t-code we need to create security policy from t-code SECPOL. Below two attributes are mandatory to use smaintenance t-code
TENANT_RUNLEVEL_LOGON_PRIVILEGE = 1
SERVER_LOGON_PRIVILEGE = 1
This security policy needs to be assigned to all system Admin users in SU01 which needs to be allowed when system is in maintenance mode
Below is the screen of t-code smaintenance
When we “Switch to Maintenance” only Admin users who are having security policy assigned are allowed to login to system and perform maintenance activity.
Remaining all users including system users are blocked against SAP logon.
Switch to Maintenance
The action “Switch to Maintenance” starts a workflow which sets the system to mode “In Maintenance”. The workflow consists of the modes as described above: “Running -> Web dispatcher closed -> Cool down -> In Maintenance”. The current duration of the whole workflow is 10 minutes.
Switch to Running
The action “Switch to Running” starts a workflow which sets the system to mode “Running”. The workflow consists of the modes “In Maintenance -> Running”. The switch to “Running” is performed immediately.
On the top current system status is displayed as show in below
There are different modes system goes through:
Running (Runlevel – 0)
The system is fully operational for business end users and administrator. There are no restrictions for services (e.g. batch, rfc, …) or for inbound and outbound connections.
Web dispatcher Closed (Runlevel – 4)
The system is fully operational for business end users and administrators but connections to the Web dispatcher from outside are blocked. That is users connected via the web dispatcher cannot work any longer.
Cool down (Runlevel – 9)
The system is fully operational for administrators only. Business users are expected to finish their work and logout. At the end of the cool down phase business end users’ sessions are terminated.
In Maintenance (Runlevel – 100)
The system is fully operational for administrators only. Administrators are users which have a special security policy assigned. There are no business end users logged onto the system.
Error during mode switch
An error occurred during a system mode switch.
Below you see the so called “Maintenance Periods” and a “Log” of the maintenance mode.
The maintenance periods are time periods in which the system is set to Maintenance Mode or where the system is shut down. Maintenance Periods may be defined by external monitoring tools or from within the system by creating a new entry in this view. Only entries created from within the system may be deleted here.
There is no automatic mode switch implemented according to this schedule. By default the schedule of the current year is displayed. Use the selection button to modify this default selection.
The log shows messages created by the framework which performs system mode switches. By default the log of the current month is displayed. Use the selection button to modify this default selection.
When system is in maintenance mode below things are restricted
- Users which are not having security policy assigned are prevented to logon
- Background jobs are not allowed to run during maintenance mode
- All sessions and users are logged off post 10 mins upon activating maintenance mode
- HTTP sessions(webservices) are also closed and users will get 503 error
- External interfaces/RFC are restricted to connect SAP system
Message end users will see when system in maintenance mode
By using this we need not worry about ramp down activities such as users locking/unlocking, Job suspend, system messages, etc during any maintenance related task