sp_engine

Description

Enables you to bring a Q engine online or take it offline.

Syntax

sp_engine "online | offline | can_offline | shutdown
	| q_online | q_offline | q_can_offline | q_shutdown" , [ engine_id]

Parameters

can_offline

returns information on whether an engine can be brought offline. If the engine cannot be brought offline, you see the spids of the Adaptive Server sessions that prevent the engine from being offline. You cannot use this parameter to specify a Q engine.

engine_id

is the ID of the engine.

The type of the engine that you specify must match the command (online, q_online, and so on). For example, you cannot specify a non-Q engine with q_offline, and you cannot specify a Q engine with offline.This parameter is required for offline, q_offline, can_offline, q_can_offline, shutdown, and q_shutdown.This parameter is not required for online, q_online.

online

brings an engine online. The value of sp_configure "max online Q engines" must be greater than the current number of Q engines online. You must use quotes, because online is a reserved keyword. You cannot use this parameter to specify a Q engine.

offline

brings an engine offline. You can also use engine_id to specify an engine to bring offline. You cannot use this parameter to specify a Q engine.

q_can_offline

returns information on whether a Q engine can be brought offline. If the engine cannot be brought offline, you see the spids of the Adaptive Server sessions that prevent the engine from being offline. You must use engine_id to specify whether a Q engine can be taken offline.

q_offline

brings a Q engine offline. You must use engine_id to specify an engine to bring offline.

q_online

brings the next Q engine online.

q_shutdown

forces a Q engine offline. If there are any tasks with an affinity to this engine, they are killed after a five-minute wait. You must use quotes, as shutdown is a reserved keyword. You must use engine_id to specify whether the Q engine can shut down.

shutdown

forces an engine offline. If there are any tasks with an affinity to this engine, they are killed after a five-minute wait. You must use quotes, as shutdown is a reserved keyword. You cannot use this parameter to specify a Q engine.

Examples

Example 1

Manually brings a Q engine online:

sp_engine 'q_online'
go
(return status=0)

02:00000:00000:2005/06/08 12:52:21.09 kernel Network and device connection limit is 1014.
02:00000:00000:2005/06/08 12:52:21.24 server Initialized Unilib version 7.2.
02:00000:00000:2005/06/08 12:52:21.24 kernel Q engine 2, os pid 20025 online
02:00000:00000:2005/06/08 12:52:21.33 kernel LDAP dynamic libraries successfully
loaded.
02:00000:00000:2005/06/08 12:52:21.38 kernel IBM MQ dynamic libraries successfully 
loaded.

Example 2

Takes a Q engine offline:

1> select engine, status from sysengines
2> go
 engine status
 ------ ------------ 
      0 online 
      1 online_q 
      2 online_q 
(3 rows affected)
1> sp_engine 'q_offline', 1
2> go
(return status = 0)
00:00000:00000:2005/06/08 12:55:54.25 kernel engine
2, os pid 20025 offline
1> select engine, status from sysengines
2> go
 engine status 
 ------ ------------ 
      0 online 
      1 online_q 
(2 rows affected)

Example 3

Checks to see whether you can take a Q engine offline:

1> select engine, status from sysengines
2> go
 engine status
 ------ ------------ 
      0 online 
      1 online_q 
(2 rows affected)
1> sp_engine 'q_can_offline', 1
2> go
spid: 13 has outstanding rtms-connection connections.

Example 4

Shuts down a Q engine:

1> select engine, status from sysengines
2> go
 engine status
 ------ ------------ 
      0 online
      1 online_q 
(2 rows affected)
1> sp_engine 'q_shutdown', 1
2> go
(return status = 0)
1> select engine, status from sysengines
2> go
 engine status
 ------ ------------ 
      0 online

(1 row affected)

Usage

Permissions

You must be a system administrator to bring engines online or take them offline.