+ All Categories
Home > Documents > Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... ·...

Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... ·...

Date post: 14-Feb-2018
Category:
Upload: phamkiet
View: 240 times
Download: 6 times
Share this document with a friend
100
BAAN IVc Installation and Administration Guide for Sybase
Transcript
Page 1: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IVcInstallation and Administration Guide forSybase

Page 2: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

A publication of:

Baan Development B.V.P.O.Box 1433770 AC BarneveldThe Netherlands

Printed in the Netherlands

© Baan Development B.V. 1999.All rights reserved.

The information in this documentis subject to change withoutnotice. No part of this documentmay be reproduced, stored ortransmitted in any form or by anymeans, electronic or mechanical,for any purpose, without theexpress written permission ofBaan Development B.V.

Baan Development B.V.assumes no liability for anydamages incurred, directly orindirectly, from any errors,omissions or discrepanciesbetween the software and theinformation contained in thisdocument.

Document Information

Code: U7019E USGroup: User DocumentationEdition: EDate: January 1999

Page 3: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

i

Installation and Administration Guide for Sybase

1 BAAN IV Sybase database driver overview 1-1BAAN SQL processing 1-2BAAN IV database driver features 1-2BAAN data dictionary (DD) 1-2Security 1-3Referential integrity 1-3Data buffering, reduction, and compression 1-3Tuning aspects: profiling and statistics 1-3BAAN IV database driver interface 1-4Data dictionary mapping 1-5Mapping the BAAN data dictionary to the Sybase format 1-5Stored procedure name convention 1-7Data types 1-7Constraints 1-8Hash column size 1-9Index ordering 1-9Index uniqueness 1-10Isolation level usage 1-10Transaction management 1-11Locking 1-11Optimization 1-12Fetch optimization 1-12Effect of fetch optimization 1-13Refresh time 1-13Hash optimization 1-14Cache 1-15Stored procedures 1-15Error reporting 1-17Steps for analyzing errors 1-18BAAN IV database driver trace information 1-18

2 To install BAAN IV for Sybase 2-1Installation preparations 2-1To tune the kernel 2-1To create database devices 2-4To create the required UNIX directories, groups, and users 2-4To set environment variables 2-6

Table of contents

Page 4: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Table of contents

Installation and Administration Guide for Sybase

ii

To install Sybase 2-8To unload the software 2-8To create the Sybase servers 2-10To prepare Sybase for BAAN IV 2-11To install BAAN IV 2-12Files required for the BAAN IV database driver 2-16Tuning aspects 2-17BAAN IV database driver statistics 2-17BAAN IV database driver profiling 2-19Profile output file format 2-20Effect of optimization 2-20Location of management file 2-22

3 BAAN IV Sybase database driver administration 3-1Group management 3-1Create a group 3-1Drop a group 3-2Change the group user password 3-3BAAN user management 3-3Add a BAAN user to a group 3-3To drop a BAAN user from a group 3-4To change a Sybase user password 3-4Maintenance tool 3-4User administration 3-4User information 3-5Main menu 3-5User administration 3-5Add user 3-6Drop user 3-6Change user password 3-7Add group 3-7Drop group 3-8Change group password 3-8User information 3-8List users 3-8List groups 3-9List storage 3-9Edit storage 3-10Escape to shell 3-10Storage file management 3-10The syb_maint6.1 tool 3-11

Page 5: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Table of contents

Installation and Administration Guide for Sybase

iii

4 BAAN IV Sybase database driver configuration and tuning aspects 4-1Configuration and tuning aspects 4-1High-level lock retries 4-1Optimistic and pessimistic reference checks 4-2File formats 4-2File $BSE/lib/sybase/syb_users 4-2BAAN user 4-2Sybase user 4-2Sybase user password 4-3User group 4-3File $BSE/lib/sybase/syb_groups 4-3Group name 4-4Group password 4-4File $BSE/lib/sybase/syb_storage 4-4

5 Appendix A: Setting database driver behavior 5-1Driver resources 5-1Environment variables 5-2Server environment variables 5-3Client environment variables 5-4Storage file 5-4

6 Appendix B: Database driver resources and environment variables 6-1Summary of Sybase resources and environment variables 6-1Detailed description of Sybase resources and environment variables 6-3Generic driver resources 6-4Sybase driver specific resources 6-11Sybase environment variables 6-17

7 Appendix C: Storage file format and configuration options 7-1Storage file format 7-1Storage file field descriptions 7-2

8 Appendix D: BAAN IV Sybase database driver SQL queries 8-1No hash optimization 8-1Unique index 8-1Duplicate Index 8-2Single hash optimization 8-3Unique index 8-3Duplicate index 8-4

Page 6: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Table of contents

Installation and Administration Guide for Sybase

iv

Page 7: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Installation and Administration Guide for Sybase

v

This document addresses the BAAN IV Sybase database driver, which allowsBAAN application tables to be created and manipulated in the Sybase AdaptiveServer Enterprise (Sybase ASE) environment.

BAAN IVc4 and earlier releases support Sybase ASE 11.5. Later BAAN IVreleases support both Sybase ASE 11.5 and 11.9. This document describesprocedures required for both Sybase releases and flags those places in the textwhere the Sybase version is significant to the context.

In addition, this document describes how to install the BAAN IV Sybasedatabase driver to be used with the BAAN application software that uses Sybaseas the database. The audience for this document is anyone who wants to useSybase as a database management system that works with the BAAN applicationsoftware in a UNIX server environment. However, an elementary knowledge ofUNIX and Sybase is required to understand this document.

The procedure to install the BAAN software is described in the BAANInstallation Guide (U7016 US). This guide also contains a set of flow charts thatdepict the place of the Sybase installation in the whole installation process.

This document is divided into four chapters and four appendixes:

Chapter 1 is a general overview of the BAAN database driver architecture.

Chapter 2 describes the installation of the BAAN IV Sybase database driver.

Chapter 3 describes the administration of the BAAN IV Sybase database driver.

Chapter 4 offers configuration and tuning aspects relevant to the BAAN IVSybase database driver.

Appendix A describes how to set the database drives behavior.

Appendix B lists the database driver resources and environment variables.

Appendix C describes the file format of the storage file and the configurationoptions.

Appendix D lists the BAAN IV Sybase database driver SQL queries.

About this document

Page 8: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

About this document

Installation and Administration Guide for Sybase

vi

Page 9: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Installation and Administration Guide for Sybase

1-1

This chapter describes the general architecture of the BAAN IV database driver.In particular, this chapter supplies background information about the BAAN IVSybase database interface of the Sybase Adaptive Server Enterprise (SybaseASE) relational database management system (RDBMS). This chapter alsodescribes where the BAAN IV database driver files are located.

BAAN supports a wide range of databases by implementing an interface calledthe BAAN database driver. The interface to the Sybase ASE RDBMS is theBAAN IV database driver.

As part of the BAAN Tools client/server architecture, the BAAN IV databasedriver acts as an interface between the BAAN Tools and the active RDBMS. TheBAAN IV database driver also acts as a server to the BAAN application andcommunicates with the Sybase RDBMS. The BAAN application carried out bythe bshell program sends database requests to the BAAN IV database driver, andthe BAAN IV database driver transfers the request to the Sybase RDBMS. TheBAAN IV database driver sends data returned by the Sybase RDBMS back to theBAAN application.

An overview of the architecture is illustrated in Figure 1-1.

Bshell

Client

BAAN/SYBASEDriver

Server

SYBASESQL Server

RDBMS

BAAN Query SYBASE Query

Figure 1-1, BAAN IV database driver architecture

1 BAAN IV Sybase database driveroverview

Page 10: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver overview

Installation and Administration Guide for Sybase

1-2

BAAN SQL processingIf the application server (indicated by the bshell in Figure 1-1) encounters adatabase query in the application that is being carried out, it parses the query andsends an internal representation to the BAAN IV database driver. The BAAN IVdatabase driver translates this representation into one or more single-table Sybasequeries. The BAAN IV database driver connects to the Sybase RDBMS by usingthe Sybase client-library API. The queries are then handed over to the RDBMSfor processing. The rows returned by the RDBMS as a result of the queries arecollected by the BAAN IV database driver and sent back to the BAANapplication. The BAAN IV database driver handles the error conditions.

For BAAN query processing, the BAAN IV database driver receives database-independent representations of queries that are further processed to generateSybase RDBMS-compatible queries. The BAAN IV database driver consists ofan RDBMS-independent section and an RDBMS-dependent section. In terms ofevaluating the SQL expressions, a possibility exists that the Sybase RDBMS willnot be able to handle an expression. For example, in some instances the SybaseRDBMS may not support some operators such as the BAAN LIKE operatorbecause the BAAN definition of the operator is different from that of the SybaseRDBMS. Disparately defined expressions are translated by the BAAN IVdatabase driver into a Sybase equivalent statement that is supported by theSybase RDBMS. All expressions that can be supported by the Sybase RDBMSare combined and the database-dependent layer within the BAAN IV databasedriver generates a database expression.

BAAN IV database driver featuresThe following section describes the main features of the BAAN database driverarchitecture.

BAAN data dictionary (DD)

BAAN has an internal data dictionary (DD) environment that is separate from theSybase RDBMS data dictionary. The BAAN data dictionary for a table containscolumn names, column types, and column sizes, which are defined and located inthe BAAN application. This table representation could be different from thesame table representation in Sybase.

Page 11: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver overview

Installation and Administration Guide for Sybase

1-3

Security

The authorized BAAN users are registered in the administration files kept in$BSE/lib/sybase directory. The $BSE/lib/sybase/syb_users file contains the username and password in encrypted form. The BAAN IV database driver establishesa connection to the database for the user that uses this password. Theadministration of these files is performed by user root or by the sybase (databaseadministrator) account. For every BAAN session, a corresponding Sybaseconnection exists that was established by the BAAN IV database driver.

Referential integrity

Baan drivers do not depend on the underlying RDBMS to maintain referentialintegrity. In other words, the BAAN Sybase database driver does not use any ofthe Sybase features like references, foreign key, or triggers to maintainreferential integrity of the BAAN tables. All BAAN drivers contain a built-inmechanism to take care of references.

Data buffering, reduction, and compression

When multiple rows are returned from a query, the rows are buffered and thensent back to the client as one block. Also, data reduction and compression areapplied to minimize the amount of data transferred between the applicationserver (bshell) and the BAAN IV database driver.

Update actions, such as insert, update, and delete, are buffered at the client sideand flushed at the time of transaction commit, or earlier when necessary. Thisaction reduces the number of network roundtrips and data volumes.

Tuning aspects: profiling and statistics

The BAAN IV database driver also enables users to log timing aspects andstatistics. This function is useful for tuning purposes because the information canhelp to identify performance bottlenecks. The BAAN IV database driver offersboth profiling and statistics options, which are described below.

Profiling

The profiling option of the BAAN IV database driver provides a way of lookingat SQL statements from the point of view of how long it takes for thesestatements to be carried out. By using an environment variable to define alogging threshold based on a predefined number of seconds, you can create a listof all SQL statements that take a longer time to carry out than the specifiedthreshold. This list is logged to a file named sybprof, in the directory in whichthe BAAN server database driver is started.

Page 12: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver overview

Installation and Administration Guide for Sybase

1-4

If the profiling environment variable is set tofive seconds, each statement thattakes longer than five seconds (real time) is logged to the log file. Theinformation that is logged in the file is the SQL statement with the elapsed timeand user, date/time. The maximum precision that can be specified with theenvironment variable is 0.01 seconds.

Two statement types are timed and can appear in the log file:

n The execute eventThis event represents the amount of time the RDBMS engine took to carryout a SQL statement.

n The fetch eventThis event represents the amount of time required to execute the command toretrieve the data from the buffer.

Statistics

The BAAN IV database driver also provides an option that gathers BAAN IVdatabase driver-wide statistics about actions being performed, such as:

n Number of cursors (opened, closed, and current open)n Number of parses, binds, executes, and fetchesn Number of logons (sessions)n Number of inserts, updates, and deletesn Number of commits and rollbacks

For each action, the cumulative (real) time spent by the action and average timeis also logged. The statistics can be enabled with an environment variable. If thevariable is set to 0, a statistics report is generated when the BAAN IV databasedriver terminates (exits from BAAN Tools or session). If a value greater than 0 isspecified, the BAAN IV database driver logs an incremental report each n second(BAAN IV database driver must be active). The statistics report is written to afile in the directory in which the BAAN database driver is started.

The additional BAAN IV database driver profiling and statistics sections thatfollow further describe how the environment variable must be set to enableprofiling and statistics.

BAAN IV database driver interface

This section describes aspects of the BAAN IV database driver interface, such asmapping conventions, data types, constraints, column size, indexing, isolationlevel usage, transaction management, locking, and optimization.

Page 13: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver overview

Installation and Administration Guide for Sybase

1-5

Data dictionary mapping

Because the BAAN IV database driver cannot directly use the data dictionary(DD) of BAAN the to create Sybase tables, the BAAN IV database driverperforms some mapping or translation to create the tables.

The conventions listed below play an important part in this process.

Mapping the BAAN data dictionary to the Sybase format

The BAAN environment keeps the table columns and index information in itsdata dictionary. The BAAN IV database driver uses this information for variousdatabase actions. However, the BAAN IV Sybase driver cannot directly use theinformation that is stored in the BAAN data dictionary. Supported data types andtheir meanings are defined differently by the BAAN application and the SybaseRDBMS. Some of the characters used for column names in the BAAN datadictionary cannot be used for column names in the Sybase RDBMS. Therefore,after reading the BAAN data dictionary, theBAAN IV database driver maps that information into a format suitable for theSybase RDBMS.

Table name convention

A BAAN table, such as tfgld006, can be created for more than one company.Because these same tables can be created in the same database for differentcompanies, a table name must be made unique. The BAAN IV database drivermakes the table name unique by adding the company number as part of the tablename. The following format is used:

t<Package>< Table name >< Company Number ( 3 digit ) >

For example, in package tf, table name gld006 with company number 505, hasthe corresponding Sybase table ttfgld006505. Note that the company number isalways defined with three digits, with leading zeros if necessary.

The BAAN IV database driver always accesses the table using theowner.tablename convention. So table ttfgld006505, created by user root, isaccessed as root.ttfgld006505 and the same table, created by bsp, is accessed asbsp.ttfgld006505.

Page 14: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver overview

Installation and Administration Guide for Sybase

1-6

Column name convention

The BAAN IV database driver forms a Sybase column name by preceding theBAAN column name with the string “t_”. For example, a BAAN column namedcode, would have the corresponding Sybase column name t_code.

If the BAAN column is defined as an array of columns, each member of the arrayis treated by the BAAN IV database driver as a separate Sybase column, andeach Sybase column is named using the depth level to which it corresponds. Forexample, if a BAAN column ctod has a depth of 7, 7 Sybase columns namedt_ctod_1, t_ctod_2, and so on to t_clod_7.

In Sybase, the maximum size of a character column is 255 bytes. If a BAANcharacter column is larger than 255 bytes, the BAAN IV database driver createsmultiple Sybase columns. So, if the BAAN column info is 600 bytes, the BAANIV database driver creates three columns named t_info_1, t_info_2 and t_info_3.The first two columns are 255 bytes and the last column is 90 bytes in size.

Sybase does not allow a period (.) as a part of a column name. If a BAANcolumn name contains a period, it is replaced by an underscore( _ ) whenforming the Sybase column name.

Hash column name convention

The hash column is created for an index if the index has hash optimization. Formore information on hash optimization, see Appendix D.

For each index with a hash optimization, an extra column is created in the table.The name of this column is hash, plus the index number. For example, the hashcolumn for index 1 will be named hash1, and the hash column for index 2 willbe named hash2.

Index name convention

In Sybase, each table must have a unique index name. The BAAN IV databasedriver uses the index number to create the index name. For example, index 1 on atable is named I1a. Similarly, index 2 would be named I2a.

Page 15: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver overview

Installation and Administration Guide for Sybase

1-7

Stored procedure name convention

