From: riggor9999 on
Hello -

We normally run Unix / Oracle but I now have a sandbox running two SAP
instances (Sol Man 7.0 and NetWeaver 7.0) on Windows 2003.

I am trying write windows scripts to stop SAP and stop Oracle when the UPS
senses a power failure / low battery. This was very easy with Unix as
"stopsap" will stop SAP and Oracle. While in windows "stopsap" only stops
SAP, not Oracle.

Years ago - on Win2K / 4.6C ... I could issue a "sapdba -shutdown" command
and that worked just fine, but I am now having trouble with brtools and
brspace at the command line. When I issue a "brspace -f dbshut -mode
normal -confirm force" ... I still get the brtools menu to confirm /
interact. I need this to be automated without human interaction.

Does anyone have any experience with this? I have googled and searched but
have not found a simple / elegant way.

The other factor is that I have two SAP instances and two Oracle instances -
which probably need two diff scripts running under diff userids.

Bottom line is - I need a windows 2003 cmd script to run an automated sap
and oracle shutdown when the OS / UPS sense a power loss / low battery
condition.

Thanks in advance.

--

to reply via email, remove the "nospam_" from the return address


From: Werner Flamme on
riggor9999 [03.11.2009 16:34]:
> Hello -
>
> We normally run Unix / Oracle but I now have a sandbox running two SAP
> instances (Sol Man 7.0 and NetWeaver 7.0) on Windows 2003.
>
> I am trying write windows scripts to stop SAP and stop Oracle when the UPS
> senses a power failure / low battery. This was very easy with Unix as
> "stopsap" will stop SAP and Oracle. While in windows "stopsap" only stops
> SAP, not Oracle.

Do the parameters r3 and db not work with Windows? I used "stopsap r3"
to fire up my system after the DB was running (which I did with "lsnrctl
stop" plus the scripted sqlplus shutdown command - but "stopsap db" has
worked sometimes, too). But I did this with Linux, I was never condamned
to run SAP on Windows :->

> The other factor is that I have two SAP instances and two Oracle instances -
> which probably need two diff scripts running under diff userids.

I think so, yes, because the Unix' "su" command is not widespread under
Windows ;-) And since each SAP instance and DB instance has its own
owner, you will have to run multiple scripts.

> Bottom line is - I need a windows 2003 cmd script to run an automated sap
> and oracle shutdown when the OS / UPS sense a power loss / low battery
> condition.

Can't you use the "net stop %SAPSERVICENAME%" command? AFAIK there are
SAP Services in the system control board, and they usually can be
started an stopped via Windows' "net" command. I do not know about
Oracle, though.

HTH
Werner
From: riggor9999 on
Thanks for your fast reply ....

"Werner Flamme" <werner.flamme(a)ufz.de> wrote in message
news:7lb3atF3cpr58U1(a)mid.dfncis.de...
> riggor9999 [03.11.2009 16:34]:

> Do the parameters r3 and db not work with Windows? I used "stopsap r3"
> to fire up my system after the DB was running (which I did with "lsnrctl
> stop" plus the scripted sqlplus shutdown command - but "stopsap db" has
> worked sometimes, too). But I did this with Linux, I was never condamned
> to run SAP on Windows :->

==> no - they behave differently ....

>
>> The other factor is that I have two SAP instances and two Oracle
>> instances -
>> which probably need two diff scripts running under diff userids.
>
> I think so, yes, because the Unix' "su" command is not widespread under
> Windows ;-) And since each SAP instance and DB instance has its own
> owner, you will have to run multiple scripts.

==> I have tried using one sid1adm to do both - it does not work
==> I have tried using the windows "RUNAS" command for each line in the
script - but it prompts for password an I have not found a way to hard code
it

>> Bottom line is - I need a windows 2003 cmd script to run an automated sap
>> and oracle shutdown when the OS / UPS sense a power loss / low battery
>> condition.
>
> Can't you use the "net stop %SAPSERVICENAME%" command? AFAIK there are
> SAP Services in the system control board, and they usually can be
> started an stopped via Windows' "net" command. I do not know about
> Oracle, though.

==> The services are different than the running applications / and running
databases.

Here is my script. I have figured out the -confirm force issue .... I had
it at the end but it has to be before the -f dbshut. The only issue now is
how to get this script either to do both ... or to separate it into two
scripts and have each run under each SID's ID. The problem I have now - is
the UPS power utility can only run one script, and it can only run as one
user.

REM
REM ***** stopping SAP Instances ******
REM
E:\usr\sap\SID1\SYS\exe\uc\NTAMD64\stopsap.exe name=SID1 nr=00
SAPDIAGHOST=hostname
E:\usr\sap\SID1\SYS\exe\uc\NTAMD64\stopsap.exe name=SID1 nr=01
SAPDIAGHOST=hostname
E:\usr\sap\SID2\SYS\exe\uc\NTAMD64\stopsap.exe name=SID2 nr=02
SAPDIAGHOST=hostname
E:\usr\sap\SID2\SYS\exe\uc\NTAMD64\stopsap.exe name=SID2 nr=03
SAPDIAGHOST=hostname
REM
REM
REM ***** stopping Oracle Instances *****
REM
brspace -p initSID1.sap -c force -f dbshut -m immediate -i SID1
brspace -p initSID2.sap -c force -f dbshut -m immediate -i SID2 <== problem
running this for SID #2 ... need to be sid2adm
REM
REM
REM ***** stopping SAP services *****
REM
net stop SAPSID1_00
net stop SAPSID1_01
net stop SAPSID2_02
net stop SAPSID2_03
net stop SAPOsCol
REM
REM
REM ***** stopping Oracle Services *****
REM
net stop OracleSID1102TNSListener
net stop OracleServiceSID1
net stop OracleJobSchedulerSID1
net stop OracleServiceSID2
net stop OracleJobSchedulerSID2
net stop OracleSID1102iSQL*Plus


Thanks .......




From: St. Kother on
Hi,

riggor9999 schrieb:
>
> ==> I have tried using one sid1adm to do both - it does not work
> ==> I have tried using the windows "RUNAS" command for each line in the
> script - but it prompts for password an I have not found a way to hard code

Run the script as administrator - Shortcut on desktop and then shift +
right mouse button... Included commands will be executed with rights
from script starting user. I don't know where but I know that the
shortcut can be forced to run as an other user everytime.

Hope that helps,
--
Kind regards

Steffen
From: Christian Knappke on
riggor9999 schrieb:

> ==> I have tried using one sid1adm to do both - it does not work
> ==> I have tried using the windows "RUNAS" command for each line in the
> script - but it prompts for password an I have not found a way to hard code
> it

Use the /savecred option of runas. The first time it asks for the
password ans then stores it. Use the user login that is supposed to
run the UPS scripts.

HTH and best regards
Christian