Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9656

Re: Script to Shutodwn SAP

$
0
0

Hi,

 

First: I strongly recommend you to use powershell instead of bloody old and stupid cmd.exe (Batch files). With powershell it is very easy to do really complicated things where you would break your fingers trying to do it on cmd.exe.

 

Second: use sapcontrol.exe instead of deprecated stopsap script - it is part of the every kernel and instance directory (/usr/sap/SID/SYS/exe/uc/ntamd64 or /usr/sap/SID/DVEBMGSxx/exe) and has a very rich functionality.

For online help information just run it in a cmd.exe without parameters

 

sapcontrol.exe is also able to work remotely:

 

This command will stop all instances of a system in the right order:

 

/usr/sap/SID/DVEBMGS01/exe/sapcontrol.exe -prot PIPE -nr 01 -function StopSystem ALL

 

 

But you can also stop the system instance by instance.

 

Stopping the services can be done using powershell commands:

 

stop-service SAP*
will stop all services whoes name starts with SAP.

 

you can use sc.exe which is able to control services remotely.

sc.exe <server> [command] [service name]

 

For stopping SAPHostControl on computer nodeB:
     sc.exe nodeB stop SAPHostControl

 

A very interesting feature of powershell is powershell remoting.
It has features similar to ssh - so you can execute code on a remote computer.

 

Here you can run a single command on several computers:
invoke-command -computer nodeA,nodeB {stop-service SAPSID_00}

 

 

This will stop the Service SAPxxx_01 on the local computer, the SID is not needed, because the number has to be unique on a host).

 

C:/usr/sap/SID/DVEBMGS01/exe/sapcontrol.exe -prot PIPE -nr 01 -function StopService

 

This will stop the Service SAPxxx_01 on the remote computer nodeB, the SID is not needed, because the number has to be unique on a host).

 

C:/usr/sap/SID/DVEBMGS01/exe/sapcontrol.exe -prot PIPE -nr 01 -function StopService -hostname nodeB


Third. SAPHostExec Service depends on SAPHostControl. Starting/Stopping SAPHostControl will also start/stop SAPHostExec.

 

Forth:

Stopping an SAP-Windows-Service will also shutdown it's instance.

 

Don't waste your time writing batch scripts - use powershell!

 

regards

 

Peter


Viewing all articles
Browse latest Browse all 9656

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>