Sybase Technical Library - Product Manuals Home
[Search Forms] [Previous Section with Hits] [Next Section with Hits] [Clear Search] Expand Search

Chapter 1 Introduction [Table of Contents] Chapter 3 Configuring

the Operating System for Adaptive Server

Configuring Adaptive Server for UNIX Platforms

[-] Chapter 2 Starting and Stopping Servers

Chapter 2

Starting and Stopping Servers

This chapter describes how to start and stop Adaptive Server, Backup Server, Monitor Server, and XP Server.

Overview

Use the methods described in this chapter to start Adaptive Server, Backup Server, and Monitor Server after a shutdown for database maintenance, because of an operating system crash, or for other reasons.

XP Server is not started by the installation process. XP Server is started only when an XP command is issued through isql.

For information about starting the Full-Text Search server, see the Standard Full-Text Search Specialty Data Store User's Guide.

You can start Adaptive Server, Backup Server, and Monitor Server on UNIX either by:

Starting servers

You can start Adaptive Server, Backup Server, or Monitor Server from the UNIX command line by using runserver files and startserver commands. You can move the Adaptive Server shared memory files by adding a flag to the runserver file.

Using a runserver file

Each time a new Adaptive Server, Backup Server, or Monitor Server is installed, the srvbuild program creates a runserver file that contains the information required to restart that server. Runserver files are created in the $SYBASE/$SYBASE_ASE/install directory. For Adaptive Server, the runserver file is named RUN_servername, where servername is the name of the server.

For example, the runserver file name for an Adaptive Server named TEST is RUN_TEST.

For Backup Server and Monitor Server, the runserver files are named RUN_servername_back and RUN_servername_mon, respectively, where servername is the name of the server.

Warning!

Do not delete the runserver file that is created in $SYBASE/$SYBASE_ASE/install. This file is used to restart servers when you customize your installation. If you need the runserver file in another location, make a copy of the original runserver file in the new location.

The runserver file for a server named SYBASE is named RUN_SYBASE. If the runserver file for your current Adaptive Server is named RUNSERVER, you must change the name to RUN_SYBASE during the upgrade process.

Using the startserver command

To start a server from the command line, enter:

$SYBASE/$SYBASE_ASE/install/startserver [ -f runserverfile ]

where $SYBASE/$SYBASE_ASE/install/startserver is the full path name of the startserver utility, and runserverfile is the full path name of the runserver file (usually $SYBASE/$SYBASE_ASE/install/RUN_servername).

If your Adaptive Server is named SYBASE, the runserver file specification is optional.

You must have read and write permissions on the master device for an Adaptive Server to start it with startserver. For more information about startserver, see Utility Programs for UNIX Platforms.

Although startserver runs Adaptive Server in the background, it does not return to the operating system prompt after restarting. After Adaptive Server has been restarted, press Return to return to the operating system prompt.

Using the monserver command

Use the monserver command to start Monitor Server from the UNIX command line. For details, see the Adaptive Server Enterprise Monitor Server User's Guide.

Starting servers when the operating system restarts

This section describes how to configure your operating system for automatic restart of Adaptive Server and Backup Server.

On production systems, Adaptive Server, Backup Server, and Monitor Server should restart automatically when the UNIX operating system starts. This is accomplished by making an entry for the server in the operating system start-up script. Monitor Server must be listed after Adaptive Server in the start-up script.

For more information on starting Monitor Server at operating system restart, see the Sybase Adaptive Server Enterprise Monitor Server User's Guide.

For Digital UNIX

Before configuring your operating system for automatic restart:

To configure your operating system for automatic restart of Adaptive Server and Backup Server:

For HP-UX

In HP-UX versions 10.0 and later, you cannot edit commands in the /etc/rc file, so the System Administrator must create a script that executes when the operating system starts or shuts down.

For more information about rc (1M), see the HP-UX manual page. You can model your script after the HP-UX template file /sbin/init.d/template.

After creating the start-up and shutdown script, place it in the directory /sbin/init.d. Execution scripts placed in this directory have symbolic links to directories /sbin/rcn.d where n is the system run level. The linked scripts in /sbin/rcn.d are used to control the sequencing order of the execution scripts.

For IBM RS/6000

On production systems, Adaptive Server can be restarted automatically whenever the UNIX operating system restarts. To have Adaptive Server restart automatically, place the startserver command in the /etc/inittab file.

Following is a suggested format for an Adaptive Server start-up command to add to /etc/inittab:

"sybase:2:wait:/release_directory/install/startserver  -f \ RUN_servername /dev/console  2>&1"

Where release_directory is the full path to the Sybase installation directory (specified as the SYBASE environment variable), and RUN_servername is the runserver file for the server you are starting.

Make sure that the entry for starting Adaptive Server follows any entry for /etc/rc.tcpip and /etc/rc.nfs in the /etc/inittab file. All network resources must be available before you start Adaptive Server; otherwise Adaptive Server will not start. Also, your server will not start if the network is not up.

Slow start-up of network operations can also prevent Adaptive Server from starting, even when the commands in the /etc/rc.tcpip file are in the correct order. You can designate a period of time for Adaptive Server to wait before starting by inserting a sleep command before the server start-up command in the runserver file. The sleep command is in the form:

sleep seconds_of_rest

To enable restart of a Backup Server when the operating system starts, add a Backup Server start-up command to /etc/inittab. Use the path of the Backup Server runserver file in this command.

For Sun Solaris