The BAAN IV database driver can, as an option, create and use storedprocedures for singleton selects on unique indexes of a table. These storedprocedures perform singleton selects on corresponding indexes at dirty readisolation.

For each unique index of a table, a stored procedure is created. The name of thestored procedure is formed as follows.

s<Package>< Table Name >< Company Number >< Index Number >

For example, in Table tiitm001, company 812, for index 1, the procedure nameis:

stiitm0018121

A variation of singleton select exists that is used to lock the record. This selectalways occurs on the primary index of the table. An extra stored procedure existsthat was created to perform a select with lock on the primary index. Thisprocedure does a select for update at isolation repeatable read (isolation 2).

The name of the stored procedure is formed as

s<Package><Table Name><Company Number>1L

Note that this name has a similar format to the name of procedures created fordirty read isolation. Because this procedure is always created on index 1 (only)and is used to lock the row, the suffix is always 1L, where L indicates the lockingvariation.

Data types

The BAAN IV database driver uses the CHAR data type that conforms to theANSI standards because the BAAN STRING data type has characteristics thatconform to the ANSI specifications. Operations such as comparison andconcatenation can be performed in an ANSI-compliant way when the CHARdata type is used. The following table shows the mapping between the BAANdata types and Sybase data types being used.

Page 16: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver overview

Installation and Administration Guide for Sybase

1-8

The mapping between BAAN and Sybase data types is listed in the table below:

Mapping between BAAN and Sybase data types

BAAN data type Sybase data type

CHAR TINYINT

ENUM TINYINT

SHORT SMALLINT

LONG INTEGER

MAIL INTEGER

TIME INTEGER

TEXT INTEGER

BITSET INTEGER

FLOAT REAL

DOUBLE FLOAT

STRING CHAR

MULTIBYTE STRING CHAR

DATE DATETIME

Constraints

All the columns created by the BAAN IV database driver have the NOT NULLconstraint. BAAN does not use NULLS in the RDBMS. BAAN applicationshave internal representations to identify undefined values.

For hash columns, the Sybase data type BINARY is used.

When using the Sybase data type DATETIME, the minimum date that can bestored is 1/1/1753 and the maximum date is 31/12/9999. The BAAN IV databasedriver reserves the Sybase minimum date (1/1/1753) to indicate an unspecifieddate in BAAN (Date 0). Therefore, the date 1/1/1753 or earlier dates cannot bestored in the BAAN Sybase database. If such a date is specified the BAAN IVdatabase driver returns an NOT_IN_RANGE error message.

For more information about Sybase datatypes and their minimum and maximumvalues, see the Sybase ASE Reference Manual.

Page 17: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver overview

Installation and Administration Guide for Sybase

1-9

Hash column size

If an index is created with hash column optimization, additional column(s) arecreated in the table at the time of creation. The size of the hash column that iscreated depends on the type of the index column. The following table gives sizesof hash columns for various data types.

digv = digits before, diga = digits after

Field types and their hash column size

Field type Hash column size

Char 1

char(n) N

Short 3

Data 4

Long 5

Float (digv+diga+2)/2

Double (digv+diga+2)/2

If the index is a composite, the size of the hash column is the total of the sizerequired for each column in the index. For example, if the index consists of aLONG column and a CHAR column, the hash column size is 6 (5 + 1).

If the index has single hash optimization, the index contains one such column. Ifthe index has double hash optimization, two such columns are created.

Index ordering

Starting with ASE 11.5, Sybase allows descending scans on index. In otherwords, the same index can be used for ascending order by query as is used fordescending order by query.

NOTE

Page 18: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver overview

Installation and Administration Guide for Sybase

1-10

Index uniqueness

All indexes built by the BAAN IV database driver are unique. If an index isdefined as a duplicate in BAAN, it is still made unique by the BAAN IVdatabase driver using one of the techniques described below.

n If the index uses the hash optimization option, using parts of that indexcombined with parts of the primary index (which is always unique) makes thehash column for that index. Thus, each hash column value is unique in thetable because of primary key parts even though duplicate values are specifiedfor that index. A unique index is created on this column.

n If the hash optimization technique is not used, a unique composite index iscreated on columns of that index and columns of the primary index, whichare not parts of that index. For example, if the primary index is on bothcolumns c1 and c2 and the duplicate index is defined on columns c8, c9, andc10, the BAAN IV database driver actually creates an unique compositeindex on c8, c9, c10, c1, and c2. If another duplicate index is defined on c1,c5 and c6 that index is created on c1, c5, c6, and c2. Here, because column c1is also part of a duplicate index, it is used only once, in the order sequence ofthat index and not as part of the primary index.

Isolation level usage

The Sybase ASE 11.9 provides four isolation levels for select actions: dirty read,committed read, repeatable read, and holdlock. For more information about theisolation levels, refer to the Sybase ASE 11.9 documentation. The BAAN driverperforms select-without-lock queries at isolation dirty read. For selects with lock,the repeatable read isolation level is used.

The isolation levels do not apply to Sybase ASE 11.5.

The driver also uses the “for update” clause to obtain an update lock on theobject. If the “for update” clause is not used, a shared lock results. In this case,multiple users can lock the same row with selects and can later deadlock eachother when trying to perform updates or deletes. Such deadlocks roll back thetransaction of the users involved in the deadlock, reducing the throughput. Whenthe for “update” clause is used, an update lock is obtained by one user, and otherusers are blocked until the first user releases the lock. This action avoids thedeadlock condition.

NOTE

Page 19: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver overview

Installation and Administration Guide for Sybase

1-11

Transaction management

The BAAN IV database driver does not use the ANSI-styled chained transactionmode of Sybase ASE.

The driver starts an explicit transaction when any of following actions arerequested:

n Select with lockn Lock tablen Insert rown Update rown Delete rown Clear table (delete all rows)

Once a transaction is started, it continues until either the application commits oraborts the transaction or an error forces Sybase ASE to abort the transaction. Ifan action fails, ASE aborts the transaction. If this action occurs, the databasedriver either notifies the application of the problem or attempts a retry.

Locking

Sybase ASE 11.9 provides the following lock granularities for tables:

This information does not apply to Sybase ASE 11.5.

n All Page LockingPage locks are used for data and index pages. This is the default mode when atable is created unless a different lock mode is specified. This lock mode isthe same as is used in earlier versions of Sybase.

n Data Page LockingPage locks are used for data pages. Index pages are not locked.

n Data Row LockingRow locks are used for data rows. Indexes are not locked.

In the BAAN environment, the lock mode for a table can be specified in thestorage file located in $BSE/lib/sybase/syb_storage. The storage file is describedin Appendix C. Different lock modes can be specified for different tables. If youdid not specify a lock mode for a table, the driver creates the table with data rowlocking.

NOTE

Page 20: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver overview

Installation and Administration Guide for Sybase

1-12

Sybase ASE 11.9 also provides a lock timeout feature. If you are blocked on alock, you can wait for a controlled interval to obtain the lock. If the blocking lockis not released before the end of the lock time-out period, Sybase ASE 11.9 failsthe request and aborts the transaction that contains the failed request. Thisfunctionality is different from databases such as Oracle and Informix in whichthe transaction that contains the failed request is not aborted.

The lock timeout feature is not available to Sybase ASE 11.5.

Optimization

For every database action, the BAAN IV database driver, in principle, canconstruct a SQL statement, send it to the SQL server, parse it, execute it, and getthe result. When the next request arrives, this cycle is repeated. But executing allthese steps for each command creates an enormous overhead, and theperformance will be very slow. The BAAN IV database driver uses varioustechniques to speed up performance. These techniques are based on theobservations of the client applications described below:

n Selects are the most common actions on a table, followed by updates, inserts,and deletes. Furthermore, a fixed number of types of select exist, such asfirst, last, great, less, gteq, eqle, next, prev, equal, curr, and theircounterparts with the lock option. Table-level actions, such as create table,drop table, or clear table, are infrequent. So, the Sybase RDBMS databaseadministrator should attempt to optimize the select commands.

n Generally, when you access a table, more than one row from a set in thattable is read. Exceptions exist, such as checking a reference in which onlyone db.equal is performed. Another example is after performing db.first ordb.great many times, the BAAN application performs db.next until somecondition occurs. Similarly, after performing db.last or db.eqle, db.prev isfrequently executed.

Fetch optimization

Once a select query is carried out , the result is a set of row(s) that satisfies thewhere clause. At this point, just performing a fetch command on that cursor canretrieve all the rows in the set. This action does not involve any function beingcarried out and results in a quick retrieval.

The following are useful example cases:

n If a db.first, db.great, db.gteq or db.next is executed, the resulting row setis in ascending order of the index. If the command following this action isdb.next, the cursor already contains the suitable set and instead ofperforming a select again, a fetch on the same cursor is sufficient.

NOTE

Page 21: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver overview

Installation and Administration Guide for Sybase

1-13

n If a db.last, db.less, db.eqle or db.prev is executed, the resulting row setappears in the opposite order of the entries in the index. If the commandfollowing this action is db.prev, the cursor already contains the suitable setand instead of performing a select again, a fetch on the same cursor issufficient.

Thus, execution of db.next or db.prev can be avoided if the last executedcommand on the table was a sequence command. In this case, a fetch is sufficientto move through the record. This technique is called fetch optimization.

Note that the db.equal command does not result in a set, so you cannot performa fetch optimization if the next command is db.next or db.prev.

Effect of fetch optimization

The data set for a select is marked on the first fetch on the cursor. After youperform the first fetch, if a row in the set is modified by some other process, thefirst process still gets the old values on subsequent fetches because those valueswere marked on the first fetch. Refresh time helps to address this problem.

Refresh time

Refresh time is the number of seconds the data set remains valid after the firstfetch by a cursor. During this time, no insert, update, or delete operation isperformed on the table, and the data set remains unchanged.

If refresh time is set for five seconds, then five seconds after the first fetch (forexample, a fetch performed after carrying out the query), the data set for thatcursor is assumed to be valid. With this assumption, the next record in the dataset can be accessed using fetch optimization (for example, by performing fetchon the cursor). If a fetch is to be performed after this time, the data set is treatedas invalid and a select must be performed again.

The refresh time for a table is specified in the storage file. Because the frequencyof data modification can vary from table to table, you must carefully define therefresh time. With a large refresh time, the BAAN IV database driverperformance improves, although the latest data is occasionally not available.With a smaller refresh time, the performance degrades, but the chances of gettingthe latest data are good.

If the process locks the table, other processes cannot modify the table data.

To update or delete a record, you need the latest row for consistency. So when arecord is read for update, fetch optimization is disabled.

If an insert, update, or delete is performed on a table, the fetch optimization isdisabled for the next action on that table because the current data set is old.

Page 22: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver overview

Installation and Administration Guide for Sybase

1-14

Hash optimization

If table1 contains columns c1, c2, c3, c4, and c5 and has a composite index 1 onc2, c4, and c5, the index is created as:

create unique index I1a on table1( c2, c4, c5 )

If you want to carry out a db.first on this table, the required query looks like:

select * from table1where c2 > ? or ( c2 = ? and ( c4 > ? or c4 = ? and ( c5 > ? ) ) )order by c2, c4, c5

If an or clause or a where clause is used as above, the RDBMS query optimizermay decide to perform a sort, which degrades the performance. However, thesort can be avoided if the index is made on a single column. For this purpose, ahash column is used. The hash column is an additional column in the table thathas a value that is obtained by concatenating all the key column values using analgorithm. The index is created on this column (instead of the original keycolumns). Thus, the index consists of a single column, and the search time isreduced.

When a hash column is used, the index is created as follows:

create index I1a on ... ( hash1 ).

Then, the query looks like:

“select ... where hash1 >= ? order by hash1 asc”.

This query eliminates the sort and results in a faster query. This optimization iscalled hash optimization.

If a hash column is made unique, the index is also unique, which furtherimproves queries. The BAAN application always enforces the unique primarykey. If a nonprimary key is duplicated, the BAAN IV database driver still makesits hash column values unique by computing the hash column values with theprimary key and the current key columns. Every hash column and every index ismade unique, irrespective of its definition in the BAAN data dictionary.

Page 23: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver overview

Installation and Administration Guide for Sybase

1-15

Cache

The BAAN IV database driver maintains a single record cache for each table. Formany database commands, if you perform the same command twice insuccession on the same table with the same key values, a chance exists that thesame record is fetched.

For example, the command Select * from table1 where X > ? fetches the samerecord if you carry it out twice in succession with the same value of X, providedthe table is not modified between fetches. For such actions, if the record is savedin cache on the first fetch, the same record can be returned during the next fetch,which avoids a second fetch. To avoid duplicate fetches, use the refresh time (seethe section on fetch optimization earlier in this chapter). If the refresh timeinterval has not expired, both the cache and data in the cache are valid. If thesame request comes after the refresh time interval, the cache is treated as invalidand data in it is not used.

This fact is true for error messages as well. If a duplicate fetch is attempted on acached database action that has resulted in an error, the error from the cache isreturned, thus saving a statement execution. An exception to this action is therecord locked error. In some situations, the first access got a record locked errorand before the command was repeated, the lock was released by another process.In such a case, the record-locked error is not cached, and the record is marked asnot found in the cache, so an actual fetch has to be performed.

For some database actions, like db.next or db.prev, you cannot use the cachedue to the nature of these commands.

When an insert, update, or delete is performed on a table, the cache becomesinvalid and is not used during the next database action.

At the end of the transaction, the cache is disabled so that a new transaction doesnot use the cache data of the previous transaction.

Stored procedures

The Sybase database driver uses client library cursors to perform selects. Eachsession uses several cursors to perform selects although a cursor cannot be sharedacross sessions. If a cursor is declared, several commands must be sent from theSybase driver to ASE. ASE must parse and compile the select statement. Theseactions increase network traffic as well as CPU requirements for ASE.

Page 24: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver overview

Installation and Administration Guide for Sybase

1-16

The BAAN IV database driver provides the option to use stored proceduresinstead of cursors for the most frequent type of selects. In the BAANenvironment, singleton selects such as db.equal() are the best candidates forstored procedure usage. The stored procedures are used for unique indexes of atable.

For a table, stored procedures are specified by ORing the flag 010 to the indexoptimization flag in the storage file $BSE/lib/sybase/syb_storage. For example,for hash column (001), 011 can specify stored procedures. See Appendix C formore information on the storage file.

Stored procedures are created when the table is created. After creating the table,the BAAN IV database driver creates procedures for all the indexes on that table,which are defined as unique in BAAN. The BAAN IV database driver does notcreate procedures on duplicate indexes as defined in BAAN because duplicateindexes performed by the client do not result in db.equal() in the BAAN IVdatabase driver. Therefore, the BAAN IV database driver never makesdb.equal() on a duplicate index, and the stored procedure for that index is notrequired.

When the table is dropped, all stored procedures for that table are dropped.

If you decide to use stored procedures for existing tables, you should update thefile $BSE/lib/sybase/syb_storage to indicate stored procedure usage and continueusing the applications. When the driver tries to use a stored procedure on a tableand finds the stored procedure is missing, it will create the stored procedures. Noerror will be returned to the application, which will keep on working using thestored procedures.

A sample procedure is listed below:

create procedure dbo.saabdb9990001 @khash1 binary(3) asselect t_byte, t_int, t_date, t_long, t_string,t_refcntd, t_refcntu, hash1from dbo.taabdb999000 ( Index I1a )where hash1 = @khash1at isolation 0

Page 25: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver overview

Installation and Administration Guide for Sybase

1-17

Error reporting

The Sybase RDBMS detects and reports errors at two levels:

n Sybase ASE Errorsn Sybase Client-Library Errors

These two error-handling mechanisms operate independently of each other andhave their own error reporting mechanisms via callback routines, which you cansupply. The BAAN IV database driver installs callback routines for the SQLserver messages and the client library messages.

If a SQL command is carried out, the following combinations can occur:

n No ASE error. No client-library error. This combination means that thecommand was successfully carried out.

n ASE error. No client-library error. This combination means that the commandexecution failed.

n Client-library error. No ASE error. This combination means that thecommand execution failed.

