![]() | ![]() |
Home |
|
|
ASA 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 remains running. The way you do this depends on your operating system.
Windows NT service
You can run the Windows NT database server as a service. This has many convenient properties for running high availability servers.
UNIX daemon
You can run the UNIX database server as a daemon by using the
-udcommand-line option, enabling the database server to run in the background, and to continue running after you log off.
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
-udcommand-line option when starting the database server. For example:
dbsrv6 -ud asademo.db
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.
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.
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.
Sybase Central provides a more convenient and comprehensive way of managing Adaptive Server Anywhere services than the Windows NT services manager.
You can run the following programs as services:
Network Database Server (dbsrv6.exe)
Personal Database Server (dbeng6.exe)
SQL Remote Message Agent (dbremote.exe)
A sample application
Not all these applications are supplied in all editions of Adaptive Server Anywhere.
You can carry out the following service management tasks from Sybase Central:
Add, edit, and remove services.
Start, stop, and pause services.
Modify the parameters governing a service.
Add databases to a service, so you can run several databases at one time.
The service icons in Sybase Central display the current state of each service using a traffic light icon (running, paused, or stopped).

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.
Service Names must be unique within the first eight characters.
If you choose to start a service automatically, it starts whenever the computer starts Windows NT. If you choose to start manually, you need to start the service from Sybase Central each time. You may want to select Disabled if you are setting up a service for future use.
Enter command-line switches for the executable, without the executable name itself, in the window. For example, if you want a network server to run using the sample database with a cache size of 20Mb, and a name of myserver, you would enter the following in the Parameters box:
-c 20M -n myserver c:\asa6\asademo.db
Line breaks are optional. For information on valid command-line switches, see the description of each program in Database Administration Utilities .
Choose the account under which the service will run: the special LocalSystem account or another user ID. For more information about this choice, see Setting the account options .
If you want the service to be accessible from the Windows NT desktop, check Allow Service to Interact with Desktop. If this option is unchecked, no icon or window appears on the desktop.
For more information on the configuration options, see Configuring services .
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
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 optionThe following options govern startup behavior for an Anywhere service:
Automatic
If you choose the Automatic setting, the service starts whenever the Windows NT operating system is starts. This setting is appropriate for database servers and other applications running all the time.
Manual
If you choose the Manual setting, the service starts only when a user with Administrator permissions starts it. For information about Administrator permissions, see your Windows NT documentation.
Disable
If you choose the Disable setting, the service will not start.
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.
To start a network server service running two databases, with a cache size of 20 Mb, and with a name of my_server, you would enter the following in the Parameters box:
-c 20M -n my_server c:\asa6\db_1.db c:\asa6\db_2.db
To start a SQL Remote Message Agent service, connecting to the sample database as user ID
DBA, you would enter the following:
-c "uid=dba;pwd=sql;dbn=asademo"
The following figure illustrates a sample Property sheet.

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 optionsYou 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.
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:
If a service runs under LocalSystem, and Allow Service to Interact with Desktop is checked in the Service Configuration window, an icon appears on the desktop of every user logged in to NT on the computer running the service. Consequently, any user can open the application window and stop the program running as a service.
If a service runs under LocalSystem, and Allow Service to Interact with Desktop is unchecked in the Service Configuration window, no icon appears on the desktop for any user. Only users with permissions to change the state of services can stop the service.
If a service runs under another account, no icon appears on the desktop. Only users with permissions to change the state of services can stop the service.
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 serviceEach 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.
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.
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.
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.
This section describes some topic specific to running more than one service at a time.
Service dependenciesIn 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 overviewYou 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 dependenciesWith Sybase Central you can specify dependencies for a service. For example:
You can ensure that at least one member of each of a list of service groups has started before the current service
You can ensure that any number of services start before the current service. For example, you may want to ensure that a particular network server has started before a SQL Remote Message Agent that is to run against that server starts.
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 serviceYou 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.
|
|