on 06-09-2006 4:33 PM
Hi, we want to make scripts to automate start and stop system in a windows platform.
I can develop a stop script that works well, but I'm having a problem with the start script.
Could anybody please help me with the scripts to automate this?
Thanks in advance.
JuanM
Hi Juan,
You can take a look at startsap script (normally in /usr/sap/<SID>/SYS/exe/run folder)
Regards,
Mike
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
You will have to create an batch file startsap.bat or stopsap.bat.
These would call ..\exe\run\stopsap.exe or
..\exe\run\startsap.exe accordingly with parameters.
Additional parameters needs to be supplied with these executables
startsap name=SID nr=<system number> SAPDIAHOST=<hostname>
Ravinder
These scripts are from the good old 3.x days, (from SAPSERV3) hope they still be of use to someone
(mind the SAPDBA database startup/shutdown part !, brconnect -f dbstart / dbshut should be used, note 403704)
NTstartR3andDBora.cmd
@rem echo off
REM
REM substitute following strings:
REM string to subst substitution value typical values
REM <sid> your DB-SID C11
REM <central> your central host's name
REM <app> your applications server's name
REM <instance> the instance name DVEBMGS00
REM <instance1> the app server's instance name D01
REM <no> the central system's SAPSYSTEM 00
REM <no1> the app server's SAPSYSTEM 01
REM
REM for your values see the definitions in the profiles.
REM all profile names and values including the hostnames are cASeSenSiTivE!!!
REM
REM check the users which will definitely not work
if %USERNAME% == "SYSTEM" goto bad_user
REM first check existence of environment setup file
if not exist <sid>env.cmd
<central>\sapmnt\<sid>\sys\exe\run\ntreg2cmd <sid>
REM setup the environment for the process so that he is able to run
REM also from poor telnet daemons and Schedule Service
call <sid>env.cmd
REM STARTUP FOLLOWING
REM DATABASE startup (not necessary, normally done through service)
REM for example sapdba -startup
sapdba -startup
ntscmgr start SAP<sid>_<no> -m <central>
REM you may want also to start <app>s services here...
REM ntscmgr start SAP<sid>_<no1> -m <app>
REM if Autostart=1 is specified in the startup_profile you need
REM not to execute the next two lines
REM you may want to startup the <app>s here...
REM sapstart pf=
<central>\sapmnt\<sid>\sys\profile\start_<instance1>_<app> SAPDIAHOST=<app>
sapstart pf=
<central>\sapmnt\<sid>\sys\profile\start_<instance>_<central> SAPDIAHOST=<central>
REM sapstart pf=
<central>\sapmnt\<sid>\sys\profile\start_<instance1>_<app> SAPDIAHOST=<app>
goto finito
REM ERROR_HANDLING
:bad_user
echo this batchfile (NTstartR3andDB) will not run under user %USERNAME% > \batcherr.err
echo please configure the Schedule Service to run under <sid>adm >> \batcherr.err
:finito
NTstopR3andDBora.cmd
@rem echo off
REM
REM substitute following strings:
REM string to subst substitution value typical values
REM <sid> your DB-SID C11
REM <central> your central host's name
REM <app> your applications server's name
REM <instance> the instance name DVEBMGS00
REM <instance1> the app server's instance name D01
REM <no> the central system's SAPSYSTEM 00
REM <no1> the app server's SAPSYSTEM 01
REM
REM for your values see the definitions in the profiles.
REM all profile names and values including the hostnames are cASeSenSiTivE!!!
REM check the users which will definitely not work
if %USERNAME% == "SYSTEM" goto bad_user
REM first check existence of environment setup file
if not exist <sid>env.cmd
<central>\sapmnt\<sid>\sys\exe\run\ntreg2cmd <sid>
REM setup the environment for the process so that he is able to run
REM also from poor telnet daemons and Schedule Service
call <sid>env.cmd
REM you may want also to shutdown the <app>s here...
REM repeat the next two lines per app-server to stop them
REM sapsrvkill <app>_<sid>_<no1>
REM sapntwaitforhalt pf=
<central>\sapmnt\<sid>\sys\profile\START_<instance1>_<app> SAPDIAHOST=<app> 120
sapsrvkill <central>_<sid>_<no>
sapntwaitforhalt pf=
<central>\sapmnt\<sid>\sys\profile\START_<instance>_<central> SAPDIAHOST=<central> 120
REM wait until
REM you may want also to stop <app>s services here...
REM ntscmgr stop SAP<sid>_<no1> -m <app>
ntscmgr stop SAP<sid>_<no> -m <central>
REM DATABASE_SHUTDOWN ....
REM for example sapdba -shutdown
sapdba -shutdown
REM SHUTDOWN COMPLETE
goto finito
REM ERROR_HANDLING
:bad_user
echo this batchfile (NTstopR3andDB) will not run under user %USERNAME% > \batcherr.err
echo please configure the Schedule Service to run under <sid>adm >> \batcherr.err
:finito
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.