(#200) Upgrading from SOS 2009 to SOS 2010

The upgrade to SOS 2010 is quite similar to previous SOS upgrades that you may have done. It does, however, replace your older Sybase database components with newer versions. In some cases that change will require a couple of post-installation steps, which are detailed below.

All Installations, Including Network Workstations

You may find that one or two obsolete shortcuts remain in your Windows Start > Programs > SOS Applications menu.


The DBISQLG query utility has been replaced by the new DBISQL (no G at the end). The old program shortcut will no longer work and should be removed from the SOS Applications menu. Similarly, the shortcut to bring up the Sybase documentation now has a slightly different name, Sybase SA Manuals. The old Sybase ASA Manuals shortcuts will no longer work, so that shortcut should also be deleted, to avoid confusion.

To delete a menu shortcut, just right-click the shortcut and then click Delete on the pop-up menu. The two menu entries to be deleted are circled in the figure to the left.

Standalone Computer Installations

In most cases, the installation will make all necessary changes for you, except, possibly, the removal of the now obsolete menu items in the Start > SOS Applications menu.

64 Bit Windows Option

If you are running your software on a 64-bit version of Windows, you can choose to run the 64-bit version of the database engine rather than the default 32-bit version. Although either one will work fine in your environment, if you have more than three GB of RAM in your system, you may experience better performance with the 64-bit engine. Changing from one to the other is quite easy:

  1. Select Start > Programs (or All Programs) > SOS Applications > ODBC Administrator.
  2. Click the System DSN tab.
  3. Double-click SOSDATA.
  4. Click the Database tab.
  5. In the Start line, scroll to the left, so you can see the beginning of the command.
  6. Replace the number 32 with 64. The command will now start with c:\sos\sa\bin64\dbeng11.exe
  7. Click OK to save, then OK again to close the ODBC Administrator applet.

The next time you start SOS, the database will start using the 64-bit engine!

Database Servers

Edit the SERVER.PRM File

In the old version of the Sybase database engine, the recommended network packet size was 1480 bytes. With the new engine, the default and recommended size is 7300 bytes. For best performance, therefore, SOS recommends that you remove the “-p 1480” parameter from your SERVER.PRM file, or change the “1480” to “7300”. In addition, to close a potential security threat, SOS strongly recommends that you add the parameter “TDS=NO”, in parentheses, after “tcpip”. Here is an example:

server_prm

Modify all Database Startup Shortcuts

Prior to the 2010 release, the database engine was called DBSRV9.EXE and was located in \SOS\ASA\Win32. The new database engine is named DBSRV11.EXE and is located in \SOS\SA\BIN32, with the 64-bit version located in \SOS\SA\BIN64. As a result, old shortcuts will no longer work and should be deleted. There is a shortcut in Start > All
Programs > SOS Applications to start the new database server, using the 32-bit engine (Start SOSDATA Server). You should delete any left-over shortcuts and create new ones by copying the one in the Start menu:

If you are running the database on a 64-bit Windows machine with more than 2 GB of RAM, you will probably see better performance by using the 64 bit engine, so after creating the 32-bit shortcut, just edit its properties as shown below, modifying the Target location from BIN32 to BIN64:

Delete and Re-create the Database Service

You may have been running your database as a windows background service, or perhaps you want to start doing so. The main advantage to running as a service is that the database will start and run whether or not anyone is logged into the server computer’s console. Services created in versions prior to SOS 2010 appear in the Windows Service Manager in the form:

Adaptive Server Anywhere – mysos

where “mysos” is the name you gave to the service when you created it. You must first remove the existing service, if there is one, then create a new one. The new one will appear in the list of services with a name in the form:

SQL Anywhere – mysos

To delete the existing service:

  1. Open a command window, being careful to use the Run as administrator option if you are working on Windows 7. Windows 8 and newer, type CMD in the Start menu Search field, then right-click CMD.EXE in the search results and select “Run as administrator”.
  2. Even if you plan to run the 64 bit database engine, change to the \SOS\SA\BIN32 directory:
    CD \SOS\SA\BIN32 <enter>
  3. Assuming that the name of your existing service is “mysos”, delete it with this command:
    dbsvc –y –d mysos

To create the new service:

  1. If you are not already in a command window running with Administrator rights, follow steps one and two above.
  2. Now create the new service with the following command. The options in this example will set the service to run under the system account (-sa), as a network service (-t network), to start automatically (-s auto), to display the database icon in the system tray (-i), and to be named “mysos” (-w mysos). It will appear in the Windows Services Manager as “SQL Anywhere – mysos”. If you are running the database in 64-bit Windows, using the 64-bit option is recommended, but either version of the engine will work. The 64-bit engine often provides better performance, especially for larger databases. If you are running in 32-bit Windows, you MUST use the 32-bit command. These commands would be typed on a single line, of course. Note that the -i option to display the icon in the system tray won’t work on Windows 7, or Server 2008 R2 and later, so omit that option if using one of those. Service configuration commands are case sensitive. Type your options exactly as shown (eg: “automatic” will fail but “Automatic” will work). If you still have trouble getting the service created, leave out the “-s Automatic”. You can change the properties to “automatic” from the Windows Services list after it is created.
    32-bit Windows:
    dbsvc -as -t Network -s Automatic -i -w mysos c:\sos\sa\bin32\dbsrv11.exe @c:\sos\server.prm c:\sos\data\sosdata.db
    64-bit Windows:

    dbsvc -as -t Network -s Automatic -i -w mysos c:\sos\sa\bin64\dbsrv11.exe @c:\sos\server.prm c:\sos\data\sosdata.db
  3. After executing the command, you will find a new Windows service listed in Windows’ Administrative Tools > Services applet: SQL Anywhere – mysos. You can adjust the properties for the service just as you would for any other service.

For more detailed discussion and instruction for running SQL Anywhere as a Windows service, see:

https://sos-resources.info/g4/running-the-sos-sql-anywhere-11-database-as-a-windows-service/

Adjust Scheduled Tasks

You may be using one or more Scheduled Tasks in Windows to control starting or stopping your database. Normally stopping the database is handled with a –tq parameter in the SERVER.PRM file, such as:

-tq 22:00

to automatically shut down the database at 10:00 pm, but if running as a service, it is possible that you are using a scheduled NET STOP command to do so. More likely, however, if you check your Windows Scheduled Tasks, you will find a task that starts your database server engine each morning, whether you run it as a foreground task, or as a Windows service.

If you have a task to execute a CMD or BAT file that launches the database, find and edit the batch file, replacing the old c:\sos\asa\win32\dbsrv9.exe with the new c:\sos\sa\bin32\dbsrv11.exe (or c:\sos\sa\bin64\dbsrv11.exe) command.

If you are restarting a service, that service no longer exists, so change the command to start the correct service. For example, you might have scheduled the command:

NET START “Adaptive Server Anywhere – mysos”

which now should be:

NET START “SQLANYs_mysos”

This name, of course, should match the name of the service you created above. Check the properties of the new service in your Control Panel > Administrative Tools > Services to be sure of the name. Once you open the Properties dialog for the service, you will see the service name at the top of the first tab:

Windows 7 –

6-15-2012 5-05-43 PM

Windows Server 2008 R2 –

6-15-2012 5-08-20 PM

Network Workstations

After installing the new version of the software on a network workstation, including a terminal server, check the ODBC settings to be sure that the Buffer Size setting on the Network tab is set to 7300 bytes to match the packet size setting on the server. While on this tab, note that specifying the IP address of your database server in the form HOST=123.123.123.123 (using your own server’s address) is sometimes necessary if the workstation cannot otherwise locate and connect to the database server. Unless you are having a problem, do not specify this parameter. Also on the Network tab is an option to Compress network packets. Using this option can make a significant performance improvement on some networks, but can slow things down on others. If your servers and workstations are relatively speedy, but your network is slow, this option should help. On the other hand, if your server and/or workstations are already working pretty hard, and you have abundant network capacity, checking this option may actually slow things down. You will have to experiment to know for sure. Test by timing the generation of large reports.

SNAGHTML178e068

Updated 2/26/2009

Extending Cache Size Beyond 1.8GB Using 32 Bit Windows

[This discussion assumes that you are running SOS 2010 or later]

The best and simplest option for getting optimal performance from a large database is to run it on a 64 bit Windows system with an abundance of RAM. Ideally, you would have enough RAM installed in your system so that the entire database could be cached. In that case, allowing a larger cache is simply a matter of increasing the value in the –ch parameter in the STDALONE.PRM or SERVER.PRM file located in the SOS folder on your standalone SOS computer, or your SOS database server computer, respectively. If you have, for example, 12 GB of RAM in your 64 bit system, you could allocate 10 GB of that RAM for potential use as database cache by including:

-ch 10g

in your PRM file.

Windows 32 bit platforms, however, normally would limit you to 1.8 GB, regardless of the amount of physical RAM in the computer. If you are running your database on a 32-bit version of Windows 7, or Server 2008 R2, you can make a simple modification to quickly boost the maximum RAM you can allocate for cache from 1.8 GB to 2.7 GB:

  1. Log into the system using an administrator-level account.
  2. Open a command window.
  3. Type bcdedit /set increaseuserva 3072
  4. Restart Windows.

The maximum cache size is configured by inserting or adjusting the –ch setting in the SERVER.PRM file located in the SOS folder on your SOS computer, or SOS database server computer. Although you can put most any valid setting in this file, it will be reset to the maximum available based on the usable RAM in your system. For example, if your SERVER.PRM contained the line:

-ch 2700m

indicating a high limit of 2,700 MB (2.7 GB) for database cache, the database engine will adjust it back to 1,800 MB when it starts. After executing the bcdedit command above, however, the defined high limit of 2.7 GB will be accepted by the database engine (2,700 * 1024 = 2,764,800K):

10-11-2010 5-45-43 PM

On a system with 4GB of physical RAM, you would not want to allocate more than 2.7 for database cache anyway, so this configuration is the best you can do. It will work reasonably well for databases up to about 5GB in size.

If you happen to have more than 4GB of physical RAM in your 32 bit Windows system running Windows Server Enterprise or Datacenter Edition, there is an option called AWE (Address Windowing Extensions) that can provide access to much more memory for you to use as database cache. If you happen to be in that situation, we would suggest that you call SOS to discuss your options.

Updated 2/27/2019

Backup and Recovery: Advanced Topics

The information in the Backing Up Your Data article is quite sufficient for most installations. The current document discusses advanced topics that will be of particular interest to those running the system in larger organizations with high data entry volume. The following topics include how to recover data entered since the most recent backup and how to backup up a running database. Much of this material is reprinted from the Backup and Data Recovery chapter of the SA Usage manual, with permission from Sybase, Inc. You can read this information directly in the online SA help, accessed from your Start > Programs > SOS Applications menu.

The material below explains how to use SA transaction log files to protect your data, how to make backup copies of your database and log files while the database is running, and how to recover after system and media failures.

Backing Up a Database While It Is Running

In some installations, it is desirable to keep the database running 24 hours a day. You cannot backup the running database using commercial backup software, so a special procedure must be used.

You can either:

1. Depend on Microsoft Volume Shadow Copy Services (VSS) to snapshot the database when using third party backup software after configuring your system to run the dbvss11 utility as a Windows service, or

2. (preferred) Use the included live backup utility to make a copy of the database in a separate directory, and backup that copy rather than the running production files in your backup set.

There is a downside to running the database non-stop. There are several maintenance/clean-up procedures that run automatically when the database is started. If you never restart the database, it is possible that you might run into minor issues, such as the inability to log into the system with a particular user ID after that user disconnected from the database in an unusual fashion. See Database Tools in the Admin Module to do the cleanup manually.

The recommended the following live backup procedure:

Create a CMD batch file containing the following commands:

(SOS 2015 and earlier)

C:\SOS\DBTOOLS /V
C:\SOS\DBTOOLS B=<target directory> -y

(SOS 2016 - Requires that you create a backup-only user account in SOS! See the SOSADMIN.PDF document in the \SOS folder of your system.)
c:
cd \sos\sa\bin32
DBBACKUP -c “uid=<account ID>;pwd=<account password>;dsn=SOSDATA” <target directory>

where <target directory> is an existing directory in which you want the copy of the database to be created. This directory must be located on the computer running the database. It should NOT be a shared folder on another computer! Make sure that this target directory is included in your backup configuration so that the database copy is backed up, and set the backup to skip the \SOS\DATA directory in which the running database files are located. Most backup software will fail to make usable backups of a running database!

Here is an example command line, including an optional -y parameter to create 
the directory if it doesn't exist, and to overwrite existing files:
DBBACKUP -y -c "uid=BU_BILL;pwd=PASSword#1;dsn=SOSDATA" C:\SOSBU

You can run a database validation or database copy interactively from the menus in the “DBA Utils” program in the Admin Module. Once the program has started, go to the Tools menu. Run the validation by selecting “Check Database”. You can run an ad-hoc live database copy by choosing “Copy Database” in the Tools menu. Generally, live backups are done as a Windows scheduled task that executes one or more times each day.

Note that for security reasons copying the database is only possible on the computer running the database software.

It is absolutely essential that you monitor your backups closely to be sure that the current database files are being copied to your backup media. If you are using commercial backup software, be sure to turn on the “verify” or “compare” operation and inspect your backup logs every day!

If you plan to backup the running database with Backup Exec, NovaBackup, or some other backup software that uses Microsoft Volume Shadow Copy Services (VSS) to backup open files, then create and run a Windows service for the SA VSS Writer component, DBVSS11.EXE, as follows:

  1. Open a command window.
  2. On 32-bit Windows type:
    CD \SOS\SA\BIN32 <enter>On 64-bit Windows type:
    CD \SOS\SA\BIN64 <enter>
  3. On 32-bit Windows type
    dbsvc -as -s Automatic -t vss -w VSSWriter “c:\SOS\SA\BIN32\dbvss11.exe” <enter>On 64-bit Windows type:
    dbsvc -as -s Automatic -t vss -w VSSWriter “c:\SOS\SA\BIN64\dbvss11.exe” <enter>

Once you have created the service, you should see it listed in your Windows Services as
“SQL Anywhere – VSSWriter”

It is absolutely essential that you test your backup during a period when the database is actively in use by restoring your backup, restarting your system, and validating the restored database as described in “Validating the Database”, above.

Live Backup and Database/Log Mirroring

SQL Anywhere also has the capability of running a continuous live backup of the transaction log on a separate computer, and even doing a failover database server running on a second computer. For discussion of these topics please see the appropriate topics in SQL Anywhere Database Administration manual located on your system. Go to Start > Programs > SOS Applications > Sybase SA Manuals. Open the Database Administration manual, then find “Backup and Data Recovery” in the “Maintaining Your Database” section.

System and Media Failures

SA has features to protect your data from two categories of computer failure: system failure and media failure.

System Failure: A system failure occurs when a power failure or some other failure causes the computer or operating system to go down while there are partially completed transactions. This could occur when the computer is inappropriately turned off or rebooted, or when another application causes the operating system to crash.

Media Failure: A media failure occurs when the database file, the file system, or the device storing the database file becomes unusable.

Recovery from Failure

When failures occur, the SA recovery mechanism treats transactions properly, as atomic units of work: any incomplete transaction is rolled back and any committed transaction is preserved. This ensures that even in the event of failure, the data in your database remains in a consistent state.

Make Regular Backups

You should make regular backups of your database files so that you can recover your database in the case of a media failure. SA uses the transaction log (which you should store on a separate device from the database for maximum data safety, or continuously backup using the transaction log mirroring feature of SA) to recover information put into the database since the last full backup. For information on management of the transaction log file, please see:

http://www.sosoft.com/fod/doc126-tranlog.pdf

The SA Logs

SA uses three logs to protect your data from system and media failure. These log files exist for each database running on a database engine or server.

All these logs play a role in data recovery. Each log exists for each database running on a database engine or server. Optionally, you can maintain a mirror of the transaction log for greater protection of vital data.

The Checkpoint Log

An SA database file is composed of pages. Before a page is updated (made dirty), a copy of the original is always made. The copied pages are the checkpoint log.

Dirty pages are not written immediately to the disk. For improved performance, they are cached in memory and written to disk when the cache is full or the server has no pending requests. A checkpoint is a point at which all dirty pages are written to disk. Once all dirty pages are written to disk, the checkpoint log is deleted.

Reasons for a Checkpoint

A checkpoint can occur for several reasons:

· The database engine is shut down

· The amount of time since the last checkpoint exceeds the database option CHECKPOINT_TIME

· The estimated time to do a recovery operation exceeds the database option RECOVERY_TIME

· The database engine is idle long enough to write all dirty pages

· A transaction issues a CHECKPOINT statement

· The database engine is running without a transaction log and a transaction is committed

The priority of writing dirty pages to the disk increases as the time and the amount of work since the last checkpoint grows. This is important when the database engine does not have enough idle time to write dirty pages. The database option CHECKPOINT_TIME controls the maximum desired time between checkpoints. The database option RECOVERY_TIME controls the maximum desired time for recovery in the event of system failure. Both times are specified in minutes.

When the database server is running with multiple databases, the CHECKPOINT_TIME and RECOVERY_TIME specified by the first database started is used, unless overridden by command line switches.

For a description of the command-line options, see “The database engine” in the on-line SA manual.

The Rollback Log

As changes are made to the contents of tables, a rollback log is kept for the purpose of canceling changes. It is used to process the ROLLBACK statement for recovering from system failure. There is a separate rollback log for each transaction. When a transaction is complete, its rollback log is deleted. (Note that the term transaction in this context refers to a related set of database operations, not a transaction in the sense of a single charge or credit entry in OM.)

The Transaction Log

For a condensed and SOS-specific discussion of transaction log management, see http://www.sosoft.com/fod/doc126-tranlog.pdf on the SOS web site.

All changes to the database are stored in the transaction log in the order in which they occur. If you should suffer a data loss, you could restore your most recent backup, then use the transaction log to restore all your changes since the last backup was done. In most cases, therefore, you can restore everything up to the time of your failure or loss, not just up to the time of your backup! The only price you pay for this additional security is the disk space taken by the transaction log. In the sections below you will learn how to move the log to another disk and how to clear it from time to time (after you have made and verified a full backup).

Although use of the transaction log is optional, by default it is enabled. If you run SA with no transaction log, a checkpoint is carried out whenever a transaction is committed. The checkpoint ensures that all committed transactions are written to the disk. Checkpoints can be time consuming, so you should run with a transaction log for improved performance as well as protection against media failure and corrupted databases.

For greater protection, SA allows you to maintain two identical transaction logs in tandem. This is called transaction log mirroring.

The transaction log is not kept in the main database file. The filename of the transaction log is set when the database is installed. For additional security against media failure, the transaction log may be written to a different device than the database file. Some machines with two or more hard drive letters only have one physical disk drive with several logical drives or partitions. If you want protection against media failure, make sure that you have a machine with two separate disk drives or use a storage device on another computer on the network. Note that by default, the transaction log is put on the same device and in the same directory as the database (\SOS\DATA). This default installation, although convenient, does not protect against media failure.

Placing the transaction log on a separate device can also result in improved performance by eliminating the need for disk head movement between the transaction log and the main database file.

Moving the Transaction Log

Use the SA DBLOG utility, located in the \SOS\SA\BIN32 folder, to move the transaction log to a different drive by setting a new transaction log name. Simply copying the file from one drive to another will not work because the location of the log is stored in the database.

Make sure that the database is not running.

From the \SOS\SA\BIN32 prompt, type, in lower case:

dblog -t <new log name> <database name>

The new log name should include the drive, path, and filename of the new log file, for example, d:\soslog\sostran.log .

The database name should include the drive, path, and filename of the main database file, for example, c:\sos\data\sosdata.db.

Once you have reset the location in the database using this procedure, physically move or copy the current transaction log to the new location and, optionally, name you have specified. You will then be able to restart the database engine normally. Remember to include the transaction log, in its new location in your daily backup!

Using a Transaction Log Mirror

A transaction log mirror is an identical copy of the transaction log, maintained at the same time as the transaction log. Every time a database change is written to the transaction log, it is also written to the transaction log mirror file. By default, SA does not use a mirrored transaction log, but you can readily add a transaction log mirror to your system. The procedure is described in the next section.

A mirrored transaction log is useful for extra protection of critical data. There is a performance penalty for using a mirrored log, as each database log write operation must be carried out twice. The performance penalty will depend on the nature and volume of database traffic and on the physical configuration of the database and logs, but in most cases will not be apparent to users of the system.

A transaction log mirror should be kept on a separate physical drive from the transaction log, so that if either drive fails, the other copy of the log keeps the data safe for recovery. Both drives should be on the same computer, however! Maximum protection of your data, therefore, would require three drives (physical drives, not just partitions on the same drive). The database files (the *.DB files) would be on one drive, the transaction log (sosdata.log) on a second, and the mirrored log (sosdata.mlg) on a third.

Creating a Transaction Log Mirror

Use the SA DBLOG utility, located in the \SOS\SA\BIN32 folder, to create a transaction log mirror file on another hard drive.

Make sure that the database is not running.

From the \SOS\SA\BIN32 prompt, type, in lower case:

dblog -m <new mirror log name> <database name>

The new mirror log name should include the drive, path, and filename of the new mirror log file, for example, d:\soslog\sosdata.mlg (mlg is the default mirror extension)

The database name should include the drive, path, and filename of the main database file, for example, c:\sos\data\sosdata.db

Removing a Transaction Log Mirror

If you have been using a log mirror and no longer want to do so, use DBLOG to discontinue mirroring:

Make sure that the database is not running.

From the \SOS\SA\BIN32 prompt, type, in lower case:

dblog -r <database name>

The database name should include the drive, path, and filename of the main database file, for example, c:\sos\data\sosdata.db

Erasing Transaction Log and Mirror Files

You can erase transaction logs and mirrors using the DBERASE command-line utility. Note that this command physically deletes the file from the disk, but does not terminate the use of either. As soon as you restart the database, the files will be recreated.

To delete a mirror log file only:

Make sure that the database is not running.

From the \SOS\SA\BIN32 prompt, type, in lower case:

dberase <mirror file name>

The mirror file name should include the drive, path, and filename of the mirror file that you want to erase, for example, e:\sos\data\sosdata.mlg

To delete a transaction log file but not its mirror:

Make sure that the database is not running.

From the \SOS\SA\BIN32 prompt, type, in lower case:

dberase <transaction log file name>

The transaction log file name should include the drive, path, and filename of the transaction log file that you want to erase, for example, d:\sos\data\sosdata.log

Validating the Transaction Log and Mirror

When a database that is using a mirror starts up, the database engine or server carries out a series of checks and automatic recovery operations to confirm that the transaction log and its mirror are not corrupted, and to correct some problems if corruption is detected.

On startup, the database engine checks that the transaction log and its mirror are identical by carrying out a full comparison of the two files; if they are identical, the database starts as usual.

The comparison of log and mirror adds to database startup time when you are maintaining a log mirror.

If the database stopped because of a system failure, it is possible that some operations were written into the transaction log but not into the mirror. If the database engine finds that the transaction log and the mirror are identical up to the end of the shorter of the two files, then the remainder of the longer file is copied over into the shorter file to produce identical log and mirror. After this automatic recovery step, the database engine starts as usual.

If the check finds that the log and the mirror are different in the body of the shorter of the two, one of the two files is corrupt. In this case, the database does not start, and an error message is generated saying that the transaction log or its mirror is invalid. If this situation should occur, consult “Recovering from media failure on a mirrored transaction log” in the on-line SA Database Administration Guide.

Validating the Database

From time to time prior to running a full backup, it is a good idea to verify that the database file is not corrupt. A small portion of the database could be corrupt without you ever knowing until it was too late to recover the data.

With the database engine (single user) or server (network) running, execute the Check Database tool in the database utility that comes with your SOS software. Enter a Security Administrator id and password, then click the Admin icon. Once at the administration console window, select Database Tools > DBA Utilities > Tools > Check Database.

If desired, you can run the same procedure from the command line or from within a batch file, using the following command, from the prompt in the SOS directory:

DBTOOLS /V

You may want to include this command in a desktop shortcut. It is an excellent idea to run this routine before or after your daily backup to be sure that you are backing up an intact database.

The validation procedure can take a little while to complete on a large database. It scans every record in every table and looks up each record in each index on the table. It can be run while the database is in use, but you may notice some performance impact while it is running.

Any messages produced by the utility are collected in a file on disk (\SOS\SOSVALID.LOG) and displayed when the procedure is complete. If the database file is corrupt, you must restore the DB files (but not the LOG file) from your previous intact backup. You may then be able to apply the current transaction log in order to bring the database up to date (see “Lost Database Files” on page 28).

Backing up Your Database
On-line Backups

In some organizations, operations continue around the clock and it is not possible to stop the database to perform a traditional backup. Under these circumstances, you can use the provided Copy Database utility to make a copy of the database, while it is running, in a different directory. Once the copy is complete, the duplicated files can be included in your regular backup even though the open production database files will be skipped by your backup software. (To avoid errors in your backup logs, configure your backup to skip over the production database files or folder.)

Run Copy Database interactively from the menus in the DBA Utilities program, which is located in the Admin Module. The Admin icon appears on the login window for users who are designated as Security Administrators. On the Admin menu, select Database Tools, then DBA Utilities.

Once the program has started, go to the Tools menu. Select Copy Database to make a live copy of the running database into a different directory. Note that for security reasons copying the database is only possible on the computer running the database software.

The Copy Database utility can be run against a standalone engine or network database server. The utility will not run from a network workstation for security reasons. Using the Copy Database utility on a running database is equivalent to copying the database files when the database is not running. In other words, it provides a snapshot of a consistent database, even while it is being modified by other users.

For a full description of the SA online backup facility, see “Use the Backup utility (dbbackup) to make a server-side backup” in the online SA Database Administration Guide, page 882 (pdf page 900). It is important to understand, however, that you will not be able to use the utility directly against the secure SOSDATA database. Rather, you must run it from within the DBA Utilities shell program provided by SOS as described above or using the DBTools command line explained below.

You also can copy the database from the command line, batch file, or desktop shortcut by executing DBTOOLS.EXE B=<target directory> from the SOS directory (but only on a standalone system or directly on the database server computer). For example, assuming that the SOS folder is located on the C: drive:

C:\SOS\DBTOOLS.EXE B=C:\SOS\BACKUP

would create a copy of the currently running database in the C:\SOS\BACKUP folder. Note that the folder must exist before you execute the command. SOS recommends that the destination for the copy operation be a different drive on the database computer than that on which the production database is located. That way, if your primary drive should fail, the most recent copy of the database on the secondary drive will be readily available to use in the restoration process.

Open File Backups Using Volume Shadow Copy Service

[SOS 2010 and later] SOS recommends the Copy Database procedure detailed above for best reliability. In addition, there is a side benefit that it leaves a backup copy of your database and log on a local hard disk as a redundant backup to the one you make on removable media, internet-based backup service, or both.

[SOS 2010 and later] That said, many commercial backup programs include the ability to backup files that are in use through the Volume Shadow Copy Service available on versions of Windows starting with XP. For best results, you should create and enable the SA VSS Writer service by executing the following command from the command prompt in the \SOS\SA\BIN32 directory:

dbsvc -as -s Automatic -t vss -w SAVSSWriter “c:\sos\sa\bin32\dbvss11.exe”

It is absolutely essential that you test your backup during a period when the database is actively in use by restoring your backup, restarting your system, and validating the restored database as described in “Validating the Database”, above .

Incremental Backups of the Transaction Log

You can carry out an off-line incremental backup by making a copy of the transaction log. Alternatively, you can carry out an online incremental backup by running the SOS Copy Database utility, and subsequently backing up the SOSDATA.LOG file in the normal fashion to tape or other removable media.

You should back up the transaction log daily. This is particularly important if you have the transaction log on the same device as the database file. If you have a media failure, you could lose both files. By doing daily backups of the transaction log, you will never lose more than one day of changes.

Daily backups of the transaction log are also recommended when the transaction log tends to grow to an unmanageable size between full backups and you do not want to get a larger storage device or do more frequent full backups. In this case, you can choose to archive and delete the transaction log by selecting the appropriate options in the SOS Copy Database utility.

There is a drawback to deleting the transaction log after a daily backup. If you have media failure on the database file, there will be several transaction logs since the last full backup. Each of the transaction logs needs to be applied in sequence to bring the database up to date, as described below. It is therefore extremely important to save all transactions logs that cover database activity after the most recent verified backup of the database files themselves!

SOS strongly recommends that Transaction logs be archived onto CD-R or other permanent media that will not be overwritten and that these media be stored in a safe location, such as a fireproof data safe, or even better, off-site in a bank vault.

Backing Up, Renaming and Restarting the Transaction Log

Use of the following command will do a live backup of the transaction log into the target directory, but will also rename the backup with the form YYMMDD##.LOG (where ## is a sequential number starting with 00, in case you execute the command more than once on a single date) and restart the log. The result will be a copy of the current SOSDATA.LOG in the backup directory, but renamed based on the date, and a brand new, small SOSDATA.LOG file in the \SOS\DATA folder.

C:\SOS\DBTOOLS B=C:\BACKUPS -t -r -n

You can specify any existing directory on the server instead of “C:\BACKUPS”, but be sure to type the -t -r and -n in lower case.

If you prefer to work within a graphical interface, you can do this process from Database Tools > DBAUtils in the Administration module. Select Copy Database on the Tools menu, select the desired backup directory and check the -t, -r, and -n options as shown below.

Use the Copy Database utility to backup and restart your transaction log file.

To create the renamed backup copy in the current data directory, just type a period (.) for the Backup directory. The dated copy of the old log will be created in the same directory as the database files and new log file.

Data Recovery
System Failure

After a power failure or other system failure you should run the Windows’ scandisk utility to correct simple errors in the file system structure that might have been caused by the system failure. This step should be done before running any other software.

After a system error occurs, SA automatically recovers when you restart the database. The results of each transaction committed (written to the database) before the system error are intact. All changes by transactions that were not committed before the system failure are canceled, and therefore lost. In most cases that means you will only lose those changes that had not been completely saved prior to the failure.

The database engine automatically takes three steps to recover from a system failure:

1. Restore all pages to the most recent checkpoint, using the checkpoint log.

2. Apply any changes made between the checkpoint and the system failure. These changes are in the transaction log.

3. Rollback all uncommitted transactions, using the rollback logs. There is a separate rollback log for every connection.

Step 3 may take a long time if there are long uncommitted transactions that have already done a great deal of work before the last checkpoint.

Media Failure

Perhaps the most frequent cause of data loss is the failure of a hard drive or failure of drive controller electronics, leading to corruption of the data on the drive.

If you have backups, you can always recover all transactions that were committed before the media failure. Recovery from media failure requires you to keep the transaction log on a separate device from the database file. The information in the two files is redundant. Regular backups of the database file and the transaction log reduce the time required to recover from media failures.

The first step in recovering from a media failure is to clean up, reformat, or replace the device that failed.

The steps to take in recovery depend on whether the media failure is on the device holding your database file or on the device holding your transaction log. These discussions assume that your system stores the transaction log (or mirror) on a separate drive from the database files.

Lost Database Files

When your transaction log is still usable, but you have lost your database file, the recovery process depends on whether you keep or delete the transaction log on incremental backup.

If you have not deleted or restarted the transaction log since the last full backup, the transaction log contains everything since the last backup. Recovery involves four steps:

1. If you do not already have one, make a backup of the current transaction log immediately. The database file is gone and the only record of the changes is in the transaction log.

2. Restore the most recent full backup (the database file).

3. Change to the \SOS\SA\BIN32 directory.

4. Use the database engine with the apply transaction log (-a) switch to apply the transaction log and bring the database up to date:

dbeng11 c:\sos\data\sosdata.db -a d:\soslogs\sosdata.log

Start the database in the normal way. The database engine will come up normally and any new activity will be appended to the current transaction log.

If you have archived and deleted the transaction log since the last full backup, each transaction log since the full backup needs to be applied in sequence to bring the database up to date.

Make a backup of all transaction logs immediately. The database file is gone and the only record of the changes is in the transaction logs.

Restore the most recent full backup (the database file).

Change to the \SOS\SA\BIN32 directory.

Starting with the first transaction log after the full backup, apply each archived transaction log by starting the database engine with the apply transaction log (-a) switch. For example, if the last full backup was on Sunday and the database file is lost during the day on Thursday:

dbeng11 c:\sos\data\sosdata.db -a d:\soslogs\mon.log

dbeng11 c:\sos\data\sosdata.db -a d:\soslogs\tue.log

dbeng11 c:\sos\data\sosdata.db -a d:\soslogs\wed.log

dbeng11 c:\sos\data\sosdata.db -a d:\soslogs\sosdata.log

SA does not allow you to apply the transaction logs in the wrong order or to skip a transaction log in the sequence.

An easier approach is to put all the log files in the same directory, then use this command:

dbeng11 c:\sos\data\sosdata.db -ad d:\soslogs

where “d:\soslogs” is the directory in which you have placed all the relevant log files. The database will inspect the files and automatically apply them in the correct sequence.

After applying the transaction logs, start the database in the normal way. The database engine will come up normally and any new activity will be appended to the current transaction log.

Lost Transaction File

When your database file is still usable but you have lost your transaction log, the recovery process is as follows:

1. Make a backup of the database file immediately. The transaction log is gone and the only record of the changes is in the database file.

2. Restart the database with the -f switch:

dbeng11 c:\sos\data\sosdata.db -f

Without the -f switch, the database engine will complain about the lack of a transaction log. With the switch, the database engine will restore the database to the most recent checkpoint and then roll back any transactions that were not committed at the time of the checkpoint. A new transaction log will be created and the database will do a clean shutdown, after which you should be able to restart it normally.

Media failure on the transaction log can have more serious consequences than media failure on the database file. When you lose the transaction log, all changes since the last checkpoint are lost. By default, database checkpoints are set at 30 minute intervals. This will be a problem when you have a system failure and a media failure at the same time (such as if a power failure causes a head crash that damages the disk). Frequent checkpoints minimize the potential for lost data but also create work for the database engine writing out dirty pages.

For running high-volume or extremely critical applications, you can protect against media failure on the transaction log by mirroring the transaction log or by using a special-purpose device, such as a storage device that mirrors the transaction log automatically.

Client/Server Computing with Sybase SQL Anywhere

Complete Sybase documentation for Sybase SQL Anywhere (SA) can be found by selecting Sybase Manuals on the Help menu in Office Manager (OM), Case Manager (CM), or Appointment Scheduler (AS). Alternatively, select Start > Programs > SOS Applications > Sybase Manuals. There are actually three SA guides:

SQL Anywhere Server SQL Usage, which includes an introduction to SA databases, queries, and other related topics. Many of these are not relevant to your “read only” access to the SOS database.

SQL Anywhere Server SQL Reference, which includes detailed information about SQL syntax.

SQL Anywhere Server Database Administration, which is perhaps the most useful in that it includes detail about management of the database and log files.

Another valuable source of SA information is the Sybase web site, http://www.sybase.com.

Specifications and Limits

The version of SA that comes with SOS Applications is locked to prevent changes to any SOS data by third party programs such as Microsoft Access. This restriction in no way limits your ability to view, read, report, or analyze SOS data with another program (assuming you have been granted access), but you will not be able to modify the data. Without a thorough knowledge of the intricacies of the SOS database and exactly how the many tables relate to one another, you could accidentally introduce data errors or inconsistencies by making a seemingly innocent change.

As you can see from the specifications below, you are extremely unlikely to run into any technical limitations of the database system.

Database size Operating system maximum file size
Number of tables per database Up to 4 billion
Number of tables referenced per transaction No limit
Table size Limited only by file size
Number of columns per table 45,000
Number of rows per table Limited only by file size
Row size Limited only by table size
Number of rows per database Limited only by file size
Field size 2 GB
Number of indexes 2,048 per table
Maximum index entry size No limit

Standalone Installations

When you run an SOS application in a standalone configuration, you are making use of three separate but related software systems: SOS’s application, Microsoft’s Open Database Connectivity (ODBC) system, and Sybase’s SA personal database server engine.

OM, CM and other SOS programs are called front-end or client applications. These applications do not directly manipulate the data stored in the database files. Rather they sends messages, commands, and requests to the Windows ODBC system. Using information stored in the SA driver installed on your system, ODBC translates these generic messages into the specific dialect that can be understood and acted upon by the SA database engine, also running on your system. The database engine then retrieves or modifies your data in accordance with the messages received through the ODBC interface and passes any requested data back to the client program through the ODBC layer.

Network Installations

Client/Server architecture was designed to make network computing more efficient. Work is divided between client workstations and a powerful server, thereby improving performance. Further, client/server applications create much less “traffic” on the network, also resulting in higher performance. Finally, because workstations do not directly control the physical data files, there is little chance of data corruption from power losses, reboots, and other disruptions at the workstation end of the system.

As with a standalone implementation, the operation of an SOS program involves several related software systems (the front-end program such as OM, CM, or the Appointment Scheduler, the Windows ODBC component, the SA client drivers) but also the network operating system on the workstation, the network operating system on the server computer and the SA server software. The network implementation also involves additional hardware components, including network interface cards, cables, other network devices, and, of course, the server computer itself. In a wide area network installation, there can also be routers, firewalls, and various other pieces of communications technology. If the SOS application has trouble reading or updating data in the database, any of these components could be to blame.

All of these potential points of failure could lead to challenging troubleshooting, but the presence or absence of the same problem at a different workstation can quickly isolate the problem to the server or workstation. See the Troubleshooting document in the SOS web site document library for pointers on problem-solving. The online user group (http://groups.google.com/group/sosoft) also can be a great resource. Another user may have had and solved a similar problem in the past.

Backing Up Your Data

Revised Jan. 2, 2025

Nothing that you do on your computer in the course of a day — or for that matter, a month — has anywhere near the significance of your backup procedure. A good backup will someday mean the difference between a minor inconvenience and a very costly disaster.

What can you do to safeguard your data?

1.  SOS Applications do not have a built-in backup program. Use high-quality, brand-name data backup software or the backup software that comes with your backup media.

2.  Configure your backup software to TURN ON all error checking, correction, verify options, data compression feature, and automatic compare feature.  Always use the full backup option. Enable the encryption option, and if there is none, find other software. If you will be transporting the backup out of the office, encryption is essential to avoid a potential data breach. The loss or theft of your SOS backup would compromise the privacy of all your patients and result in serious and expensive HIPAA-related remediation and possible civil or even criminal prosecution. Ensure that you record the encryption key and that all parties who need it can find it should the need arise. Your backups will do you no good if you cannot decrypt them.

3.  Next, you might want to follow the instructions that came with your backup software for creating a setup or script that will permit you to backup only those files you want to save. You can, for example, have a setup that backs up only the data files in your \SOS\DATA folder, which contains the SOS database.

4.  All good backup programs include a notification feature that will tell the program to email a report to you at the end of every backup operation to let you know if any errors were encountered. Checking to be sure your backup is running correctly is critical; this option makes that part of the process quick and easy. 

5.  It is essential that you rotate your backup media. In short, this means you never use the same cartridge, tape, or backup disk two days in a row. The bare minimum should be a rotation through three backup sets. Still, we strongly recommend backup each day of the week, plus several more for rotating off-premises.

The safety location is often the home of one of the people in the office. Storing some backups off-premises provides you with an extra margin of safety in the event of a fire, burglary, or other event that might result in the loss of the data on your hard disk and any media stored near the computer. We strongly suggest storage in another location. For additional security, SOS recommends making periodic “archival” backups that are never over-written. Archival backups should be stored in a secure off-premises location, such as a bank safe deposit box. This extra step will allow you to restore your financial data for a quarter or longer. An alternative for archival backups is to make backups that are saved to an online repository.

6.  In addition to your multiple generations of local backups, you should consider using one of the many online backup services or have your IT consultant set up regular uploads of an encrypted backup to an off-site web server, preferably located far from your office. If you choose this route, select a vendor that provides pre-transmission encryption. The only way you can be sure your data is not at risk is if you encrypt it BEFORE sending it off-site!

Note that as of October 2013, new HIPAA rules went into effect that require you to execute a formal Business Associate Agreement (BAA) with any vendor who “creates, receives, maintains, or transmits protected health information.” That would seem to include online backup services. If you do not execute a Business Associate Agreement with this type of vendor, you might be in violation of the new HIPAA rules.

7.  Have a disaster recovery drill regularly. Start by shutting down your database and renaming your DATA folder in SOS to something else, such as DATASAVE. Now, try to restore your backup, following the appropriate restore procedure for your backup software. When the restore is complete, open SOS to be sure the database is intact and contains all the data you believe it should. If you cannot open the database, something is wrong with your backup procedure, and you must correct it. If the program starts properly and you can access all your data, you know your backup procedure is working. You can now delete the DATASAVE folder.

If you follow the procedure outlined above, your data should be safe and available should you ever have to restore it from a backup.


 

Copying the Database Files While The Database Is Running

In some installations, it is desirable to keep the database running 24 hours a day or to do a backup without stopping the database. You cannot backup a running SQL Anywhere database using commercial backup software, so a special procedure must be used. (Even if you manage to make such a backup of the files while they are open, it is exceedingly unlikely that the database will run after being restored.)

There is a downside to running the database non-stop. Several maintenance/cleanup procedures run automatically when the database is started. If you never restart the database, you might run into minor issues, such as the inability to log into the system with a particular user ID after that user disconnected from the database in an unusual fashion. See Database Tools in the Admin Module to clean up manually. SOS recommends restarting the database once daily to allow these maintenance procedures to run.

Even though you cannot backup the data files while the database is running, you can make a copy of the running database in a separate directory. You can then configure your backup software to back up the copy and ignore the directory in which the production database files are located.

There are two ways to make a copy of the database while people are in the program:

  1.  Via a Command Line
  • For this purpose, starting with SOS 2016, you will need user credentials for an account with no rights other than creating a copy of the database files while they are in use. Backup-only user accounts are created on the Backup Users tab of the user account maintenance list in the Administration module.
  • Create a batch file (CMD file) containing the  following command. This example assumes the software is installed in the SOS folder on the C: drive. Make adjustments as appropriate. It is important to note that this command file must be run directly on the computer that runs the database.
  • You can use the command line below to make a copy of the database.

 DBBACKUP -y -c “uid=<backup user account ID>;pwd=<backup user account password>;dsn=SOSDATA” <target directory>

Here is an example command line for SOS 2016, including an optional -y parameter to create the directory if it doesn’t exist, and to overwrite existing files:

 DBBACKUP -y -c “uid=BU_BILL;pwd=PASSword#1;dsn=SOSDATA” C:\SOSBU

  •  Generally, copies of a running database are done using a Windows-scheduled task that executes the command above, one or more times daily.
  1. Via a utility in the ADMIN module called Copy Database
  • Click on the SOSLogin and enter your Super ID and password.
  • Click on ADMIN
  • Click on Database Tools
  • Highlight DBA Utilities and click Select (hand icon)
  • Click on Tools then Copy Database
  • Select the path where you want to copy the database to or enter a path you want to create
  • Check the last box -Y. This will create the directory if it doesn’t exits.
  • Click the Copy

To backup the copy of the database files, you need to make sure that this target directory is included in your backup configuration so that the database copy is backed up. Set the backup to skip the \SOS\DATA directory in which the running database files are located.