Before you set Adaptive Server or Backup Server to start automatically, make sure that all network resources are available. Your server will not start if the network is not up. Be sure that the entry for restarting the server follows any commands in the rc directory for starting network operations. Slow start-up of network operations can prevent servers from starting, even if commands are in the correct order in the rc directory. You may want to designate a period of time for your server to wait before starting by inserting a sleep command at the beginning of the linked runserver file you created.

To configure your operating system for automatic restart of Adaptive Server and Backup Server:

Stopping servers

Only the System Administrator has permission to issue a shutdown command. Using a shutdown command minimizes the amount of work that automatic recovery needs to do when the servers are restarted.

The preferred method of stopping Adaptive Server or Backup Server is to use the Transact-SQL shutdown command. For Monitor Server, use the sms_shutdown command.

Stopping Adaptive Server

To shut down Adaptive Server:

The default for the shutdown command is with wait. The with wait option allows Adaptive Server to finish executing SQL statements or procedures, perform a checkpoint in each database, disable new logins, and perform other shutdown tasks.

Issuing the shutdown command prints a message like this to the sterr file:

Server SHUTDOWN by request.The SQL Server is  terminating this process.
CT-LIBRARY error:

This is normal behavior. If the message indicates that Adaptive Server is waiting for processes to complete, and you need to stop Adaptive Server immediately, you can use the shutdown with nowait command. shutdown with nowait does not wait for currently executing statements to finish and does not perform checkpoints in every database.

Stopping Backup Server

To shut down a Backup Server:

After you shut down a Backup Server, you must wait at least 30 seconds before restarting it.

Issuing the shutdown command prints a message similar to the following to the stderr file:

Backup Server: 3.48.1.1: The Backup Server will  go down immediately. 
Terminating sessions.

This is normal behavior. If a message indicates that Adaptive Server or Backup Server is waiting for processes to complete, and you need to stop Adaptive Server or Backup Server immediately, you can use the shutdown with nowait command. shutdown with nowait does not wait for currently executing statements to finish and does not perform checkpoints in every database.

Using shutdown with nowait for Backup Server can cause inconsistent or incomplete dumps and loads. Use this command only when necessary.

For more information on the shutdown command, see the Adaptive Server Reference Manual.

Stopping Monitor Server

You must shut down Monitor Server before restarting Adaptive Server. If Adaptive Server stops, make sure that Monitor Server is shut down before you restart Adaptive Server. Monitor Server must be shut down to release resources. Otherwise, Adaptive Server may not be able to allocate enough resources to restart.

If the Monitor Server heartbeat feature is in effect, Monitor Server automatically detects the termination of Adaptive Server within the specified period and shuts itself down. Therefore, before attempting to restart Adaptive Server after a shutdown, either wait for the automatic shutdown of Monitor Server to occur, or explicitly stop Monitor Server.

For more information on stopping Monitor Server, see the Adaptive Server Enterprise Monitor Server User's Guide.

Using the kill command

Warning!

Use the kill command in Adaptive Server and Backup Server only as a last resort.

When possible, use the Transact-SQL shutdown or shutdown with nowait command. Do not use kill with the -9 flag because it exits the server without running a checkpoint to ensure that all database changes are written to the database device. Adaptive Server may also exit without removing associated shared memory files and network handlers.

Because Adaptive Server and Backup Server are background processes, they can be killed from the operating system by their owner or by "root" with the UNIX kill command. The syntax is:

kill pid

where pid is the process identification of any dataserver or backupserver process, as determined by the showserver command. Killing one engine for a particular Adaptive Server kills all engines for that server.

If more than one Adaptive Server is running on the same system, you must be careful that the engine you kill is associated with the correct Adaptive Server. If your Adaptive Server is configured to use multiple engines (CPUs), each engine has an associated operating system process. The correct way to kill a multi-engine server is to specify the process ID for engine 0.

This

showserver
output shows the processes for a four-engine server:

showserver

UID

PID

PPID

C

STIME

TTY

TIME

COMD

jorge

3320

1

80

10:31:40

pts/4

302:15

dataserver -dteamster

jorge

3321

3320

80

10:31:45

pts/4

324:47

dataserver -ONLINE:1

jorge

3322

3320

80

10:31:45

pts/4

326:02

dataserver -ONLINE:2

jorge

3323

3320

80

10:31:45

pts/4

328:56

dataserver -ONLINE:3

This example shows four running dataserver processes with operating system process identifications (PID) 3320, 3321, 3322, and 3323. (dataserver is the executable form of the Adaptive Server program.)

Child engine processes for the dataserver have the -ONLINE: argument.

Each child engine has a parent process identificatio n (PPID) that is equal to the process identifi cation (PID) of the parent. In the example above, the PID of the parent server is 3320. The other three engines spawned by the parent process have the same PPID.

If the PPIDs appear to be unrelated, and there is more than one dataserver process, then more than one Adaptive Server is running on the system.

Shutdown and shared memory files

On Digital UNIX, HP-UX, and IBM RS/6000, when Adaptive Server starts, it creates the following files in $SYBASE to store information about the shared memory segments that it uses:

On Sun Solaris, when Adaptive Server starts, it creates the SERVER_NAME.krg file in $SYBASE to store information about the shared memory segments that it uses. When Adaptive Server is shut down in a normal manner, the shared memory files are automatically removed. If Adaptive Server crashes or is stopped with the kill -9 command, these files are not deleted. You need read and write permissions on these files to restart Adaptive Server after a crash or a kill -9 command, because Adaptive Server must be able to overwrite the previously created shared memory files.


Chapter 1 Introduction [Table of Contents] Chapter 3 Configuring

the Operating System for Adaptive Server