If an error is reported at any level, the BAAN IV database driver tries to map itinto one of the BAAN error codes such as NOREC or ENDFILE. If a selectquery does not fetch any row, the BAAN IV database driver sets the error toNOREC if the query was db.great, or to ENDFILE if the query was db.first.Similarly, if the SQL server error indicates that a select failed because no tableexisted, the error is set to NOTABLE.

If the BAAN IV database driver encounters a ASE error code or client-libraryerror code that cannot be mapped to application-defined errors, the error isreported to the application by adding 1000 to it. For example, if the BAAN IVdatabase driver encounters SQL server error 2812, which cannot be mapped toany application-defined errors ( NOREC, ENDFILE ), this error code is reportedas 2812 + 1000, or 3812. The application sees the error code 3812.

The BAAN IV database driver logs all errors that could not be mapped toapplication errors into the log file $BSE/log/log.driver name in tabledef. If adatabase driver is defined as sybase in tabledef, all related errors are logged infile $BSE/log/log.sybase. The log entry consists of error number and errormessage text. Such errors are called generic errors.

Page 26: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver overview

Installation and Administration Guide for Sybase

1-18

Steps for analyzing errors

The Client-Library error entries in the log file are identified by the keywordCTLIB_ERROR. The SQL server error entries in the log file are identified bythe keyword SQL_ERROR.

If you receive a generic error (one not defined in the BAAN environment), suchas 3812, subtract 1000 from this error code to get the actual error number. Next,check the error log for the entry with the actual error code. The error messagetext can help to locate the problem.

BAAN IV database driver trace information

The BAAN IV database driver provides an option to log online informationabout the actions that are being performed by the BAAN IV database driver. Theresulting log file contains information that can help debug problems. Listedbelow is some of the information stored in log files.

n Table/index information (data dictionary)n The SQL statements being carried outn Values of the input and output bind variablesn Other function-level debug statements

Several tracing categories are defined so that tracing can be enabled for onlythose categories that are of interest. Tracing can be enabled using theenvironment variable DBSLOG. See Appendix B for more information aboutDBSLOG.

Page 27: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Installation and Administration Guide for Sybase

2-1

This chapter describes the following topics:

n Installation preparationsn Installing Sybasen Installing BAAN IVn Files required for the BAAN IV database drivern Tuning aspects

Installation preparationsThis section discusses the steps that must be performed before you install theSybase and BAAN software. The following sections describe the steps that mustbe performed:

n To tune the kerneln To create database devicesn To create the required UNIX directories, groups, and usersn To set environment variables

To tune the kernel

Several kernel parameters must be adjusted before you can install the Sybase andBAAN software. The following parameters must be verified and changed ifnecessary:

n Shared memoryn Asynchronous disk I/On Number of users

The following sections give basic information on tuning requirements. If youneed more information, please refer to Chapter 1 of the Sybase manual InstallingAdaptive Server and OmniConnect on UNIX Platforms or your systemdocumentation.

2 To install BAAN IV for Sybase

Page 28: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

To install BAAN IV for Sybase

Installation and Administration Guide for Sybase

2-2

Shared memory

In order for the Sybase Adaptive Server to run, the operating system kernel mustbe set to allow a shared memory segment to be allocated. Although the sharedmemory segment requirements that Sybase recommends vary by platform andare around 24 MB, you must allocate at least 256 MB.

After you install Sybase Adaptive Server, you can increase the total memoryparameter by using the Sybase procedure sp_configure. If you increase memoryfor Sybase Adaptive Server, increase the operating system kernel parameters by asimilar amount.

The procedure you must use to set shared memory depends on the platform youare using.

Setting shared memory

Platform OS configuration file Shared memory parameter

HP/UX Use the system administration manager (SAM).

Sun Solaris /etc/system shminfo_shmmax

IBM AIX N/A N/A

Digital UNIX /etc/sysconfigtab shm-max

For more information, refer to Chapter 1 of the Sybase manual InstallingAdaptive Server and OmniConnect on UNIX Platforms.

Asynchronous disk I/O

Check your system to see if you need to enable the asynchronous disk I/O. If youare using an IBM AIX, HP, or Digital UNIX system, enable the asynchronousdisk I/O. If you are using a Sun system,you do not need to enable theasynchronous disk I/O.

NOTE

Page 29: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

To install BAAN IV for Sybase

Installation and Administration Guide for Sybase

2-3

Enable Asynchronous Disk I/O

Platform Procedure

HP/UX 1) From the SAM Kernel Configuration menu, selectDrivers.

2) Set the Pending State for asyncdisk to IN.

3) From the Actions menu option, rebuild the kernel andreboot the system.

4) Execute the following statements as root at the UNIXcommand line:

% /etc/mknot /dev/async c 101 4

% chmod 0660 /dev/async

% chown sybase /dev/async

Sun Solaris Not required.

IBM AIX 1) Enter smit at the UNX command line.

2) From the Devices menu, select Asynchronous I/O.

3) Select the Change/Show Characteristics ofAsynchronous I/O option.

4) Enter the following values for the SMIT parameter and entryboxes for AIX 4.1.2:

MINIMUM number of servers: 1

MAXIMUM number of servers: 10

MAXIMUM number of REQUESTS I/O: 4096

Server priority: 39

ASYNC I/O STATE to be configured at system restart: available.

If your system uses more than seven disks at the same time forAIO, increase the MAXIMUM number of servers parameter byone for every active device.

Digital UNIX Digital UNIX automatically enables asynchronous I/O but, bydefault, limits the number of concurrent I/O requests to 64. Ifyou expect to need additional requests for your Adaptive Serverinstallation, add the following lines to the /etc/sysconfigtab file:

rt:

aio-maximum=1024

For more information, refer to Chapter 1 of the Sybase manual InstallingAdaptive Server and OmniConnect on UNIX Platforms.

Page 30: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

To install BAAN IV for Sybase

Installation and Administration Guide for Sybase

2-4

Number of users

The kernel of the UNIX machine must be tuned to accommodate the projectednumber of BAAN users. Refer to your system administration documentation toadjust this value.

To create database devices

Several database devices must be created prior to installing the Sybase andBAAN software. Database devices are operating system files or raw portions of adisk used to store databases and database objects. Whenever possible, create thedevices on different disks. The following table specifies the database devices thatmust be created.

Required database devices

Device Purpose Recommendedsize

Recommendedtype

Master Stores Sybase systemdatabases

30 MB Raw partition

Sysprocsdev Stores Sybase storedprocedures

60 MB File system

baandata01 Stores BAAN IV data 2 GB Raw partition

baanindex01 Stores BAAN IV indexes 2 GB Raw partition

baanlog01 Stores BAAN IV logginginformation

100 MB Raw partition

baandbs01 Stores BAAN IV metainformation

100 MB Raw partition

Tempdbs Stores the Sybasetempdb database

100 MB File system

To create the required UNIX directories, groups, andusers

Before installing the Sybase and BAAN software, you must create the directorieswhere they will be installed. In addition, for a first-time installation, severalUNIX users and groups must be created both for Sybase and for BAAN. Thefollowing sections specify the directories, users, and groups that you need tocreate.

Page 31: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

To install BAAN IV for Sybase

Installation and Administration Guide for Sybase

2-5

To create UNIX directories

You will need to create a home directory both for the Sybase products and forBAAN IV. To create these directories, perform the following functions:

1 Create a directory for the Sybase product. Later, you will set an environmentvariable called SYBASE that will contain the path to this directory.

If you are upgrading from an earlier version of Sybase, make sure to create anew installation directory. Do not install the new version in the samedirectory as the earlier version.

2 Set the permissions of the SYBASE directory to read, write, and execute.

3 Create a directory for BAAN IV. Later, you will create an environmentvariable called BSE (BAAN Software Environment) that will contain the pathto this directory.

4 Set the permissions for the BSE directory to read, write, and execute.

To create UNIX groups

You will need the UNIX group accounts sybase, bsp, and baan before you caninstall Sybase and BAAN IV. You can use a standard system administrationutility to add these groups,which are described below:

n sybaseThe group sybase includes the users who are given system administrationprivileges for the Sybase database.

n bspThe group bsp includes the users who are given system administrationprivileges for the BAAN database. The group bsp must be given the UNIXgroup ID 125.

n baanThe group baan includes all users who are given user access to the BAANdatabase.

NOTE

Page 32: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

To install BAAN IV for Sybase

Installation and Administration Guide for Sybase

2-6

To create UNIX users

Several UNIX users are required for both the Sybase and the BAANinstallations. You can use a standard system administration tool to create therequired users. The following table gives details on these users.

UNIX users and groups

Logon ID Primary group

sybase sybase

baan baan

bsp bsp

demo bsp

tools bsp

applic bsp

Be sure to assign the user bsp a user ID of 125.

To set environment variables

Several environment variables must be set for both Sybase and for BAAN IV.This section describes the variables that must be set before the software isinstalled.

Sybase environment variables

Four environment variables must be set in the .profile of the user sybase beforeSybase can be installed. Three of these variables are the same for all hardwareplatforms, but the fourth is platform dependent. The following are the threeplatform-independent variables and the values to which they should be set.

Platform-ndependent environment variables

Environment variable Setting

SYBASE The complete path to the Sybase installationdirectory

DSQUERY The name of the Sybase instance that will be createdduring the BAAN installation: for example, baanIV

PATH Must include $SYBASE/bin

Page 33: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

To install BAAN IV for Sybase

Installation and Administration Guide for Sybase

2-7

The fourth environment variable that must be set in the .profile of the usersybase has different names for different platforms. This variable defines thelibrary path. How you set this variable depends on whether or not a previouslibrary path has been defined. The following table gives the names and settingsof the library path of the different platforms.

Platform dependent environment variable

Platform Environment variable Setting

Sun Solaris

Digital UNIX

LD_LIBRARY_PATH If not set previously:

$SYBASE/lib

If set previously:

$SYBASE/lib:$LD_LIBRARY_PATH

HP-UX SHLIB_PATH If not set previously:

$SYBASE/lib

If set previously:

$SYBASE/lib:$SHLIB_PATH

IBM AIX LIBPATH If not set previously:

$SYBASE/lib

If set previously:

$SYBASE/lib:$LIBPATH

If the library path variable was set previously, be sure to add $SYBASE/lib firstin the path as listed in the table, otherwise you may encounter unresolvablesymbol errors.

BAAN environment variables

After installing BAAN IV, you can define the $BSE variables in the .profile filesof the users instead of in the system-wide /etc/profile. If you plan to installBAAN IV in a directory that previously existed, verify whether or not directoriesalready exist in the $BSE/home directory. If so, remove any .profile files fromthese directories. The BAAN IV installation script creates .profile files for thedirectories of $BSE/home, but will not overwrite any files that already exist.

NOTE

Page 34: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

To install BAAN IV for Sybase

Installation and Administration Guide for Sybase

2-8

To install SybaseTwo steps exist to install the Sybase Adaptive Server: unloading the software andcreating the Sybase servers. After Sybase is installed, several parameters must beconfigured for BAAN IV. This section describes the following required steps:

n To unload the softwaren To create the Sybase serversn To prepare Sybase for BAAN IV

To unload the software

The Sybase Adaptive Server is distributed both on CD-ROM and on tape. Themost common distribution medium is CD-ROM, so the instructions belowassume a CD-ROM distribution. If you have a tape, refer to Chapter 2 of theSybase manual Installing Adaptive Server and OmniConnect on UNIX Platforms.

The instructions below also assume that the machine you are using hasX Windows. If not, you must use the sybload utility to unload the CD-ROM intext mode instead of the sybsetup utility that is described below. If you do nothave X Windows, please refer to Chapter 2 of the Sybase manual InstallingAdaptive Server and OmniConnect on UNIX Platforms.

To install Sybase Adaptive Server from CD-ROM on a machine runningX Windows, perform the following:

1 Place the Sybase CD-ROM in the CD-ROM drive, and then mount the CD-ROM. If you are installing on a Sun system, go to Step 4. Solaris machinesmount the CD automatically.

2 Log on as user root to a UNIX system attached to the CD-ROM drive. If youare installing Sybase on a machine that is not attached to the CD-ROM, youmust log on remotely.

Page 35: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

To install BAAN IV for Sybase

Installation and Administration Guide for Sybase

2-9

3 Mount the CD by entering the following platform-specific command: (inwhich device_name is the device name of the CD-ROM and /cdrom is thedirectory where the CD is to be mounted).

Platform Command

Sun Solaris Not applicable. Sun provides auto mount.

HP % /etc/mount -F cdfs -o ro device_name /cdrom

IBM AIX % /etc/mount -v cdrfs -r device_name /cdrom

Digital UNIX % /usr/sbin/mount -r -t cdfs -o noversion –o rripdevice_name /cdrom

4 Log on as sybase to the UNIX system attached to the CD-ROM drive.

5 Run the sybsetup utility to unload Sybase products from the CD-ROM usingthe following platform dependent command:

Platform Command

Sun Solaris % /cdrom/cdrom0/sybsetup

HP/UX

IBM AIX

Digital UNIX

% /cdrom/sybsetup

% /cdrom/sybsetup

% /cdrom/sybsetup

6 Select Unload Sybase Products from the sybsetup menu and follow thedirections on the screen.

7 Copy the sybsetup executable to your $SYBASE/bin directory. This actionallows you to run sybsetup to invoke the configuration utilities from thesybsetup graphical interface.

8 Log on as root and enter the following platform-dependent command tounmount the CD-ROM:

Platform Command

Sun Solaris % /usr/bin/eject cd

HP/UX

Digital Unix

% /etc/umount /cdrom

% /etc/umount /cdrom

IBM AIX % /etc/unmount /cdrom

9 When unloading is complete, remove the Sybase CD from the drive andcontinue with the following section, “To Create the Sybase servers”.

Page 36: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

To install BAAN IV for Sybase

Installation and Administration Guide for Sybase

2-10

To create the Sybase servers

After you have unloaded the Sybase software, you are ready to create the Sybaseservers. You will need to create an adaptive server and a backup server. To createthese servers, perform the following:

1 Start srvbuild, the Sybase server creation utility, either by clicking BuildNew Servers on the sybsetup main menu or by typing the followingcommand at the UNIX command prompt:

% $SYBASE/bin/srvbuild

2 From the srvbuild menu, select Adaptive Server and Backup Server.

3 Server Attribute Editor displayed for the adaptive server. Enter thefollowing information:

server name The value of the DSQUERY variable

master device path name Enter the path to the master device

master device size 50

master database size 30

sysprocsdev device pathname

Enter the path to the sysprocsdev devicecreated in Chapter 1

sysprocsdev device size 60

sysprocsdev database size 60

error log path Accept the default path for the error log orenter a new path

4 Verify the connection information and set the Transport type, Host name, andPort number to values appropriate for your system.

5 Server Attribute Editor is displayed for the Backup Server. Set theattributes as required.

6 Click Build Servers. You are asked if you would like to add a language otherthan U.S. English or a character set other than iso-1.

7 If you click Yes, the Add and Remove Languages screen is displayed.Choose the desired languages and character sets.

Page 37: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

To install BAAN IV for Sybase

Installation and Administration Guide for Sybase

2-11

To prepare Sybase for BAAN IV

Take the following steps to adjust the Sybase installation for BAAN IV:

1 Change directories to the Sybase installation directory defined by $SYBASE.

2 Use vi to modify the following entries in the DSQUERY.cfg file (in thisexample, baanIV.cfg) to the values listed below:

procedure cache percent = 50number of devices = 20default network packet size = 4096max network packet size = 4096tcp no delay = 1number of open indexes = 10000number of open objects = 10000total memory = 30000number of locks = 50000

3 Stop Sybase by entering the following commands:

$ isql -Usa -p””1> shutdown2> go

4 Start Sybase by entering the following commands:

$ cd $SYBASE/install$ ./startserver -f ./RUN_DSQUERY

5 After the output of the startserver command has stopped, press ENTER toreturn to command prompt.

6 Enter the following commands to define a password for the Sybase databaseadministrator sa. This password must be a minimum of six characters. In theexample below, the password is manager.

$ isql -U sa -P “”1> sp_password NULL, manager2> go

Page 38: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

To install BAAN IV for Sybase

