Collection Contents Index Loading and unloading databases Troubleshooting server startup pdf/chap1.pdf

User's Guide
   PART 1. Working with Databases
     CHAPTER 1. Running the Database Server       

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 does not terminate. The way you do this depends on the operating system you are using.

Top of page  Running the UNIX database server as a daemon

In order to 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:
  1. Use the -ud command-line option when starting the database server. For example:

    dbsrv6 -ud asademo.db

Top of page  Understanding Windows NT services

Although the database server can be run 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: if you log off the computer, the program terminates. Only one person can be logged on to 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 in to the computer running the database server in order 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). The service is not tied to the user ID of the person starting it, and therefore is not stopped when that person logs off. A service can also be configured to start automatically when the NT computer is started, 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.

Top of page  Programs that can be run as Windows NT services

The following programs can be run as services:

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

Top of page  Managing services

This section describes how to manage 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).

Top of page  Adding a service

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

  To add a new service:
  1. In Sybase Central, open the Services folder.

  2. Double-click Add Service. The Service Creation Wizard is displayed.

  3. Follow the instructions in the wizard to define the service you are creating.

Notes 

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

Top of page  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 that you have removed, you will need to reenter the command-line switches.

  To remove a service:
  1. In Sybase Central, open the Services folder.

  2. Right-click the icon of the service you wish to remove, and select Delete from the popup menu

Top of page  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 will run and the conditions under which it will start.

  To change the parameters for a service:
  1. In Sybase Central, open the Services folder.

  2. Right-click the icon of the service whose parameters you wish to change in the right panel of Sybase Central, and select Properties from the popup menu.

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

  4. When you have altered the parameters as you wish, click OK to accept and save the changes.

Changes to a service configuration do not take effect immediately. They take effect next time the service is started. The Startup option is applied the next time Windows NT is started.

Top of page  Setting the startup option

The following options govern startup behavior for an Anywhere service:

Top of page  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.

For Info     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.

Top of page  Setting the account options

You can choose under which account the service will run. Most services run under the special LocalSystem account, and this 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 that is selected, and whether Allow Service to Interact with Desktop is checked, as follows:

Top of page  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.

Top of page  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:
  1. Double-click the server to change the parameters for the service, and click the configuration tab.

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

  3. Click OK to save the changes.

The new database will not be added to the service immediately. It is loaded the next time the service is started.

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

For Info     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.

Top of page  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:
  1. In Sybase Central, open the Services folder.

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

  3. Set the polling frequency. The frequency applies to all services, not just the one selected.

    The value you set in this window is saved for subsequent sessions, until you change it.

Top of page  Starting, stopping, and pausing services

  To start, stop, or pause a service:
  1. In Sybase Central, open the Services folder.

  2. Right-click the icon of the service.

  3. Select 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 is closed 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 will not need to pause their services.

Top of page  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 is given. 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 services you have installed will be found 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.

Top of page  Running more than one service

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

Top of page  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 will fail because it cannot find the server.

You can prevent these problems using service groups. You can manage the service groups from Sybase Central.

Top of page  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

SQLANYServer

Personal server

SQLANYEngine

SQL Remote Message Agent

SQLANYRemote

Replication Agent

SQLANYLTM

Before you can configure your services to ensure that 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:
  1. In Sybase Central, open the Services folder.

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

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

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

  5. Select one of the groups, or type a name of a new group, and click OK to assign the service to that group.

Top of page  Managing service dependencies

With Sybase Central you can specify the following types of dependency for a service.

For example, you may wish to ensure that a particular network server has started before a SQL Remote Message Agent that is to run against that server starts.

  To add a service or group to a list of dependencies:
  1. In Sybase Central, open the Services folder.

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

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

  4. Select one of the services or groups from the list, and click OK to add the service or group to the list of dependencies.

Top of page  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.

Top of page  

Collection Contents Index Loading and unloading databases Troubleshooting server startup pdf/chap1.pdf