# Starting and Stopping SAP Systems SAP BASIS

To start the SAP R/3 system, log on at the operating system level using the <sid>adm (lowercase) user account that was created during installation. For example, if the SID was defined as DD1, then log in as UNIX user dd1adm and enter the password. To start SAP R/3 on UNIX systems, just execute the startsap command. For example, dd1adm> startsap The startsap command is really a UNIX alias (a symbolic name pointing to something else) that calls the needed start programs. To stop the system, enter stopsap in the command line.

The startsap options are

• UNIX
STARTSAP = startsap R3
STOPSAP = stopsap R3
• Windows
STARTSAP =
\\$(SAPGLOBALHOST)\sapmnt\$(system)\sys\exe\run\startsap.exe
name = <SID> nr 5 <SYSTEMNR> SAPDIAHOST 5 <HOST>
STOPSAP 5 \\$(SAPGLOBALHOST)\sapmnt\$(system)\sys\exe\run\stopsap.exe
name = <SID> nr = <SYSTEMNR> SAPDIAHOST = <HOST>

On Windows NT systems, you can start and stop Web AS from within the SAP Service Manager that is located on the NT Programs menu, within the SAP R/3 programs group. Starting the SAP R/3 system involves starting the underlying database and all the SAP processes configured to run in all application servers. The type and number of processes are configurable with the start profile and the instance profile parameters. These processes might include the following:

• The operating system and/or network performance collectors
• The central system log collection process
• The CPIC gateway server
• The message server
• The dispatcher processes
• The spool processes
• The dialog and background processes

The SAP R/3 system can be started and stopped by using operating system commands or from within the CCMS utilities. However, for the latter, at least the database server and the central instance must have been started first using the operating system startup commands. In current releases, the database system is not stopped from within Web AS either. In centralized installations, with just one single server, one start and one stop command are enough for starting or stopping the whole system. However, in distributed configurations, some configuration is needed to start and stop the group of application servers of a SAP system. Starting the SAP system first requires starting the database and then the instance processes. Stopping is the opposite process: first you have to stop the instance processes and then the database background processes.

For example, you can write a shell script command file that can start the whole system from a single server. In these cases, many people use remote shell commands to execute the start programs in remote computers. Stopping can be done the same way. Remember that using remote commands (for example, rsh, remsh, or similar) can be a security violation in some systems because a list of permitted hosts is necessary. For this, check with your security manager. To start or stop the SAP system in a UNIX environment, you must log on as user <sid>adm, for example, for SAP system DD1, as user dd1adm. The following commands are available.

Note The brackets indicate optional parameters where you can choose just one from the list or none at all.

1. startsap [R3] [DB] [ALL]
• Using the command, startsap R3, only the SAP instance is started. It is assumed that the database is already running. Otherwise, the instance will not start successfully.
• With the command, startsap DB, only the database is started.
• Using startsap ALL, the system will first start the database and then the SAP instance. ALL is the default setting and can be omitted. If the database is running, it will just start the instance.
2. stopsap [DB] [R3] [ALL]
• Using stopsap R3, all the instance processes are stopped.
• With the command, stopsap DB, the system stops just the database. Make sure you first stop the instance processes; otherwise, the SAP processes will "hang" because no update is possible.
• Issuing the command, stopsap [ALL], the system stops the SAP instance and then the database. ALL is the default parameter and can be omitted. When in distributed SAP installations with several application servers, pay attention to stopping all the instances before stopping the database, which is only located in the database server.

To check if the system has been correctly started or stopped, you can use standard UNIX operating system utilities such as the ps command. From the UNIX system, the SAP processes are prefixed by dw, so, for example, issuing the command dd1adm> ps -eaf | grep dw will show the SAP running processes. If you see no lines from the command output, then no SAP processes are running on this system. Note In different UNIX implementations, the options for the ps command might differ.Another way to check whether the SAP processes in an application server are running correctly is by selecting Tools | Administration | Monitor | _System Monitoring | _Process Overview from the standard SAP monitoring tools. Or, use the CCMS, which permits a check of all the application servers in the system by choosing Tools | _CCMS | Control Monitoring | Global Process Overview.

In the Web AS startup process, the startsap script calls the sapstart program with the startup profile as the argument. The startup profile is specified in the variable START_FILES, which is contained in the script. The script can be found under the home directory of the SAP administration user account, <sid>adm. The actual name of the script is usually startsap_<hostname>_<sap_system_number>, for example, startsap_copi01_00; the script startsap is really a UNIX alias defined in the login environment variables for the <sid>adm user.