Installation and Administration Guide for Sybase

2-12

7 Enter the following commands to enlarge the existing temporary database:

$ isql -U sa -P manager1> disk init2> name = “temp01”,3> physname = “pathname to raw device for temporary database”,4> vdevno = 2, (or whatever number is free)*5> size = 512006> go1> alter database tempdb on temp01 = 1002> go1> use temdb2> go1> create procedure sp_thresholdaction2> @dbname varchar(30),3> @segmentname varchar(30),4. @space_left int,5> @status int6> as7> dump transaction @dbname with truncate_only8> print “LOG DUMP ‘%1!’ for ‘%2!’ dumped”, @segmentname, @dbname9> go1> grant exec on sp_thresholdaction to dbo2> go1> sp_addthreshold tempdb, “logsegment”, 5120, sp_thresholdaction2> go1> exit

* The value for vdevno is 2 in this example. During installation, however,you must use sp_helpdevice to pick a free device number because a chanceexists that the virtual device number 2 is already in use.

To install BAAN IVTake the following steps to install BAAN IV:

1 Take the steps as described in the Installation Guide for BaanIV on Unix(U7016 US).

2 After you select the Sybase database driver, you are asked to define thefollowing Sybase environment variables:

− SYBASE− DSQUERY

3 At a certain stage of the installation, you are asked if you want to go to thesystem prompt to perform Sybase specific actions. Enter Y.

Page 39: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

To install BAAN IV for Sybase

Installation and Administration Guide for Sybase

2-13

4 Enter the following command:

bshell6.1> syb_install6.1

5 Supply the information listed below:

S.A Login saS.A Password password for sa loginWant to create initial group? YInitial group baanGroup Passwd password for initial group (6 characters at minimum)Add group ‘baan’ YDo you want to create a device YWant to see list of devices N

6 Supply the names of and the pathnames to the raw devices you created in thesection “Installation preparations”, earlier in this chapter. You must, forexample, supply the information in the list below:

For each device you must supply an unused device number as well as the sizeof the device (must be the same as the size you specified in the section“Installation preparations”). You can obtain a list of device numbers withsp_helpdevice. Do not mirror the devices.

− baandbs01The name of the device to be used to store the BAAN IV metainformation. As the pathname, you must insert the pathname of the rawdevice of 100 MB you created in the section “Installation preparations”,earlier in this chapter.

− baanlog01The name of the device to be used to store the BAAN IV logginginformation. As the pathname, you must insert the pathname of the rawdevice of 100 MB you created in the section Installation prerequisites,earlier in this chapter.

− baandata01The name of the device to be used to store the BAAN IV data. As thepathname, you must insert the pathname of the raw device of 2 GB youcreated in the section Installation prerequisites, earlier in this chapter.

− baanindex01The name of the device to be used to store the BAAN IV indexes. As thepathname, you must insert the pathname of the raw device of 2 GB youcreated in the section Installation prerequisites, earlier in this chapter.

NOTE

Page 40: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

To install BAAN IV for Sybase

Installation and Administration Guide for Sybase

2-14

7 After you created the devices, you must supply the information listed below:

O.K. to create the database baan YSpecify device for database YDevice Name baandbs01Specify size for database YSize of Part (MB) 100 (same size as physical device)Specify device for database YDevice Name baandata01Specify size for database YSize of Part (MB) 2000 (same size as physical device)Specify device for database YDevice Name baanindex01Specify size for database YSize of Part (MB) 2000 (same size as physical device)Specify device for database NSpecify device for log YDevice Name baanlog01Specify size for log YSize of Part (MB) 100 (same size as physical device)Specify device for log NOK to continue YDo you want to create segments YSegment Name baandataDevice Name baandata01Do you want to create segments YSegment Name baanindexDevice Name baanindex01O.K. To continue YDo you want to create segments NWant to dump database/transaction Y

8 At the new display prompt, enter the following commands:

1> use baan (same name as the name of the Initial group entered in step 5)2> go1> dump tran baan with truncate_only2> go1> exit

You will return to the syb_install6.1 script.

Page 41: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

To install BAAN IV for Sybase

Installation and Administration Guide for Sybase

2-15

9 Supply the information listed below:

O.K. to create Group File YAdd Triton user ‘root’ YDB User rootDB Password passwordAdd Triton user ‘bsp’ YDB User bspDB Password passwordCreate Default Storage Entries Y

The passwords must be six characters at minimum.

10 Use vi to edit the $BSE/lib/sybase/syb_storage. This file should look like theone given below (in the example below, the segments for the BAAN tablesand indexes are called baandata and baanindex, respectively)

*:*:T:group:011:5:SEGMENT baandata*:*:I::011::SEGMENT baanindex

The values in the example above (011) only apply to Sybase version 11.9. Ifyou use an older version of Sybase, you must replace these values by 001.

11 Enter the following commands to enable automatic flushing of the log devicefor the database (in our example, database baan):

bshell6.1> isql -U sa -P sa password1> use baan2> go1> create procedure sp_thresholdaction2> @dbname varchar(30),3> @segmentname varchar(30),4> @space_left int,5> @status int6> as7> dump transaction @dbname with truncate_only8> print “LOG DUMP ‘%1!’ for ‘%2!’ dumped”, @segmentname, @dbname9> go1> grant exec on sp_thresholdaction to dbo2> go1> sp_addthreshold baan, “logsegment”, 5120, sp_thresholdaction2> go1> exit

12 If you use Sybase ASE 11.5, set syb_init to 0 (zero):

syb_init:0

13 Exit the UNIX shell to return to the BAAN IV installation procedure.

NOTE

NOTE

Page 42: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

To install BAAN IV for Sybase

Installation and Administration Guide for Sybase

2-16

Files required for the BAAN IV databasedriverThe table below lists the various files required for the BAAN IV database driver(in the directory $BSE/bin). These files will be moved to $BSE/bin by install.

Files in $BSE/bin

File File type Usage

syb_srv6.1 Unix executable BAAN IV database driver

syb_admin6.1 Shell script Sybase Driver Maintenance

syb_maint6.1 Unix executable Sybase Driver Maintenance

syb_install6.1 Shell script Sybase Driver installation

The table below lists the various files required for the BAAN IV database driver(in the directory $BSE/lib/sybase).

Files in $BSE/lib/sybase

File File type Usage

syb_users ASCII file Driver users

syb_groups ASCII file Driver groups

syb_storage ASCII file Driver specifications

syb_instmsg ASCII file Driver installation message

Files syb_users, syb_groups, and syb_storage are created during installation bysyb_install6.1. File syb_instmsg is moved to the proper directory by install.

Page 43: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

To install BAAN IV for Sybase

Installation and Administration Guide for Sybase

2-17

Tuning aspectsThis section describes facilities built in the BAAN IV database driver that can beused to tune its performance. This process is different from tuning the SybaseASE, which is described in the Sybase DBMS documents.

BAAN IV database driver statistics

The BAAN IV database driver has a built-in facility to keep detailed statisticsabout various events that occur. These statistics can be accumulated and printedfor a specified time interval. The following setup is required to print statistics:

Set the value of the sybstat variable, either through the shell variable or,preferably, in the $BSE/lib/tabledef version file. The tabledef entry can look like:

.:sybase(SYBASE=/dbms/sybase,SYBSTAT=45)

The value of the SYBSTAT variable is the time interval in seconds during whichstatistics are accumulated. A fractional value cannot be specified.

For tables that require statistics, make sure a STATISTICS variable is defined intheir storage file entry. If this variable is to be enabled for all itm tables, thestorage file can look like:

tiitm:*:T:group:011:10:STATISTICS

Now, statistics are enabled for all itm tables and are accumulated for each 45-second period as specified in the tabledef file. At the end of each period, the datais written into a text file. This file is called sybstat and is created in the directoryin which the BAAN IV database driver was started.

Page 44: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

To install BAAN IV for Sybase

Installation and Administration Guide for Sybase

2-18

Below is a sample sybstat file:

<12900> 97-10-10[13:51:39]: Statistics [interval = 5]

CURSORS

Title Opened Closed Parse Bind Define Execute FetchCount 19 18 19 504 19 19 35Time(s) 0.12 0.00 0.13 0.03 0.06 0.12 2.43Average 0.01 0.00 0.01 0.00 0.00 0.01 0.07

DATABASE

Title First Last Next Prev Curr Great Gteq Equal Less EqleCount Read 1 1 7 6.0 0 0 1 0 0Cached Read 0 0 0 0 0 0 0 0 0 0Fetched Read 0 0 6 5 0 0 0 1 0 0Executed Read 1 1 1 1 0 0 0 0 0 0Time(s) Read 0.37 0.20 1.38 1.20 0.00 0.00 0.00 0.01 0.00 0.00Average Read 0.37 0.20 0.20 0.20 0.00 0.00 0.00 0.01 0.01 0.00Count Lock 0 0 0 0 0 0 0 0 0 0Time Locked 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00Average Lock 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00

Title Insert Delete UpdateCount Exe 0 0 0Time(s) Exe 0.00 0.00 0.00Avg Exe 0.00 0.00 0.00

Title Commit RollbackCount Exe 0 0

SUMMARY

Total asc read(s) 0.22Total desc read(s) 0.20Total exact read(s) 0.20Total all read(s) 0.20Total cache hit (%) 0.00Total fetch opt (%) 0.00Total updates (s) 0.00Forced close 0Current open cursors 1

Page 45: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

To install BAAN IV for Sybase

Installation and Administration Guide for Sybase

2-19

CURSORS gives statistics about cursor actions. This information includes thetotal number of times an action is performed, the total time required for thoseactions, and average time required per action.

DATABASE gives statistics about all read actions, all read-with-lock actions, allinsert, delete, update, and transaction actions. For SELECT actions, theoptimization (fetch optimization or fetched from cache) is also counted.

BAAN IV database driver profiling

In order to determine which table actions are time consuming, you can set theSYBPROF environment variable to a number of seconds. All SELECT actionsthat take longer than the number of seconds that you have defined are written to afile. The file includes information such the time for carrying out the query andthe retrieval of the result. This file is called sybprof and is stored in the directorywhere the server was started.

The profile value can be set as an environmental variable such as for the Bourneshell:

$ SYBPROF=0.4$ export SYBPROF

An alternate way to set SYBPROF is to set it in $BSE/lib/tabledef file asfollows:

*:*:sybase(SYBASE=/usr1/sybase,SYBPROF=0.4)

This script sets the value of the SYBPROF variable to 0.4 seconds. Actualprofiling is performed for selective tables. Tables for which profiling is requiredneed to have the PROFILE variable in their corresponding storage file entry. Forexample, after setting the above value in the tabledef file, if profiling is requiredfor all BAAN finance tables, the storage file entry for these tables can be writtenas follows.

tf:*:T:group:011:10:PROFILE*:*:T:group:011::

In this case, profiling is performed only on the finance tables. For any financetable, if a select takes more than 0.4 seconds, an entry is generated.

If two tables have different SYBPROF values, a separate BAAN IV databasedriver will be started when the second table is accessed. Different profile valuescan be specified in the tabledef file, such as:

tfgld005:*:sybase(SYBASE=/usr1/sybase,SYBPROF=0.1)tfgld006:*:sybase(SYBASE=/usr1/sybase,SYBPROF=0.2)*:*:sybase(SYBASE=/usr1/sybase)

Note

Page 46: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

To install BAAN IV for Sybase

Installation and Administration Guide for Sybase

2-20

Profile output file format

The following is a sample sybprof file.

97-10-10[17:26:25]: Profiling value = 0.01 sec

Pid Table Owner I Mode Cache Exe Fetch Exe Fetch Total<12912> ttfgld006000 tools 1 FIRST - 0.36 0.01 - - 0.37<12912> ttgld006000 tools 1 NEXT - - 0.01 - - 0.01<12912> ttfgld005000 tools 1 LAST - 0.08 0.01 - - 0.09<12912> ttfgld005000 tools 1 PREV - - 0.01 - - 0.01

The first line is the header, which indicates the start time and the value of theSYBPROF variable. The remaining lines are for various commands executed.

n Pid is the UNIX process ID of the BAAN IV database driver.

n Table name is the table on which the action was performed.

n Owner indicates the owner of the table.

n I lists the number of the index used for query.

n Mode is the 4GL command executed, such as db.first or db.next.

n Cache entry shows that a record was fetched from the BAAN IV databasedriver cache.

n Profile timings are shown for two steps of a query: first for the execution ofthe query Exe and second for fetching data Fetch. Each entry in sybprofshows two Exe and two Fetches.

Effect of optimization

The BAAN IV database driver has a single record cache. If the row is fetchedfrom the cache, no query is executed. In the following example, both db.equalswere performed with the same key value. For the first command, a query wasexecuted and the result fetched. For the next command, because the record wasin cache, it was used from the cache and no execute and fetch was required.

The record in the cache is indicated by the entry in the Cache column and noentries in any Exe or Fetch columns.

97-10-10[11:20:54]: Profiling value = 0.00 sec

Pid Table Owner I Mode Cache Exe Fetch Exe Fetch Total<11008> taabdb999000 tools 1 EQUAL - 0.18 0.17 - - 0.35<11008> taabdb999000 tools 1 EQUAL 0.00 - - - - -

Page 47: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

To install BAAN IV for Sybase

Installation and Administration Guide for Sybase

2-21

After executing an ascending sequence query such as db.first or db.great, if thenext query is db.next, the query is fetch optimized. No execute stage exists, onlya fetch stage. Similarly, after a descending sequence query such as db.last ordb.less, if the next query is db.prev, the query is fetch optimized. Below is asample output of such a case.

97-10-10[17:26:25]: Profiling value = 0.01 sec

Pid Table Owner I Mode Cache Exe Fetch Exe Fetch Total<12912> taabdb999000 tools 1 FIRST - 0.36 0.01 - - 0.37<12912> taabdb999000 tools 1 NEXT - - 0.01 - - 0.01<12912> taabdb999000 tools 1 NEXT - - 0.01 - - 0.01<12912> taabdb999000 tools 1 NEXT - - 0.01 - - 0.01<12912> taabdb999000 tools 1 NEXT - - 0.01 - - 0.01<12912> taabdb999000 tools 1 NEXT - - 0.01 - - 0.01<12912> taabdb999000 tools 1 LAST - 0.08 0.01 - - 0.09<12912> taabdb999000 tools 1 PREV - - 0.01 - - 0.01<12912> taabdb999000 tools 1 PREV - - 0.01 - - 0.01<12912> taabdb999000 tools 1 PREV - - 0.01 - - 0.01<12912> taabdb999000 tools 1 PREV - - 0.01 - - 0.01<12912> taabdb999000 tools 1 PREV - - 0.01 - - 0.01

In the above case, initially a db.first was performed followed by multipledb.next. The db.first is executed and fetched. The subsequent db.next are justfetched and not executed. After the fifth db.next, a db.last is performed, whichcannot be optimized; so, it is executed and fetched. The subsequent db.prev areagain fetched without being executed.

Page 48: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

To install BAAN IV for Sybase

Installation and Administration Guide for Sybase

2-22

Location of management file

The BAAN IV database driver uses the files in the directory $BSE/lib/sybase formanaging users and groups.

n syb_usersThis file has the lists of BAAN users with their Sybase user name, Sybasepassword, and group name. The BAAN IV database driver uses syb_users tologon as a specific user.

n syb_groupsThis file has the lists of groups and their encrypted passwords. The passwordis used when performing logging as a group.

n syb_storageThis file contains specifications for the various tables. See Appendix C formore information.

n Sybase Error ReportsIf the BAAN IV database driver encounters an error, an error message islogged in the file log.sybase, in the $BSE/log directory.

Page 49: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Installation and Administration Guide for Sybase

3-1

This chapter describes the administration procedures required for the setup of theBAAN IV database driver. All BAAN users have corresponding Sybase useraccounts and are grouped into Sybase groups. This chapter describes themanagement of these groups and users.

The BAAN group information is kept in a file $BSE/lib/sybase/syb_groups andis referred to as the group file. The BAAN user information is kept in a file$BSE/lib/sybase/syb_users and is referred to as the user file. Also, passwords inSybase must be at least six characters long.

