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

Loading and unloading databases [Table of Contents] Troubleshooting server startup

ASA User's Guide

[-] Part 1 Working with Databases
[-] Chapter 1: Running the Database Server
[-] Running the server outside the current session

Running the server outside the current session

When you log on to a computer using a user ID and a password, you establish a session. When you start a database server, or any other application, it runs within that session. When you log off the computer, all applications associated with the session terminate.

It is common to require database servers to be available all the time. To make this easier, you can run Adaptive Server Anywhere for Windows NT and for UNIX in such a way that, when you log off the computer, the database server remains running. The way you do this depends on your operating system.

Running the UNIX database server as a daemon

Run the UNIX database server in the background, and to enable it to run independently of the current session, you run it as a daemon.

Do not use '&' to run the database server in the background

If you use the UNIX & (ampersand) command to run the database server in the background, it will not work. You must instead run the database server as a daemon.

To run the UNIX database server as a daemon:

Use the

-ud
command-line option when starting the database server. For example:

dbsrv6 -ud asademo.db

Understanding Windows NT services

Although you can run the database server like any other Windows NT program rather than as a service, there are limitations to running it as a standard program, particularly in multi-user environments.

Limitations of running as a standard executable

When you start a program, it runs under your Windows NT login session, which means that if you log off the computer, the program terminates. Only one person logs onto Windows NT (on any one computer) at one time. This restricts the use of the computer if you wish to keep a program running much of the time, as is commonly the case with database servers. You must stay logged onto the computer running the database server for the database server to keep running. This can also present a security risk as the Windows NT computer must be left in a logged on state.

Advantages of services

Installing an application as a Windows NT service enables it to run even when you log off.

When you start a service, it logs on using a special system account called LocalSystem (or using another account you specify). Since the service is not tied to the user ID of the person starting it, the service remains open even when that person who started it logs off. You can also configure a service to start automatically when the NT computer starts, before a user logs on.

Managing services

Sybase Central provides a more convenient and comprehensive way of managing Adaptive Server Anywhere services than the Windows NT services manager.

Programs that can be run as Windows NT services

You can run the following programs as services:

Not all these applications are supplied in all editions of Adaptive Server Anywhere.

Managing services

You can carry out the following service management tasks from Sybase Central:

The service icons in Sybase Central display the current state of each service using a traffic light icon (running, paused, or stopped).

raster

Adding a service

This section describes how to set up services using Sybase Central.

To add a new service:

In Sybase Central, open the Services folder.

Double-click Add Service. The Service Creation Wizard appears.

Follow the instructions in the wizard to define the service you want to create.

Notes

For more information on the configuration options, see Configuring services .

Removing a service

Removing a service removes the server name from the list of services. Removing a service does not remove any software from your hard disk.

If you wish to re-install a service you previously removed, you need to re-enter the command-line switches.

To remove a service:

In Sybase Central, open the Services folder.

Right-click the icon of the service you want to remove

Choose Delete from the popup menu

Configuring services

A service runs a database server or other application with a set of command-line switches. For a full description of the command-line switches for each of the administration utilities, see Database Administration Utilities .

In addition to the command-line switches, services accept other parameters that specify the account under which the service runs and the conditions under which it starts.

To change the parameters for a service:

In Sybase Central, open the Services folder.

Right-click the icon of the service whose parameters you want to change in the right panel of Sybase Central

Choose Properties from the popup menu.

Alter the parameters as needed in the tabs of the Property sheet.

When you finish altering the parameters, click OK to accept and save the changes.

Changes to a service configuration take effect next time someone starts the service. The Startup option is applied the next time Windows NT is started.

Setting the startup option

The following options govern startup behavior for an Anywhere service:

Entering command-line switches

The Configuration tab of the service property sheet provides a text box for entering command-line switches for a service. Do not enter the name of the program executable in this box.

Examples

The following figure illustrates a sample Property sheet.

raster

The command-line switches for a service are the same as those for the executable. For a full description of the command-line switches for each program, see The Database Server .

Setting the account options

You can choose under which account the service runs. Most services run under the special LocalSystem account, which is the default option for services. You can set the service to log on under another account by clicking Account and entering the account information.

If you choose to run the service under an account other than LocalSystem, that account must have the "log on as a service" privilege. This can be granted from the Windows NT User Manager application, under Advanced Privileges.

When an icon appears on the taskbar

Whether or not an icon for the service appears on the taskbar or desktop depends on the account you select, and whether Allow Service to Interact with Desktop is checked, as follows:

Changing the executable file