When stopping the SAP system, the stopsap script calls the kill.sap script, which is located under the instance work directory (/usr/sap/<SID>/SYS/<INSTANCE>/work). The kill.sap script activates the shutdown processing in the sapstart process. As can be seen, both the start and the stop process of the SAP R/3 system are initiated from the sapstart program, which is located under the executables directory. The syntax of this program is sapstart pf = <start_profile>.

For example,

pf=/usr/sap/C11/SYS/profile/START_DVEBMGS00

When the sapstart program is executed, it reads from the start profile to determine the preliminary commands it has to process. These commands are preceded by the Execute_xx keyword, and often they just establish logical links or clean the shared memory. It then launches the SAP processes as described in the Start_program_xx statements. The xx indicates the processing order. However, you should know that sapstart processes the entries asynchronously, which means it will not check the status of one process before proceeding with the next one. The sapstart process is the mother of all the processes running in a SAP R/3 system. For that reason, when this process is shut down, all the child processes are shut down as well.

When in shutdown processing, the sapstart program executes the commands in the start profile and it will wait until all of its child processes terminate or it receives a stop signal from the system. The stopsap script works by sending the stop message to the sapstart program by means of the kill.sap script. This script is very simple, and what it contains is simply the PID of the sapstart process running in the system.

The SAP processes are also shut down asynchronously and therefore in parallel. Both the startsap and stopsap procedures are logged into files that are left in the home directory of the SAP administrator user account, <sid>adm. The names of these files are startsap _<hostname> _<sap _system _number>.log and

stop_<hostname>_<sap_system_number>.log.

The sapstart program itself logs its processing in a log file located under the instance work directory: sapstart.log. This log file can be seen either from the operating system or inside the Web AS system from the monitoring and tracing utilities.

Starting and Stopping SAP WAS for ABAP under Windows

The process for starting or stopping SAP R/3 systems on Windows NT systems is basically the same as under UNIX, except that some of the programs are different, and also Windows NT includes a graphical interface, known as the SAP Service Manager. Additionally,Windows NT reads some of the required SAP R/3 variables directly from the Registry. Starting Web AS from the SAP Service Manager requires that the SAP R/3 Service SAP<SAPSID> _ <Instance _number> (for example, SAPK2P _00) be started. This is usually done automatically because the SAP R/3 service is defined for automatic start at system boot by default.

In any case, to check whether the SAP R/3 service is running, on the Windows NT server, select Control Panel | Services and make sure that the SAP R/3 service has the status Started. If this is not the case, you will need to start it manually. If the SAP R/3 service is started, to start the SAP R/3 system, select Programs | SAP R/3 | SAP Service Manager <SID> _<Instancenumber>. This program can be located in different places according to the Web AS release. It is recommended that system managers or SAP administrators create shortcuts on their desktops.

ress the Start button to start the SAP R/3 system. It will start the database first and then the central instance. If the database was already started, then only the central instance is started. The system is completely started when the stoplights turn green. Stopping Web AS is also done from the SAP Service Manager, by pressing the Stop button. However, this procedure will not stop the database. In the case of Oracle and Informix, SAP R/3 can be stopped using sapdba, or the database-specific tools that in Windows NT can be used graphically or from the command line. For Microsoft SQL Server, the database can be stopped from the taskbar.

When the SAP R/3 system includes several instances (application servers), the procedure for starting those instances can be done from the SAP Service Manager of each server, or from the CCMS, once the database and central instance have been started. However, when stopping the full SAP R/3 system, the first things to stop are the application servers, then the central instance, and finally the database. The process of starting and stopping a full SAP R/3 system with several instances has been simplified since release 4.5 of SAP R/3 because installation of SAP R/3 on Windows NT requires the installation of the Microsoft Management Console, which enables starting and stopping all the instances centrally. Notice, however, that on SAP R/3 installations on Microsoft Server Cluster Services (MSCS), the procedure for starting and stopping the system is quite different on the cluster nodes. Starting and stopping SAP R/3 and the database is done from the Cluster Administration application by selecting the service and choosing the action (Start, Stop, Move, etc.)

Further Guidelines for Productive Environments

The purpose of this section is to make the people in charge of technically implementing the system aware that installing the system is not the same thing as having it ready for productive day-to-day business work.
There are certain aspects of the SAP R/3 system that, from a technical and management point of view, must be carefully considered. Many of them apply to all installations, and others might not be necessary. All these points are discussed in more detail in different sections of this book.

These points are as follows:

• A backup and recovery strategy for R/3.
• Cleaning background jobs.
• Definition of daily or periodic tasks for the operation and support teams.
• Printing strategy.
• System management procedures.
• Definition and setup of the CCMS operation modes and alerts.
• SAP R/3 monitoring (CCMS) and administration, including performance and tuning.