Stopping Servers

Different ways to stop a server.

SERVER OPERATOR system privilege is the default permission level required to stop a server, but you can use the -gk startup option to change the default to ALL or NONE. Setting the permission level to ALL lets all users stop the server; setting the permission level to NONE means that no one can stop the server. In a production environment, only the Server Operator is allowed to stop the database server.

Do not shut down a server that is still connected to a client, or you will lose uncommitted transactions. Disconnect or close all the clients before shutdown.

Server Shutdown Commands on UNIX

Several commands shut down the database server.

Command Description

stop_iq

Shuts down a server completely without regard for users, connections, or load process status.

Syntax:

stop_iq [ options ] 

dbstop

Stops a server or database. Additional options let you stop a server, even if there are active connections.

Syntax:

dbstop [ options ] server-name 

To use dbstop to stop a server, you must specify a server-name, as well as any connection parameters you specified when you started the server.

iqsrv16

Stops a server when typed in the window where the server was started, if you have not redirected input to another device.

q

STOP ENGINE

STOP ENGINE is a SQL statement that stops a database server.

Syntax:

STOP ENGINE engine-name [ UNCONDITIONALLY ]

The UNCONDITIONALLY argument stops a database server, even if there are client connections to the server.

Server Shutdown Methods on Windows

There are several methods to shut down or stop a server.

To stop the server from.. Do this...

Command line

Run the stop_iq or dbstop command.

Desktop

Right-click the server icon in the system tray, and choose Shutdown server name.

Service Manager

If you started the server as a Windows service:
  1. On the Control Panel, choose Administrative Tools > Services.
  2. Choose the SAP Sybase IQ service, then click Stop the service.

Interactive SQL

Run the stop engine command to stop a named database server.

Stopping Servers in Cron or At Jobs on UNIX

To use stop_iq in a cron or at job, specify the full path name to the stop_iq executable and the appropriate –stop option.

Setting –stop one shuts down a single server, when exactly one running server was started by the user ID that starts the cron or at job. This prevents accidentally shutting down the wrong server if several are running:

stop_iq –stop one

Setting –stop all shuts down all servers that were started by the user ID that starts the cron or at job:

stop_iq –stop all

Example — Stop a Server Using stop_iq

The following example uses the stop_iq utility in a UNIX operating system command line to shut down an SAP Sybase IQ server and close all user connections to it.

When you issue the stop_iq command, SAP Sybase IQ lists all servers owned by other users, followed by the servers you own. It then asks if you want to stop your server. For example:
% stop_iq
Checking system for IQ 16 Servers ... 
The following 2 server(s) are owned by other users.
##     Owner   PID   Started   CPU_Time  Additional Information
--     -----  -----  --------  --------  -----------------------
      handari  19895  15:43:44   183:38 
start_iq @iqdemo.cfg iqdemo.db -gn 105 -o /server1/users/surya/IQ-16_0/logfiles/surya_ibm2.001.srvlog -hn 8       pamela    409802  18:05:02    0:05  SVR:ibm1_iqdemo2 DB:iqdemo 
PORT:2678/ibm1/users/sybase/iq160/IQ-16_0/bin64/iqsrv16 @iqdemo.cfg
iqdemo.db -ti 4400 -gn 25 -o /ibm1/users/sybase/iq160/IQ
16_0/logfiles/ibm64qa_iq
The following 1 server(s) are owned by 'kermit'
##     Owner    PID   Started   CPU_Time  Additional Information 
-- ---------   -----  --------  --------  -----------------------
1:     kermit  422034  15:11:37     0:07  SVR:myserver_iqdemo 
DB:iqdemo PORT:2638 /myserver/users/sybase/iq160/IQ-16_0/bin64/iqsrv16
@iqdemo.cfg iqdemo.db -ti 4400 -gn 25 -o /myserver/users/sybase/iq160/IQ-
16_0/logfiles/myserver_iq
start_iq -c 32m -gd all -gm 10 -gn 25 -gp 4096 -ti 4400 -tl 300 @iqdemo.cfg

--
	Please note that 'stop_iq' will shut down a server completely 
	without regard for users connections or load processes status. 
	For more control, use the 'dbstop' utility, which has options 
	that control stopping servers based on active connections.

Do you want to stop the server displayed above <Y/N>? 
To shut down the server, type Y (yes). You see messages similar to:
Shutting down server (422034) ...
Checkpointing server (422034) ...
Server shutdown.
To leave the server running, type N (no). You return to the system prompt and the server does not shut down.
If no running servers were started by your user ID, SAP Sybase IQ displays information about servers run by other users, then a message similar to:
There are no servers owned by 'kermit' 

Example — Stopping a Server From Interactive SQL

The following example stops a server from Interactive SQL:

STOP ENGINE Ottawa UNCONDITIONALLY

The optional keyword UNCONDITIONALLY specifies that the database server will be stopped even if there are connections to it.

Note: You can stop a server from Interactive SQL if you are connected as DBA to one of the databases running on that server (including the utility_db database), or if the server was started with the -gk ALL option.