When restarting a server in the SAP environment all services of the operating system are started automatically. So when restarting a big SAP server it might be suitable to start the SAP systems automatically. Sun Solaris 10 gives us the ability to do so by using the service facility, called SMF. We will use self established services to start the SAP system automatically by creating services for the SAP system. This means we take advantage of the service framework in Sun Solaris 10 and easily start/stop/restart the SAP system.
To demonstrate the service framework we will use an exemplary SAP system, operating on top of a MaxDB. Please note that you can easily adopt the service to your Oracle DB.
The overview - three services
When starting a SAP system operating on top of MaxDB you have to start three components:
- the X-Files
- the app instance
- the SAP CID / SCSI
So I decided to establish three service on my servers. The first two services are running inside the database server zones, the third one is running on my application server (SAP SCS and CI are running inside zones too). The aim is an automatic start of the SAP system without interaction of the administrator.
To get a first idea of the Sun Solaris service, please have a look into the /var/svc/manifest directory. The directory contains manifest files from every service. Manifests are a description of a service. We will put our manifest files later on in this directory.
The X-Files service
Our first service handles the start of the X-Server, which is a prerequisite before starting the MaxDB. So, please go to the /var/svc/manifest/application/database directory and create a new file called xserver.xml Now we have to define several sections in the XML file:<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
What does the manifest file tells us:
- At first we define a new XML file with the associated DTD.
- Then we describe a service_bundle, which is in fact the manifest for our new service.
- In the third step we define the service itself. The service is ordered in the application/database tree and is named xserver.
- The fourth step is about the definition of dependencies. This means the xserver service can only be started when the filesystem and the NIC are up and running. Moreover we assign the new service to a milestone. This means the milestone multi user can be only reached when this service is started.
- In the exec_method tags we define the start and stop method for starting and stopping the X-Server. These are the OS level commands. So, when dealing with the other service definitions, the exec_methods must contain the start and stop methods from the database and the SAP system.
- At least we define the instance as well as a description of our new service. the instance defines, that we have an instance on startup.
Now we have to import the manifest as a new service into Solaris. This can be easily done by the following command:
svccfg import /var/svc/manifest/application/database/xserver.xml
The command imports the new manifest and makes the service ready to use. Now you can start the X-Server with the new command:
svcadm enable xserver or disable it with svcadm disable xserver
You may continue with the MaxDB service and the SAP service now. In the end you will have three services. All of these services are going to start when the system comes up. And this is what we wanted to have on our server.
Administrate your new service
To administrate your service you need the svc* commands from Solaris. To start your service please use:
svcadm enable xserver
To disable it, use:
svcadm disable xserver
To have a look on all disabled services:
To get a process ID list:
svcs -p xserver
Control your new service
To control your new service and get an idea in case of failures, please have a look into the following directory and control the log file: /var/svc/log/xserver:default.log
Here is the MaxDB service manifest. You have to replace the user and password in the exec_method sections.
And here comes the SAP manifest for starting the SAP system. Please note, that the service is executed as user root, but to fire up SAP it is necessary to switch to user <sid>adm and execute the startsap command separately.