Group managementA group represents a login to Sybase, which is also the owner of the database ofthe same name as the group. A group named BAAN means a Sybase login nameBAAN exists with a non-null password, which is the owner of the databasename, BAAN. Also, in the database BAAN, a Sybase group is created withsp_addgroup, which has the name BAAN. Multiple BAAN users can bemembers of this group.

Create a group

To create a group such as BAAN, use the Sybase system administrator accountsa. Create the Sybase login for BAAN, using the procedure sp_addlogin. Do notuse the null password for any Sybase login.

The Group name cannot be the same as any existing group, or Sybase user or saor dbo. The Sybase RDBMS has default databases named master, model,sybsystemprocs, and tempdb. These names are reserve names and cannot be usedfor group names.

3 BAAN IV Sybase database driveradministration

Page 50: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver administration

Installation and Administration Guide for Sybase

3-2

To add a login for a group test with the password testpwd, type the following:

$ isql –U sa –P password1> use master2> go1> sp_addlogin test, testpwd2> go1> create database test . . .2> go1> use test2> go1> sp_changedbowner test, true2> go

Now, run the syb_admin tool to add the group to the BAAN group file. Use theAdd Group option in the User Administration menu of the tool.

Drop a group

To drop a group, several steps are required:

1 Drop the group from the group file using the syb_admin tool.

2 If any BAAN users exist in the group to be dropped, as a precaution youcannot drop the group from the group file. In such a case, you must first dropall the BAAN users from the group, then drop the group using the DropGroup option.

3 A database is created for each group, which contains group tables as well asprivate tables for all the BAAN users in the group. If none of the tables in thisdatabase are required, this database can be dropped.

4 A Sybase login is created for each group. If the Sybase login is no longerrequired, drop it as follows.

$ isql –U sa –P password1> use master2> go1> sp_droplogin <groupname>2> go

The decision to drop a database must be made carefully. If any of the tables inthe database are required, do not drop the database. Once a database is dropped,the data in it is lost unless a backup exists.

NOTE

Page 51: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver administration

Installation and Administration Guide for Sybase

3-3

Change the group user password

If a group is created, it is assigned a password for the login procedure to thedatabase. After a group is created, this password can be changed any time.

Type the following to change the group password:

$ isql –U sa –P password1> use master2> go1> sp_password <sa password>, <new group password>, <group name>2> go

The group password is also stored in the group file. Use the maintenance toolsyb_admin to update the group file for a new password. Use the Change GroupPassword option in the User Administration menu of the tool.

BAAN user managementA BAAN user is represented by the environmental variable $USER. BAAN andsetup is based on this variable. For logging to the Sybase ASE, the BAAN IVdatabase driver requires a Sybase user account and its password. Thus everyBAAN user is assigned a Sybase user account and password. BAAN users aregrouped to facilitate shared access to a table. A Sybase user represents a Sybaselogin, which is a non-dbo user in a database (such as a group database), and haspermissions to create tables and procedures in that database. The Sybase user is amember of a sybase group in the database. The group name is the same as thedatabase name.

Add a BAAN user to a group

Before adding a BAAN user to a group, the group must exist. If the group doesnot exist, first create the group. Type the following to add a BAAN user to agroup.

The Sybase passwords must be six characters at minimum. A BAAN user canuse only one Sybase user account. The Sybase user name cannot be the same asany of the existing group names. The Sybase user name cannot be sa or dbo.

$ isql –U sa –P password1> use master2> go1> sp_addlogin <user name>, <user password>2> go

NOTE

Page 52: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver administration

Installation and Administration Guide for Sybase

3-4

Add the user to the user file, using maintenance tool syb_admin. Use the Adduser option in the User Administration menu of the tool.

See the section on “Storage file management” in Chapter 3 for issues regardingthe consistency of storage files for group objects.

To drop a BAAN user from a group

To drop a BAAN user from a group, first drop the BAAN user from the user filewith the maintenance tool syb_admin. Type the following to drop the Sybaseuser:

$ isql –U sa –P password1> use master2> go1> sp_droplogin <user name>2> go

To change a Sybase user password

Every BAAN user has a Sybase login. The password for the Sybase login isassigned when creating the Sybase login. This password can be changed any timeafter the login is created.

To change the password, type the following:

$ isql –U sa –P password1> use master2> go1> sp_password <sa password>, <new user password>, <user name>2> go

Run the maintenance tool syb_admin to change a user file. Use the Change Userpassword option in the User Administration menu of the tool to update the userfile with a new password.

Maintenance toolThe maintenance tool syb_admin is a shell script that runs on the Bourne shelland Korn shell. Listed below are major functionalities of this maintenance tool.

User administration

This option provides a facility to add or drop groups and add or drop users from agroup.

Page 53: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver administration

Installation and Administration Guide for Sybase

3-5

User information

This option can be used to list contents of the user file, group file, or storage filein a formatted manner.

The script uses another program syb_maint, which actually performs all actionsalthough it is transparent to the user.

Main menu

When syb_admin is run, the following menu is displayed:

M A I N M E N U

1 User Administration.2 User Information.3 Escape to shell.

e Exit.

Choice: 1The sections below describe each menu option in detail.

User administration

The BAAN user management is performed under user administration. Forsecurity reasons, only the Sybase system administrator ( UNIX login sybase )and root are allowed to perform user administration. To add and drop users orgroups, login as sybase or root. Any attempt to perform user administration withany other UNIX login fails.

Note that the procedure to add and drop a user or a group involves many steps, asexplained in the “Group management” and “BAAN user management” sectionsearlier in this chapter. The syb_admin tool only manipulates the user and groupfiles as a part of those procedures.

Below is the description of each screen that appears in the user administrationtool.USER ADMINISTRATION

1 Add User.2 Drop User.3 Change User Password.4 Add Group.5 Drop Group.6 Change Group Password.

e Exit.

Choice: 1

Page 54: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver administration

Installation and Administration Guide for Sybase

3-6

Add user

Use this option to add a BAAN user to a user file. Required inputs are the BAANuser name, the Sybase user name, the Sybase user password, the Sybase group towhich the BAAN user is to be added, and the group password. This step is thelast to be performed when adding a BAAN user, as explained in the section“BAAN user management” earlier in this chapter.

The following verifications are performed before the user entry is added to thesyb_users file.

n The user login that runs the syb_admin is either sybase or root.

n The group exists in the syb_group file.

n The BAAN user does not exist in the syb_users file.

n The Sybase user is not in use by other BAAN users. If an existing BAANuser named trade is using the Sybase user bsp, no other BAAN users can usethat Sybase user account. Also, the Sybase user name cannot be sa becausethis name represents the system administrator. The Sybase user name cannotbe an existing group name.

n Using the given Sybase user password, login to Sybase and access the groupdatabase. Make sure the password specified is the same as the one specifiedwhen creating the login for the Sybase user.

Multiple BAAN users cannot share a Sybase user account. Thus, a one-to-onerelationship exists between a BAAN user and a Sybase user.

If any of the above checks fail, the operation fails with an appropriate errormessage. Otherwise, an entry is added for the user in the user file. The user isalso added to the database group using sp_adduser.

Drop user

This step is the first in the procedure for dropping a BAAN user, as explained inthe section “BAAN user management”earlier in this chapter.

This option is used to drop a BAAN user from the user file. The BAAN username, the group name to which the user belongs, and the group password arerequired inputs.

The user login that is running the syb_admin must be sybase or root. If thiscondition is not satisfied, the BAAN user is not dropped from the user file. Also,the user can be dropped from the database group using sp_dropgroup.

Note that if the user owns some objects in the database, sp_dropuser fails and theuser cannot be dropped.

NOTE

Page 55: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver administration

Installation and Administration Guide for Sybase

3-7

Change user password

This step is used to change the password for the Sybase user (which correspondsto a BAAN user in the user file). This step is the last in the procedure forchanging the user password.

The BAAN user name, corresponding Sybase user name and the new passwordare required input. The user file is updated with the new password. If logginginto Sybase with the new password fails, the user file is not updated.

Do not use this option to change the group password, for which a separate optionexists.

Add group

This step is used to add a Sybase group entry to a group file. This step is the lastin the procedure for creating a group, as explained in the “Group management”section earlier in this chapter.

The name of the group to be created and the group password (which is used tolog into Sybase as group) are required.

The following verifications are performed before the group entry is added to thegroup file.

n The user login to run the syb_admin is either sybase or root.

n The group name must not be sa, which represents the Sybase systemadministrator. Sybase DBMS creates three databases during installation:master, model and tempdb. The group name cannot be the same as any ofthese names.

n No group or Sybase user exists with the same name as the group name.

If any of the above checks fail, the operation fails with an appropriate errormessage. Otherwise, an entry is added in the group file. A group is created in thedatabase by using sp_addgroup. The group is granted permissions to create tablesand procedures in the database.

Page 56: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver administration

Installation and Administration Guide for Sybase

3-8

Drop group

In the first step of the procedure for dropping a group, the user is prompted forthe name of the group to be dropped and its password. The followingverifications are performed before the group entry is dropped from group file.

1 The user login, to run the syb_admin is either sybase or root.

2 The group is empty; no users in the group exist. This check is provided as asafety measure against mistakenly removing a group in use.

If any of the above checks fail, the operation fails with an appropriate errormessage. Otherwise, the entry is deleted from the group file. The group isdropped from the database by using sp_dropgroup.

If the database group is not empty, sp_dropgroup fails and the group cannot bedropped.

Change group password

This step is the last in the procedure to change the group password. The groupname and new password are required input. If logging into Sybase with the newpassword fails, the group file is not updated. Otherwise, the group file is updatedwith the new password.

User information

This option is used to list the contents of the user file, group file, and storage file.This option also provides an option to edit the storage file.

User Information

1 List Users.2 List Groups.3 List Storage.4 Edit Storage.e Exit from this menu.

Choice: 1

List users

This option lists all the BAAN users in the user file with the correspondingSybase users and their respective group.

NOTE

Page 57: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver administration

Installation and Administration Guide for Sybase

3-9

List groups

This option lists all the groups in the group file as well as the users in eachgroup.

List storage

The storage file contains information about tables and indexes. This option canbe used to selectively display the information about a table or index. An object isidentified in a variety of ways, such as the owner’s BAAN user name, the tablename, or the customer number. A BAAN user name could be trade, a table namecould be tfgld006 and a customer number could be 005. The object can be T, I,or In where n is the index number, such as I4. If the object is T, then the tableinformation as well as the information of all the indexes on those tables isdisplayed. If the object is I, the information of all the indexes on that table isdisplayed. If the object is a specific index such as I4, then the information forthat index only is displayed.

The owner name, the table name, and the company number qualify an objectentry in the storage file. If an exact entry is not found in the storage file for anobject, the default entries are used if they exist. For example, assume that thestorage file is as follows:

{fin1}tfgld006:*:T:private:001:5:{fin2}tfgld006:*:I1,I2,I3::001::SEGMENT seg2::T:group:001:5:{fin2}*:*:I::001::SEGMENT seg2*:*:I::001::SEGMENT seg1

In the above file, for user fin1, the table specification entry exists for tfgld006.But no specific index specification entry exists for fin1, so the default indexentry (the last line) is used for all the indexes. For user fin2, no specific tableentry for tfgld006 exists, so the default table entry is used (third line). However,an entry exists for indexes I1, I2, and I3, so for these indexes, the specificationsin line 2 are used. For other indexes, the default index entry for fin2 is used(fourth line). If index optimization is not specified in an index entry, the one inthe table entry is used as the default. Refresh time is meaningless in the case ofindexes.

If, for a table, some indexes have a specific entry, the default entry also existsand if the object selected is T or I, the default index specifications as well asspecific entries are shown. For example, if the user is fin2, the table is tfgld006and the object is I, the first default index specifications are shown as well as theones for I1, I2, and I3.

Page 58: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver administration

Installation and Administration Guide for Sybase

3-10

Edit storage

Edit the storage file using the vi editor.

Escape to shell

This option creates a child shell. When you log out of that shell, you are returnedto the main menu.

Storage file management

Information about Sybase tables is specified in a file$BSE/lib/sybase/syb_storage, commonly called a storage file.

When putting the table or index specifications in the storage file, make sure tonot create multiple specifications that refer to the same group table or index. Thisaction is explained in the example that follows:

acp:acp:<Encrypted Password>:financeacr:acr:<Encrypted Password>:financegld:gld:<Encrypted Password>:financesls:sales:<Encrypted Password>:tradepur:purchase:<Encrypted Password>:trade

Three BAAN users (acp, acr, and gld) are in the same group named finance.

Now consider following storage file.

{acp}tfgld006:505:T:group:000:0:{acr}tfgld006:505:T:group:001:0:{gld}tfgld006:505:T:group:001:0:{sls}tdinv001:606:T:group:001:5:{pur}tdinv001:606:T:group:001:5:::I::::

This file is valid from the syntax point of view. But because acp, acr and gld arein the same group, they refer to the same group table tfgld006 with differentspecifications. This reference is conflicting and leads to trouble. If the table doesnot exist and if acp creates the table, the server creates the table without hashcolumns because the entry for acp specifies no hash optimization. If acr tries toaccess that table, the BAAN IV database driver assumes that an index has asingle hash column and will try to use it in a query. Because the column does notexist, the query fails and the database call produces an error. A similar problemexists with the table tdinv001 for BAAN users sls and pur if sls creates the tableand pur tries to access it.

Page 59: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver administration

Installation and Administration Guide for Sybase

3-11

This situation can be avoided if a common entry for all BAAN users in the groupis created, as follows:

{acp,acr,gld}tfgld006:505:T:group:001:0:{sls,pur}tdinv001:606:T:group:001:0:

Now, only one set of specifications exists for the group table.

If a new user is added to the group, this entry must be modified to include thenew user. If a user is dropped from the group, that user’s name must be droppedfrom this entry.

This problem occurs only if an installation has more than one group. If aninstallation has a single group, a group table entry can be created that isapplicable to all users. For example:

tfgld006:505:T:group:001:0:

If any private tables of the same name exist, those entries must be placed beforethis entry.

If an installation has multiple groups for group objects such as a table or index, asingle entry must be created that consists of all BAAN users in the group. Notfollowing this rule can lead to inconsistencies in the storage file and to runtimeerrors.

The syb_maint6.1 toolThe tool syb_admin uses the syb_maint6.1 tool to perform administration tasks.The tasks performed by syb_admin can also be started manually by invokingsyb_maint6.1.

syb_maint6.1 performs several administration functions. Each function requirescertain options to be specified. In the function descriptions below, all optionsmust be specified unless they are listed within brackets. For options listed withinbrackets, exactly one of the two sets of options within brackets must be specified.

Note that changes made through syb_maint6.1 will not effect the files syb_usersand syb_groups. Any unknown user specified as input to syb_maint6.1 will becreated.

The syb_maint6.1 functions and their required options are explained below:

To add a user to a group:syb_maint6.1 –a<BAAN IV user>

–m<Sybase user> –p<user password> –G<group name>–P<group password>

Page 60: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver administration

Installation and Administration Guide for Sybase

3-12

To change a user password:syb_maint6.1 –r<BAAN IV user>

–m< Sybase user> –p<new user password>

To drop a user from a group:syb_maint6.1 -d<BAAN IV user>–G<Group name> –P<group password>

To add a group:syb_maint6.1 –A<group name>–P<group password>

To change a group password:syb_maint6.1 -R<Group name> –P<new group password>

To drop a group:syb_maint6.1 –D<group name> –P<group password>

To list users:syb_maint6.1 –l

To list groups:syb_maint6.1 –L

To list storage:syb_maint6.1 –S<table> -u<BAAN IV user> -C<customer number> -O<object>

To print usage information:syb_maint6.1 –U

To print version information:syb_maint6.1 { –v | –V }

Page 61: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Installation and Administration Guide for Sybase

4-1

This chapter supplies information about aspects of the general configuration andtuning that includes:

n Sybase database configuration and tuning aspectsn BAAN IV Sybase database driver configuration and tuning aspectsn SUN tuning aspects

