Page tree
Skip to end of metadata
Go to start of metadata

Introduction

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">

<service_bundle type='manifest' name='xserver'>
</service_bundle> <service
        name='application/database/xserver'
        type='service'
        version='1'>        <!--
           Wait for network interfaces to be initialized.
        -->
        <dependency
                name='network'
                grouping='require_all'
                restart_on='none'
                type='service'>
                <service_fmri value='svc:/milestone/network:default' />
        </dependency>        <!--
           Wait for all local filesystems to be mounted.
        -->
        <dependency
                name='filesystem-local'
                grouping='require_all'
                restart_on='none'
                type='service'>
                <service_fmri value='svc://system/filesystem/local:default' />
        </dependency> <dependent
name='xserver'
grouping='require_all'
restart_on='none'>
<service_fmri value='svc:/milestone/multi-user' />
</dependent>
        <exec_method
                type='method'
                name='start'
                exec='/sapdb/programs/bin/x_server/kill start'
                timeout_seconds='60' />        <exec_method
                type='method'
                name='stop'
                exec='/sapdb/programs/bin/x_server stop'
                timeout_seconds='60' />        <instance name="default" enabled="true">        </instance>
        <template>
                <common_name>
                        <loctext xml:lang='C'>
                                MaxDB X-Server
                        </loctext>
                </common_name>
        </template></service></service_bundle>

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:

svcs -xv

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

MaxDB manifest

Here is the MaxDB service manifest. You have to replace the user and password in the exec_method sections.

<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='export'>
  <service name='application/database/maxdb' type='service' version='0'>
    <create_default_instance enabled='true'/>
    <dependency name='xserver' grouping='require_all' restart_on='none' type='service'>
      <service_fmri value='svc:/application/database/xserver:default'/>
    </dependency>
    <dependent name='maxdb' restart_on='none' grouping='require_all'>
      <service_fmri value='svc:/milestone/multi-user'/>
    </dependent>
    <exec_method name='start' type='method' exec='/sapdb/programs/bin/dbmcli -d G00 -u user,password db_online' timeout_seconds='360'>
      <method_context/>
    </exec_method>
    <exec_method name='stop' type='method' exec='/sapdb/programs/bin/dbmcli -d G00 -u user,password db_offline' timeout_seconds='360'>
      <method_context/>
    </exec_method>
    <template>
      <common_name>
        <loctext xml:lang='C'>MaxDB Database G00</loctext>
      </common_name>
    </template>
  </service>
</service_bundle>

SAP manifest

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.

<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='export'>
  <service name='application/sap' type='service' version='0'>
    <create_default_instance enabled='false'/>
    <dependency name='maxdb' grouping='require_all' restart_on='none' type='service'>
      <service_fmri value='svc:/application/database/maxdb:default'/>
    </dependency>
    <exec_method name='start' type='method' exec='su - <sid>adm -c startsap R3' timeout_seconds='360'>
      <method_context/>
    </exec_method>
    <exec_method name='stop' type='method' exec='su - <sid>adm -c stopsap R3' timeout_seconds='360'>
      <method_context/>
    </exec_method>
    <template>
      <common_name>
        <loctext xml:lang='C'>SAP System G00</loctext>
      </common_name>
    </template>
  </service>
</service_bundle>






  • No labels