Ingres 0212
Ingres 0212
Ingres 0212
Chapter 1: Introduction
In This Guide................................................................................ 1–1
Intended Audience .......................................................................... 1–2
How This Guide Is Organized ................................................................ 1–3
Additional References ........................................................................ 1–4
Contents iii
Chapter 5: Using MK with Ingres
Introduction ................................................................................ 5–1
Defining the Database in MK ................................................................. 5–2
Linking Companies to Ingres ................................................................. 5–3
Optimizing Database Structure ............................................................... 5–5
Chapter 8: Troubleshooting
Introduction ................................................................................ 8–1
Error Mapping and Reporting ................................................................ 8–2
Timeout and Deadlocking Problems .......................................................... 8–6
Contents v
Chapter
Introduction
1
In This Guide
This document provides information specific to the Ingres database driver for
MK (Manufacturing Knowledge). The Ingres database driver serves as the
connecting layer between the Ingres database and MK.
This guide describes installation and maintenance of the Ingres database driver,
and provides guidelines for using it in an Ingres environment and for optimizing
its performance.
Introduction 1–1
Intended Audience
Intended Audience
This guide is intended for system administrators and system programmers who
are responsible for installing and maintaining the Ingres database, the Ingres
database driver, and MK. Before using this guide, you should be familiar with
the following:
■ Operating system and common commands (or the POSIX shell if installing
on a POSIX-compliant system)
■ System administration tools
■ Ingres database and Ingres documentation
■ Structured Query Language (SQL)
■ MK concepts (such as users, companies, etc.)
■ Menu navigation skills
Introduction 1–3
Additional References
Additional References
Related documentation is listed below:
Ingres Installation and Operation Guide
Getting Started with Ingres II
Ingres Database Administrator’s Guide
Hardware and operating system documentation
Introduction
Using MK with Ingres involves a communication layer referred to as the
database driver. The database driver is designed to meet the specific needs of a
particular database management system, so the MK application can operate in
the same manner regardless of the database environment. To this end, the driver
allows MK to access data stored in an Ingres database.
MK Shell
Database Driver
SQL/Fastpath I-Record
Ingres
Database
Dynamic SQL
Dynamic SQL is used to perform database actions. When a user requests table
actions (for example, create table or drop table) the database driver generates an
SQL statement and executes the statement with any input parameters.
Fastpath API
Fastpath API calls are substituted for dynamic SQL whenever possible to reduce
the time and effort needed to satisfy a database request.
If execution is successful, the driver passes the results and requested data back to
MK by way of the indexed record (I-Record). If the operation fails, an error code
is generated and passed back to MK.
Key Files
In addition to the files Ingres requires, an MK installation uses several key files
to manage access to the database. These files are shown in the diagram below
and described in the table that follows. The files are discussed in greater detail
in the “Maintaining Driver Files” chapter.
tabledef6.0
oping_users ipc_info
Ingres oping_groups MK
Database oping_storage
Not
Specific to the
Database
Ingres Driver
Specific
In addition, MK uses the files below to link tables to a particular database driver
and to identify the communication protocol to be used between the shell and
driver:
For additional information about these and other MK files, refer to the MK
System Administrator’s Guide.
Introduction
This chapter contains an overview of how to configure Ingres for MK. The first
part of this chapter describes how to do this in the UNIX environment, and the
second part of this chapter describes how to do this in the Windows NT
environment.
Disk Requirements
Consider the following when using an Ingres database:
If you have multiple disks, you can reduce input/output bottlenecks by careful
software placement. The following graphic illustrates some possible
configurations.
Disk 1 Disk 2
MK Users
UNIX or NT Data
2 Disk
System Ingres
Ingres log
Checkpoints
Checkpoints
Checkpoints
The first two steps are described in this section. Steps 3 and 4 are discussed in
the following chapters and should be performed as part of your post-installation
process.
Before You Begin Before installing the Ingres database driver, the Ingres database must be
installed. If the Ingres database is not installed on your system, follow the
instructions below.
Installing Ingres
Install Ingres using the standard database installation instructions for your
system. Make a note of the setting of the UNIX environment variable
II_SYSTEM for later reference. Note that the release of Ingres you are installing
uses shared (dynamically linked) libraries. The shared library path environment
variable for your operating system must be defined in your environment before
attempting to use Ingres or the Ingres driver and utilities.
The shared library environment variable for the HP-UX system is SHLIB_PATH.
For AIX, the shared library environment variable is LIBPATH. For DEC, Sun,
and Linux, the shared library environment variable is LD_LIBRARY_PATH.
These environment variables must be set for all MK users who need to access
Ingres through the MK driver. You can set the variables quickly in the tabledef
file for those users. Run the Maintain Database Definitions (ttaad4110m000)
session and specify the SHLIB_PATH variable in the parameter field as follows:
II_SYSTEM=<Ingrespath>,SHLIB_PATH=/lib:$II_SYSTEM/ingres/lib
Here is an example:
II_SYSTEM=/disk2/Ingres,SHLIB_PATH=lib:$II_SYSTEM/ingres/lib
Substitute the location of your Ingres system files for <ingrespath> in the
parameter line. For complete instructions on defining the Ingres database in
MK, refer to the “Using MK with Ingres” chapter.
Once you have entered the parameter field in the Maintain Database Definitions
(ttaad4110m000) session, save your changes and run the Convert to Runtime
Data Dictionary (ttaad4200m000) session to update the tabledef file. Exit MK.
The next time you start MK, Ingres will be accessible through the driver.
Note: Refer to the “Using MK with Ingres” chapter for information on how to
access the Maintain Database Definitions (ttaad4110m000) and Convert to
Runtime Data Dictionary (ttaad4200m000) sessions.
During the installation, you will need to set values for a number of parameters.
Use the table below to set the recommended values for Ingres installation
parameters. These parameters are organized according to their stage in the
installation. You can configure some of these values at install time or any of
them (except character set) after installation with the cbf utility.
After you install Ingres, you need to configure it for MK. This section describes
what you need to do, including:
■ Configure installation
■ Create Ingres users
■ Create the Ingres database for MK
■ Verify the Ingres installation
■ Install the MK Ingres driver
■ Map MK users to Ingres databases
For an initial installation, all users are mapped to a single database. The
database administrator (DBA) of this database and the name of the database
must be the same (for example, mk). (The DBA of all Ingres databases used by
MK must be a user with the same name as the database.) This section
summarizes the steps you need to take before installing the MK Ingres driver.
You are running the ACCESSDB program. In this program, you can control
access to INGRES, specify which databases may be accessed by which
Authorized Identifiers (users or public) and display summary information about
all users or databases. In addition, you can add Location Name to MK and extend
databases to other areas (disk volumes or directories). This Ingres installation
has been configures to use case insensitive delimited usernames. Your effective
INGRES username is ingres.
User Name
$Ingres
bill
bap
frank
Ingress
bsp
bsp
mmx01
root
The following steps verify that the Ingres database has been installed correctly:
1. Make sure you are logged in as ingres.
2. Enter the following command:
sql iidbdb
4. Verify that the users root, bsp, and mk exist as Ingres users. At the prompt
(*), type:
select name from iiuser order by name\g\q
Executing. . .
name
——————————
bsp
ingres
mk
root
(4 rows)
Once you have defined users to Ingres and created the Ingres database, you need
to install the Ingres database driver:
1. Use the su command to become the root user:
su root
4. This must be done after installation because the last step of the installation
process changes the file ownership to bsp. Verify the file permissions you
have set. The permissions should be:
-rwsr-x--- 1 root bsp (size) (date) oping_exec6.0
5. Add the ingres user to the bsp group in the /etc/groups file (if you have not
already done so).
6. Exit the shell started by su.
exit
7. Log in as ingres.
Note: On some System V-based operating systems, you may need to use the
newgrp bsp command to change your primary group after logging in.
8. Run the oping_inst6.0 script as shown below to link MK to Ingres:
oping_inst6.0
The next step is to add all of your users to the mmx group. To do this, use the
oping_admin6.0 administration tool.
1. Enter the following command:
oping_admin6.0
M A I N M E N U
Add all of the Ingres users that you created when setting up the database.
Specify the user name and then the group name you entered previously. Do
not attempt to add user mmx to the group.
For more information about the user, group, and storage files, refer to
the“Maintaining Driver Files” chapter.
Next Step
Refer to the MK Installation and Update Guide for information about how to
complete the installation and about the activities you should perform after
installing MK. Before creating tables, refer to the following “Mapping MK to
Ingres” and “Using MK with Ingres” chapters.
Use the table below to set the recommended values for Ingres installation
parameters. These parameters are organized according to their stage in the
installation. You can configure some of these values at install time or any of
them (except Character Set) after installation with the cbf utility.
The following steps verify that the Ingres database has been installed correctly:
1. Make sure you are logged in as ingres.
2. Enter:
sql iidbdb
Successful execution of this statement verifies the following:
■ Ingres has been installed
■ The Ingres executables are in your path
■ The environment variable II_SYSTEM is set
■ The Ingres database server is running
3. Verify that the mandatory users, mkadmin and mk, exist as Ingres users. At
the prompt (*), type:
select name from iiuser order by name\g\q
Executing. . .
name
——————————
mkadmin
ingres
mk
(3 rows)
4. If you wish to modify any settings, for instance to enable Ingres journaling,
you should modify the %BSE%\lib\openingres\oping_storage file. You
should review these settings before creating tables for your Ingres
companies.
The next step is to add all of your MK users to group mk. To do this use the
administration tool oping_maint directly from the command line. Use the syntax
shown for the following maintenance options:
For more information about the user, group, and storage files, see the
“Maintaining Driver Files” chapter.
Mapping MK to Ingres
4
Mapping MK to Ingres
4
Introduction
Before creating tables for MK, you should be familiar with certain MK
requirements. This chapter discusses the mapping between MK and Ingres for:
■ Tables
■ Indexes
■ Columns
■ Data types
MK stores table columns and index information in its data dictionary. The
Ingres driver uses this information for various database actions. However, the
Ingres driver cannot use this information directly because fields in MK use
certain characters that are invalid for Ingres and some data types (such as date)
are represented differently in MK and Ingres.
In order to store and/or write the MK data, the driver maps the information into
a format suitable for Ingres. All Ingres database actions use this mapped
information.
For example, MK table name tiitm001 with company number 100 has the
corresponding Ingres table ttiitm001100. Note that the company number always
contains three digits, using zeros if necessary.
The Ingres driver adds the owner name to a private table name to differentiate
the private table from the group table in the same database.
Table Name MK
ttiitm001100 table: tiitm001
company number: 100
package code: ti
group table
bobttiitm001100 table: tiitm001
company number: 100
package code: ti
private table created by user bob
If you do not SELECT the index optimization technique for an index and that
index is a duplicate, a pseudo column named t_sequence is created. This column
is added to the index to make the index unique.
If the data dictionary field has a depth greater than 1, each depth is a separate
Ingres column. If the data dictionary type is BDB_ARRAY, each of the Ingres
columns is named using the corresponding depth. For example, if data
dictionary field ctod has depth 7, there are seven Ingres columns with names
t_ctod_1, t_ctod_2, ...t_ctod_7. If the data dictionary type is not BDB_ARRAY,
each Ingres column takes the corresponding data dictionary field name.
Ingres does not allow a period (.) as part of a column name. Therefore, if a data
dictionary field name contains a period, the period is replaced by the underscore
character (_) in the corresponding Ingres column name.
A hash column is created when the table has index optimization. For more
information on index optimization, refer to the “Tuning” chapter.
The hash column name contains its corresponding index number. When single
column index optimization is used, there is a single hash column per index. The
column name is hash<index number> (for example, hash1, hash2). Thus, hash1 is
created for index 1, and hash2 for index 2.
When double index column optimization is used, two hash columns are created
per data dictionary index, one of which is in ascending order and the other in
descending order. For the ascending order column, the naming convention is
the same as the single index column optimization convention. For the
descending order column, the name has a “d” suffix. Thus, for index 1, hash
column names are hash1 and hash1d.
Note: If the table owner name length would cause the index name to exceed its
32 character maximum, the owner name is truncated.
With single or no index optimization, the index ordering can be ascending only.
Also, the primary key is part of the base table structure. If the primary key has
either single or no index optimization, only the ascending index is created. This
is part of the base table structure. All other indexes are named with the naming
convention described in the previous example, depending on their index
optimization level.
Using the previous example as a model, if the primary index has single or no
index optimization, index 2 has double index optimization, and index 3 has
single or no index optimization, then the indexes have the following names:
Index Name
Index 1 Ascending index not named as it is part of base table
structure.
There is no descending index.
Index 2 tiitm0011002ammx (ascending)
tiitm0011002dmmx (descending)
Index 3 tiitm0011003ammx (ascending)
There is no descending index.
If the primary index has double index optimization, the ascending index is part
of the base table structure. The descending index (created in ascending order on
descending hash columns) has the following name:
<package><table name><company number><i#><sort><owner>
Index Name
Index 1 Ascending index not named as it is part of base table
structure.
tiitm0011001dmmx (descending)
Index 2 tiitm0011002ammx (ascending)
tiitm0011002dmmx (descending)
Index 3 tiitm0011003ammx (ascending)
There is no descending index.
If an index consists of many fields, the size of the hash column equals the total of
the sizes required for each field. For example, if the index consists of a long field
size of 5 and a char field size of 1, the hash column size is 6. If the index has
single index optimization, there is one hash column. For indexes with double
index optimization, two such columns are created.
Index Ordering
Index Uniqueness
All indexes built by the Ingres driver are unique with the no duplicate clause if
the user does not select the index optimization option for the index. For all
duplicate indexes (according to the MK data dictionary), the driver internally
adds a system-maintained table key to all user-defined index columns and
makes the index unique. A system-maintained table key is a type of unique
number generated by Ingres.
If the user selects index optimization, the primary index parts are added to the
duplicate index; this makes the index unique.
Field Numbering
The field number of each field in an index is stored as part of the Ingres index
information. If a field having a depth greater than 1 is part of the index, Ingres
uses the following logic:
A field having a depth of n creates n columns in the Ingres table. For
example, if field 3 in the data dictionary has a depth of 3, it creates 3 fields in
the Ingres table—field 3, field 4, and field 5.
If this field is part of the index, the index description contains all
corresponding Ingres field numbers; in this example, 3, 4, and 5.
The index length includes the length of each of these fields.
When the index is created, the corresponding field name is used for each field
number.
Data Types
The following table shows the mapping between MK and Ingres data types:
MK Ingres
BDB_CHAR integer1
BDB_ENUM integer1
BDB_SHORT smallint (integer2)
BDB_LONG integer4
BDB_MAIL integer4
BDB_TIME integer4
BDB_TEXT integer4
BDB_BITSET integer4
BDB_DATE date
BDB_FLOAT float4
BDB_DOUBLE float8
BDB_STRING char
Dates
In MK, the date data type is stored as the number of days from the year 0001.
Ingres stores a date as the number of days since January 1, 1582. Conversion
from the MK date to the Ingres date involves getting the day of the month, the
month, and the year from the MK date (using the MK function) and passing
these to an Ingres function that returns a corresponding Ingres date.
Conversion from Ingres to MK follows the reverse path. In MK, date 0 means
that the date is not specified. In this case, minimum values are used to create the
Ingres date:
day of month = 1,month = 1,year = 1582
Similarly, when the following is retrieved from Ingres, the MK date is set to zero:
day of month = 1,month = 1,year = 1582
Strings (char)
The MK BDB_STRING data type is mapped to the Ingres char data type. When
storing data for type char, Ingres may strip trailing blanks to save disk space.
When retrieving the data, the Ingres driver replaces the blanks before passing
the data back to the user. You never see this truncation.
Introduction
You need to add or modify some MK data before you can create any Ingres
tables:
1. Add Ingres as a database in the Maintain Database Definitions
(ttaad4110m000) session.
2. Create at least one company with the Maintain Companies (ttaad1100m000)
session.
3. Link the company to the Ingres database with the Assign Tables to
Databases (ttaad4111m000) session.
4. Run the Convert to Runtime Data Dictionary (ttaad4200m00) session.
After you have completed these steps, you can post data to the Ingres database.
Note: Run the MK-Ingres binaries and the Ingres database at matching patch
levels. Check the binary patch level information for UNIX from the output after
using the “-v” option. Use properties/version to check the Windows NT binary
patch level.
Make sure that the company you want to create has been entered in the
company tables.
2. If Ingres has not been added already, add Ingres as a database in the
Maintain Database Definitions (ttaad4110m000) session. Refer to the
previous section, Defining the Database in MK.
3. Run the Assign Tables to Databases (ttaad4111m000) session to specify that
the database for the company is Ingres.
5. Log in as ingres.
6. Run sysmod to modify the database:
sysmod iidbdb
sysmod mk
Introduction
Normally, all Ingres users share tables and must have specific privileges to
access these tables. There are three files used to assign these privileges to MK
driver users and to link MK driver users to Ingres databases:
■ oping_users (user file)
■ oping_groups (group file)
■ oping_storage (storage file)
User Administration
MK users are mapped to Ingres databases or ‘groups’. Each group can have
many users. When creating a user, the group to which the user belongs is also
specified. An MK group maps a user to an Ingres database. All objects in the
database are owned by the database administrator (DBA).
Creating Databases
In Ingres, any properly authorized user can create a database. The user is the
owner and has DBA privileges. A user can create and own more than one
database. The objects can be accessed using dot notation, as in the following
examples:
mk.ttiitm001100
frank.ttccom001200
However, because the LOCK TABLE command does not support the dot
notation, private tables can be created with the user name included in the table
name (such as frankttccom001200). This avoids using the dot notation and
makes the names unique. Group tables are created the normal way, without
user names. Refer to the Table Names section in the “Mapping MK to Ingres”
chapter.
User File
The user file contains information about all MK users who may access Ingres
tables. This information is stored in the $BSE/lib/openingres/oping_users file.
Each line in this file is made up of four fields, separated by a colon (:).
For example:
Group File
The group file contains information about Ingres groups in MK optimization.
These groups specify the name of the database in which MK optimization finds
the Ingres tables. This information is stored in
$BSE/lib/openingres/oping_groups. Each line in this file is made up of two
fields, separated by a colon (:). For example:
mk:GP'8!a'o(V<>!IhY'5gapjx-YuXw5A_a
Group Name. The group name should be a valid Ingres database name with
the DBA name the same as the database name.
Storage File
The storage file contains information about the storage structure of MK
optimization and Ingres tables, and specifies various object parameters. The
Ingres driver refers to this file when creating objects and executing queries. For
each table, you can specify whether it is a private or group table by using the
private and group keywords.
For example:
tiitm001:999:T:group:1:10:STRUCTURE btree nojournaling
*:*:T:group:1:10:STRUCTURE btree nojournaling
*:*:I::1::STRUCTURE btree
Field Description
User Table information can be linked to a specific user by indicating the user’s login
name in braces ({}). Specifications then only apply to the defined user. A list of
users separated by commas (,) can also be specified. For example:
{frank,brad,will}.....
If a user is not specified, the information applies to all users.
Module/Table name Specifies the MK table. Available options are:
■ * (all tables in all modules)
■ All tables in a module, specified by the 5-letter package/module code (for
example, tfacp, tdsls)
■ Module code and table number (for example, tiitm005, tccom001)
You can specify several table names, separated by commas.
Company number Specifies the company number. Available options are:
■ * (all company numbers)
■ Specific company number (3 digits)
You can specify several company numbers, separated by commas.
Field Description
Entry/Object type Indicates the object the line relates to:
■ Table and all indexes (*)
■ Table only (T)
■ All indexes of the table (I)
■ One or more indexes of the table (In, where n is the number of the index)
You can specify a list of indexes, separated by commas, for example, I1,I2.
Owner type Specifies whether the table belongs to a single person or to a group. The
following options are available:
■ Private (the table belongs to a single person)
■ Group (the table can be accessed by the entire group)
Owner type only relates to tables; when used for an index, it is ignored.
Index optimization Specifies the index optimization level:
1 = Single index optimization.
2 = Double index optimization.
The index optimization level changes row size and may add extra secondary
indexes requiring more disk space.
Note: Currently only single index optimization is supported.
Refresh time By setting a refresh time (in seconds) you determine the validity period of a
query’s result set. You can only have refresh time for tables; for indexes it is
ignored. The default value is 10.
You can change refresh time to control fetch optmization and caching.
Storage Specifies the table’s storage structure.
Refer to the “Table and Index Parameters” appendix for a complete list of the
storage types and parameters used to create tables in the UNIX environment.
Note: Only btree storage structure is supported.
Note: While editing the storage parameter file, make sure that all lines end with
a new line character.
Maintenance Tools
You can maintain the user, group, and storage files with a special administration
tool. Depending on the user interface you want to use, you can access this tool in
several ways. To maintain the driver files, you can use any of the following:
− Interactive utility ( in the UNIX environment)
Enter the oping_admin6.0 command
− Command line utility
Enter the oping_maint6.0 command
− MK optimization sessions in package tt, module dba (refer to the next
section, MK Optimization Sessions)
Before maintaining users and groups, the corresponding group database should
be created.
Note: To use any of the UNIX administration utilities, you must be logged in as
user ingres (in the UNIX bsp group). Before adding groups or users with these
tools, they must be defined as valid UNIX and Ingres users. The user
administration options only manage table permissions.
From this menu, select the appropriate sessions for adding, removing, and
reporting user and group information and for editing and viewing the storage
file. For information on how to use these sessions, refer to the online help for
individual sessions and to the documentation for the implementation functions
Ingres Database Driver Management (coms8700) and Ingres Database
Administration (com8701).
Note: To access a menu using the P function, you must add a sequence number
to the menu number to distinguish members of parallel menu sets. This number
displays on the top-right corner of the menu. To access the menu above, press P
from any menu and enter mttdba1000m0001. The last digit, the added sequence
number, represents menu one of two.
M A I N M E N U
6. List users
7. List groups
8. List storage
9. Enter Shell
E Exit
Choice: 5
From this menu, select the operation you want to perform. Descriptions of these
options follow.
Add User to Group This option adds the user to the oping_users file and grants the user access to all
group tables using the following Ingres command:
ALTER USER <user> WITH PROFILE=<profile name>
Enter the group and MK optimization user name (this is the same as the Ingres
user name). The following restrictions apply:
■ The group should exist in the group file oping_groups.
■ The user name cannot be an existing group name or the same as the DBA
name; the user name must be known to the Ingres DBMS (accessdb).
■ The Ingres user should have access to the group database.
■ The MK optimization user should not already exist in the user file.
If any of the above checks fail, then the operation fails with an appropriate error
message. Otherwise, the user is granted permissions on the group tables and
added to the user file.
For administrator-level privileges, the user can access help from Ingres utilities,
such as accessdb.
Remove User from This option revokes all privileges to group tables for a user and automatically
Group deletes the user’s line in oping_users. It runs the following Ingres command:
ALTER USER <user> WITH NOPROFILE
The name of the user is the MK optimization user name; you cannot use
wildcards. If the MK optimization user does not exist in the user file, then the
operation fails and gives an appropriate error message. Otherwise, the user is
disassociated with the Ingres profile having privileges on the group tables, and
the user’s entry is deleted from the user file. After removing the user, the DBA
should revoke the user’s access permissions to Ingres.
Add Group This option adds the group to the oping_groups file. The following restrictions
apply:
■ No group or Ingres user should exist with the same name as the group
name.
■ The group must be a valid Ingres database name.
■ The database for the group must exist.
Remove Group This option deletes a group from the oping_groups file. The following
restrictions apply:
■ The group should exist in the group file.
■ A group can only be deleted if it does not contain any users. This option
only deletes a line from oping_groups; it does not delete the group’s tables
or the Ingres login name.
Edit Storage This option allows you to edit the storage file using the vi editor.
Information
List Users This option lists all the users in the oping_users file. For each user, this option
displays the MK optimization name, and the Ingres name and group.
List Groups This option lists all groups in the oping_groups file, including each group name
(database) and all of its users.
List Storage This option retrieves information for a table or index from the oping_storage file.
Enter the following values (no blanks or wildcards allowed):
■ User name (UNIX)
■ Table name
■ Company number
Object Description
T Table information, as well as information for all indexes on
those tables, is displayed.
I The information for all indexes on that table is displayed.
In The information for a specific index (such as I4) is displayed.
For user ‘bsp1,’ table ‘tiitm998,’ company number ‘000,’ and object ‘I,’ the default
index specifications are shown first, then the index specifications for I1, I2, and I3
are shown.
Enter Shell This option creates a child shell. When you log out of that shell (using exit or
Ctrl-D), you return to the main menu.
Exit Exits the maintenance utility and returns you to the UNIX shell.
Disassociates a user from the group profile and automatically deletes the user’s
line in oping_users.
⇒ To add a group:
oping_maint6.0 -A <group> [-B <$BSE path>]
⇒ To remove a group:
oping_maint6.0 -D <group> [-B <$BSE path>]
Revokes all privileges to group tables for the group and automatically deletes
the group’s entry in oping_groups.
⇒ To list users:
oping_maint6.0 -l [-B <$BSE path>]
Lists all the users in the oping_users file. For each user, displays the MK
optimization name, and Ingres name and group.
⇒ To list groups:
oping_maint6.0 -L [-B <$BSE path>]
Lists all groups in the oping_groups file, including each group name and all of
its users.
Introduction
This chapter tells you how to tune and maintain the Ingres database.
Since this is an administrative step, MK services should be turned off when you
run these commands.
You may need to stop the Ingres RMCMD process. For more details, refer to the
Ingres Database Administrator’s Guide.
Rebalancing
You should periodically re-balance the b-tree structure in tables that are
relatively dynamic, such as tdsls045 (sales orders), tisfc001(production orders),
and tiitm001 (item master). The frequency with which you should perform this
task and the tables to which this procedure applies vary with each
implementation of MK.
You can apply the oping_modify utility to individual company tables or a list of
tables:
oping_modify –B –Ntdsls045 –p<package combination>
–C500
oping_modidfy –B –I<tablelist> -p<package combination> -C500
Checkpointing
Use the rollforwarddb utility to recover from online checkpoints. You can use
the infodb and auditdb utilities to display journaling information.
Refer to your Ingres System Reference Guide for instructions on these utilities.
The checkpoint, journal and audit locations are generally specified when Ingres
is installed.
If for some reason, you expect a table to grow beyond this Ingres 2 GB limit, you
need to request an alteration to the storage structure for the table so the table
spans multiple locations.
Remember that you must perform this editing for both the base table
specification and the indices.
4. Modify the %BSE%\lib\openingres\oping_storage file to reflect the
multiple locations. This text should be added at the top of the file, not the
bottom:
tdinv800:500:T:group:1:10:STRUCTURE btree LOCATION (ii_database,
ii_database_1)
tdinv800:500:I::1::STRUCTURE btree LOCATION (ii_database, ii_database_1)
5. Use the accessdb Ingres utility to specify the new database location,
ii_database_1, for Ingres. This is a two-part process described more fully in
the Ingres Database Administrators Guide. Basically, using accessdb, the
administrator:
■ Requests to create the location (ii_database_1), specifying the folder
where the secondary location is to be located and the flags to associate
with the location (for example, journaling). You can specify the file
location (or area) of the database as an explicit NT folder location, or you
can use the Iingres utility, ingsetenv, to specify an Ingres environmental
variable (for example, II_DATABASE) that specifies the location area.
■ After the location is defined, use the Databases, Extend option of
accessdb to add the new “database” location to the Ingres database (for
example, mk).
6. Perform the copy.out part of the conversion:
sql mk –umk < copy.out
7. If step 6 completes successfully, then you can drop the existing table:
sql mk –umk
drop table ttdinv800500\g
\q
8. Perform the copy.in step to re-create the table and its indices:
sql mk –umk < copy.in
Troubleshooting
8
Troubleshooting 8–i
Chapter
Troubleshooting
8
Introduction
This chapter provides tips for troubleshooting in the MK Ingres environment. It
includes information about database errors and some potential solutions to
specific problems.
Troubleshooting 8–1
Error Mapping and Reporting
However, some Ingres errors do not have corresponding MK error codes. These
codes are passed back to MK after adding 1000 to the absolute value of the error
code.
The Ingres driver logs each error that it encounters into a log file called
$BSE/log/log.ingres. Analyze any errors using this file along with other log files
and $II_SYSTEM/ingres/files/errlog.log from Ingres.
Driver Errors
If an error code greater than 1000 is returned, you can determine the nature of
the error using the following methods:
Ingres error - 1000 = Database error
Note: When a fatal error occurs, more information is stored in the log files in the
$BSE/log directory. For example, if bdbpost6.0 causes an error, this is reported
in the log.bdbpost6.0 file. The log files are very useful for tracking down the
cause of errors.
Database Errors
Troubleshooting 8–3
Error Mapping and Reporting
Troubleshooting 8–5
Timeout and Deadlocking Problems
Database Tuning
You can reduce locking and timeout problems by periodically tuning your Ingres
database. Refer to Chapter 7, “Tuning the Ingres Database,” for more
information.
You can also use Ingres to set up row level locking for some highly used tables.
Refer to Appendix E, “Row Level Locking,” for more information.
When testing these database changes, the test database should be representative
of your production database. For example, if you expect 100 concurrent users on
the production database and are doing benchmarks with 30 concurrent users, the
benchmark database should be at least one third of the size of the eventual
production database.
Similarly, if you expect production users to choose among 500 items or 250
suppliers, the test database should have a proportionate number of items and
suppliers. If users are all using the same item or supplier during benchmark
testing, the benchmark will show more locks and deadlocks than production.
Making the pilot database as representative as possible will help ensure the
reliability of the results.
Executables
The files listed in the table below are the Ingres executables used by MK.
Driver Files
The files listed below are the MK Ingres driver files.
In addition to specifying the database driver as Ingres, you can use this file to
assign values to driver environment variables such as:
Variable Description
II_SYSTEM This variable identifies one instance of an Ingres
installation on a system. It should contain the full
path name of the Ingres installation directory.
When starting the Ingres driver, the MK shell reads
and sets this environment variable so that the Ingres
driver uses the corresponding installation.
ING_TIMEOUT The number of seconds that a statement should be
retried before timing out when a resource lock is
encountered.
MMX_PREFETCH The number of rows to prefetch:
1—no prefetch of rows.
0—the database determines the number of rows to
prefetch.
>1—indicates the number of rows to prefetch.
ING_LOCKMODE The level of locking. Set to row for row-level (record-
level) locking. The default is page-level locking.
UNIX Example In this UNIX example, table tiitm990xxx (all companies) is in the Ingres database;
all tiitm999xxx tables are on the system darkman; and tiitm055xxx tables are
created in INFORMIX, Ingres, and on the remote machine, Viper. All other
tables are in Ingres.
tiitm990:*:ingres(II_SYSTEM=/disk1,ING_TIMEOUT=10):N
tiitm999:*:darkman
tiitm055:*:informix&ingres&viper
*:*:ingres(II_SYSTEM=/darktools):N
For more information about defining databases and the tabledef6.0 file, refer to
the “Managing Databases” chapter in MK System Administrator’s Guide.
Windows NT Example In this example, all tables and all companies (represented by *:*) are in the Ingres
database, which is installed on drive E of the server star. The Audit Trail is set to
No.
*:*:ingres(II_SYSTEM=e:\oping):N
For more information about defining databases and the tabledef6.0 file, see
System Administrator’s Guide, Volume 2, Database Management.
1 2 3 4 5 6
For more information about defining databases and the ipc_info file, refer to the
“Managing Databases” chapter in MK System Administrator’s Guide.
Table Parameters
The table parameters below can be controlled through this storage file.
Parameters can be specified in any order or combination. Some parameters
require keywords that can be typed in either uppercase or lowercase as follows:
STRUCTURE/structure
LOCATION/location
NOJOURNALING/nojournaling
JOURNALING/journaling
DUPLICATE/duplicate
NODUPLICATE/noduplicate
INDEX/index
NOINDEX/noindex
FILLFACTOR/fillfactor*
ORDER/order*
MINPAGES/minpages*
MAXPAGES/maxpages*
LEAFFILL/leaffill*
NONLEAFFILL/nonleaffill*
NOCOMPRESSION/nocompression*
COMPRESSION/compression*
Note: The parameters marked with an asterisk (*) should be used only when
modifying an existing table using oping_modify.
List of Parameters
The following describes each table or index parameter and provides examples of
their usage:
In this example, table ‘tiitm998’ for all company numbers is created with the
btree structure. Indexes for this table are also created with the btree structure.
The default storage structure, written by oping_inst6.0, for the table created by
the Ingres driver is btree.
LOCATION Specifies the location where the new table is created. The location name(s) must
be defined on MK, and the database must have been extended to the
corresponding area(s). If no location name is specified, the default area for the
database is assumed.
{bob}tiitm998:*:T:group:1:10:STRUCTURE btree \
LOCATION (location1, location2 )
NOJOURNALING Indicates that journaling should be disabled for the table(s). This is the default.
{bob}tiitm998:*:T:group:1:10:STRUCTURE btree \
LOCATION (location1, location2 ) NOJOURNALING
JOURNALING Ingres uses a circular log file. To save your transaction log records, use the
Ingres journaling facility. Each database has its own journal files, if journaling is
enabled. The default is nojournaling.
{bob}tiitm990:*:T:group:1:10:STRUCTURE btree \
LOCATION (location1, location2 ) JOURNALING
The journal file contains a record of all changes (insert, update, and delete) made
to that database since the last checkpoint was taken. The archiver process
(dmfacp) removes completed transactions from the transaction log file and
writes them to the corresponding journal files for the database. This facility is
especially useful after a disk crash to reconstruct the table. It can also log the
history of changes made to the table.
DUPLICATE Indicates whether the table can contain duplicate rows. It cannot be used with a
heap storage structure. The default is noduplicate.
NODUPLICATE Indicates that the table cannot contain duplicate rows. It cannot be used with a
heap storage structure. The default is noduplicate.
{bob}tiitm990:*:T:group:1:10:STRUCTURE btree \
LOCATION ( location1, location2 ) NODUPLICATE
INDEX Use I to refer to an index. Specify the base table structure and index table
structure for the table. Enter the following lines in oping_storage:
{bob}tiitm999:000:T:group:1:10:STRUCTURE btree \
LOCATION ( location1, location2 )
{bob}tiitm999:000:I::1::STRUCTURE btree
Then run oping_modify6.0 to modify the base table structure from heap to
another structure type (such as btree) and to create all indexes.
For the fastest loading of bulk data, use bdbpost –f. This creates tables and
inserts rows immediately without creating the indexes on the tables. The
example that follows illustrates this strategy.
Assume you are creating table ‘ttiitm999000’ from a sequential dump called
‘tiitm999.dump’. Use the information below to avoid creating an index.
■ Enter the following lines in the oping_storage file:
{bob}tiitm999:000:T:group:1:10:STRUCTURE btree
LOCATION ( location1, location2 ) NOINDEX
■ Run bdbpost:
bdbpost6.0 -C100 < tiitm999.dump
FILLFACTOR Specifies the percentage (1 to 100) of each primary data page that should be filled
with rows under ideal conditions.
{bob}tiitm998:*:T:group:1:10:STRUCTURE btree \
FILLFACTOR 80
FILLFACTOR does not have any effect when a new empty table is created, but it
can be used to reorganize the table when doing housekeeping activity.
Note: Be careful when using fillfactors. Large ones can overflow the data pages
and degrade performance for a non-uniform key distribution.
Below are the default FILLFACTOR values for different storage structures:
LEAFFILL Specifies the maximum percentage value to fill index leaf pages. Leaf index
pages are the index pages directly above the data pages. The default value is
70%. This parameter only applies to the btree structure.
{bob}tiitm998:*:T:group:1:10:STRUCTURE btree \
LEAFFILL 80
NONLEAFFILL Specifies the maximum percentage value to fill non-leaf index pages. These are
the pages above the leaf pages. The default value is 80%. This parameter applies
only to the btree structure.
{bob}tiitm998:*:T:group:1:10:STRUCTURE btree \
NONLEAFFILL 70
{bob}tiitm998:*:I:group:::STRUCTURE btree \
NONLEAFFILL 70
NOCOMPRESSION Specifies no key and data compression. This is the default behavior of the
driver.
{bob}tiitm998:*:T:group:1:10:STRUCTURE btree \
NONLEAFFILL 70 NOCOMPRESSION
The following table lists the valid types of compressions for Ingres storage
structures:
Parameter Recommendation
Log buffers Set to 32. Increasing the log buffers improves logging
efficiency but may increase log fragmentation.
Log buffer size Set to 8. Increasing the log buffers improves logging
efficiency but may increase log waits.
Note: The server options listed here are for a 128 Ingres user server. Trace
points QS510 and DM420 have played a key role in determining the appropriate
settings. For more information about these parameters, refer to Ingres Systems
Reference Guide.
The following parameter values are only recommendations and may not be
optimal for your system. Consult an Ingres DBA for configuring specific
parameters for your system.
Parameter Recommendation
connect_limit 3 to 5 times the number of MK users.
fast_commit Set this parameter to reduce writes from Ingres transaction log file to
disk. It cannot be used in a VAXcluster installation, but it may be used
on any node of the cluster with a non-clustered Ingres installation. It
compliments the write_behind and shared_cache options.
write_behind Set to 4. Spreads I/O over time by asynchronously writing “dirty” pages
(modified pages that have not been written) to the databases. It speeds
work at consistency points by reducing the work to be done and is
usually used with fast_commit. If write_behind is set too high, your
system can become I/O bound. If write_behind is set too low, your DMB
cache may occasionally fill up.
qsf_pool_size Set to 7,800,000. The default is 100 kb+ (session x 40 kb). Use the QS510
trace point to determine usage.
The MK driver takes advantage of repeated queries. A large cache is
highly recommended. Use this calculation for optimal performance: 100
kb+ (session x 60 kb)
dmf_group_size Set to 16. Represents the size of group buffers used in read-ahead
operations.
Parameter Recommendation
dmf_group_count Set this to (number of sessions/4). The number of sessions can be
considered to be the same as the connect_limit.
dmf_cache_size Set to 8192. The default is (128 kb+ 4 x sessions). You should increase
this value, if memory permits, to improve server efficiency and to lower
disk I/O. Use QS510 and DM420 to determine the optimal number.
To figure the size of the DMF cache, note that the unit is 2K pages, so a
cache of size 8192 takes up 16 MB of shared memory. To reach the screen
where this parameter can be changed in CBF, select DBMS Server,
Configure, Cache, 2K cache, Configure, Derived. Do not let
dmf_wb_start get greater than 1500 and do not let dmf_wb_end get
greater than 1000 as these are computed from dmf_cache_size. Change
their values manually if needed.
dmf_count_read_ahead Set to 128. This is the maximum number of group buffers. Group buffers
are used when chunks of data are selected.
dmf_size_read_ahead Set to 32. Should be set to 64 if using a 64-bit machine. Any size larger
than 32 on a 32-bit machine may cause bit masking information to be lost.
The DMF marks the last bit when the page is used. This is the group
buffer size in pages; a reasonable starting value is 16; if many locations
are used, 32 might be more appropriate.
dmf_wb_start Set to the value to start flushing dirty pages (such as 4,000).
dmf_wb_end Set to the value to end flushing dirty pages (such as 1,600).
dmf_mlimit Set to the maximum number of modified pages.
rdf_memory Set to 50% of qsf_pool_size (such as 4,000,000). The RDF facility caches
table structure information. Most queries access this facility twice before
any database manipulation. Use the QS510 trace point to determine RDF
hits and increase or decrease memory size as necessary.
rdf_max_tbls Set to the number of tables to cache. In this example, the recommended
setting is 2,560.
rdf_max_cols Set to the average number of columns in tables. Recommended setting is
30.
qef_qep_size Use the trace point QS510 to find the optimum setting. In this example,
the recommended setting is 8,192. The default is 2560.
These utilities require the standard MK connect mechanism, which are the
remote user files, %BSE%/lib/user/r<user>. You can use the MK
camk3rem.exe utility to create these files. The MK installation process generally
creates these files for mkadmin on the application server. It is important that for
a particular user that r<user> files are created on both the application and
database servers. The first r<user> file allows the application server to connect
to the database server in order to start the proper database driver. The second
r<user> is required to allow the database driver running on the database server
to access %BSE%/lib/user/u<user> files on the application server. Generally, it
is only necessary to create the pair of r<user> files for user mkadmin. If another
user wants to run these utilities, he can force the USER to mkadmin:
set USER=mkadmin
bdbpost -k -n -c402 –y<MK system name> -F tables.pre
There is an option available for these utilities to specify the database driver to be
used for the utility. For example:
bdbpost -d ingres -n -c402 –y<MK system name> -F tables.pre
Do not use this option on the application server unless the specified database
driver exists and is runnable on the application server.
OPING_MODIFY.EXE Utility
This utility is always run on the database server. It needs to access u<user>
information, which exists only on the application server. Therefore, the setup
must include not only specifying the user and having a r<user> file, but also
specifying the application server node for the application. Therefore, the usual
calling sequence for this utility in a dual server environment is:
set USER=mkadmin
set BS_HOST=APP
oping_modify -B –I <tablelist> -C402
GENLIST_OPING.CMD Utility
This utility is run on the database server. It generates a list of tables belonging to
a particular company.
We recommend that an entire company not have row level locking turned on. It
is better to turn row level locking on for selected tables with heavy usage. Some
examples are tcmcs047, tdsls045, tdpur045.
Before You Begin It is strongly recommended that you back up the Ingres database.
2. Shutdown Ingres and restart to apply the changes made using cbf.
For a Single Server In the parameter field, add the following to the end of the data already in the
Environment field. If no data is in the parameter field, add the following line without the first
comma:
,ING_LOCK_MODE=row,MMX_PREFETCH=1
where
■ server name — name of the machine on the network. The name returned by
the hostname works.
■ MK system id — name assigned to the MK installation. On UNIX, it is the
token passed as the –r parameter to MKspwnsrvr6.0. On NT, it is defined in
the registry under the
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\"MK
Server" \Systems key.
■ Ingres path — the path into the Ingres installation.
■ The following example shows table tcmcs047 in company 200 only will
have journaling turned on and a page size of 4096:
tcmcs047:200:T:group:1:10:STRUCTURE btree LEAFFILL 80 PAGESIZE 4096
journaling
tcmcs047:200:I::1::STRUCTURE btree LEAFFILL 80 PAGESIZE 4096
Any special oping_stroage lines must be added before the default lines of:
*:*:T:group:1:10:STRUCTURE btree nojournaling
*:*:I::1::STRUCTURE btree