Starting and Stopping Engines with sp_engine

You can dynamically stop or start engines using sp_engine, which allows a you to reconfigure CPU resources as processing requirements fluctuate over time.

The syntax for sp_engine is:
sp_engine {“online” | [offline | can_offline] [, engine_id] | 
[“shutdown”, engine_id]
For example, the following brings engine 1 online. Messages are platform-specific (in this example, Sun Solaris was used):
sp_engine "online", 1 
02:00000:00000:2001/10/26 08:53:40.61 kernel  Network and device connection limit is 3042.
02:00000:00000:2001/10/26 08:53:40.61 kernel  SSL Plus security modules loaded successfully.
02:00000:00000:2001/10/26 08:53:40.67 kernel  engine 1, os pid 8624  online
02:00000:00000:2001/10/26 08:53:40.67 kernel  Enabling Sun Kernel asynchronous disk I/O strategy
00:00000:00000:2001/10/26 08:53:40.70 kernel  ncheck: Network fc0330c8 online
Use can_offline to check whether or not a specific engine can be brought offline. For example, to chech whether engine 1 can be brought offline, use:
sp_engine can_offline, 1

sp_engine specifies a return code of 0 if you can bring the specified engine offline. If you do not specify an engine_id, sp_engine describes the status of the engine in sysengines with the highest engine_id.

You can bring engines online only if max online engines is greater than the current number of engines with an online status, and if enough CPU is available to support the additional engine.

To bring an engine offline, enter the engine ID. For example, to take engine 1 offline, use:
sp_engine offline, 1
SAP ASE waits for any tasks that are associated with this engine to finish before taking the engine offline, and returns a message similar to:
01:00000:00000:2001/11/09 16:11:11.85 kernel  Engine 1 waiting for affinitied process(es) before going offline
00:00000:00000:2001/11/09 16:16:01.90 kernel  engine 1, os pid 21127  offline

You cannot take engine zero offline.

sp_engine “shutdown” forces any tasks associated with the specified engine to finish in a five-second period, and then shuts down the engine. You can use sp_engine shutdown when an engine has gone into a dormant state or to bring an engine offline. sp_engine kills any remaining processes that are preventing the engine from going offline normally. The following shuts down engine 1:
sp_engine "shutdown", 1

See the Reference Manual: Procedures.