Configuration and tuning aspectsConfiguring and tuning the Sybase database is important in order to removepossible performance bottlenecks and to optimize the BAAN performance on theSybase database. In this chapter, several topics are described briefly. For furtherdetails, refer to the Sybase server documentation.

High-level lock retries

When a row lock cannot be acquired, high-level lock retries are initiated; in otherwords, the same action is performed after a sleep period. The environmentvariable LOCK_RETRY or the resource variable lock_retry can define the retrypattern. This pattern can contain a comma, a separated list of combinations ofnumber of retries, and sleep periods in milliseconds (ms), for example:

LOCK_RETRY=”5*100,5*500”

or

lock_retry:”5*100,5*500” (resource variable)

This pattern is the default retry pattern, which means that the action is retried fivetimes with a sleep period of 100 ms, and then five times with a sleep period of500 ms. The lock retries can also be disabled by specifying:

LOCK_RETRY=”0”

or

lock_retry:”0”

This feature is common to all database drivers.

The LOCK_RETRY variable can be used in both level-1 and level-2 databasedrivers.

4 BAAN IV Sybase database driverconfiguration and tuning aspects

NOTE

Page 62: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver configuration and tuning aspects

Installation and Administration Guide for Sybase

4-2

Optimistic and pessimistic reference checks

To optimize concurrency, the BAAN IV Sybase database driver supportsoptimistic and pessimistic reference checks. If inserts are performed in a childtable in lookup reference mode, the BAAN IV Sybase database driver verifiesthat the reference exists in the parent table and locks the row in order to be surethat another user cannot delete it within the current transaction. This approach iscalled the pessimistic approach, and it blocks an insert of another userreferencing the same parent row, thereby affecting the concurrency. Anotherapproach to this problem is that a row in the parent table is not locked, dependingupon the choice of the user. This approach is called the optimistic approach. Asthe record is not locked, another user can still perform an insert operation, whichimproves the concurrency.

File formatsThe BAAN environment uses various files for administration. Some of thesefiles are common to all database drivers, while others are specific to a singledatabase driver.

This section describes the format of various files used specifically by theBAAN IV Sybase database driver. For information on files common to alldatabase drivers, refer to the BAAN Tools Technical Manual (U7040A US).

File $BSE/lib/sybase/syb_users

The BAAN IV Sybase database driver to connect to the Sybase ASE uses the$BSE/lib/sybase/syb_users file. This file is commonly called the user file.

The user file contains information on all BAAN users on the system who use theBAAN IV Sybase database driver. Each line in this file is made up of four fields,which are separated by a colon (:).

< BAAN User >:< Sybase User >:< User Password >:< User Group >.

BAAN user

This value set is used for the variable $USER.

Sybase user

This Sybase login uses the database that is accessed. This user can be differentfrom the BAAN user name, but BAAN users cannot share the Sybase login.

Page 63: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver configuration and tuning aspects

Installation and Administration Guide for Sybase

4-3

Sybase user password

This password is assigned to the Sybase user while creating a Sybase login. TheBAAN IV Sybase database driver to log into the Sybase ASE uses this password,which is stored in encrypted form.

User group

The BAAN user belongs to this group. A sample user file is shown below.