To change the program executable file associated with a service, click the Configuration tab on the service property sheet and enter the new path and file name in the Path of Executable box.

If you move an executable file to a new directory, you must modify this entry.

Adding new databases to a service

Each network server or personal server can run more than one database. If you wish to run more than one database at a time, we recommend that you do so by attaching new databases to your existing service, rather than by creating new services.

To add a new database to a service:

Double-click the server to change the parameters for the service

Click the Configuration tab.

Add the filename of the new database to the end of the list of parameters.

Click OK to save the changes.

The new database is loaded the next time the service starts.

Databases can be started on running servers by client applications, such as Interactive SQL.

For a description of how to start a database on a server from Interactive SQL, see START DATABASE statement . For a description of how to implement this function in an Embedded SQL application, see the db_start_database function in The Embedded SQL Interface . Starting a database from an application does not attach it to the service. If the service is stopped and restarted, the additional database will not be started automatically.

Setting the service polling frequency

Sybase Central polls at specified intervals to check the state (started, stopped, paused, removed) of each service, and updates the icons to display the current state.

To alter the Sybase Central polling frequency:

In Sybase Central, open the Services folder.

Right-click the icon of any service in the right panel of Sybase Central, and choose Polling from the popup menu.

Set the polling frequency.

The frequency applies to all services, not just the one selected. The value you set in this window remains in effect for subsequent sessions, until you change it.

Starting, stopping, and pausing services

To start, stop, or pause a service:

In Sybase Central, open the Services folder.

Right-click the icon of the service.

Choose Start, Stop, or Pause from the popup menu

If you start a service, it keeps running until you stop it. Closing Sybase Central or logging off will not stop the service.

Stopping a service closes all connections to the database and unloads the database server. For other applications, the program closes down.

Pausing a service prevents any further action being taken by the application. It does not shut the application down or (in the case of server services) close any client connections to the database. Most users do not need to pause their services.

The Windows NT Service Manager

You can use Sybase Central to carry out all the service management for Adaptive Server Anywhere. You do not need to use the Windows NT Service Manager in the Control Panel.

If you open the Windows NT Service Manager (from the Windows NT Control Panel), a list of services appears. The names of the Adaptive Server Anywhere services are formed from the Service Name you provided when installing the service, prefixed by Adaptive Server Anywhere. All the installed services appear together in the list.

You cannot install or configure parameters for Adaptive Server Anywhere services using the NT Service Manager. You must use Sybase Central.

Running more than one service

This section describes some topic specific to running more than one service at a time.

Service dependencies

In some circumstances you may wish to run more than one executable as a service, and these executables may depend on each other. For example, you may wish to run a server and a SQL Remote Message Agent or Log Transfer Manager to assist in replication.

In cases such as these, the services must start in the proper order. If a SQL Remote Message Agent service starts up before the server has started, it fails because it cannot find the server.

You can prevent these problems using service groups, which you manage from Sybase Central.

Service groups overview

You can assign each service on your system to be a member of a service group. By default, each service belongs to a group, as listed in the following table.

Service

Default group

Network server

ASANYServer

Personal server

ASANYEngine

SQL Remote Message Agent

ASANYRemote

MobiLink Synchronization Server

ASANYMobiLink

Replication Agent

ASANYLTM

Before you can configure your services to ensure they start in the correct order, you must check that your service is a member of an appropriate group. You can check which group a service belongs to, and change this group, from Sybase Central.

To check and change which group a service belongs to:

In Sybase Central, open the Services folder.

Right-click the icon of the service you wish to start, and choose Properties from the popup menu.

Click the Dependencies tab. The text box displays the name of the group the service belongs to.

Click Look Up to display a list of available groups on your system.

Select one of the groups, or type a name for a new group

Click OK to assign the service to that group.

Managing service dependencies

With Sybase Central you can specify dependencies for a service. For example:

To add a service or group to a list of dependencies:

In Sybase Central, open the Services folder.

Right-click the icon of the service, and choose Properties from the popup menu.

Click the Dependencies tab.

Click Add Service or Add Group to add a service or group to the list of dependencies.

Select one of the services or groups from the list.

Click OK to add the service or group to the list of dependencies.

Possible problems running more than one server as a service

You may experience problems if you run more than one network server as a service at a time. Under some circumstances, it cannot be guaranteed that the correct service will respond to a client that sends a request to the database server as a broadcast. Broadcasts are typically used if you are using TCP/IP, or IPX on a Novell network without using the bindery. The broadcast is only used to find the server during startup.

We recommend that you not run more than one network server service at a time.


Loading and unloading databases [Table of Contents] Troubleshooting server startup