cancel
Showing results for 
Search instead for 
Did you mean: 

Batch / script file to start /stop sap server

Former Member
0 Kudos

Hi,

I would like to start/stop SAP server using batch file (in windows). I need this, whenever we have to shutdown the server and restart of the server, so that SAP will automatically shutdown and restart using batch files while server restart cases? If anyone knows, please let me know. Thanks,

Regards,

Sundar.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Which Windows is it?

If you registered SAP with Windows services then i would use commands like

net start servicename

net stop servicename

Go for it click on Start -> Run -> cmd -> net

NET

[ ACCOUNTS | COMPUTER | CONFIG | CONTINUE | FILE | GROUP | HELP |

HELPMSG | LOCALGROUP | PAUSE | SESSION | SHARE | START |

STATISTICS | STOP | TIME | USE | USER | VIEW ]

former_member196353
Active Participant
0 Kudos

HI Denis Heitbrock ,

I have windows 2003 Sp3 I have to stop my Sap services of ITS and XMII when ever there is any activity using the scripts

Thansk in advance.

Regards,

Mohammed Iqbal

Former Member
0 Kudos

What do you mean with activity?

Do you want an automatic script which check for any activity or do you want a script where you do something like a click and your SAP start or stop?

former_member196353
Active Participant
0 Kudos

Yes you got it right, When ever we want to bring the system down we can run a script and that stops the system and vice versa.

Regards,

Iqbal

Former Member
0 Kudos

create am cmd file like startsap.cmd or stopsap.cmd

example for startsap.cm

--- START ---

@echo off

net start servicename1

net start servicename2

net start servicename3

--- END ---

for servicename just enter the name from the service. You'll find that when you open the services MMC under service name.

Only make sure that you meet all service dependencies in your script.

former_member196353
Active Participant
0 Kudos

Thank you so much, I will try this on our sandbox environment and keep you posted.

Really helpful thanks a ton.

Regards,

Mohammed Iqbal

former_member196353
Active Participant
0 Kudos

Hi Sundar,

Did you got the scripts for windows to start and stop SAP. Can you please share that with me at

I would really appreciate ur help.

Thanks,

Iqbal

former_member204746
Active Contributor
0 Kudos

for startup: let SAP[SID]_00 set aut AUTOMATIC start.

then in the start profile add:

AUTOSTART = 1

as for shutdown, put this in a script:

stopsap.exe name=%ORACLE_SID% nr=%SYSNR% SAPDIAHOST=%SAPLOCALHOST%

then, call shutdown.exe

Former Member
0 Kudos

if you are running SAP Kernel version 700 or higher I would recommend to use sapcontrol instead of stopsap or startsap.

regards

peter

former_member204746
Active Contributor
0 Kudos

Sap notes 877795 states:

As of Release 7.00 the SAP start service "sapstartsrv" is delivered on all platforms. The previous DCOM "SAPControl" interface was replaced by a new Web service interface featuring enhanced functions for J2EE Engine administration.

Former Member
0 Kudos

target of the 700 sapstartsrv improvement was to deliver identical functionality on all SAP platforms. As the DCOM programing model is only available on Windows platforms sapstartsrv.exe was enhanced by the WEB-Service interface and is available now on Unix too.

The DCOM SAPControl interface of sapstartsrv.exe is still existing, but only on Windows. Here you can use VB Script or any other programming language able to handle DCOM objects to write your own programs / scripts to interact with the SAPControl.

sapcontrol.exe is a command line program available since 700 which enables you control over nearly all functions of the sapstart service.

Even it has the same name as the DCOM interface it' something completly different.

regards

Peter

PS: sapcontrol syntax

usage: sapcontrol [

-prot GSOAP_HTTP| http using gsoap build in sockets (default)

NI_HTTP| http using SAP NI sockets (prefer Unix domain sockets)

NI_HTTPS| https using SAP NI sockets (prefer Unix domain sockets)

WINHTTP| http using Windows winhttp

WINHTTPS| https using Windows winhttp

PIPE Windows named pipes

]

[-user <user> <password>] OS user and password for Webservice authentication

[-repeat <N> <D>] Repeat Webmethod call <N> times (-1=forever) with <D> sec delay

[

-format list| List output format (default)

script Script output format

]

[-host <hostname>] Host to connect to (default: localhost)

-nr <instance nr.> SAP Instance number to connect to

-function <Webmethod> [parameter list]

Webmethods: Start

Stop [softtimeout sec]

Shutdown

RestartInstance [softtimeout sec]

StopService

StartService <SID>

RestartService

ParameterValue [<parameter>]

GetStartProfile

GetTraceFile

GetAlertTree

GetAlerts

GetEnvironment

GetVersionInfo

GetQueueStatistic

GetProcessList

GetInstanceProperties

ListDeveloperTraces

ReadDeveloperTrace <filename> <filesize>

ListLogFiles

ReadLogFile <filename> [<filter> [<language> [<maxentries> [<cookie>]]]]

AnalyseLogFiles [<severity 0-2>] [<maxentries>] [<starttime YYYY MM DD HH:MM:SS> <endtime YYYY MM DD HH:MM:S

S>]

OSExecute <command> <async> <timeout> <protocolfile>

SendSignal <pid> <signal>

GetSystemInstanceList

StartSystem [ALL|SCS|DIALOG|ABAP|J2EE|LEVEL <level> [<waittimeout sec>]]

StopSystem [ALL|SCS|DIALOG|ABAP|J2EE|LEVEL <level> [[<waittimeout sec>] [softtimeout sec]]]

RestartSystem [ALL|SCS|DIALOG|ABAP|J2EE|LEVEL <level> [[<waittimeout sec>] [softtimeout sec]]]

AccessCheck <function>

ABAPReadSyslog

ABAPReadRawSyslog

ABAPGetWPTable

J2EEControlProcess <processname> <function>

J2EEGetProcessList

J2EEGetThreadList

J2EEGetSessionList

J2EEGetCacheStatistic

J2EEGetApplicationAliasList

J2EEGetVMGCHistory

J2EEGetVMHeapInfo

StartWait <timeout sec> <delay sec>

StopWait <timeout sec> <delay sec>

WaitforStarted <timeout sec> <delay sec>

WaitforStopped <timeout sec> <delay sec>

Exitcode: 0: Last Webmethod call successfull

1: Last Webmethod call failed, invalid parameter

2: StartWait, StopWait, WaitforStarted, WaitforStopped timed out

3: GetProcessList succeeded, all processes running correctly

4: GetProcessList succeeded, all processes stopped

Security: Trusted connects without user and password check are possible through

Unix domain socket or Windows named pipes. Protected webmethods like

Start or Stop require a trusted connection or OS user and password

authentication.