acp:acp:MyNO?%H$h9/Bnc9yb/@2‘(llU=8:4Wbj:financeacr:acr:\‘$YW/k\RfbL^<qhM<vxk3Dhm2ayV^]7:financegld:gld:>9~[{’EOu^UA,)[(vt\MTw3y=AhTdPgK:financesls:sales:N$x’1$xHoY+^5hm[.:7JQx-;B(=>@,^/:tradepur:purchase:KqJeZwD@PC6d3Z+KojKb,;/utq%0nJa+:tradet1:tool1:jkfjkdjkjkjd3Z+KojKb,;/utq%0nJa+:toolst2:tool2:KqJjsfjkjsdfj*and#ojKb,;/88890nJB-:tools

The table below explains the user file shown in the above example.

Explanation of sample user fileBAAN user Sybase user Groupacp acp financeacr acr financegld gld financesls sales tradepur purchase tradet1 tool1 toolst2 tool2 tools

The Sybase user can be different from the BAAN user. Also, multiple BAANusers cannot share a Sybase user.

This file is created and maintained by the maintenance utility syb_admin.

File $BSE/lib/sybase/syb_groups

The BAAN IV Sybase database driver to connect to the Sybase ASE uses the$BSE/lib/sybase/syb_groups file. This file is commonly called the group file.

This file contains information on all groups used by all BAAN users who use theBAAN IV Sybase database driver. Each line in this file is made up of two fields,which are separated by a colon (:).

< Group Name >:< Group Password >

Page 64: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver configuration and tuning aspects

Installation and Administration Guide for Sybase

4-4

Group name

This name is used by the BAAN IV Sybase database driver to login to SybaseASE when performing table-level actions, such as create table and drop table forgroup tables. This name is a Sybase login, and the login is owner of a database ofsame name.

Group password

This password is assigned to the group when a Sybase login was created for it.The password is in encrypted form. The BAAN IV Sybase database driver usesthis password when it performs a login as a group.

A sample file is shown below.

finance:5tT’”I*/qmn;7cORtYP:8*Hksop*9‘g6trade:ESMQ3Ti(khD‘@@a+,y”75+B5andNEno<f”tools:B8jkj8%*’jkjlkjsKJLJkjRjjkJLjlUt

Here the group file contains groups finance, trade, and tools.

This file is created and maintained by the maintenance utility syb_admin.

File $BSE/lib/sybase/syb_storage

This file is more commonly called the storage file and is used to specify variousobject parameters for the BAAN IV Sybase database driver. The BAAN IVSybase database driver references this file while creating objects as well asduring data manipulation, such as queries. This file can be created and managedby any text editor such as vi or any other UNIX utility.

Each line in this file consists of seven fields that are separated by a colon (:). Theformat of the line is as follows.

[{BAAN user}]< table_name >:< customer number >:< object >:< owner type >:< indexoptimization >:< refresh time >:[< storage specifications >]

The fields in square brackets are optional. An explanation of each field follows:

BAAN UserThe table information can be specified per BAAN user. This specification can beperformed by putting the BAAN user name in braces, ({}). Then, specificationsin this line are applicable to that BAAN user only. A list of BAAN users can alsobe specified by separating each user with a comma (,): for example,{acp,gld,acr}.

If a BAAN user is not specified, the information is applicable to all BAAN users.

Page 65: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver configuration and tuning aspects

Installation and Administration Guide for Sybase

4-5

Table NameThe referenced table’s name can be specified in one of the following formats,which uses the asterisk (*) as a wildcard:

n An asterisk (*) means all packages, such as “{acp}*:...” or “*:

n Package code “{acp}tf,tc:...” or “ti,td,tt:...”.

n Package and module code “{acp}tfacp:...” or “tiitm,tdsls:...”.

n Package code, module code and table number “{acr}tfacr011:...” or“ttadv999,ttadv995:”

n A combination of the above options, separated by comma “,”“{gld}tfgld006,tfacp,tccom010,ti:....”

Customer NumberThe customer number can be specified in one of the following formats:

n An asterisk (*) means all customer numbers. tf:*:...n A 3 digit customer number, {gld}tfgld:001:....n A comma separated list of 3 digit customer numbers.

“{gld}tfgld:001,002:...”.

ObjectThe object to which this line refers can be specified in the following formats:

n “*” table and all indexes on it.n T, the table only.n I, all indexes on a table.

One or more indexes on the table, indicated by In where n is the number of theindex, such as I10. You can also specify a list of indexes, separated by a comma,such as I2,I10,I4.

Owner TypeThis field defines the type of owner for a table. The type can be either private orgroup, and its owner can only access a private table. All users in that group canaccess a group table.

This field is meaningless for indexes because all indexes are used internally bythe Sybase ASE and are not accessed explicitly by a user.

Page 66: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver configuration and tuning aspects

Installation and Administration Guide for Sybase

4-6

Index OptimizationThis field is to specify the level of index optimization, which can be specified asan octal or hexadecimal number. The following values are applicable:

n 000Use no hash columns

n 001Use single hash optimization

n 010For singleton selects on this table, the BAAN IV Sybase database drivercreates and uses stored procedures. This flag is specified for the table.Procedures are used for all unique indexes of the table.

You can specify a default optimization value for each index in the correspondingtable line. If an index specification does not contain this parameter, the defaultoptimization is taken from the corresponding table entry.

Refresh TimeRefresh time is used to set the validity period of a data set, when optimization isin effect. Refresh time is meaningful only for tables; for indexes, it is ignored.This time is specified as number of seconds. If no seconds are specified, thedefault value is zero.

For usage of refresh time, refer to the “Optimization” section in Chapter 1.

StorageThe BAAN IV Sybase database driver provides a facility for controlling variousparameters used for creating and accessing tables. These parameters are specifiedin the storage file. For detailed information on these parameters, refer to Chapter1. Options that are applicable to the table are as follows.

SEGMENT “segment name”ROWSPERPAGE nPREFETCH mCACHE “lru”/”mru”CURSROWCOUNT nLOCKMODE “allpages”/”datapages”/”datarows”STATISTICSPROFILE

Page 67: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver configuration and tuning aspects

Installation and Administration Guide for Sybase

4-7

Note that some of the options require a number as a value. Options that areapplicable to indexes are as follows.

SEGMENT “segment name”FILLFACTOR nROWSPERPAGE nCLUSTERED

A default table and index entry (covering all user/tables/customer number) mustbe present. In the example above, the last two lines are the default table andindex entries.

NOTE

Page 68: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

BAAN IV Sybase database driver configuration and tuning aspects

Installation and Administration Guide for Sybase

4-8

Page 69: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Installation and Administration Guide for Sybase

5-1

Several facilities are available to configure the BAAN IV Sybase database driver,although the most common is driver resources. Two other facilities forconfiguring the BAAN IV Sybase database driver are environment variables andthe storage file. The driver resources and environment variables are described inmore detail in Appendix B and the storage file in Appendix C.

Driver resourcesThe database driver resources are parameters that can be set to modify thebehavior of the BAAN IV Sybase database driver. These parameters are set in afile called the resource file (db_resource). One resource file exists for alldatabase drivers that run in a BAAN IV environment; resources for all thedatabase driver types can be found in this file. A database driver reads theparameters set in the resource file when it is first invoked.

The resource file can contain many entries, with one entry per line. Each entry isused to set a single resource parameter, with the resource name followed by acolon and then the value to which the resource is to be set. The following is anexample of the contents of a resource file that contains a single entry:

syb_login_timeout: 300

When modifying the behavior of the database driver, you must often modify thebehavior of the BAAN IV application virtual machine to take advantage of thecharacteristics of the database driver. Therefore, two types of database driverresources exist:

n Resources for the server, which are used to modify the behavior of thedatabase driver.

n Resources for the client, which are used to modify the behavior of theapplication virtual machine.

5 Appendix A: Setting database driverbehavior

Page 70: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix A: Setting database driver behavior

Installation and Administration Guide for Sybase

5-2

In a UNIX environment, the resource file, db_resource, is located in the directory$BSE/lib/defaults, where $BSE refers to the directory where the BAAN IVsoftware environment is installed. When both the database driver and theapplication virtual machine run on the same machine, only one db_resource fileis available that contains all the necessary resources parameters. If the databasedriver and the application virtual machine run on different machines, onedb_resource file must be located on the machine that runs the database driver thatcontains the server resources, and one db_resource file must be located on themachine that runs the application virtual machine that contains the clientresources.

In addition to the default resource file, db_resource, you can set up an alternativeresource file to override resource values for specific users or groups of users. Thealternative resource file is specified with the environment variablesUSR_DBS_RES and USR_DBC_RES:

n USR_DBS_RES is used to specify the path to a file that contains analternative resource file for the server and must be set on the machine runningthe database driver.

n USR_DBC_RES is used to specify the path to a file that contains analternative resource file for the client and must be set on the machine runningthe application virtual machine. Any driver resource set in the alternativeresource file will override the setting of the same driver resource indb_resource.

The next section describes how to set the database driver environment variables.

Environment variablesEnvironment variables can be used to override driver resources. Usually, adefault set of resource parameters is configured in the resource file. Theadministrator can override these default settings with environment variables.

For the most part, an environment variable exists that corresponds to eachresource parameter. The environment variable name is usually the uppercaseequivalent of the resource parameter name. As with the database driverresources, some environment variables are used to modify the behavior of thedatabase driver (server), and some are used to modify the behavior of theapplication virtual machine (client).

n If a database driver environment variable for the server is to be used, it mustbe set on the machine that runs the database driver in order to override thecorresponding driver resource.

Page 71: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix A: Setting database driver behavior

Installation and Administration Guide for Sybase

5-3

n If a database driver environment variable for the client is to be used, it mustbe set on the machine that runs the application virtual machine in order tooverride the corresponding driver resource.

Server environment variables

Environment variables that affect the database driver can be used to override thedriver resources for all tables in a database or for specific tables and companynumbers within the database. Three ways exist to set the database driver serverenvironment variables:

n By using the BAAN IV Maintain Database Definitions (ttaad4100m000)sessions

n By manually modifying the BAAN IV tabledef6.1 file

n By using the standard operating system mechanism for setting environmentvariables

Use the Maintain Database Definitions (ttaad4100m000) session to modifydatabase driver behavior. This session causes environment variables for aparticular database driver to override the defaults set in the resource file andallows the environment variables to be maintained centrally.

This session maintains database driver configuration information in a file calledtabledef6.1. This file is stored in the directory $BSE/lib which resides on themachine where the database driver runs. Although most users will use theMaintain Database Definitions (ttaad4100m000) session to maintain this file,advanced users can modify this file manually. The format of the tabledef6.1 fileis as follows:

<table name>:<company number>:<driver type>(<environment variable>=<value>)

If multiple environment variables are to be specified for a single table andcompany number, they are listed within the parentheses and separated bycommas. If all tables or all companies are to be specified, an asterisk (*) is usedin place of a table name or company number. For example, the following entrycan be made in the tabledef6.1 file:

tccom010:812:sybase(SYBPROF=0.4)

In this example, all the queries on table tccom010812 that require at least 0.4seconds are logged in the SYBPROF file. Note that this table is considered tohave a different database definition from other tables. If a Sybase driver isalready running but is accessing a different table, a separate driver will be startedfor this table.

Page 72: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix A: Setting database driver behavior

Installation and Administration Guide for Sybase

5-4

Environment variables that appear in the driver specifications of the tabledef6.1file are put into the driver’s environment before it is invoked, so they areavailable to the driver at startup.

If the default database driver resources must be modified for specific users, thestandard operating system method can be used to set database driver environmentvariables for specific users. These environment variables will override thesettings created for these users in the Maintain Database Definitions(ttaad4100m000) session.

Client environment variables

Database driver environment variables that affect the client can be used tooverride the client resources that affect the application virtual machine. Theseenvironment variables must be set on the machine that runs the applicationvirtual machine by using the standard operating system methods used for settingenvironment variables. Any client environment variables that are used willoverride the equivalent resource variables set for the client in the db_resourcefile.

Storage fileThe storage file provides a way to specify the distribution of table and index datain different segments. Storage parameters are used by the database driverwhenever a DDL statement such as a create table or create index statement isexecuted. The following is an example of an entry in the storage file:

SEGMENT tableseg LOCKMODE datapages

In this example, the database driver adds the following clause to the createstatement during index or table creation: in <tablespace name> index in <indextablespace name>

A storage file is defined for each database driver. The storage file for theBAAN IV Sybase database driver is called syb_storage and is located in thedirectory $BSE/lib/sybase. The format of the storage file is described in detail inAppendix C.

Page 73: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Installation and Administration Guide for Sybase

6-1

This appendix lists all the database driver resources and environment variablesthat can be used as configuration parameters to modify the behavior of theSybase database driver. Some of these resources are used with the client andothers with the server. In the context of this document, the client is the BAAN IVapplication virtual machine and the server is the BAAN IV Sybase databasedriver. If the BAAN IV application virtual machine and the database driver runon different machines, client resources must be set on the machine that runs theBAAN IV application virtual machine, and server resources must be set on themachine running the database driver. Resources for both the client and the servermust be set on both machines.

A description of how to set the database driver resources and environmentvariables can be found in Appendix A.

This appendix provides the following information:

n A summary of Sybase resources and environment variablesn A detailed description of Sybase resources and environment variables

Summary of Sybase resources andenvironment variablesFour types of resources and environment variables exist that can be used with theBAAN IV Sybase database driver:

n Client and server resources used by all BAAN IV database driversn Client resources used by all BAAN IV database driversn Server resources used by all BAAN IV database driversn Resources used only by the BAAN IV Sybase database driver

The following four tables provide a summary of each of these types of resourcesand environment variables. Detailed descriptions of each entry in the tables canbe found beginning in the next section of this chapter.

6 Appendix B: Database driverresources and environment variables

Page 74: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix B: Database driver resources and environment variables

Installation and Administration Guide for Sybase

6-2

Client and server resources used by all BAAN IV database drivers

Resource name Environment variable Description

rds_full RDS_FULL Sets maximum number of rows transferred inone block

tt_sql_trace TT_SQL_TRACE Allows viewing of SQL query information

Client resources used by all BAAN IV database drivers

Resource name Environment variable Description

bdb_debug BDB_DEBUG Sets debugging link between client and server

bdb_driver BDB_DRIVER Sets database specifications

ssts_set_rows SSTS_SET_ROWS Sets number of rows read ahead (single tablesingle row)

USR_DBC_RES Specifies alternative resource file for client

Server resources used by all BAAN IV database drivers

Resource name Environment variable Description

bdb_max_session_schedule

BDB_MAX_SESSION_SCHEDULE

Defines mechanism for closing idle driversessions

Dbslog DBSLOG Allows driver profiling

Dbsinit Specifies optimistic or pessimistic referencechecking

lock_retry LOCK_RETRY Defines the number of lock retries and thesleep period between retries

USR_DBS_RES Specifies alternative resource file for server

Page 75: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix B: Database driver resources and environment variables

Installation and Administration Guide for Sybase

6-3

Resources used only by the BAAN IV Sybase database driver

Resource name Environment variable Description

syb_char_set Sets the Sybase alpha character set

syb_con_max_prepares

Sets number of cursors that can be defined inone connection

syb_ddl_timeout Sets timeout value for DDL statements

syb_init Allows selection of Sybase version

syb_lock_timeout Sets locking timeout behavior

syb_login_timeout Sets login timeout behavior

syb _max_connections

Sets maximum number of connections toSybase

syb_misc_options Specifies various database driver options

syb_national_language

Specifies language for error messages

SYBPROF Allows profiling

SYBSTAT Allows statistics to be gathered

syb_tds_packet_size

Specifies packet size of TDS protocol

Detailed description of Sybase resources andenvironment variablesThis section provides detailed information about the BAAN IV Sybase driverresources and environment variables. The driver resources are divided into twosections: those that are generic to all BAAN IV database drivers and those thatare specific to the BAAN IV Sybase driver. Each group of resources is listed inalphabetical order.

Page 76: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix B: Database driver resources and environment variables

Installation and Administration Guide for Sybase

6-4

Generic driver resources

bdb_debug / BDB_DEBUG

Driver resource bdb_debug

Environment variable BDB_DEBUG

Client/Server resource Set for client only

Type Integer (octal)

Default 0

Description This variable is used to generate debugginginformation about the communication between theclient and the database driver. When set, the clientprints debugging information to standard error (stderr).The following categories of debugging information canbe specified:

00001 server types

00002 database actions

00004 delayed lock actions

00010 reference information

00040 TSS info from $BSE/lib/tss_mbstore

00100 permission information

Multiple categories can be defined by adding the octalvalues. The value is compared bitwise to determine if agiven category should be logged.

bdb_driver / BDB_DRIVER

Driver resource bdb_driver

Environment variable BDB_DRIVER

Client/Server resource Set for client only

Type String

Default None

Description This variable is used to set a database specification,usually found in the file tabledef6.1. When this variableis set, all tables will be accessed using the databasedriver specified and tabledef6.1 will not be read. Thedriver specified must be defined in the file$BSE/lib/ipc_info.

Page 77: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix B: Database driver resources and environment variables

Installation and Administration Guide for Sybase

6-5

bdb_max_session_schedule / BDB_MAX_SESSION_SCHEDULE

Driver resource bdb_max_session_schedule

Environment variable BDB_MAX_SESSION_SCHEDULE

Client/Server resource Set for server only

Type Integer

Default 3

Description This variable defines the mechanism to close idlesessions in the driver. Whenever the client process hasno more references (cursors or queries) to the session,it can be closed by the client. An idle session is closedafter a number of schedule ticks. A schedule tick isgenerated whenever a BAAN IV session is ended. Atthis point, all idle sessions will have a schedule counterincremented. When the value of the schedule counterreaches the value of bdb_max_session_schedule, thesession is closed.

The default for bdb_max_session_schedule is 3.Setting bdb_max_session_schedule to 1 results infewer connections from the driver to the RDBMSbecause whenever a BAAN IV session is ended, thecorresponding RDBMS session (logon) is closed(logoff).

Page 78: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix B: Database driver resources and environment variables

Installation and Administration Guide for Sybase

6-6

dbsinit

Driver resource dbsinit

Environment variable —

Client/Server resource Set for server only

Type Integer (octal)

Default 0

Description This variable allows flags to be set to specify theoptimizations to be used. At this time, legal values are000 (not set) and 001. Other values are reserved andmust not be used.

A flag of 00001 specifies that an optimistic approachshould be used when checking for references in parenttables. The referenced row in the parent table is notlocked, which improves the overall concurrency. If thisflag is not set, optimistic reference checking is notused.

Other values are reserved for future use and must notbe used. Multiple categories can be defined by addingthe octal values. The value is compared bitwise todetermine if a given category should be logged.

Page 79: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix B: Database driver resources and environment variables

Installation and Administration Guide for Sybase

6-7

dbslog / DBSLOG

Driver resource dbslog

Environment variable DBSLOG

Client/Server resource Set for server only

Type Integer (octal)

Default 0

Description This variable provides detailed debugging informationabout the online processing of the driver. Theinformation is logged in the file dbs.log in the driver’scurrent directory. The following debugging categoriescan be specified:

0000001 Data Dictionary info of tables within thedriver

0000002 Query info (SQL Level 1)

0000004 Query plan info (SQL Level 2)

0000010 Row action information

0000020 Table action information

0000040 Transaction action information

0000100 DBMS input/output data (SQL Level 2)

0000200 Administration file info (SQL drivers)

0000400 DBMS SQL statements

0001000 General debug statements

0002000 Query processing info (for tt_sql_trace info)

0004000 Data buffering info (communication)

0100000 Lock retries logged (includes session name)

0200000 Logs successful locks and longest lockduration in a transaction

Multiple categories can be defined by adding the octalvalues. The value is compared bitwise to determine if agiven category should be logged.

Page 80: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix B: Database driver resources and environment variables

Installation and Administration Guide for Sybase

6-8

lock_retry / LOCK_RETRY

Driver resource lock_retry

Environment variable LOCK_RETRY

Client/Server resource Set for server only

Type String

Default 5*100,5*500

Description This variable defines the high-level locking behaviorthat is used when an action is locked. This variabledefines the number of retries and the length of thesleep periods between retries in milliseconds (MS). Forexample, for the default setting, the action is retried fivetimes with a sleep period after each try of 100 MS. Theaction is then retried five more times with a sleepperiod of 500 MS after each retry.

rds_full / RDS_FULL

Driver resource rds_full

Environment variable RDS_FULL

Client/Server resource Set for both client and server

Type Integer

Default 5

Description This variable defines the maximum number of rowstransferred between the BAAN IV application virtualmachine and the driver as one block. Multiple blocks(and thus network round trips) are transferred if morerows are requested. Set this variable to the same valuefor both client and server.

Page 81: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix B: Database driver resources and environment variables

Installation and Administration Guide for Sybase

6-9

ssts_set_rows / SSTS_SET_ROWS

Driver resource ssts_set_rows

Environment variable SSTS_SET_ROWS

Client/Server resource Set for client only

Type Integer

Default 3

Description This variable defines the number of rows to be readahead for a fetch request from the client. The default isthree rows, which means that for one fetch request,three rows will be read. For the following two fetchrequests, rows will be taken from the client row bufferor fetched from the database without reexecuting thequery.

tt_sql_trace / TT_SQL_TRACE

Driver resource tt_sql_trace

Environment variable TT_SQL_TRACE

Client/Server resource Set for both client and server

Type Integer (octal)

Default 0

Description This variable is introduced to view the BAAN IV SQLquery information being handled in client and server.When this variable is set, the client prints debuginformation to the display; the server prints informationonly if the dbslog variable allows it. The informationcontains different categories that can be enabledseparately, such as evaluation trees, SQL statements,bind variables, timings, and communication debugging.The possible values of the TT_SQL_TRACE variableand their descriptions are shown below:

000040 (c) Show queries with their QID

000200 (c) Show query execution times

002000 (c) Show calls of internal SQL functions

004000 (c+s) Show query execution tree

010000 (s) Show query evaluation plan

020000 (s) Show FullTableScan

Page 82: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix B: Database driver resources and environment variables

Installation and Administration Guide for Sybase

6-10

USR_DBC_RES

Driver resource

Environment variable USR_DBC_RES

Client/Server resource Set for client only

Type String

Default None

Description This variable contains the file specification of analternative resource file for the client. The filespecification is based on the BSE directory andappears within double quotes. If set, any resources inthe alternative resource file override the same clientresources set in db_resource.

USR_DBS_RES

Driver resource

Environment variable USR_DBS_RES

Client/Server resource Set for server only

Type String

Default None

Description This variable contains the file specification of analternative resource file for the client. The filespecification is based on the BSE directory andappears within double quotes. If set, any resources inthe alternative resource file override the same serverresources set in db_resource.

Page 83: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix B: Database driver resources and environment variables

Installation and Administration Guide for Sybase

6-11

Sybase driver specific resources

syb_char_set

Driver resource syb_char_set

Environment variable -

Client/Server resource Set for server only

Type String

Default Not set

Description If a character set is specified using this variable, theBAAN IV database driver turns on the conversionbetween this set and the Sybase character set. Forexample, to use the Japanese character set with euc,set this variable as syb_char_set:eucjis.

syb_con_max_prepares

Driver resource syb_con_max_prepares

Environment variable -

Client/Server resource Set for server only

Type Integer

Default 256

Description The client library allows the driver to define anunlimited number of cursors and prepare an unlimitednumber of statements in one connection. However,cursors and statements take resources and the BAANIV database driver can run out of memory if no limit iskept on these parameters.

By default, the BAAN IV database driver never allowsthe total of cursors and statements in a connection toreach beyond 256. If a connection needs to preparemore statements or define more cursors, existingstatements and cursors are first freed. Use this variableto change that limit to another value.

Setting the value too high results in more memoryallocated in the BAAN IV database driver and otherSQL server resources (like the procedure cache), sothe database driver could run out of memory. Settingthe value too low leads to frequent repreparingstatements and redeclaring cursors, which results inslow performance.

Page 84: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix B: Database driver resources and environment variables

Installation and Administration Guide for Sybase

6-12

syb_ddl_timeout

Driver resource syb_ddl_timeout

Environment variable -

Client/Server resource Set for server only

Type Integer

Default 3600

Description As with syb_lock_timeout, the BAAN IV database driversets a nonzero timeout value. This value can work wellfor queries and updates but might be short for otheractions, such as the creation of many indexes on atable that contains a large number of rows. For suchactions, the BAAN IV database driver increases thetimeout to higher values (default 3600 seconds). Useddl_timeout to set another value in seconds. SybaseASE 11.9 provides server-based lock timeouts todetected lock errors. Do not use this variable forSybase ASE 11.9 environments.

syb_init

Driver resource syb_init

Environment variable -

Client/Server resource Set for server only

Type Integer

Default 01

Description You do not need to set this resource for Sybase ASE11.9 and higher. However, you must set this resourceto 0 (zero) for Sybase ASE 11.5.

Page 85: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix B: Database driver resources and environment variables

Installation and Administration Guide for Sybase

6-13

syb_lock_timeout

Driver resource syb_lock_timeout

Environment variable -

Client/Server resource Set for server only

Type Integer

Default 300

Description By default, the client library waits indefinately for arequest to complete. The BAAN IV database driver setsa timeout of 300 seconds by default. Use this resourcevariable to set the timeout to some other value inseconds. Avoid setting the timeout to zero (infinitewaiting). If the value is too low, spurious timeouts canresult, especially on a busy server.

ASE 11.9 provides server-based lock timeouts. In aSybase ASE 11.9 environment, this timeout is not usedfor the client library. Rather, this timeout is set insidethe server and is used to abort a command that failedto obtain a lock. The client library default timeout isused for ASE 11.9.

syb_login_timeout

Driver resource syb_login_timeout

Environment variable -

Client/Server resource Set for server only

Type Integer

Default 60

Description The default login timeout used in the client library is 60seconds. Use this variable to change the default logintimeout in seconds.

Page 86: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix B: Database driver resources and environment variables

Installation and Administration Guide for Sybase

6-14

syb_max_connections

Driver resource syb_max_connections

Environment variable -

Client/Server resource Set for server only

Type Integer

Default 25

Description By default, the client library allows 25 connections froma single process. This variable can be used to changethat value.

Page 87: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix B: Database driver resources and environment variables

Installation and Administration Guide for Sybase

6-15

syb_misc_options

Driver resource syb_misc_options

Environment variable -

Client/Server resource Set for server only

Type Integer (octal)

Default 0

Description Use this variable to specify various options for theBAAN IV database driver. These options are octalvalues, and multiple options can be specified byperforming an OR operation of individual values.

001 The value of 001 causes the BAAN IV databasedriver to execute the “set showplan on”statement at the start of each connection.Sybase ASE returns a query execution plan tothe BAAN IV database driver. The BAAN IVdatabase driver prints this information in thedbs.log file if the DBSLOG flag 01000 is set. Formore information on the dbs.log file, see theinformation on DBSLOG in the “Generic driverresources” section.

002 The value of 002 changes the default behaviorof the Sybase driver for network buffering. Bydefault, the BAAN IV database driver disablesTDS packet buffering in the Sybase clientlibrary. In most of the cases, this leads to betterperformance at the cost of higher networktraffic. This flag enables the buffering in clientlibrary and affects the client side but does notaffect the Sybase ASE. Sybase ASE also hasthe option to disable the buffering on the serverside by turning on the following configurationoption: tcp no delay.

004 The value of 004 causes the BAAN IV databasedriver not to force indexes for select queries (bydefault, Baan driver forces index on selectqueries). If stored procedures are created ontable when this flag is set, the procedures donot force an index in the query. For example, touse the Japanese language, the record shouldbe syb_national_language:japanese.

Page 88: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix B: Database driver resources and environment variables

Installation and Administration Guide for Sybase

6-16

syb_national_language

Driver resource syb_national_language

Environment variable -

Client/Server resource Set for server only

Type String

Default Not set

Description If this resource variable is set, the BAAN IV databasedriver uses the specified language for error messages.

SYBPROF

Driver resource -

Environment variable SYBPROF

Client/Server resource Set for server only

Type Floating point

Default Not set

Description When you specify a value for this variable, anystatement that takes more than the specified number ofseconds is logged. The maximum precision that youcan specify is 0.01 seconds. Use this variable todetermine which table actions are the most timeconsuming.

SYBSTAT

Driver resource -

Environment variable SYBSTAT

Client/Server resource Set for server only

Type Integer

Default Not set

Description This allows database driver statistics to be reported. Ifyou set this variable to a value n greater than zero,statistics are logged every n seconds while the driver isactive. If you set this variable to zero, a statistics reportis generated when the driver terminates.

Page 89: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix B: Database driver resources and environment variables

Installation and Administration Guide for Sybase

6-17

syb_tds_packet_size e

Driver resource syb_tds_packet_size

Environment variable -

Client/Server resource Set for server only

Type Integer

Default 512

Description This variable specifies the packet size, in bytes, of theTDS protocol used by the Sybase client library and theSQL server for communication. If you increase thepacket size, you can boost performance. If youincrease the client side packet size, also change theSybase ASE maximum packet size. Set the SybaseASE options max network packet size and defaultnetwork packet size to allow larger packets.

Sybase environment variables

The following Sybase variables can be set either as environment variables orspecified in the $BSE/lib/tabledef file. The latter method is preferred.

SYBASE is the directory where the Sybase RDBMS software is installed.

DSQUERY is the name of the Sybase server to be used. Make sure the value setfor this variable exists in the interface file.

See the Sybase RDBMS Installation and Administration Manuals for moreinformation about the interface file. If the interface file is not set, use the defaultname Sybase.

Page 90: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix B: Database driver resources and environment variables

Installation and Administration Guide for Sybase

6-18

Page 91: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Installation and Administration Guide for Sybase

7-1

The storage file provides a way to specify the distribution of table and index datain different segments. Storage parameters are used by the database driverwhenever a DDL statement such as a create table or create index statement isexecuted. The following is an example of an entry in the storage file:

SEGMENT tableseg LOCKMODE datapages

In this example, the database driver adds the following clause to the createstatement during index or table creation: in <tablespace name> index in <indextablespace name>. If the tablespace for a table or index is not specified, the tableand index data are created in the default segment. If index data is to be separated,a tablespace must be specified.

A storage file is defined for each database driver. The storage file for theBAAN IV Sybase database driver is called syb_storage and is located in thedirectory $BSE/lib/sybase.

The entries in the syb_storage file consist of fields that are the same for thestorage files for all database drivers and storage parameters that are specific tothe Sybase database driver. This appendix describes the fields that make up theentries in the syb_storage file.

Storage file formatThe storage file consists of one or more entries, each consisting of several fieldsseparated by colons. The format of an entry in the storage file is as follows:

[{<user list>}]<table/module specification>:<company number>:<object type>: <private |group>:<table/index optimization>:<refresh time>:<storage parameters>

The following describes each of the fields in an entry in the storage file.

7 Appendix C: Storage file format andconfiguration options

Page 92: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix C: Storage file format and configuration options

Installation and Administration Guide for Sybase

7-2

Storage file field descriptions

user list

Description This field consists of a list of comma-separated usernames to which this entry applies. When no list isspecified, the entry applies to all users.

Example {maria,john}

table/module specification

Description This field consists of a list of comma-separated tablenames or a module name to which the entry applies.An asterisk (*) indicates all tables.

Example ttadv000,ttadv999 two specific tables

ttadv all tables in module tt and packageadv

tt all tables in module tt

* all tables

company number

Description This field consists of a list of company numbers towhich the entry applies. An asterisk (*) indicates allcompany numbers.

Example 000,999 companies 000 and 999

* all companies

object type

Description This field consists of a list of object (table or index)identifications to which the entry applies. The followingoptions can be specified:

T table only

I all indexes

I <index number> only specified index

* both table and indexes

Example I1,I2 only index 1 and 2

T only for table

Page 93: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix C: Storage file format and configuration options

Installation and Administration Guide for Sybase

7-3

private | group

Description This field identifies the owner of the table. Either privateor group must be specified.

table/index optimization

Description Specific flags related to indexes and tables can bespecified. When specified on a T object entry, this fielddefines the default for all indexes.

The following octal values can be used to set the flagsfor a specific index or table:

0000 Use no optimization (no hash columns)

0001 Use single hash optimization

0010 Use stored procedure for singleton select onunique index

Default values can be defined for each table entry. Toset multiple options, the octal values can be OR’ed.

Example 0011

refresh time

Description This field specifies the amount of time (in seconds) thata retrieved dataset is considered valid. No fetch fromthe database will be made if the same request is madewithin this time. A value of 0 specifies no fetchoptimization.

Example 5

Page 94: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix C: Storage file format and configuration options

Installation and Administration Guide for Sybase

7-4

storage parameters

Description These parameters are defined by the specific databasedriver implementation and often map to table and indexcreation options available in the host RDBMS.

The following Sybase storage parameters are defined:

CURSROWCOUNT

The client library can provide buffering for rows. Whenperforming a fetch on a cursor, you can fetch multiplerows from the Sybase ASE to the client library internalbuffers. The subsequent fetchs return the data fromclient library buffers rather than the Sybase ASE. Thisparameter specifies the number of rows that the clientlibrary fetches internally if the BAAN IV database driverperforms a fetch on the cursor. The BAAN IV databasedriver still gets a single row but subsequent fetches getdata from the client library and not from the SybaseASE, which is faster. This functionality is useful whenfetch optimization is performed.

STATISTICS

This parameter enables the statistics feature of theBAAN IV database driver for the table. See the sectionon Tuning in Chapter 1 for more information.

PROFILE

This parameter enables the profiling by BAAN IVdatabase driver for this table. See the section onTuning in Chapter 1 for more information.

CLUSTERED

This parameter specifies that the primary index for thetable must be clustered. Although Sybase RDBMSallows any index of the table to be clustered, definitelykeep the most frequently used index as clustered. So,the BAAN IV database driver makes only the primaryindex clustered. If the primary index is double hashed,the ascending primary index is clustered. Use theSEGMENT parameter if the primary index is going tobe clustered.

ROWSPERPAGE

This parameter specifies the max_rows_per_pagefactor for table or indexes. When creating clusteredindexes, the BAAN IV database driver ignores thisparameter.

Note that max_rows_per_page and fillfactor aremutually exclusive parameters, so only specify one ofthese for an index.

Page 95: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix C: Storage file format and configuration options

Installation and Administration Guide for Sybase

7-5

FILLFACTOR

This parameter specifies the fill factor for the index.Note that fillfactor and max_rows_per_page aremutually exclusive parameters, so only specify one ofthese for an index.

PREFETCH

This parameter is used to specify a prefetch kilobytesize for a query. This action is used when the index isforced. The valid values are 2, 4, 8 or 16.

CACHE

This parameter is used to force a cache strategy, forexample, mru or lru in selects.

LOCKMODE

LOCKMODE is not used with Sybase ASE 11.5.

Sybase ASE 11.9 provides various locking modes fortables. The BAAN Sybase database driver usesdatarows locking mode as default when creating tables.The locking mode can be changed using theLOCKMODE option in the storage file. This optiontakes three values: allpages, datapages and datarow.Note that datarows is the default behavior.

Once a table is created with any lock mode, updatingthe storage file will not change the lock mode for thetable. After updating the storage file, the table must bedropped and recreated to change the lock mode.

SEGMENT

This parameter specifies the segment on which thetable or index should be placed.

Indexes can be located on a segment different from thesegment on which the table is created. The onlyexception is a clustered index which, by its nature,follows the table. Thus, if the table is created on onesegment, a clustered index is created on anothersegment, and the table is moved to the segment onwhich the index is created. To avoid this effect, theBAAN IV database driver always creates a clusteredindex on the same segment as that of the table.

For nonprimary indexes or for a nonclustered primaryindex, a SEGMENT other than table segment can beused.

Page 96: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix C: Storage file format and configuration options

Installation and Administration Guide for Sybase

7-6

Examples For nonprimary indexes or for a nonclustered primaryindex, a SEGMENT other than table segment can beused. Some examples are shown below:

tiitm001:*:T:group:0111:0:

tiitm001:*:I:group:0111:0:SEGMENT indexsegmentCLUSTERED

In the example above, the table and the primary indexare created on the default segment. Other indexes arecreated on the segment named indexsegment.

tiitm001:*:T:group:011:0:SEGMENT tablesegment

tiitm001:*:I:group:011:0:CLUSTERED SEGMENTindexsegment

In the example above the table and primary index arecreated on the segment named tablesegment. Otherindexes are created on the segment namedindexsegment.

tiitm001:*:T:group:01:0:SEGMENT tablesegment

tiitm001:*:I:group:01:0:SEGMENT indexsegment

In the example above, the table is created on thesegment named tablesegment. All indexes are createdon the segment named indexsegment.

The storage file is scanned from the beginning whenever a create table or createindex is performed. The first entry that matches the table or index is taken, so theorder in which the entries are specified is important. For example, the followingneeds to be changed in order to be Sybase examples:

{maria,john}ttadv999,ttadv000:000:T:private:011:5:SEGMENT mydatasegmentCLUSTERED{maria,john}ttadv999,ttadv000:000:I::011:5: SEGMENT myindexsegmenttdsfc:505:::011:5:*:*:T:group:011:5:SEGMENT datasegment CLUSTERED*:*:I:group:011::SEGMENT indexsegment

In the example above, the users maria and john will create tables ttadv999 andttadv000 of company 000 in segment mysegment. The associated indexes will becreated in segment myindexsegment, and index 1 will be a clustered index. Allusers creating tables in module tdsfc will create tables and indexes in the defaultsegment. Other users create tables and indexes in segments datasegment andindexsegment, respectively, with index 1 being a clustered index.

If the segment for a table or index is not specified, the table and index data arecreated in the default segment. If you want to separate the index data, you mustspecify a segment.

NOTE

NOTE

Page 97: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Installation and Administration Guide for Sybase

8-1

This chapter lists the SQL queries generated by the BAAN IV database driver forthe various selects. In the examples, the following table is used:

Table: t_byte, t_int, t_float, t_long, t_string, t_date,t_doublePrimary index: t_byte, t_intDuplicate index: t_long

The BAAN IV database driver uses the force index option of the Sybase ASEoptimizer and specifies the index name for select queries. When the duplicateindex has no hash optimization, it uses the primary index parts to force the selectorder.

No hash optimization

Unique index

SELECT_FIRST, SELECT_GTEQselect t_byte,t_int,t_float,t_long,t_string,t_date,t_double,t_Refcntd,t_Refcntufrom dbo.taabdb996000 (Index I1a )where t_byte > @kt_byte OR t_byte = @k2t_byte AND (t_int >= @kt_int)order by t_byte ,t_intat isolation 0

SELECT_NEXT, SELECT_GREATselect t_byte,t_int,t_float,t_long,t_string,t_date,t_double,t_Refcntd,t_Refcntufrom dbo.taabdb996000 ( Index I1a)where t_byte > @kt_byte OR t_byte = @k2t_byte AND (t_int > @kt_int)order by t_byte ,t_intat isolation 0

SELECT_EQUAL,select t_byte,t_int,t_float,t_long,t_string,t_date,t_double,t_Refcntd,t_Refcntufrom dbo.taabdb996000 ( Index I1a)where t_byte = @kt_byte AND t_int = @kt_intat isolation 0

8 Appendix D: BAAN IV Sybasedatabase driver SQL queries

Page 98: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix D: BAAN IV Sybase database driver SQL queries

Installation and Administration Guide for Sybase

8-2

SELECT_LAST, SELECT_EQLEselect t_byte,t_int,t_float,t_long,t_string,t_date,t_double,t_Refcntd,t_Refcntufrom dbo.taabdb996000 ( Index I1a )where t_byte < @kt_byte OR t_byte = @k2t_byte AND (t_int <= @kt_int)order by t_byte DESC,t_int DESCat isolation 0

SELECT_PREV, SELECT_LESSselect t_byte,t_int,t_float,t_long,t_string,t_date,t_double,t_Refcntd,t_Refcntufrom dbo.taabdb996000 ( Index I1a )where t_byte < @kt_byte OR t_byte = @k2t_byte AND (t_int < @kt_int)order by t_byte DESC,t_int DESC at isolation 0

SELECT_EQUAL_WITH_LOCKselect t_byte,t_int,t_float,t_long,t_string,t_date,t_double,t_Refcntd,t_Refcntufrom dbo.taabdb996000 ( Index I1a )where t_byte = @kt_byte AND t_int = @kt_intfor update at isolation 2

Duplicate Index

SELECT_FIRST, SELECT_GTEQselect t_byte,t_int,t_float,t_long,t_string,t_date,t_double,t_Refcntd,t_Refcntufrom dbo.taabdb996000 ( Index 2a)where t_long >= @kt_longorder by t_long ,t_byte, t_intat isolation 0

SELECT_GREATselect t_byte,t_int,t_float,t_long,t_string,t_date,t_double,t_Refcntd,t_Refcntufrom dbo.taabdb996000 (Index 2a)where t_long > @kt_longorder by t_long ,t_byte, t_intat isolation 0

SELECT_LAST, SELECT_EQLEselect t_byte,t_int,t_float,t_long,t_string,t_date,t_double,t_Refcntd,t_Refcntufrom dbo.taabdb996000 (3) where t_long <= @kt_long order by t_longDESC,t_byte DESC,t_int DESC

SELECT_LESSselect t_byte,t_int,t_float,t_long,t_string,t_date,t_double,t_Refcntd,t_Refcntufrom dbo.taabdb996000 (3) where t_long < @kt_long order by t_long DESC,t_byte DESC,t_int DESC

Page 99: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix D: BAAN IV Sybase database driver SQL queries

Installation and Administration Guide for Sybase

8-3

Single hash optimization

Unique index

SELECT_FIRST, SELECT_GTEQselect t_byte,t_int,t_float,t_long,t_string,t_date,t_double,t_Refcntd,t_Refcntu,hash1from dbo.taabdb996000 (Index I1a)where hash1 >= @khash1order by hash1at isolation 0

SELECT_NEXT, SELECT_GREATselect t_byte,t_int,t_float,t_long,t_string,t_date,t_double,t_Refcntd,t_Refcntu,hash1from dbo.taabdb996000 (Index I1a)where hash1 > @khash1order by hash1at isolation 0

SELECT_EQUALselect t_byte,t_int,t_float,t_long,t_string,t_date,t_double,t_Refcntd,t_Refcntu,hash1from dbo.taabdb996000 (Index I1a)where hash1 = @khash1at isolation 0

SELECT_LAST, SELECT_EQLEselect t_byte,t_int,t_float,t_long,t_string,t_date,t_double,t_Refcntd,t_Refcntu,hash1from dbo.taabdb996000 (Index I1a)where hash1 <= @khash1order by hash1 DESCat isolation 0

SELECT_PREV, SELECT_LESSselect t_byte,t_int,t_float,t_long,t_string,t_date,t_double,t_Refcntd,t_Refcntu,hash1from dbo.taabdb996000 (Index I1a)where hash1 < @khash1order by hash1 descat isolation 0

Page 100: Installation and Administration Guide for Sybase - Baan IV C Install and Admin Guide for... · Installation and Administration Guide for Sybase 1-1 This chapter describes the general

Appendix D: BAAN IV Sybase database driver SQL queries

Installation and Administration Guide for Sybase

8-4

SELECT_EQUAL_WITH_LOCKselect t_byte,t_int,t_float,t_long,t_string,t_date,t_double,t_Refcntd,t_Refcntu,hash1from dbo.taabdb996000 (Index I1a )where hash1 = @khash1for update at isolation 2

Duplicate index

SELECT_FIRST, SELECT_GTEQselect t_byte,t_int,t_float,t_long,t_string,t_date,t_double,t_Refcntd,t_Refcntu,hash2from dbo.taabdb996000 (Index 2a)where hash2 >= @khash2order by hash2at isolation 0

SELECT_NEXT, SELECT_GREATselect t_byte,t_int,t_float,t_long,t_string,t_date,t_double,t_Refcntd,t_Refcntu,hash2from dbo.taabdb996000 (Index 2a)where hash2 > @khash2order by hash2at isolation 0

SELECT_LAST, SELECT_EQLEselect t_byte,t_int,t_float,t_long,t_string,t_date,t_double,t_Refcntd,t_Refcntu,hash2from dbo.taabdb996000 (Index I2a)where hash2 <= @khash2order by hash2 descat isolation 0

SELECT_PREV, SELECT_LESSselect t_byte,t_int,t_float,t_long,t_string,t_date,t_double,t_Refcntd,t_Refcntu,hash2from dbo.taabdb996000 (Index 2a)where hash2 < @khash2order by hash2 descat isolation 0


Recommended