Informix 9.x System Admin Guide
Informix 9.x System Admin Guide
Dynamic Server
Administrator’s Guide
Version 9.4
March 2003
Part No. CT1UCNA (Volume 1) and CT1SXNA (Volume 2)
Note:
Before using this information and the product it supports, read the information in the appendix
entitled “Notices.”
This document contains proprietary information of IBM. It is provided under a license agreement and is
protected by copyright law. The information contained in this publication does not include any product
warranties, and any statements provided in this manual should not be interpreted as such.
When you send information to IBM, you grant IBM a nonexclusive right to use or distribute the information
in any way it believes appropriate without incurring any obligation to you.
© Copyright International Business Machines Corporation 1996, 2003. All rights reserved.
US Government User Restricted Rights—Use, duplication or disclosure restricted by GSA ADP Schedule
Contract with IBM Corp.
List of Chapters
List of Chapters v
vi IBM Informix Dynamic Server Administrator’s Guide
Table of
Contents
Table of Contents
Introduction
In This Introduction . . . . . . . . . . . . . . . . . 3
About This Manual . . . . . . . . . . . . . . . . . . 3
Types of Users . . . . . . . . . . . . . . . . . . 3
Software Dependencies . . . . . . . . . . . . . . . 4
Assumptions About Your Locale. . . . . . . . . . . . 4
Demonstration Database . . . . . . . . . . . . . . 5
New Features in Dynamic Server, Version 9.4 . . . . . . . . 6
Database Server Usability Enhancements . . . . . . . . . 6
Security Enhancements . . . . . . . . . . . . . . . 7
Features from Dynamic Server 9.3 . . . . . . . . . . . 7
Features from Dynamic Server 9.21 . . . . . . . . . . . 9
Organizational Changes to This Manual Since Version 9.2 . . . . 9
Documentation Conventions . . . . . . . . . . . . . . 10
Typographical Conventions . . . . . . . . . . . . . 10
Icon Conventions . . . . . . . . . . . . . . . . . 11
Sample-Code Conventions . . . . . . . . . . . . . . 12
Additional Documentation . . . . . . . . . . . . . . . 13
Related Reading . . . . . . . . . . . . . . . . . . . 15
Compliance with Industry Standards . . . . . . . . . . . 16
IBM Welcomes Your Comments . . . . . . . . . . . . . 16
Section I The Database Server
Chapter 1 Installing and Configuring the Database Server
In This Chapter . . . . . . . . . . . . . . . . . . . 1-5
Planning for the Database Server . . . . . . . . . . . . . 1-6
Considering Your Priorities . . . . . . . . . . . . . 1-6
Considering Your Environment . . . . . . . . . . . 1-7
Configuring the Operating System . . . . . . . . . . . . 1-7
Configuring Windows Memory . . . . . . . . . . . 1-8
Modifying UNIX Kernel Parameters . . . . . . . . . . 1-8
Allocating Disk Space . . . . . . . . . . . . . . . . 1-8
Using Large Chunks . . . . . . . . . . . . . . . 1-9
Creating Chunk Files on UNIX . . . . . . . . . . . . 1-9
Providing NTFS Partitions in Windows . . . . . . . . . 1-10
Setting Permissions, Ownership, and Group . . . . . . . 1-10
Creating Standard Device Names . . . . . . . . . . . 1-11
Setting Environment Variables . . . . . . . . . . . . . 1-12
Setting GLS Environment Variables . . . . . . . . . . 1-13
Setting Environment Variables on UNIX . . . . . . . . . 1-14
Setting Environment Variables on Windows . . . . . . . 1-15
Configuring Connectivity . . . . . . . . . . . . . . . 1-16
The sqlhosts File on UNIX . . . . . . . . . . . . . 1-16
The sqlhosts Registry on Windows. . . . . . . . . . . 1-17
Configuring Connectivity Using ISA . . . . . . . . . . 1-17
Configuring the Database Server . . . . . . . . . . . . . 1-18
Preparing the ONCONFIG Configuration File . . . . . . 1-18
Using Server Setup in ISA to Customize Your Configuration. . 1-20
Using IBM Informix Server Administrator to Update
the ONCONFIG File . . . . . . . . . . . . 1-20
Using the Instance Manager to Create a New
Database Server Instance . . . . . . . . . . . 1-21
Configuring Java Support . . . . . . . . . . . . . . 1-21
Starting and Administering the Database Server . . . . . . . 1-22
Starting the Database Server and Initializing Disk Space . . . 1-22
Preparing for Automatic Startup . . . . . . . . . . . 1-23
Preparing to Connect to Applications . . . . . . . . . 1-25
Creating Storage Spaces and Chunks . . . . . . . . . . 1-25
Supporting Large Chunks. . . . . . . . . . . . . . 1-26
Setting Up Your Backup System and Storage . . . . . . . 1-26
Table of Contents ix
Logging Parameters . . . . . . . . . . . . . . . . . 2-6
Logical Log . . . . . . . . . . . . . . . . . . . 2-6
Physical Log Parameters . . . . . . . . . . . . . . 2-7
Backup and Restore Parameters. . . . . . . . . . . . 2-7
Message-Log Parameters . . . . . . . . . . . . . . . 2-8
Shared-Memory Parameters . . . . . . . . . . . . . . 2-9
Shared-Memory Size Allocation . . . . . . . . . . . 2-9
Shared-Memory Space Allocation . . . . . . . . . . . 2-10
Shared-Memory Buffer Control . . . . . . . . . . . . 2-11
SQL Statement Cache Usage . . . . . . . . . . . . . 2-11
Decision-Support Parameters . . . . . . . . . . . . . . 2-12
Database Server Process Parameters . . . . . . . . . . . 2-13
Virtual Processor Parameters. . . . . . . . . . . . . 2-13
Time Intervals . . . . . . . . . . . . . . . . . . 2-14
Restore Parameters . . . . . . . . . . . . . . . . . 2-14
High-Availability Data-Replication Parameters . . . . . . . . 2-15
Event-Alarm Parameters . . . . . . . . . . . . . . . 2-15
Dump Parameters . . . . . . . . . . . . . . . . . . 2-16
Specialized Parameters . . . . . . . . . . . . . . . . 2-16
Auditing Parameters . . . . . . . . . . . . . . . 2-17
Optical Media Parameters. . . . . . . . . . . . . . 2-17
UNIX Parameters . . . . . . . . . . . . . . . . 2-17
Monitoring Configuration Information . . . . . . . . . . 2-18
Table of Contents xi
Create sysmaster Database and Prepare SMI Tables . . . . . 4-11
Create the sysutils Database . . . . . . . . . . . . . 4-12
Monitor Maximum Number of User Connections . . . . . 4-12
Database Server Operating Modes . . . . . . . . . . . . 4-12
Changing Database Server Operating Modes . . . . . . . . 4-14
Users Permitted to Change Modes . . . . . . . . . . . 4-14
ISA Options for Changing Modes . . . . . . . . . . . 4-15
On-Monitor Options for Changing Modes . . . . . . . . 4-16
Command-Line Options for Changing Modes . . . . . . . 4-16
Table of Contents xv
Properties of Table Types . . . . . . . . . . . . . . 9-40
Temporary Tables . . . . . . . . . . . . . . . . 9-42
Tblspaces . . . . . . . . . . . . . . . . . . . . . 9-45
Maximum Number of Tblspaces in a Table . . . . . . . . 9-46
Table and Index Tblspaces . . . . . . . . . . . . . 9-46
Extent Interleaving . . . . . . . . . . . . . . . . 9-48
Table Fragmentation and Data Storage . . . . . . . . . . . 9-49
Amount of Disk Space Needed to Store Data . . . . . . . . 9-49
Size of the Root Dbspace . . . . . . . . . . . . . . 9-49
Amount of Space That Databases Require . . . . . . . . 9-52
Disk-Layout Guidelines . . . . . . . . . . . . . . . . 9-52
Dbspace and Chunk Guidelines. . . . . . . . . . . . 9-53
Table-Location Guidelines . . . . . . . . . . . . . 9-54
Sample Disk Layouts . . . . . . . . . . . . . . . . . 9-55
Logical-Volume Manager . . . . . . . . . . . . . . . 9-60
Appendix A Notices
Index
Introduction
In This Introduction . . . . . . . . . . . . . . . . . . 3
About This Manual . . . . . . . . . . . . . . . . . . . 3
Types of Users . . . . . . . . . . . . . . . . . . . 3
Software Dependencies . . . . . . . . . . . . . . . . 4
Assumptions About Your Locale . . . . . . . . . . . . . 4
Demonstration Database . . . . . . . . . . . . . . . 5
Additional Documentation . . . . . . . . . . . . . . . . 13
Related Reading . . . . . . . . . . . . . . . . . . . . 15
Compliance with Industry Standards. . . . . . . . . . . . . 16
IBM Welcomes Your Comments . . . . . . . . . . . . . . 16
This section discusses the organization of the manual, the intended audience,
and the associated software products that you must have to use the database
server.
Types of Users
This manual is written for the following users:
■ Database users
■ Database administrators
■ Database server administrators
■ Performance engineers
Introduction 3
Software Dependencies
This manual is written with the assumption that you have the following
background:
Software Dependencies
This manual is written with the assumption that you are using IBM Informix
Dynamic Server or IBM Informix Dynamic Server with J/Foundation,
Version 9.4, as your database server.
The examples in this manual are written with the assumption that you are
using the default locale, en_us.8859-1. This locale supports U.S. English
format conventions for date, time, and currency. In addition, this locale
supports the ISO 8859-1 code set, which includes the ASCII code set plus
many 8-bit characters such as é, è, and ñ.
If you plan to use nondefault characters in your data or your SQL identifiers,
or if you want to conform to the nondefault collation rules of character data,
you need to specify the appropriate nondefault locale.
Demonstration Database
The DB-Access utility, which is provided with your Informix database server
products, includes one or more of the following demonstration databases:
The scripts that you use to install the demonstration databases reside in the
$INFORMIXDIR/bin directory on UNIX and in the %INFORMIXDIR%\bin
directory on Windows.
Introduction 5
New Features in Dynamic Server, Version 9.4
The ability to clean buffers faster because “Number of Pages Added to the
of acceptance of decimals in the LRU MLRU Queues” on page 7-38.
configuration parameters.
The ability to use chunks and extents to a “Using Large Chunks” on page 1-9.
maximum size of 4 terabytes. “Creating Storage Spaces and
Chunks” on page 1-25.
“Supporting Large Chunks” on
page 1-26.
“Chunks” on page 9-6.
“Sample Layout When Performance Is
Highest Priority” on page 9-56.
“Sample Disk Layouts” on page 9-55.
Security Enhancements
Version 9.4 adds the encryption communication support module (ENCCSM),
which enables you to encrypt data transmissions over the network. This
option provides complete data encryption with the OpenSSL library, with
many configurable options.
This product includes software developed by the OpenSSL Project for use in
the OpenSSL Toolkit. (http://www.openssl.org/).
Performance Enhancements
Version 9.3 includes many new features that help you monitor and improve
the performance of your database.
Introduction 7
Features from Dynamic Server 9.3
SQL Enhancements
Version 9.4 includes several new SQL statements that ease migration from
non-Informix databases to Dynamic Server, Version 9.4.
Features Reference
Introduction 9
Documentation Conventions
Documentation Conventions
This section describes the conventions that this manual uses. These
conventions make it easier to gather information from this and other volumes
in the documentation set.
Typographical Conventions
This manual uses the following conventions to introduce new terms,
illustrate screen displays, describe command syntax, and so forth.
Convention Meaning
italics Within text, new terms and emphasized words appear in italics.
italics Within syntax and code examples, variable values that you are
italics to specify appear in italics.
monospace Information that the product displays and information that you
monospace enter appear in a monospace typeface.
KEYSTROKE Keys that you are to press appear in uppercase letters in a sans
serif font.
Icon Conventions
Throughout the documentation, you will find text that is identified by several
different types of icons. This section describes these icons.
Comment Icons
Comment icons identify three types of information, as the following table
describes. This information always appears in italics.
Icon Description
E/C
Identifies information that is specific to IBM Informix
ESQL/C
UNIX
Identifies information that is specific to the UNIX
operating system
Windows
Identifies information that applies to all Windows
environments
Introduction 11
Sample-Code Conventions
Compliance Icons
Compliance icons indicate paragraphs that provide guidelines for complying
with a standard.
Icon Description
ANSI
Identifies information that is specific to an ANSI-compliant
database
Sample-Code Conventions
Examples of SQL code occur throughout this manual. Except where noted,
the code is not specific to any single IBM Informix application development
tool. If only SQL statements are listed in the example, they are not delimited
by semicolons. For instance, you might see the code in the following
example:
CONNECT TO stores_demo
...
COMMIT WORK
DISCONNECT CURRENT
To use this SQL code for a specific product, you must apply the syntax rules
for that product. For example, if you are using DB-Access, you must delimit
multiple statements with semicolons. If you are using an SQL API, you must
use EXEC SQL at the start of each statement and a semicolon (or other appro-
priate delimiter) at the end of the statement.
Tip: Ellipsis points in a code example indicate that more code would be added in a
full application, but it is not necessary to show it to describe the concept being
discussed.
Additional Documentation
IBM Informix Dynamic Server documentation is provided in a variety of
formats:
Introduction 13
Additional Documentation
Windows The following items appear in the Informix folder. To display this
folder, choose Start➞Programs➞Informix➞ Documentation Notes
or Release Notes from the task bar.
Related Reading
For a list of publications that provide an introduction to database servers and
operating-system platforms, refer to your Getting Started Guide.
Introduction 15
Compliance with Industry Standards
■ The name and version of the manual that you are using
■ Any comments that you have about the manual
■ Your name, address, and phone number
This address is reserved for reporting errors and omissions in our documen-
tation. For immediate help with a technical problem, contact Customer
Services.
You can customize the database server so that it functions optimally in your
particular data-processing environment. For example, using a database
server to serve 1000 users who execute frequent, short transactions is very
different from using a database server to serve a few users making long and
complicated searches.
When you are planning for your database server, consider your priorities and
your environment.
Insufficient memory for the database server can result in excessive buffer-
management activity. When you set the Virtual Memory values in the System
application on the Control Panel, ensure that you have enough paging space
for the total amount of physical memory.
If the recommended values for the database server differ significantly from
your current environment, consider modifying your operating-system
configuration. For more information, see your Performance Guide.
On some operating systems, you can specify the amount of shared memory
allocated to the database server. The amount of available memory influences
the values that you can choose for the shared-memory parameters in your
configuration file. In general, increasing the space available for shared
memory enhances performance. You might also need to specify the number
of locks and semaphores.
For background information on the role of the UNIX kernel parameters, see
Chapter 8, “Managing Shared Memory.”
To activate the creation of large chunks. you must use the onmode utility. The
onmode utility uses a -BC flag to control the availability of large chunks,
chunks greater than 2 gigabytes.
When the database server is first migrated to version 9.4, large chunks are not
allowed. You must first run onmode -BC 1 to allow large chunks to be
created. However, the server continues to write small chunks to dbspaces
and blobpages in version 9.3 and earlier previous formats. The server writes
to that dbspace or blobspace in the 9.4 version format only when a large
chunk is added to a dbspace or blobspace.
The database server uses raw disk access to improve the speed and reliability
of disk I/O operations. Raw disk access bypasses the file-buffering
mechanism that the operating system provides. The database server itself
manages the data transfers between disk and memory. The database server
optimizes table access by guaranteeing that rows are stored contiguously.
Important: It is strongly recommended that you use raw disk devices on UNIX to
achieve better performance.
Cooked Files
If optimum performance is unimportant, you can configure the database
server to store data in cooked files. Cooked files are easier to set up than raw
disk devices.
If all of your partitions are FAT partitions, you need to convert at least one
partition to NTFS. You can use the Windows convert utility, as the following
example shows:
convert /fs:ntfs
UNIX On UNIX, the owner and group must be informix, and the permissions must
be set to read and write for both user and group (but not for others).
If you want users other than informix or root to execute ON-Bar commands,
create a bargroup group. Only members of bargroup can execute ON-Bar
commands. The bargroup group is not created automatically during
database server installation. For instructions on creating a group, see the
IBM Informix Dynamic Server Installation Guide for UNIX and Linux or your UNIX
documentation. ♦
Execute the UNIX command ls -l on your device directory to verify that both
the devices and the links exist. The following example shows links to raw
disk devices. If your operating system does not support symbolic links, you
can use hard links.
ls -l
crw-rw--- /dev/rxy0h
crw-rw--- /dev/rxy0a
lrwxrwxrwx /dev/my_root@->/dev/rxy0h
lrwxrwxrwx /dev/raw_dev2@->/dev/rxy0a
Figure 1-1 shows the environment variables that you must set before you
access the database server or perform most administrative tasks.
Figure 1-1
Required Environment Variables
CLASSPATH If you are using J/Foundation, specifies the location of jvphome/krakatoa.jar file
so that Java Development Kit (JDK) can compile the Java source files.
INFORMIXDIR Specifies the directory where you installed your Informix database server.
INFORMIXSERVER Specifies the name of the default database server. It has the value specified for the
DBSERVERNAME or DBSERVERALIASES configuration parameter.
JVPHOME If you are using J/Foundation, specifies the directory where you installed the
IBM Informix JDBC Driver.
(1 of 2)
ONCONFIG Specifies the name of the active ONCONFIG file. All users who use database
server utilities such as onstat must set the ONCONFIG environment variable.
Users running client applications do not need to set the ONCONFIG environment
variable.
If the ONCONFIG environment variable is not present, the database server uses
configuration values from the onconfig file:
On UNIX: $INFORMIXDIR/etc/onconfig
On Windows: %INFORMIXDIR%\etc\onconfig.std
TERM Enables DB-Access to recognize and communicate with the terminal that you are
using. This environment variable is not required for initialization, but it must be
set before you can run an application.
TERMCAP Specifies whether DB-Access should use the information in the termcap file or the
TERMINFO terminfo directory. If required for your system, you might need assistance from the
INFORMIXTERM UNIX system administrator to set these variables because they are highly system
dependent.
(2 of 2)
For more information, see the IBM Informix GLS User’s Guide.
Figure 1-2 shows a sample setup file that contains environment variables for
the miami database server. LD_LIBRARY_PATH is set to the location of the
database server and ESQL/C library files.
Figure 1-2
setenv INFORMIXDIR /ix/informix93 Sample Setup File
setenv INFORMIXSQLHOSTS /ix/sqlhosts.unified
setenv ONCONFIG onconfig.miami
setenv INFORMIXSERVER miami
setenv LD_LIBRARY_PATH
$INFORMIXDIR/lib:$INFORMIXDIR/lib/esql:/usr/lib
For more information, see the IBM Informix Guide to SQL: Reference and
“Creating an ONCONFIG File on Windows” on page 1-19.
Configuring Connectivity
The connectivity information allows a client application to connect to any
Informix database server on the network. The connectivity data for a
particular database server includes the database server name, the type of
connection that a client can use to connect to it, the host name of the computer
or node on which the database server runs, and the service name by which it
is known.
You must prepare the connectivity information even if the client application
and the database server are on the same computer or node.
You do not need to specify all possible network connections in the sqlhosts
file or registry before you initialize the database server. But to make a new
connection available, you must take the database server offline and then
bring it back to online mode once again.
If you set up several database servers to use distributed queries, use one of
the following ways to store the sqlhosts information for all the databases:
■ In one sqlhosts file, pointed to by INFORMIXSQLHOSTS
■ In separate sqlhosts files in each database server directory
Use a text editor or ISA to edit the sqlhosts file. For more information, see
“Configuring Connectivity Using ISA” on page 1-17.
Network-Configuration Files
In addition to the sqlhosts files, TCP/IP connections require entries in the
/etc/hosts and /etc/services files. For IPX/SPX connections, the names of the
auxiliary files depend on the hardware vendor.
Network-Security Files
Informix database servers follow UNIX security requirements for making
connections. Thus, the UNIX system administrator might need to make
modifications to the /etc/passwd, etc/hosts, ~/.rhosts, and other related files.
The template files contain initial values for many of the configuration param-
eters. You can use a text editor or ISA to change the configuration parameters
in your ONCONFIG file.
Important: Do not modify or delete the template files. The database server provides
these files as templates and not as functional configuration files.
If you omit parameters in your copy of the ONCONFIG file, the database server uses
values in the onconfig.std file for the missing parameters during initialization.
1. Start your web browser and open the URL for ISA:
http://<hostname><domain_name>:port_number/
If you did not install or start ISA, see your Installation Guide for
directions.
2. Log in with the username and password that you provided during
installation.
3. On the main page, select the database server name.
4. From the ISA server view page, click Server Setup.
1. In ISA, display the setup file and edit the environment variables.
2. Select the database server name.
3. In ISA, display the ONCONFIG file and modify specific configuration
parameters.
ISA automatically updates your ONCONFIG file.
4. Shut down and restart the database server for the changes to take
effect.
If starting a new database server, use the oninit command with the -i flag to
initialize the disk space and bring the database server online. ♦
Windows On Windows, the database server runs as a service. Use the Service control
application to bring the database server to online mode. To initialize the
database server, click the Dynamic Server service and enter -iy in the Startup
Parameters box.
Warning: When you initialize disk space, all of the existing data in the database
server is destroyed. Initialize disk space only when you are starting a new database
server.
To prepare the UNIX startup script, add UNIX and database server utility
commands to the UNIX startup script so that the script performs the
following steps.
ISA provides a sample UNIX script for startup and shutdown that you can
customize in $INFORMIXDIR/etc/ids-example.rc.
■ DB-Access
■ SQL Editor
■ IBM Informix ESQL/C
■ IBM Informix ODBC Driver
■ IBM Informix JDBC Driver
For information about creating databases, see IBM Informix Database Design
and Implementation Guide and IBM Informix Guide to SQL: Tutorial. For infor-
mation about how to use client applications, see the IBM Informix DB-Access
User’s Guide, IBM Informix ESQL/C Programmer’s Manual, IBM Informix ODBC
Driver Programmer’s Manual, or IBM Informix JDBC Driver Programmer’s Guide.
Tip: To take advantage of the large limit of 4 terabytes per chunk, assign a single
chunk per disk drive. This way of distributing data increases performance.
After the database server is initialized, you can create storage spaces such as
dbspaces, blobspaces, or sbspaces. Use the onspaces utility or ISA to create
storage spaces and chunks.
You must create an sbspace if you are using the following functions:
For a description of storage spaces and other physical units such as tblspaces
and extents, refer to Chapter 9, “Data Storage,” For a discussion of the
allocation and management of storage spaces, refer to “Disk-Space Param-
eters” on page 2-4 and Chapter 10, “Managing Disk Space.”
For more information, see the IBM Informix Dynamic Server Enterprise Repli-
cation Guide and J/Foundation Developer’s Guide.
You can test your data in the onmode -BC 1 mode. When you are satisfied that
your data has converted correctly, then you can run onmode -BC 2 and
thereby put the server in large -chunk-only mode.
Setting Up ontape
If you use ontape as your backup tool, you must set up storage devices (tape
drives) before you can back up and restore data. The ontape utility does not
require a storage manager.
ON-Bar is packaged with IBM Informix Storage Manager (ISM). The storage
manager is an application that manages the storage devices and media that
contain backups. The storage manager handles all media labeling, mount
requests, and storage volumes. ISM can back up data to as many as four
storage devices at a time. ISM stores data on simple tape drives, optical disk
devices, and file systems. However, you can purchase a third-party storage
manager if you want to use more sophisticated storage devices, backups to
more than four storage devices at a time, or backups over a network.
When you plan your storage-space and logical-log backup schedule, make
sure that the storage devices and backup operators are available to perform
backups. For information about configuring and managing storage devices
and media, refer to the IBM Informix Storage Manager Administrator’s Guide or
to your third-party storage-manager documentation.
How often you back up the storage spaces depends on how frequently the
data is updated and how critical it is. A backup schedule might include a
complete (level-0) backup once a week, incremental (level-1) backups daily,
and level-2 backups hourly. You also need to perform a level-0 backup after
performing administrative tasks such as adding a dbspace, deleting a logical-
log file, or enabling mirroring.
Back up each logical-log file as soon as it fills. You can back up these files
manually or automatically. For information on using ON-Bar and ontape, see
the IBM Informix Backup and Restore Guide.
Using Mirroring
When you use disk mirroring, the database server writes data to two
locations. Mirroring eliminates data loss due to storage device failures. If
mirrored data becomes unavailable for any reason, the mirror of the data is
available immediately and transparently to users. For information on
mirroring, refer to Chapter 17, “Mirroring.” For instructions on tasks related
to mirroring, see Chapter 18, “Using Mirroring.”
Important: It is recommended that you mirror critical dbspaces that contain logical-
log files, the physical log, and the root dbspace.
When the database server starts up, it checks whether the physical log is
empty, because that implies that it shut down in a controlled fashion. If the
physical log is not empty, the database server automatically performs an
operation called fast recovery. Fast recovery automatically restores databases
to a state of physical and logical consistency after a system failure that might
have left one or more transactions uncommitted.
■ Changing the size or number of buffers (by changing the size of the
logical-log or physical-log buffer, or changing the number of buffers
in the shared-memory buffer pool)
■ Changing shared-memory parameter values, if necessary
■ Changing forced residency (on or off, temporarily or for this session)
■ Tuning checkpoint intervals
■ Adding segments to the virtual portion of shared memory
■ Using the SQL statement cache to reduce memory usage and prepa-
ration time for queries
For information on how the database server uses shared memory, refer to
Chapter 7, “Shared Memory.” For additional information, refer to “Shared-
Memory Parameters” on page 2-9 and Chapter 8, “Managing Shared
Memory.”
Tip: You cannot use HDR and Enterprise Replication on the system at the same time.
Enterprise Replication
Enterprise Replication supports asynchronous data replication over
geographically distributed database servers and allows you to replicate both
entire databases and subsets of databases and tables. Enterprise Replication
offers limited support of user-defined data types. For detailed information on
Enterprise Replication, see the IBM Informix Dynamic Server Enterprise Repli-
cation Guide.
Using Auditing
If you intend to use database server auditing, you need to specify where
audit records are stored, how to handle error conditions, and so on. You also
might want to change how users are audited if you suspect that they are
abusing their access privileges. For information on tasks related to auditing,
refer to “Auditing Parameters” on page 2-17 and the IBM Informix Trusted
Facility Guide.
For more information on distributed queries, see the IBM Informix Database
Design and Implementation Guide and IBM Informix Guide to SQL: Tutorial.
Event alarms ✔ ✔
Message log ✔ ✔
ON-Monitor ✔
oncheck utility ✔ ✔
onperf utility ✔
onstat utility ✔ ✔
SMI tables ✔ ✔
System console ✔ ✔
Event Alarms
To report situations that require your immediate attention, the database
server uses the event-alarm feature. To use the event-alarm feature, set the
ALARMPROGRAM configuration parameter to the full pathname of an
executable file that performs the necessary administrative actions.
For more information, see the appendix on event alarms and the chapter on
configuration parameters in the Administrator’s Reference.
For more information on ISA, see the utilities chapter in the Administrator’s
Reference and the ISA online help.
Message Log
The database server message log is an operating-system file. The messages
contained in the database server message log do not usually require
immediate action. To report situations that require your immediate attention,
the database server uses the event-alarm feature. See “Event Alarms” on
page 1-34. You can view the message log in ISA.
Monitor the message-log size, because the database server appends new
entries to this file. Edit the log as needed, or back it up to tape and delete it.
If the database server experiences a failure, the message log serves as an audit
trail for retracing the events that develop later into an unanticipated problem.
Often the database server provides the exact nature of the problem and the
suggested corrective action in the message log.
You can read the database server message log for a minute-by-minute
account of database server processing in order to catch events before a
problem develops. However, you do not need to perform this kind of
monitoring.
For more information, see the chapter on the messages in the Administrator’s
Reference, IBM Informix Error Messages, and “Additional Documentation” on
page 13 of the Introduction.
UNIX ON-Monitor
ON-Monitor provides a simple way to monitor many aspects of the database
server. Most of the monitoring functions are available under the Status
menu. For more information, see the section about ON-Monitor in the Admin-
istrator’s Reference.
oncheck Utility
The oncheck utility displays information about the database disk configu-
ration and usage, such as the number of pages used for a table, the contents
of the reserved pages, and the number of extents in a table. For more infor-
mation about oncheck, see the utilities chapter in the Administrator’s
Reference.
For more information about the onperf tool, see your Performance Guide.
onstat Utility
The onstat utility provides a way to monitor database server shared memory
from the command line. The onstat utility reads data from shared memory
and reports statistics that are accurate for the instant during which the
command executes. That is, onstat provides information that changes
dynamically during processing, including changes in buffers, locks, indexes,
and users.
SMI Tables
The system-monitoring interface (SMI) tables are special tables managed by the
database server that contain dynamic information about the state of the
database server. You can use SELECT statements on them to determine almost
anything you might want to know about your database server. For a
description of the SMI tables, see the chapter about the sysmaster database in
the Administrator’s Reference.
System Console
The database server sends messages that are useful to the database server
administrator by way of the system console. To specify the destination
pathname of console messages, set the CONSOLE configuration parameter.
For more information about CONSOLE, see the chapter about configuration
parameters in the Administrator’s Reference.
The changes to CONSOLE take effect after you shut down and restart the
database server.
Windows A database server system administrator can log in to the console from any
node to perform system management and monitoring tasks. ♦
ixpasswd.exe Changes the logon password for all services which log on as user informix. You can
change the password interactively or on the command line using the -y option. This
utility saves having to manually change the password for each service whenever
you change the informix password.
If you are logged on locally and run ixpasswd, it changes the password for services
that log on as the local informix user. If you are logged on domain and run ixpasswd,
it changes the password for services that log on as domain\informix.
Usage: ixpasswd [-y new_password]
ixsu.exe Launches a command-line window that runs as the specified user. The user is a local
user unless you specify a domain name. If you do not specify a user name, the
default user is informix. You no longer need to log off as the current user and log on
as informix to perform DBA tasks that need to be run as informix.
The ixsu utility requires Advanced User Rights:
■ Act as part of the operating system
■ Increase quotas
■ Replace a process-level token
To configure Advanced User Rights on Windows NT, select User
Manager➞Policies➞User Rights and check the Advanced User Rights option. If
you change the Advanced User Rights for the current user, you need to log off and
log back on for the new rights to take effect.
Usage: ixsu [[domain\]username]
The ixsu utility is equivalent to the Windows 2000 runas command. To use runas to
run a command shell as another user:
Usage: runas /user:username cmd
ntchname.exe Changes the registry entries for Dynamic Server from the old hostname to the new
hostname. Run ntchname after you change the hostname. This utility does not
change user environment variables.
After you execute ntchname, edit the %INFORMIXDIR%\%INFORMIX-
SERVER%.cmd file and change the INFORMIXSQLHOSTS entry to the new
hostname.
Usage: ntchname old_name new_name
Configuration Parameters
2
In This Chapter . . . . . . . . . . . . . . . . . . . . 2-3
Database Server Identification Parameters . . . . . . . . . . . 2-3
Disk-Space Parameters . . . . . . . . . . . . . . . . . 2-4
Root Dbspace . . . . . . . . . . . . . . . . . . . 2-4
Mirror of Root Dbspace . . . . . . . . . . . . . . . . 2-5
Other Space-Management Parameters . . . . . . . . . . . 2-5
DBSERVERALIASES Specifies an alternate name or names for an instance of the database server. The
maximum number of aliases is 32.
For information about using DBSERVERALIASES to create multiple listen
endpoints to which clients can connect, see “Specifying Listen and Poll Threads
for the Client/Server Connection” on page 5-33.
DBSERVERNAME Specifies the unique name of an instance of the database server. Use the
DBSERVERNAME for your INFORMIXSERVER environment variable and in
the sqlhosts information.
SERVERNUM Specifies a unique integer for the database server instance. The database server
uses SERVERNUM to determine the shared-memory segment addresses.
Disk-Space Parameters
The disk-space parameters control how the database server manages storage
space.
Root Dbspace
The first storage space that you allocate is called the root database space, or root
dbspace. It stores all the basic information that describes your database server.
Use the following parameters to describe the root dbspace.
ROOTNAME Specifies the name of the root dbspace. You can choose any descriptive name for
ROOTNAME, but it is usually called rootdbs. For more information, see “Root
Dbspace” on page 9-18.
ROOTOFFSET Specifies an offset. For information about when to set ROOTOFFSET, refer to
“Specifying an Offset” on page 10-6.
ROOTPATH Specifies the pathname of the storage allocated to the root dbspace. For infor-
mation on how to choose and allocate the storage, see “Allocating Disk Space”
on page 10-6.
ROOTSIZE Specifies the amount of space allocated to the root dbspace. For information on
how to choose an appropriate size for the root dbspace, see “Size of the Root
Dbspace” on page 9-49.
MIRROR Defines whether mirroring is enabled or disabled. For more information, see
Chapter 18, “Using Mirroring.”
MIRRORPATH Specifies the full pathname of the chunk that mirrors the initial chunk of the root
dbspace.
MIRROROFFSET Specifies the offset into the device that serves as the mirror for the initial root
dbspace chunk. For more information, see “Specifying an Offset” on page 10-6.
DBSPACETEMP Specifies a list of dbspaces that the database server can use for the storage of
temporary tables. For more information, see “Creating a Temporary Dbspace” on
page 10-16.
FILLFACTOR Specifies how much to fill index pages when indexes are created. For more infor-
mation, see your Performance Guide.
ONDBSPACEDOWN Defines how the database server treats a disabled dbspace that is not a critical
dbspace.
(1 of 2)
SBSPACENAME Specifies the name of the default sbspace. For more information, see “Control of
Where Data Is Stored” on page 9-16.
SBSPACETEMP Specifies the name of the default temporary sbspace. For more information, see
“Temporary Sbspaces” on page 9-32.
SYSSBSPACENAME Specifies the name of the sbspace in which the database server stores statistics
that the UPDATE STATISTICS statement collects for certain user-defined data
types.
(2 of 2)
Logging Parameters
Use the logging parameters to control the logical and physical logs.
Logical Log
The logical log contains a record of changes made to a database server
instance. The logical-log records are used to roll back transactions, recover
from system failures, and so on. The following parameters describe logical
logging.
DYNAMIC_LOGS Determines whether the database server allocates new logical-log files automat-
ically. For more information, see Chapter 13, “Logical Log.”
LOGBUFF Determines the amount of shared memory reserved for the buffers that hold the
logical-log records until they are flushed to disk. For information on how to tune
the logical-log buffer, see “Logical-Log Buffer” on page 7-19.
LOGFILES Specifies the number of logical-log files used to store logical-log records until
they are backed up on disk. For more information, see “Estimating the Size and
Number of Log Files” on page 14-4.
(1 of 2)
LTXHWM Specifies the percentage of the available logical-log space that, when filled,
triggers the database server to check for a long transaction. For more infor-
mation, see “Setting High-Watermarks for Rolling Back Long Transactions” on
page 14-25.
LTXEHWM Specifies the point at which the long transaction being rolled back is given
exclusive access to the logical log.
(2 of 2)
PHYSBUFF Determines the amount of shared memory reserved for the buffers that serve as
temporary storage space for pages about to be modified.
PHYSDBS Specifies the name of the dbspace in which the physical log resides.
For more information, see Chapter 15, “Physical Logging, Checkpoints, and
Fast Recovery.”
If you use the ontape utility, use the following parameters to describe your
tape devices. To use a tape to its full physical capacity, set TAPESIZE and
LTAPESIZE to 0 to read/write to the end of the medium.
TAPESIZE Specifies the maximum amount of data that should be written to each tape.
LTAPESIZE Specifies the maximum amount of data that should be written to each tape.
Message-Log Parameters
The message files provide information about how the database server is
functioning.
CONSOLE (UNIX) Specifies the pathname for console messages. For additional information, refer
to “System Console” on page 1-37.
MSGPATH Specifies the pathname of the database server message-log file. For more infor-
mation, refer to “Message Log” on page 1-35.
Shared-Memory Parameters
The shared-memory parameters affect database server performance.
SHMADD Specifies the increment of memory that is added when the database server
requests more memory.
SHMBASE Specifies the shared-memory base address and is computer dependent. Do not
change its value.
SHMTOTAL Specifies the maximum amount of memory that the database server is allowed to
use.
SHMVIRTSIZE Specifies the size of the first piece of memory that the database server attaches.
CKPTINTVL Specifies the maximum time interval allowed to elapse before a checkpoint.
For more information, see Chapter 15, “Physical Logging, Checkpoints, and
Fast Recovery.”
DD_HASHMAX Specifies the maximum number of entries for each hash bucket in the data-
dictionary cache. For more information about setting DD_HASHMAX, refer
to your Performance Guide.
DD_HASHSIZE Specifies the number of hash buckets in the data-dictionary cache. For more
information about setting DD_HASHSIZE, refer to your Performance Guide.
DEF_TABLE_LOCKMODE Sets the lock mode to page or row for new tables. For more information, see
the IBM Informix Guide to SQL: Tutorial.
LOCKS Specifies the initial number of locks available to database server user
processes during transaction processing. For more information, see
Chapter 8, “Managing Shared Memory” and your Performance Guide.
PC_POOLSIZE Specifies the number of UDRs (both SPL routines and external routines) that
can be stored in the UDR cache. In addition, this parameter specifies the size
of other database server caches, such as the typename cache and the opclass
cache. For more information about setting PC_POOLSIZE, refer to your
Performance Guide.
PC_HASHSIZE Specifies the number of hash buckets for the UDR cache and other caches
that the database server uses. For more information about setting
PC_HASHSIZE, refer to your Performance Guide.
STACKSIZE Specifies the stack size for database server user threads. For a discussion of
the use of stacks, refer to “Stacks” on page 7-29.
LRUS, Describes the shared-memory pool of pages (memory spaces) that the
LRU_MAX_DIRTY, database server uses. These parameters relate to LRU (least recently used)
LRU_MIN_DIRTY queues. See “LRU Queues” on page 7-34.
CLEANERS Controls the number of threads used to flush pages to disk and return the
pages to the shared-memory pool. See “Flushing Data to Disk” on page 7-40.
RA_PAGES and Control the number of disk pages that the database server reads ahead during
RA_THRESHOLD sequential scans. See “Configuring the Database Server to Read Ahead” on
page 7-39.
STMT_CACHE Turns on, enables, or disables the SQL statement cache in memory. If turned
on, specifies whether the SQL STATEMENT CACHE can hold a parsed and
optimized SQL STATEMENT.
STMT_CACHE_NOLIMIT Controls whether to insert statements into the SQL statement cache after its
size is greater than the STMT_CACHE_SIZE value.
STMT_CACHE_NUMPOOL Defines the number of memory pools for the SQL statement cache.
Decision-Support Parameters
When you configure virtual shared memory on your system, you must
decide what portion to reserve for decision-support queries. Decision-
support queries use large amounts of the virtual portion of shared memory
to perform joins and sort operations.
DATASKIP Controls whether the database server skips an unavailable table fragment.
DS_MAX_QUERIES Specifies the maximum number of queries that can run concurrently.
DS_MAX_SCANS Limits the number of PDQ scan threads that the database server can execute
concurrently.
OPTCOMPIND Advises the optimizer on an appropriate join strategy for your applications.
You need to set the following parameters to specific values, depending upon
the number of processors on your platform:
■ MULTIPROCESSOR
■ SINGLE_CPU_VP
■ VPCLASS
SINGLE_CPU_VP Specifies that the database server is using only one processor and allow the
database server to optimize for that situation.
VPCLASS Specifies a class of virtual processors, the number of virtual processors that the
database server should start, the maximum number allowed, the processor
affinity, and the priority aging. It is recommended that you use the VPCLASS
parameter instead of NOAGE, NUMCPUVPS, NUMAIOVPS, AFF_NPROCS, or
AFF_SPROCS. For more information, see “Specifying VPCLASS” on page 6-5.
Time Intervals
Use the following parameters to control the time intervals that the database
server uses while processing transactions.
DEADLOCK_TIMEOUT Specifies the amount of time that the database server waits for a shared-
memory resource during a distributed transaction.
HETERO_COMMIT Specifies whether the database server uses heterogeneous commit transactions.
TXTIMEOUT Specifies how long a participant waits to receive a commit instruction during a
two-phase commit.
Restore Parameters
Use the following parameters to control the number of threads that the
database server allocates to offline and online logical recovery. For more
information, see your Performance Guide.
OFF_RECVRY_THREADS Specifies the number of recovery threads used during a cold restore.
ON_RECVRY_THREADS Specifies the number of recovery threads used during fast recovery and a
warm restore.
DRINTERVAL Specifies the maximum time interval in seconds between flushing of the data-
replication buffer.
DRLOSTFOUND Specifies the pathname to a file that contains transactions committed on the
primary database server but not committed on the secondary database server
when the primary database server experiences a failure.
DRTIMEOUT Specifies how long in seconds a database server in a data-replication pair waits
for a transfer acknowledgment from the other database server in the pair.
Event-Alarm Parameters
The database server can execute a program if a noteworthy event occurs.
Noteworthy events include failure of database, table, index, chunk or
dbspace taken offline, internal subsystem failure, initialization failure, and
detection of long transaction.You can receive notification of a noteworthy
event through email or pagermail. For more information, refer to your
Administrator’s Reference.
ALARMPROGRAM Specifies the location of a file that is executed when an event alarm occurs.
You can set the ALARMPROGRAM parameter to back up logs automatically as
they fill. For more information, refer to the IBM Informix Backup and Restore Guide.
DUMPCNT Specifies the number of assertion failures for which a single thread dumps shared
memory.
DUMPCORE Controls whether assertion failures cause a virtual processor to dump core
memory.
DUMPDIR Specifies a directory where the database server places dumps of shared memory,
gcore files, or messages from a failed assertion.
DUMPGCORE If your operating system supports the gcore utility, an assertion failure causes the
database server to call gcore.
Specialized Parameters
Some parameters appear in the configuration file only when you use
specialized features of the database server.
ADTERR Specifies how the database server behaves when it encounters an error while it
writes an audit record.
ADTMODE Controls whether the database server or the operating system manages auditing
of user actions.
ADTPATH Specifies the directory in which the database server can save audit files.
STAGEBLOB Specifies the name of the blobspace for storing simple large objects that are
destined for optical disk.
Command Description
onstat -c Displays a copy of the ONCONFIG file. For more information, see “Configuring the
Database Server” on page 1-18.
Changes to the ONCONFIG file take effect when you shut down and restart the database
server, also called reinitializing shared memory. If you change a configuration parameter
but do not shut down and restart the database server, the effective configuration differs
from what the onstat -c option displays.
The values of the configuration parameters are stored in the file indicated by the
ONCONFIG environment variable or, if you have not set the ONCONFIG environment
variable, in $INFORMIXDIR/etc/onconfig on UNIX or
%INFORMIXDIR%\etc\onconfig.std on Windows.
oncheck -pr Lists the reserved page. The database server also stores current configuration infor-
mation in the PAGE_CONFIG reserved page.
If you change the configuration parameters from the command line and run oncheck -pr
without shutting down and restarting the database server, the configuration values that
oncheck displays do not match the current values in the reserved pages. The oncheck
utility returns a warning message.
ON-Monitor Select Status➞Configuration to create a copy of the current configuration and store it in
(UNIX) the directory and file that you specify. If you specify only a filename, the database server
stores the file in the current working directory. Changes to the configuration parameters
take effect when you shut down and restart the database server.
Figure 2-2 shows sample output from the oncheck -pr command.
Client/Server Communications
3
In This Chapter . . . . . . . . . . . . . . . . . . . . 3-3
Client/Server Architecture . . . . . . . . . . . . . . . . 3-3
Network Protocol . . . . . . . . . . . . . . . . . . 3-4
Network Programming Interface. . . . . . . . . . . . . 3-5
Windows Network Domain . . . . . . . . . . . . . . 3-5
Database Server Connection . . . . . . . . . . . . . . 3-6
Multiplexed Connection. . . . . . . . . . . . . . . . 3-7
Client/Server Architecture
IBM Informix products conform to a software design model called
client/server. The client/server model allows you to place an application or
client on one computer and the database server on another computer, but they
can also reside on the same computer. Client applications issue requests for
services and data from the database server. The database server responds by
providing the services and data that the client requested.
Network Protocol
A network protocol is a set of rules that govern how data is transferred
between applications and, in this context, between a client and a database
server. These rules specify, among other things, what format data takes when
it is sent across the network. An example of a network protocol is TCP/IP.
You can configure the database server to support more than one protocol, but
consider this option only if some clients use TCP/IP and some use IPX/SPX.
To determine the supported protocols for your operating system, see
“Database Server Connection” on page 3-6.
To specify which protocol the database server uses, set the nettype field in the
sqlhosts file on UNIX. On Windows, set the PROTOCOL field in the SQLHOSTS
registry key. For more information, see “The sqlhosts File and the SQLHOSTS
Registry Key” on page 3-29.
Both client and database server environments must be configured with the
same protocol if client/server communication is to succeed. However, some
network protocols can be accessed through more than one network
programming interface. For example, TCP/IP can be accessed through either
TLI or sockets, depending on which programming interface is available on
the operating-system platform. Therefore, a client using TCP/IP through TLI
on one computer can communicate with a database server using TCP/IP with
sockets on another computer, or vice versa. For an example, see “Using a
Network Connection” on page 3-59.
For more information on the CONNECT and DATABASE statements, see the
IBM Informix Guide to SQL: Syntax.
Multiplexed Connection
Some applications connect multiple times to the same database server on
behalf of one user. A multiplexed connection uses a single network connection
between the database server and a client to handle multiple database connec-
tions from the client. Client applications can establish multiple connections
to a database server to access more than one database on behalf of a single
user. If the connections are not multiplexed, each database connection estab-
lishes a separate network connection to the database server. Each additional
network connection consumes additional computer memory and CPU time,
even for connections that are not active. Multiplexed connections enable the
database server to create multiple database connections without consuming
the additional computer resources that are required for additional network
connections.
You do not need to make any changes to the sqlhosts file or registry that the
database server uses. The client program does not need to make any special
SQL calls to enable connections multiplexing. Connection multiplexing is
enabled automatically when the ONCONFIG file and the sqlhosts file or
SQLHOSTS registry key are configured appropriately. For information on the
NETTYPE configuration parameter, refer to the chapter on configuration
parameters in the Administrator’s Reference. For more information on the
sqlhosts file or registry, refer to “The sqlhosts File and the SQLHOSTS
Registry Key” on page 3-29.
Sockets ✔ ✔ ✔ ✔
TLI (TCP/IP) ✔ ✔ ✔
TLI (IPX/SPX) ✔ ✔ ✔
Shared memory ✔ ✔
Stream pipe ✔ ✔
Named pipe ✔ ✔
UNIX On many UNIX platforms, the database server supports multiple network
programming interfaces. The machine notes shows the interface/protocol
combinations that the database server supports for your operating system:
Machine Specific Notes:
=======================
Local Connections
A local connection is a connection between a client and the database server on
the same computer. The following sections describe these types of local
connections.
Shared
Database server
memory
Client
application
Computer
Shared memory provides fast access to a database server, but it poses some
security risks. Errant or malicious applications could destroy or view
message buffers of their own or of other local users. Shared-memory commu-
nication is also vulnerable to programming errors if the client application
performs explicit memory addressing or overindexes data arrays. Such
errors do not affect the database server if you use network communication or
stream pipes. For an example of a shared-memory connection, refer to “Using
a Shared-Memory Connection” on page 3-57.
A client cannot have more than one shared-memory connection to a database
server.
For information about the portion of shared memory that the database server
uses for client/server communications, refer to “Communications Portion of
Shared Memory” on page 7-32. For additional information, you can also refer
to “How a Client Attaches to the Communications Portion” on page 7-11.
Named pipes are supported for local connections to the database server.
Local-Loopback Connections
A network connection between a client application and a database server on
the same computer is called a local-loopback connection. The networking facil-
ities used are the same as if the client application and the database server
were on different computers. You can make a local-loopback connection
provided your computer is equipped to process network transactions. Local-
loopback connections are not as fast as shared-memory connections, but they
do not pose the security risks of shared memory.
Connectivity Files
The connectivity files contain the information that enables client/server
communication. These files also enable a database server to communicate
with another database server. The connectivity configuration files can be
divided into three groups:
■ Network-configuration files
■ Network security files
■ The sqlhosts file or SQLHOSTS registry
Network-Configuration Files
This section identifies and explains the use of network-configuration files on
TCP/IP and IPX/SPX networks.
The network administrator maintains these files. When you add a host or a
software service such as a database server, you need to inform the network
administrator so that person can make sure the information in these files is
accurate.
The hosts file needs a single entry for each network-controller card that
connects a computer running an Informix client/server product on the
network. Each line in the file contains the following information:
Although the length of the host name is not limited in the hosts file, Informix
limits the host name to 256 characters. Figure 3-8 on page 3-49 includes a
sample hosts file.
The services file contains an entry for each service available through TCP/IP.
Each entry is a single line that contains the following information:
■ Service name
IBM Informix products use this name to determine the port number
and protocol for making client/server connections. The service name
can have up to 128 characters.
■ Port number and protocol
The port number is the computer port, and the protocol for TCP/IP is
tcp.
The operating system imposes restrictions on the port number. User
informix must use a port number equal to or greater than 1024. Only
root users are allowed to use a port number less than 1024.
■ Aliases (optional)
The service name and port number are arbitrary. However, they must be
unique within the context of the file and must be identical on all computers
that are running IBM Informix client/server products. The aliases field is
optional. For example, a services file might include the following entry for a
database server:
server2 1526/tcp
This entry makes server2 known as the service name for TCP port 1526. A
database server can then use this port to service connection requests.
Figure 3-6 on page 3-39 includes a sample services file.
For information about the hosts and services files, refer to your operating-
system documentation.
Warning: On systems that use NIS, the /etc/hosts and /etc/services files are
maintained on the NIS server. The /etc/hosts and /etc/services files that reside on your
local computer might not be used and might not be up to date. To view the contents
of the NIS files, enter the following commands on the command line:
ypcat hosts
ypcat services
■ %WINDIR%\system32\drivers\etc\hosts
■ %WINDIR%\system32\drivers\etc\services
Alternately, you can configure TCP/IP to use the Domain Name Service (DNS)
for host name resolutions. For information about these files, refer to your
operating-system documentation.
■ Make an entry in the services file for each port the database server
will use, as in the following example:
soc1 21/tcp
soc2 22/tcp
Each port of a single IP address must be unique. Separate ethernet
cards can use unique or shared port numbers. You might want to use
the same port number on ethernet cards connecting to the same data-
base server. (In this scenario, the service name is the same.)
■ Put one entry per ethernet card in the hosts file with a separate IP
address, as in the following example:
192.147.104.19 svc8
192.147.104.20 svc81
■ In the ONCONFIG configuration file, enter DBSERVERNAME for one
of the ethernet cards and DBSERVERALIASES for the other ethernet
card. The following lines show sample entries in the ONCONFIG file:
DBSERVERNAME chicago1
DBSERVERALIASES chicago2
■ In the sqlhosts file on UNIX or the SQLHOSTS registry key on
Windows, make one entry for each ethernet card. That is, make an
entry for the DBSERVERNAME and another entry for the
DBSERVERALIAS.
chicago1 onsoctcp svc8 soc1
chicago2 onsoctcp svc81 soc2
For advice on how to set configuration files for these software products,
consult the manuals that accompany your IPX/SPX software.
On some networks, the host name that a remote host uses to connect to a
particular computer might not be the same as the host name that the
computer uses to refer to itself. For example, the network host name might
contain the full domain name, as the following example shows:
viking.informix.com
By contrast, the computer might refer to itself with the local host name, as the
following example shows:
viking
If this situation occurs, make sure that you specify both host name formats in
the host.equiv file.
As an alternative, an individual user can list hosts from which he or she can
connect as a trusted user in the .rhosts file. This file resides in the user’s home
Windows directory on the computer on which the database server resides. On
Windows, a home directory is not automatically assigned when the Windows
administrator creates a user identity. The administrator can add a home
directory to a user’s profile with the User Manager application. ♦
On UNIX, the netrc information resides in the .netrc file in the user’s home
directory. Use any standard text editor to prepare the .netrc file. Windows
maintains the netrc information in the registry keys. Use the Host Infor-
mation tab of setnet32 to edit the netrc information.
The database server uses the netrc information regardless of whether it uses
the default authentication policy or a communications support module.
For information about the specific content of this file, refer to your operating-
system documentation.
User Impersonation
For certain client queries or operations, the database server must imper-
sonate the client to run a process or program on behalf of the client. In order
to impersonate the client, the database server must receive a password for
each client connection. Clients can provide a user ID and password through
the CONNECT statement or netrc information.
The following examples show how you can provide a password to imper-
sonate a client.
To use encryption, you must add a line to the CSS/CSM configuration file,
concsm.cfg, and add an entry to the options column of the sqlhosts file or
registry. The concsm.cfg file must contain an entry for each communications
support module (of the same kind) that you are using.
Important: You cannot use both kinds of CSM simultaneously. For example, if you
are using the SPWDCSM and decide to encrypt your network data, you must remove
the entries for the SPWDCSM in your concsm.cfg and sqlhosts files.
Important: You cannot use either simple password CSM or encryption CSM over a
multiplexed connection.
For information on specifying the CSM in the sqlhosts file or registry, see
“Communication Support Module Option” on page 3-43.
The csmname variable is the name that you assign to the communications
support module. The lib-paths parameter has the following format:
"client=lib-path-clientsdk-csm, server=lib-path-server-csm"
WIN
UNIX
NT The database server CSM is usually installed in $INFORMIXDIR/lib/csm. ♦
The lib-path-csm is the full pathname, including the filename, of the shared
library that is the CSM. In this case, the same CSM is used by both the client
applications and the database server.
Setting Result
p=0 The password is not mandatory. If the client provides it, the password is
encrypted and used for authentication.
You can put a null value in the csm-connection-options field. For Client SDK
before Version 2.3, if the csm-connection-options field is null, the default
behavior is p=1. For Client SDK, Version 2.3 and later, if the csm-connection-
options field is null, the default behavior is p=0.
To specify that the password is mandatory for the database server CSM when the
SMI tables are not yet built
1. Do not specify the p=1 option in the concsm.cfg entry.
2. Bring up the database server with the oninit -i command to build the
SMI tables.
3. Bring down the database server.
4. Specify the p=1 option in the database server CSM entry in the
concsm.cfg file.
5. Start the database server again with the oninit command.
lib-paths Parameter
The lib-paths parameter provides the path and filename of the encryption
DLL (iencs09a.so). It has the following format:
"client=lib-path-clientsdk-csm, server=lib-path-server-csm"
WIN
UNIX
NT The database server CSM is usually installed in $INFORMIXDIR/lib/csm. ♦
The lib-path-csm is the full pathname, including the filename, of the shared
library that is the CSM. In this case, the same CSM is used by both the client
applications and the database server.
Major-tag Parameters
The other parameters (major tags) make up the string used to configure the
ENCCSM:
Each major tag has a parameter list that is enclosed by square brackets ([]).
The general format of parameter list is minor_tag:value. If there can be
multiple values for a minor tag, the list must be enclosed within angled
brackets (<>).
■ all
Specifies to include all available ciphers and all available modes.
There is no value list. For example:
cipher[all],…
■ allbut:<list of ciphers to exclude>
Specifies to include all ciphers except the ones in the list.
As there can be multiple entries, the list must be enclosed in angled
brackets (<>). The list can include unique, abbreviated entries. For
example, bf can represent bf-1, bf-2, and bf-3. However, if the abbre-
viation is the name of an actual cipher, then only that cipher is
eliminated. Therefore, des eliminates only the DES cipher, but de
eliminates des, des3, and desx.
For example:
cipher[allbut<ecb,des>],…
cipher[allbut<cbc,bf>]
■ cipher:mode
Specifies one or more cipher and mode. For example:
cipher[des3:cbc,des3:ofb]
Important: The encryption cipher and mode that will be used is randomly chosen
among the ciphers that are common between the two servers. It is strongly recom-
mended that you do not specify specific ciphers. For security reasons, all ciphers
should be allowed. If a cipher is discovered to have a weakness, then that cipher can
be eliminated by using the allbut option.
Ciphers supported at the time of going to press are shown below. For a full
list, please check your Release Notes.
des DES (64-bit key) bf-1 Blow Fish (64-bit key)
desx Extended DES (128-bit key) bf-3 Blow Fish (192-bit key)
Use both of the following minor tags with the mac tag:
■ levels
Use the levels tag to specify a comma-separated list of MAC genera-
tion levels that the connection supports. The supported generation
levels are:
❑ high —Uses SHA1 MAC generation on all messages.
❑ medium —Uses SHA1 MAC generation for all messages greater
than 20 bytes long and XOR folding on smaller messages.
❑ low —Uses XOR folding on all messages.
❑ off —Does not use MAC generation.
The level is prioritized to the highest value. For example, if one node
has a level of high and medium enabled and the other node has only
low enabled, then the connection attempt will fail. The off entry
should only be used between servers when it is guaranteed that there
is a secure network connection.
■ files
Use the files parameter to specify a comma-separated list of the full
path names of MAC key files. You can specify the built-in key by
using the keyword builtin. Using the builtin option provides lim-
ited message verification (some validation of the received message
and determination that it appears to have come from an
IBM Informix Dynamic Server client or server), but the strongest ver-
ification is done by a site-generated MAC key file.
Each of the entries in the mac tag are prioritized and negotiated at
connect time. The prioritization for the MAC key files is based on
their creation time by the GenMacKey utility (the utility that is used
to generate the MAC key). The builtin option has the lowest priority.
For example:
mac[levels:<high,low>,files:</usr/local/bin/mac1.dat,
/usr/local/bin/mac2.dat,builtin>]
Because the MAC key files are negotiated, you can periodically change the
keys using the following procedure:
Tip: If there are no MAC key files present, the built-in MAC key is used by default.
However, by using a MAC key file, the default built-in MAC key is disabled.
Use one or both of the following minor tags with the switch tag:
This configuration string states to use all available ciphers except for any of
the BlowFish ciphers, and to not use any cipher in ECB mode.
Another example:
ENCCSM(“/$INFORMIXDIR/lib/csm/iencs09a.so”,
“cipher[des:cbc,des3:ofb,desx:cbc],switch[cipher:120,key:15]”)
Each entry (each line) in the sqlhosts file contains the sqlhosts information
for one database server. Use white space (spaces, tabs, or both) to separate the
fields. Do not include any spaces or tabs within a field. To put comments in
the sqlhosts file, start a line with the comment character (#). You can also
leave lines completely blank for readability. Additional syntax rules for each
of the fields are provided in the following sections, which describe the entries
in the sqlhosts file. Use any standard text editor to enter information in the
sqlhosts file.
Each computer that hosts a database server or a client must include the
connectivity information either in the SQLHOSTS registry key or in a central
registry. When the client application runs on the same computer as the
database server, they share a single SQLHOSTS registry key.
■ The local computer where you are installing the database server
■ Another computer in the network that serves as a central, shared
repository of sqlhosts information for multiple database servers in
the network
If you specify a shared SQLHOSTS registry key, you must set the INFORMIX-
SQLHOSTS environment variable on your local computer to the name of the
Windows computer that stores the registry. The database server first looks for
the SQLHOSTS registry key on the INFORMIXSQLHOSTS computer. If the
database server does not find an SQLHOSTS registry key on the INFORMIX-
SQLHOSTS computer, or if INFORMIXSQLHOSTS is not set, the database
server looks for an SQLHOSTS registry key on the local computer.
Figure 3-3 illustrates the location and contents of the SQLHOSTS registry key
for the database server payroll.
Figure 3-3
HKEY_LOCAL_MACHINE on Local Machine sqlhosts Information in
HARDWARE HOST:REG_SZ:dewar the Windows Registry
SAM OPTIONS:REG_SZ:
PROTOCOL:REG_SZ:onsoctcp
SECURITY SERVICE:REG_SZ:py1
SOFTWARE
Classes
Description
INFORMIX
ESQL/C
OnLine
SQLHOSTS
payroll
Microsoft
The connectivity information for each database server includes four fields of
required information and one optional field. The group information contains
information in only three of its fields.
The five fields of connectivity information form one line in the UNIX sqlhosts
file. On Windows, the database server name is assigned to a key in the
SQLHOSTS registry key, and the other fields are values of that key. The
following table summarizes the fields used for the sqlhosts information.
Description of Description of
UNIX Windows Connectivity Group
Field Name Field Name Information Information
UNIX If you install IBM Informix Enterprise Gateway with DRDA in the same
directory as the database server, your sqlhosts file also contains entries for
the Gateway and non-Informix database servers. However, this manual
covers only the entries for the database server. For information about other
entries in the sqlhosts file, see the IBM Informix Enterprise Gateway with DRDA
User Manual. ♦
Connectivity Information
The next section describes the connectivity information that is in each field of
the sqlhosts file or SQLHOSTS registry key.
The dbservername field can include any printable character other than an
uppercase character, a field delimiter, a newline character, or a comment
character. It is limited to 128 characters.
UNIX If the sqlhosts file has multiple entries with the same dbservername, only the
first one is used. ♦
Product
Subfield Product
Interface Type
The middle three letters of the connection-type field represent the network
programming interface that enables communications. For more information,
see “Network Programming Interface” on page 3-5.
Interface
Subfield Type of Interface
soc Sockets
Protocol
Subfield Type of Protocol
IPC connections use shared memory or stream pipes. The database server
supports two network protocols: TCP/IP and IPX/SPX.
nettype PROTOCOL
Value Value Connection
(UNIX) (Windows) Description Type
nettype PROTOCOL
Value Value Connection
(UNIX) (Windows) Description Type
The following sections explain how client applications derive the values used
in the host name field.
In some situations, you might want to use the actual Internet IP address in the
host name field. For information about using the IP address, refer to “IP
Addresses for TCP/IP Connections” on page 3-48.
Tip: NetWare installation and administration utilities might display the NetWare
file server name in capital letters; for example, VALLEY. In the sqlhosts file, you can
enter the name in either uppercase or lowercase letters.
Figure 3-6 shows the relationship between the sqlhosts file or registry and
the hosts file, as well as the relationship of sqlhosts to the services file.
Figure 3-6
sqlhosts entry to connect by TCP/IP Relationship of
dbservername nettype hostname servicename options sqlhosts File or
Registry to hosts
sales onsoctcp knight sales_ol
and services Files
hosts file
IP address hostname alias
37.1.183.92 knight
services file
service name port#/protocol
sales_ol 1543/tcp
In some cases, you might use the actual TCP listen-port number in the service
name field. For information about using the port number, refer to “Port
Numbers for TCP/IP Connections” on page 3-53.
Options Field
The options field includes entries for the following features.
When you change the values in the options field, those changes affect the
next connection that a client application makes. You do not need to stop and
restart the client application to allow the changes to take effect. However, a
database server reads its own connectivity information only during initial-
ization. If you change the options for the database server, you must
reinitialize the database server to allow the changes to take effect.
You can combine several items in the options field, and you can include them
in any order. The maximum length of the options field is 256 characters.
You can use either a comma or white space as the separator between options.
You cannot use white space within an option.
s=3,k=0 b=5120 Yes Syntax is equivalent to the preceding entry. (White space
is used of instead of a comma.)
Buffer-Size Option
Use the buffer-size option (b=value) to specify in bytes the size of the commu-
nications buffer space. The buffer-size option applies only to connections that
use the TCP/IP network protocol. Other types of connections ignore the
buffer-size setting. You can use this option when the default size is not
efficient for a particular application. The default buffer size for the database
server using TCP/IP is 4096 bytes.
Adjusting the buffer size allows you to use system and network resources
more efficiently; however, if the buffer size is set too high, the user receives a
connection-reject error because no memory can be allocated. For example, if
you set b=64000 on a system that has 1000 users, the system might require
64 megabytes of memory for the communications buffers. This setting might
exhaust the memory resources of the computer.
On many operating systems, the maximum buffer size supported for TCP/IP
is 16 kilobytes. To determine the maximum allowable buffer size, refer to the
documentation for your operating system or contact the technical-support
services for the vendor of your platform.
Tip: It is recommended that you use the default size for the communications buffer.
If you choose to set the buffer size to a different value, set the client-side communica-
tions buffer and the database server-side communications buffer to the same size.
Connection-Redirection Option
You can define a group of database servers, or aliases in the sqlhosts file on
the client and have the client connections to the dbserver group try each of
the group members with fail-over. The connection-redirection option (c=value)
indicates the order in which the connection software chooses database
servers, aliases, or coservers within a group.
The following table shows the possible settings for the connection-
redirection option.
Setting Result
c=1 The client application chooses a random starting point from which to
connect to a list of dbserver group members.
The value of csmname must match a csmname entry in the concsm.cfg file. The
connection-options parameter overrides the default csm-connection options
specified in the concsm.cfg file. For information on the concsm.cfg file entry,
refer to “CSM Configuration File” on page 3-21.
End-of-Group Option
Use the end-of-group option (e=dbservername) to specify the ending database
server name of a database server group. If you specify this option in an entry
other than a database server group, it is ignored.
Group Option
When you define database server groups in the sqlhosts file or registry, you
can use multiple related entries as one logical entity to establish or change
client/server connections.
1. Specify the name of the database server group to which the sqlhosts
entry belongs (up to 18 characters) in the DBSERVERNAME field.
The database server group name can be the same as the initial
DBSERVERNAME for the database server.
2. Place the keyword group in the connection type field.
3. The host name and service name fields are not used. Use dash (-)
characters as null-field indicators for the unused fields. If you do not
use options, you can omit the null-field indicators.
The options for a database server group entry are as follows:
■ c = connection redirection
■ e = end of group
■ g = group option
■ i = identifier option
Use the i and g options in Enterprise Replication. All database servers partic-
ipating in replication must be a member of a database server group. Each
database server in the enterprise must have a unique identifier, which is the
server group. Make sure that the sqlhosts file is set up properly on each
database server participating in replication.
Important: Database server groups cannot be nested inside other database server
groups, and database server group members cannot belong to more than one group.
The example in shows the following two groups: asia and peru. Group asia
includes the following members:
■ asia.1
■ asia.2
■ asia.3
Because group asia uses the end-of-group option (e=asia.3), the database
server searches for group members until it reaches asia.3, so the group
includes usa.2. Because group peru does not use the end-of-group option, the
database server continues to include all members until it reaches the end of
file.
Figure 3-7 shows examples of database server groups in the sqlhosts file.
Figure 3-7
Database Server Groups in sqlhosts File or Registry
peru group – –
You can use the name of a database server group instead of the database
server name in the following environment variables, or in the SQL CONNECT
command:
■ INFORMIXSERVER
The value of INFORMIXSERVER for a client application can be the
name of a database server group. However, you cannot use a data-
base server group name as the value of INFORMIXSERVER for a
database server or database server utility.
■ DBPATH
DBPATH can contain the names of database server groups as
dbservernames.
Identifier Option
The identifier option (i=number) assigns an identifying number to a database
server group. The identifier must be a positive numeric integer and must be
unique within your network environment.
For more information on the use of the identifier option, refer to the
IBM Informix Dynamic Server Enterprise Replication Guide.
Keep-Alive Option
The keep-alive option is a network option that TCP/IP uses. It does not affect
other types of connections. If you do not include the keep-alive option in the
options field, the keep-alive feature is enabled by default. To set the keep-
alive option on the database server side only, the client side only, or on both
sides, specify k=1 in the fifth column of the sqlhosts file. For most cases, it is
recommended that you enable the keep-alive option.
When a connected client and server are not exchanging data and the keep-
alive option is enabled, the network service checks the connection
periodically. If the receiving end of the connection does not respond within
the time specified by the parameters of your operating system, the network
service immediately detects the broken connection and frees resources.
When the keep-alive option is disabled, the network service does not check
periodically whether the connection is still active. If the opposite end of the
connection terminates unexpectedly without any notification, as when a PC
reboots, for example, the network service might never detect that the
connection is broken.
Security Options
The security options let you control operating-system security-file lookups.
The letter s identifies database server-side settings, and the letter r identifies
client-side settings. You can set both options in the options field. A client
ignores s settings, and the database server ignores r settings.
Setting Result
r=0 Disables netrc lookup from the client side (no password can be supplied).
r=1 Enables netrc lookup from the client side (default setting for the client
side).
s=0 Disables both hosts.equiv and rhosts lookup from the database server side
(only incoming connections with passwords are accepted).
s=1 Enables only the hosts.equiv lookup from the database server side.
s=2 Enables only the rhosts lookup from the database server side.
s=3 Enables both hosts.equiv and rhosts lookup on the database server side
(default setting for the database server side).
The security options let you control the way that a client (user) gains access
to a database server. By default, an Informix database server uses the
following information on the client computer to determine whether the client
host computer is trusted:
■ hosts.equiv
■ rhosts information
With the security options, you can specifically enable or disable the use of
either or both files.
For example, if you want to prevent end users from specifying trusted hosts
in rhosts, you can set s=1 in the options field of the sqlhosts file or SQLHOSTS
registry key for the database server to disable the rhosts lookup.
Important: Do not disable the hosts.equiv lookup in database servers that are used
in distributed database operations. That is, if you expect to use the database server in
distributed processing, do not set s=0 or s=2.
Group Information
The following section describes the fields of the sqlhosts file or registry for
groups.
Figure 3-8
A Sample hosts File
555.12.12.12 smoke
98.765.43.21 odyssey
Using the IP address for knight from Figure 3-8, the following two sqlhosts
entries are equivalent:
sales ontlitcp 12.34.56.789 sales_ol
sales ontlitcp knight sales_ol
UNIX You can find the IP address in the net address field of the hosts file, or you can
use the UNIX arp or ypmatch command. ♦
Windows You can configure Windows to use either of the following mechanisms to
resolve Internet Domain Addresses (mymachine.informix.com) to Internet
Protocol addresses (149.8.73.14):
If the preceding conditions are met, you can use an asterisk (*) as a wildcard
in the host name field that the database server uses. When you enter a
wildcard in the host name field, the database server can accept connections
at any valid IP address on its host computer.
Each IP address is associated with a unique host name. When a computer has
multiple network-interface cards (NICs), as in Figure 3-9 on page 3-51, the
hosts file must have an entry for each interface card. For example, the hosts
file for the texas computer might include these entries.
You can use the wildcard (*) alone or as a prefix for a host name or IP address,
as shown in Figure 3-10 on page 3-52.
The wildcard format allows the listen thread of the database server to wait
for a client connection using the same service port number on each of the
valid network-interface cards. However, waiting for connections at multiple
IP addresses might require slightly more CPU time than waiting for connec-
tions with a specific host name or IP address.
Figure 3-9 shows a database server on a computer (texas) that has two
network-interface cards. The two client sites use different network cards to
communicate with the database server.
Figure 3-9
Using Multiple Network-Interface Cards
iowa
Client
texas
texas_srvr
kansas
Client
Network
programming
interfaces
Figure 3-10 shows the connectivity information for the texas_srvr database
server.
Figure 3-10
Possible Connectivity Entries for the texas_srvr Database Server
Tip: For clarity and ease of maintenance, it is recommended that you include a host
name when you use the wildcard in the host name field (that is, use *host instead of
simply *).
The client application on kansas can use any of the following host names:
texas2, *texas2, 123.45.67.82, or *123.45.67.82.
For example, if the port number for the sales database server in the services
file is 1543/tcp, you can write an entry in the sqlhosts file as follows.
Using the actual port number might save time when you make a connection
in some circumstances. However, as with the IP address in the host name
field, using the actual port number might make administration of the connec-
tivity information less convenient.
■ DBSERVERNAME
■ DBSERVERALIASES
■ NETTYPE
Client applications specify the name of the database server in one of the
following places:
■ In the INFORMIXSERVER environment variable
■ In SQL statements such as CONNECT, DATABASE, CREATE TABLE,
and ALTER TABLE, which let you specify a database environment
■ In the DBPATH environment variable
DBSERVERNAME sockets_srvr
DBSERVERALIASES ipx_srvr,shm_srvr
The sqlhosts entries associated with the dbservernames from Figure 3-11
could include those shown in Figure 3-12. Because each dbservername has a
corresponding entry in the sqlhosts file or SQLHOSTS registry key, you can
associate multiple connection types with one database server.
Figure 3-12
Three Entries in the sqlhosts File for One Database Server in UNIX format
Using the sqlhosts file shown in Figure 3-12, a client application uses the
following statement to connect to the database server using shared-memory
communication:
CONNECT TO '@shm_srvr'
For more information on environment variables, see the IBM Informix Guide to
SQL: Reference.
river
river_shm
Shared
Database server
memory
Client
The ONCONFIG configuration file for this installation includes the following
line:
DBSERVERNAME river_shm
Figure 3-14 shows a correct entry for the sqlhosts file or SQLHOSTS registry
key.
Figure 3-14
sqlhosts entry
The client application connects to this database server using the following
statement:
CONNECT TO '@river_shm'
Figure 3-16 shows the correct entry for the sqlhosts file or SQLHOSTS registry
key.
Figure 3-16
sqlhosts entry
If the network connection uses TLI instead of sockets, only the nettype entry
in this example changes. In that case, the nettype entry is ontlitcp instead
of onsoctcp.
This example assumes that an entry for river is in the hosts file and an entry
for riverol is in the services file.
river
sqlhosts entry on river
dbservername nettype hostname servicename options
Client
valley_ds onsoctcp valley valleyol
SOC - TCP
TLI - TCP
sqlhosts entry on valley
valley
An entry for the valley_ds database server is in the sqlhosts files or registries
on both computers. Each entry in the sqlhosts file or SQLHOSTS registry key
on the computer where the database server resides has a corresponding entry
on the computer where the client application resides.
UNIX Both computers are on the same TCP/IP network, but the host river uses
sockets for its network programming interface, while the host valley uses TLI
for its network programming interface. The nettype field must reflect the
type of network programming interface used by the computer on which
sqlhosts resides. In this example, the nettype field for the valley_ds database
server on host river is onsoctcp, and the nettype field for the valley_ds
database server on host valley is ontlitcp. ♦
In this case, the hostname field contains the name of the NetWare file server.
The servicename field contains a name that is unique on the IPX/SPX
network and is the same as the dbservername.
When you want the database server to accept more than one type of
connection, you must take the following actions:
■ Put DBSERVERNAME and DBSERVERALIASES entries in the
ONCONFIG configuration file.
■ Put an entry in the sqlhosts file or SQLHOSTS registry key for each
database server/connection type pair.
For the configuration in Figure 3-19, the database server has two dbserver-
names: river_net and river_shm. The ONCONFIG configuration file includes
the following entries:
DBSERVERNAME river_net
DBSERVERALIASESriver_shm
Figure 3-19
A UNIX Configuration That Uses Multiple Connection Types
river
Database server A
SOC - TCP
valley TLI - TCP
sqlhosts entries on valley
dbservername nettype hostname servicename options
Client B river_net ontlitcp river riveron
In the sqlhosts file or SQLHOSTS registry key, the nettype associated with the
name river_shm specifies a shared-memory connection, so this connection is
a shared-memory connection.
In the sqlhosts file or registry, the nettype value associated with river_net
specifies a network (TCP/IP) connection, so client B uses a network
connection.
Figure 3-20
Multiple Database Servers on UNIX
river
Shared memory riverA_shm
Database server A
Client
SOC - TCP riverB_soc
Database server B
For the configuration in Figure 3-20, you must prepare two ONCONFIG
configuration files, one for database server A and the other for database
server B. The sqlhosts file or SQLHOSTS registry key includes the connec-
tivity information for both database servers.
Install MaxConnect separately from your Informix database server and client
applications. For maximum performance benefit, install MaxConnect either
on a separate computer to which Informix clients connect or on the client
application server. You can install MaxConnect in the following
configurations:
Important: MaxConnect and the “IBM Informix MaxConnect” ship separately from
the Informix database server.
Types of Initialization
Initialization of the database server refers to two related activities: shared-
memory initialization and disk-space initialization.
Warning: When you initialize disk space, you overwrite whatever is on that disk
space. If you reinitialize disk space for an existing database server, all the data in the
earlier database server becomes inaccessible and, in effect, is destroyed.
If you are starting a database server for the first time or you want to remove
all dbspaces and their associated data, use the following methods to initialize
the disk space and to bring the database server into online mode.
Warning: When you execute these commands, all existing data in the database server
disk space is destroyed. Use the -i flag only when you are starting a new instance of
the database server.
Windows When you install the database server and choose to initialize a new instance
of the database server, or when you use the instance manager program to
create a new instance of the database server, the database server is initialized
for you.
It is recommended that you do not use the oninit -iy command to initialize
the database server unless you are diagnosing a problem. ♦
For more information about oninit, refer to the utilities chapter in the Admin-
istrator’s Reference.
For information on using these utilities to initialize the database server and
change the database server mode, see “Starting the Database Server and
Initializing Disk Space” on page 1-22.
Initialization Steps
Disk-space initialization always includes the initialization of shared memory.
However, some activities that normally take place during shared-memory
initialization, such as recording configuration changes, are not required
during disk initialization because those activities are not relevant with a
newly initialized disk.
Figure 4-1 shows the main tasks completed during the two types of initial-
ization. The following sections discuss each step.
Figure 4-1
Initialization Steps
Start all required virtual processors. Start all required virtual processors.
Change to online mode and return Change to online mode and return
control to user. control to user.
(1 of 2)
If the SMI tables are not current, update Create sysmaster database that contains
the tables. the SMI tables.
Initialize Shared-Memory
After the database server attaches to shared memory, it clears the shared-
memory space of uninitialized data. Next the database server lays out the
shared-memory header information and initializes data in the shared-
memory structures. The database server lays out the space needed for the
logical-log buffer, initializes the structures, and links together the three
individual buffers that form the logical-log buffer. For more information
about these structures, refer to the onstat utility in the Administrator’s
Reference.
After the database server remaps the shared-memory space, it registers the
new starting addresses and sizes of each structure in the new shared-memory
header.
During shared-memory initialization, disk structures and disk layout are not
affected. The database server reads essential address information, such as the
locations of the logical and physical logs, from disk and uses this information
to update pointers in shared memory.
Initiate a Checkpoint
After fast recovery executes, the database server initiates a full checkpoint.
As part of the checkpoint procedure, the database server writes a checkpoint-
complete message in the message log. For more information about
checkpoints, refer to “Checkpoints” on page 15-11.
At this point, control returns to the user. Any error messages generated by the
initialization procedure are displayed in the following locations:
If you shut down the database server before it finishes building the SMI
tables, the process of building the tables aborts. This condition does not
damage the database server. The database server simply builds the SMI tables
the next time that you bring the database server online. However, if you do
not allow the SMI tables to finish building, you cannot run any queries
against those tables, and you cannot use ON-Bar for backups.
After the SMI tables have been created, the database server is ready for use.
The database server runs until you stop it or, possibly, until a malfunction. It
is recommended that you do not try to stop the database server by killing a
virtual processor or another database server process. For more information,
refer to “Starting and Stopping Virtual Processors” on page 6-6.
This message helps the customer track license usage to determine when to
purchase more licenses. The number displayed is reset when the customer
reinitializes the database server.
The database server has three principal modes of operation, as Figure 4-2
illustrates.
Figure 4-2
Operating Modes
Offline mode When the database server is not running. No shared memory
is allocated.
Online mode Users can connect with the database server and perform all
database activities. This is the normal operating mode of the
database server.
User informix or user root can use the command-line utilities
to change many database server ONCONFIG parameter
values while the database server is online.
Maintenance mode Online mode with access restricted to users root and informix.
Users cannot initiate maintenance mode. The database server
uses this mode.
In addition, the database server can also be in one of the following modes:
To change mode with the Services tool, start the tool and select the database
server service. Then choose the appropriate button in the Services window.
The tables shown later in this chapter explain which button you select for
each mode.
To start and stop the database server, you can use other Windows tools, such
as the NET command and the Server Manager tool. For more information
about these methods, consult your Windows operating-system
documentation. ♦
Tip: After you change the mode of your database server, execute the onstat
command to verify the current server status.
Windows Figure 4-2 on page 4-13 shows which users can change the operating mode of
the database server in Windows. If you use ISA, you can log in to the
operating system as any user but you must log in to Apache as user informix.
The Apache server runs as a member of the Informix-Admin group.
Figure 4-3
Changing Operating Modes in Windows
command-line utilities ✔
such as starts
ISA ✔
When the database server is in quiescent mode, no sessions can gain access
to the database server. In quiescent mode, any user can see status
information.
Windows ■ With the Services tool, select the database server service and
click Start.
■ On the command line, use the starts dbservername
command.
If you have already taken the database server from online mode to quiescent
mode and you are now returning the database server to online mode, any
users who were interrupted in earlier processing must reselect their database
and redeclare their cursors.
Windows ■ With the Services tool, choose the database server service
and click Continue.
■ Execute onmode -m.
After you perform this task, the database server sets a flag that prevents new
sessions from gaining access to the database server. Current sessions are
allowed to finish processing.
Once you initiate the mode change, it cannot be cancelled. During the mode
change from online to quiescent, the database server is considered to be in
Shutdown mode.
The database server users receive either error message -459 indicating that
the database server was shut down or error message -457 indicating that their
session was unexpectedly terminated.
The database server cleans up all sessions that the database server
terminated. Active transactions are rolled back.
The database server users receive either error message -459 indicating that
the database server was shut down or error message -457 indicating that their
session was unexpectedly terminated.
After you take the database server to offline mode, restart the database server
in quiescent or online mode. When you restart the database server, it
performs a fast recovery to ensure that the data is logically consistent.
The database server cleans up all sessions that were terminated by the
database server. Active transactions are rolled back.
Virtual Processors
Database server processes are called virtual processors because the way they
function is similar to the way that a CPU functions in a computer. Just as a
CPU runs multiple operating-system processes to service multiple users, a
database server virtual processor runs multiple threads to service multiple
SQL client applications.
Virtual processors
Threads
A thread is a task for a virtual processor in the same way that the virtual
processor is a task for the CPU. The virtual processor is a task that the
operating system schedules for execution on the CPU; a database server
thread is a task that the virtual processor schedules internally for processing.
Threads are sometimes called lightweight processes because they are like
processes, but they make fewer demands on the operating system.
Important: Throughout this chapter, all references to “thread” refer to the threads
created, scheduled, and destroyed by the database server. All references to “Windows
threads” refer to the threads created, scheduled, and destroyed by Windows.
A user thread is a database server thread that services requests from client
applications. User threads include session threads, called sqlexec threads,
which are the primary threads that the database server runs to service client
applications.
User threads also include a thread to service requests from the onmode
utility, threads for recovery, B-tree scanner threads, and page-cleaner threads.
To display active user threads, use onstat -u. For more information on
monitoring sessions and threads, refer to your Performance Guide.
The number of virtual processors of each class that you configure depends on
the availability of physical processors (CPUs), hardware memory, and the
database applications in use.
Figure 5-2
Virtual-Processor Classes
Virtual-
Processor
Class Category Purpose
CPU Central Runs all session threads and some system threads.
processing Runs thread for kernel asynchronous I/O (KAIO)
where available. Can run a single poll thread,
depending on configuration.
LIO Disk I/O Writes to the logical-log files (internal class) if they
are in cooked disk space.
AIO Disk I/O Performs nonlogging disk I/O. If KAIO is used, AIO
virtual processors perform I/O to cooked disk
spaces.
MSC Miscellaneous Services requests for system calls that require a very
large stack.
(1 of 2)
Virtual-
Processor
Class Category Purpose
Java VP Java UDR Executes Java UDRs. Contains the Java Virtual
(JVP) Machine (JVM).
(2 of 2)
Figure 5-3 illustrates the major components and the extensibility of the
database server.
Figure 5-3
Database Server
Client applications
DataBlade API
DataBlade
DataBlade
DataBlade
DataBlade
DataBlade
Text Graphics
Date & Time Audio
Numbers Spatial Documents
Video
Sharing Processing
Virtual processors in the same class have identical code and share access to
both data and processing queues in memory. Any virtual processor in a class
can run any thread that belongs to that class.
Generally, the database server tries to keep a thread running on the same
virtual processor because moving it to a different virtual processor can
require some data from the memory of the processor to be transferred on the
bus. When a thread is waiting to run, however, the database server can
migrate the thread to another virtual processor because the benefit of
balancing the processing load outweighs the amount of overhead incurred in
transferring the data.
Generally, a virtual processor can switch from one thread to another faster
than the operating system can switch from one process to another. When the
operating system switches between processes, it must stop one process from
running on the processor, save its current processing state (or context), and
start another process. Both processes must enter and exit the operating-
system kernel, and the contents of portions of physical memory might need
to be replaced. Threads, on the other hand, share the same virtual memory
and file descriptors. When a virtual processor switches from one thread to
another, the switch is simply from one path of execution to another. The
virtual processor, which is a process, continues to run on the CPU without
interruption. For a description of how a virtual processor switches from one
thread to another, refer to “Context Switching” on page 5-13.
Processing in Parallel
In the following cases, virtual processors of the CPU class can run multiple
session threads, working in parallel, for a single client:
■ Index building
■ Sorting
■ Recovery
■ Scanning
■ Joining
■ Aggregation
■ Grouping
■ User-defined-routine (UDR) execution
For more information on parallel UDR execution, refer to IBM Informix User-
Defined Routines and Data Types Developer’s Guide.
Virtual processors
You can add virtual processors for any of the classes while the database
server is running. For more information, see “Adding Virtual Processors in
Online Mode” on page 6-7.
While the database server is running, you can drop virtual processors of the
CPU or a user-defined class. For more information, see “Setting Virtual-
Processor Configuration Parameters” on page 6-3.
■ Stacks
■ Queues
■ Mutexes
This section describes how virtual processors use these structures and
methods.
Control Structures
When a client connects to the database server, the database server creates a
session structure, which is called a session control block, to hold information
about the connection and the user. A session begins when a client connects to
the database server, and it ends when the connection terminates.
Next, the database server creates a thread structure, which is called a thread-
control block (TCB) for the session, and initiates a primary thread (sqlexec) to
process the client request. When a thread yields—that is, when it pauses and
allows another thread to run—the virtual processor saves information about
the state of the thread in the thread-control block. This information includes
the content of the process system registers, the program counter (address of
the next instruction to execute), and the stack pointer. This information
constitutes the context of the thread.
In most cases, the database server runs one primary thread per session. In
cases where it performs parallel processing, however, it creates multiple
session threads for a single client, and, likewise, multiple corresponding
thread-control blocks.
Context Switching
A virtual processor switches from running one thread to running another one
by context switching. The database server does not preempt a running thread,
as the operating system does to a process, when a fixed amount of time (time-
slice) expires. Instead, a thread yields at one of the following points:
A thread also yields when it can no longer continue its task until some
condition occurs. For example, a thread yields when it is waiting for disk I/O
to complete, when it is waiting for data from the client, or when it is waiting
for a lock or other resource.
When a thread yields, the virtual processor saves its context in the thread-
control block. Then the virtual processor selects a new thread to run from a
queue of ready threads, loads the context of the new thread from its thread-
control block, and begins executing at the new address in the program
counter. Figure 5-5 illustrates how a virtual processor accomplishes a context
switch.
Figure 5-5
Thread-control blocks Context Switch:
How a Virtual
Processor Switches
t0 prgm ctr t1 prgm ctr from One Thread to
Another
registers registers
etc. etc.
Save Restore
Time
Virtual processor
Stacks
The database server allocates an area in the virtual portion of shared memory
to store nonshared data for the functions that a thread executes. This area is
called the stack. For information on how to set the size of the stack, refer to
“Stacks” on page 7-29.
When a virtual processor switches to a new thread, it loads a stack pointer for
that thread from a field in the thread-control block. The stack pointer stores
the beginning address of the stack. The virtual processor can then specify
offsets to the beginning address to access data within the stack. Figure 5-6
illustrates how a virtual processor uses the stack to segregate nonshared data
for session threads.
Figure 5-6
Virtual Processors
Segregate
Threads t0 t1 t2 t3 Nonshared Data for
Each User
Thread-control blocks
t3 prgm ctr
t2
registersprgm ctr Stack Stack Stack Stack
t1 prgm ctr
registers
stack
registers
stack prgm ctr
t0
stack
registers
etc.
etc. ptr
stack
etc.
etc.
Virtual processor
Queues
The database server uses three types of queues to schedule the processing of
multiple, concurrently running threads:
■ Ready queues
■ Sleep queues
■ Wait queues
Virtual processors of the same class share queues. This fact, in part, enables a
thread to migrate from one virtual processor in a class to another when
necessary.
Ready Queues
Ready queues hold threads that are ready to run when the current (running)
thread yields. When a thread yields, the virtual processor picks the next
thread with the appropriate priority from the ready queue. Within the queue,
the virtual processor processes threads that have the same priority on a
first-in-first-out (FIFO) basis.
Sleep Queues
Sleep queues hold the contexts of threads that have no work to do at a
particular time. A thread is put to sleep either for a specified period of time
or forever.
The administration class (ADM) of virtual processors runs the system timer
and special utility threads. Virtual processors in this class are created and run
automatically. No configuration parameters impact this class of virtual
processors.
The ADM virtual processor wakes up threads that have slept for the specified
time. A thread that runs in the ADM virtual processor checks on sleeping
threads at one-second intervals. If a sleeping thread has slept for its specified
time, the ADM virtual processor moves it into the appropriate ready queue.
A thread that is sleeping for a specified time can also be explicitly awakened
by another thread.
A thread that is sleeping forever is awakened when it has more work to do.
For example, when a thread that is running on a CPU virtual processor needs
to access a disk, it issues an I/O request, places itself in a sleep queue for the
CPU virtual processor, and yields. When the I/O thread notifies the CPU
virtual processor that the I/O is complete, the CPU virtual processor
schedules the original thread to continue processing by moving it from the
sleep queue to a ready queue. Figure 5-7 illustrates how the database server
threads are queued to perform database I/O.
Figure 5-7
How Database
Threads t5
CPU Ready queue Server Threads Are
and t3, ready
Queued to Perform
Virtual processors to continue
VPt1 t5 Database I/O
processing
Processing
AIO VPt2 when thread t1
I/O request for t3 yields
thread t2
Ready queue
I/O requests Sleep queue Partially
for threads t4 t4 executed
and t6 t2 threads, t2, t4,
t6 and t6, waiting
t4 for completion
of their disk I/O
t6 requests
Wait Queues
Wait queues hold threads that need to wait for a particular event before they
can continue to run. For example, wait queues coordinate access to shared
data by threads. When a user thread tries to acquire the logical-log latch but
finds that the latch is held by another user, the thread that was denied access
puts itself in the logical-log wait queue. When the thread that owns the lock
is ready to release the latch, it checks for waiting threads, and, if threads are
waiting, it wakes up the next thread in the wait queue.
Mutexes
A mutex (mutually exclusive), also referred to as a latch, is a latching
mechanism that the database server uses to synchronize access by multiple
threads to shared resources. Mutexes are similar to semaphores, which some
operating systems use to regulate access to shared data by multiple processes.
However, mutexes permit a greater degree of parallelism than semaphores.
Virtual-Processor Classes
A virtual processor of a given class can run only threads of that class. This
section describes the types of threads, or the types of processing, that each
class of virtual processor performs. It also explains how to determine the
number of virtual processors that you need to run for each class.
To evaluate the performance of the CPU virtual processors while the database
server is running, repeat the following command at regular intervals over a
set period of time:
onstat -g glo
For information on deciding how many CPU virtual processors you need, see
“Running Poll Threads on CPU or Network Virtual Processors” on page 5-32.
If your operating system allows you to disable priority aging, You can disable
it by specifying noage for the priority entry in the VPCLASS configuration
parameter. For more information, refer to the Administrator’s Reference.
Virtual processor
Starting CPU = 1
UNIX To see if processor affinity is supported on your UNIX platform, refer to the
machine notes file. ♦
In the following example, the database server assigns two virtual processors
to CPUs 5 and 6, and one virtual processor to CPU 7:
VPCLASS CPU,num=3,aff=5-7
Functions that run in a user-defined virtual-processor class need not yield the
processor, and they might issue direct file-system calls that block further
processing by the virtual processor until the I/O is complete.
To execute this function, the ONCONFIG file must include a VPCLASS param-
eter that defines the UDR class. If not, calls to the GreaterThanEqual function
will fail.
Tip: The CLASS routine modifier can specify any name for the VP class. This class
name need not exist when you register the UDR. However, when you try to run a
UDR that specifies a user-defined VP class for its execution, this class must exist and
have virtual processors assigned to it.
To configure the UDR class, include a line similar to the following one in the
ONCONFIG file. This line configures the UDR class with two virtual proces-
sors and with no priority aging.
VPCLASS UDR,num=2,noage
The preceding line defines the UDR VP class as a yielding VP class; that is, this
VP class allows the C-language UDR to yield to other threads that need access
to the UDR VP class. For more information on how to use the VPCLASS config-
uration parameter, see the Administrator’s Reference.
You can specify as many JVPs as your operating system will allow. If you run
many Java UDRs or parallel PDQ queries with Java UDRs, you should
configure more JVPs. For more information about UDRs written in Java, refer
to J/Foundation Developer’s Guide.
Use the VPCLASS configuration parameter with the jvp keyword to configure
JVPs. For more information, see the configuration parameters chapter in the
Administrator’s Reference.
The PIO class performs all I/O to the physical-log file, and the LIO class
performs all I/O to the logical-log files, unless those files reside in raw disk
space and the database server has implemented KAIO.
On operating systems that do not support KAIO, the database server uses the
AIO class of virtual processors to perform database I/O that is not related to
physical or logical logging.
The database server uses the CPU class to perform KAIO when it is available
on a platform. If the database server implements KAIO, a KAIO thread
performs all I/O to raw disk space, including I/O to the physical and logical
logs.
UNIX To find out if your UNIX platform supports KAIO, refer to the machine notes
file. ♦
I/O Priorities
In general, the database server prioritizes disk I/O by assigning different
types of I/O to different classes of virtual processors and by assigning prior-
ities to the nonlogging I/O queues. Prioritizing ensures that a high-priority
log I/O, for example, is never queued behind a write to a temporary file,
which has a low priority. The database server prioritizes the different types
of disk I/O that it performs, as Figure 5-9 shows.
Figure 5-9
How Database Server Prioritizes Disk I/O
Logical-Log I/O
The LIO class of virtual processors performs I/O to the logical-log files in the
following cases:
■ KAIO is not implemented.
■ The logical-log files are in cooked disk space.
Only when KAIO is implemented and the logical-log files are in raw disk
space does the database server use a KAIO thread in the CPU virtual processor
to perform I/O to the logical log.
The logical-log files store the data that enables the database server to roll back
transactions and recover from system failures. I/O to the logical-log files is
the highest priority disk I/O that the database server performs.
If the logical-log files are in a dbspace that is not mirrored, the database server
runs only one LIO virtual processor. If the logical-log files are in a dbspace
that is mirrored, the database server runs two LIO virtual processors. This
class of virtual processors has no parameters associated with it.
Physical-Log I/O
The PIO class of virtual processors performs I/O to the physical-log file in the
following cases:
Only when KAIO is implemented and the physical-log file is in raw disk
space does the database server use a KAIO thread in the CPU virtual processor
to perform I/O to the physical log. The physical-log file stores before-images of
dbspace pages that have changed since the last checkpoint. (For more infor-
mation on checkpoints, refer to “Checkpoints” on page 15-11.) At the start of
recovery, prior to processing transactions from the logical log, the database
server uses the physical-log file to restore before-images to dbspace pages
that have changed since the last checkpoint. I/O to the physical-log file is the
second-highest priority I/O after I/O to the logical-log files.
If the physical-log file is in a dbspace that is not mirrored, the database server
runs only one PIO virtual processor. If the physical-log file is in a dbspace that
is mirrored, the database server runs two PIO virtual processors. This class of
virtual processors has no parameters associated with it.
Asynchronous I/O
The database server performs database I/O asynchronously, meaning that
I/O is queued and performed independently of the thread that requests the
I/O. Performing I/O asynchronously allows the thread that makes the
request to continue working while the I/O is being performed.
The database server performs all database I/O asynchronously, using one of
the following facilities:
Database I/O includes I/O for SQL statements, read-ahead, page cleaning,
and checkpoints, as well as other I/O.
Kernel-Asynchronous I/O
The database server uses KAIO when the following conditions exist:
The database server implements KAIO by running a KAIO thread on the CPU
virtual processor. The KAIO thread performs I/O by making system calls to
the operating system, which performs the I/O independently of the virtual
processor. The KAIO thread can produce better performance for disk I/O than
the AIO virtual processor can, because it does not require a switch between
the CPU and AIO virtual processors.
UNIX Informix implements KAIO when it ports the database server to a platform
that supports this feature. The database server administrator does not
configure KAIO. To see if KAIO is supported on your platform, see the
machine notes file. ♦
The database server assigns each disk chunk a queue, sometimes known as a
gfd queue, based on the filename of the chunk. The database server orders I/O
requests within a queue according to an algorithm that minimizes disk-head
movement. The AIO virtual processors service queues that have work
pending in round-robin fashion.
Use the VPCLASS parameter with the aio keyword to specify the number of
AIO virtual processors that the database server starts initially. For infor-
mation about VPCLASS, refer to the chapter on configuration parameters in
the Administrator’s Reference.
You can start additional AIO virtual processors while the database server is
in online mode. For more information, refer to “Adding Virtual Processors in
Online Mode” on page 6-7.
You cannot drop AIO virtual processors while the database server is in online
mode.
If the database server implements KAIO on your platform, and all of your
dbspaces are composed of raw disk space, one AIO virtual processor might
be sufficient.
If the database server implements KAIO, but you are using some buffered
files for chunks, allocate two AIO virtual processors per active dbspace that is
composed of buffered file chunks. If KAIO is not implemented on your
platform, allocate two AIO virtual processors for each disk that the database
server accesses frequently.
The NETTYPE parameter has an optional entry, called vp class, that allows
you to specify either CPU or NET, for CPU or network virtual-processor
classes, respectively.
While the database server is in online mode, you cannot drop a CPU virtual
processor that is running a poll thread.
For most systems, one poll thread and consequently one virtual processor per
network interface/protocol combination is sufficient. For systems with 200 or
more network users, running additional network virtual processors might
improve throughput. In this case, you need to experiment to determine the
optimal number of virtual processors for each interface/protocol
combination.
The listen thread opens the port and requests one of the poll threads for the
specified interface/protocol combination to monitor the port for client
requests. The poll thread runs either in the CPU virtual processor or in the
network virtual processor for the connection that is being used. For infor-
mation on the number of poll threads, refer to “Specifying the Number of
Networking Virtual Processors” on page 5-33.
When a poll thread receives a connection request from a client, it passes the
request to the listen thread for the port. The listen thread authenticates the
user, establishes the connection to the database server, and starts an sqlexec
thread, the session thread that performs the primary processing for the client.
Figure 5-11 illustrates the roles of the listen and poll threads in establishing a
connection with a client application.
Figure 5-11
Request The Roles of the Poll
Client
connection and the Listen
Threads in
Connecting to a
Client
Accept client
Pass request to connection
listen thread Key
A poll thread waits for requests from the client and places them in shared
memory to be processed by the sqlexec thread. For network connections, the
poll thread places the message in a queue in the shared-memory global pool.
The poll thread then wakes up the sqlexec thread of the client to process the
request. Whenever possible, the sqlexec thread writes directly back to the
client without the help of the poll thread. In general, the poll thread reads
data from the client, and the sqlexec thread sends data to the client.
UNIX For a shared-memory connection, the poll thread places the message in the
communications portion of shared memory. ♦
Figure 5-12 illustrates the basic tasks that the poll thread and the sqlexec
thread perform in communicating with a client application.
Figure 5-12
The Roles of the Poll
Process and sqlexec Threads
Client in Communicating
with the Client
Application
Read data
Send data
Send
data
to client
Pass request
and data
Poll to sqlexec sqlexec Process
thread thread
Read data
from client
Database server
Application Thread Data
process process
To add listen threads for additional ports, you must first use the
DBSERVERALIASES parameter to specify dbservernames for each of the ports.
For example, the DBSERVERALIASES parameter in Figure 5-13 defines two
additional dbservernames, soc_ol2 and soc_ol3, for the database server
instance identified as soc_ol1.
Figure 5-13
DBSERVERNAME soc_ol1 Defining Multiple dbservernames for
DBSERVERALIASES soc_ol2,soc_ol3
Multiple Connections of the Same Type
Once you define additional dbservernames for the database server, you must
specify an interface/protocol combination and port for each of them in the
sqlhosts file or registry. Each port is identified by a unique combination of
hostname and servicename entries. For example, the sqlhosts entries shown
in Figure 5-14 cause the database server to start three listen threads for the
onsoctcp interface/protocol combination, one for each of the ports defined.
Figure 5-14
sqlhosts Entries to Listen to Multiple Ports for a Single Interface/Protocol Combination
The database server starts the same number of CSM virtual processors as the
number of CPU virtual processors that it starts.
For descriptions of the virtual-processor classes and for advice on how many
virtual processors you should specify for each class, refer to Chapter 5,
“Virtual Processors and Threads.”
■ A text editor
■ IBM Informix Server Administrator (ISA)
UNIX ■ ON-Monitor ♦
Figure 6-1 lists the ONCONFIG parameters that are used to configure virtual
processors. For more information on how these parameters affect virtual
processors, refer to “Virtual-Processor Classes” on page 5-19.
Figure 6-1
ONCONFIG Parameters for Configuring Virtual Processors
Specifying VPCLASS
It is recommended that you use the VPCLASS parameter instead of the
NUMCPUVPS, NUMAIOVPS, NOAGE, AFF_SPROC, and AFF_NPROCS param-
eters. You can specify a VPCLASS name of up to 128 characters. The VPCLASS
name must begin with a letter or underscore, and must contain letters, digits,
underscores, or $ characters.
For recommended values for these database server parameters on UNIX, refer
to your machine notes file.
Once the database server is in online mode, you can start additional virtual
processors to improve performance, if necessary. For more information, refer
to “Adding Virtual Processors in Online Mode” below.
While the database server is in online mode, you can drop virtual processors
of the CPU and user-defined classes. For more information, refer to
“Dropping CPU and User-Defined Virtual Processors” on page 6-8.
To terminate the database server and thereby terminate all virtual processors,
use the onmode -k command. For more information on using onmode -k,
refer to the utilities chapter of the Administrator’s Reference.
You can start these additional virtual processors with one of the following
methods:
■ The -p option of the onmode utility
■ ISA
You can also start additional virtual processors for user-defined classes to run
user-defined routines. For more information about user-defined virtual
processors, refer to “Assigning a UDR to a User-Defined Virtual-Processor
Class” on page 5-25.
onmode -p +4 aio
You can add virtual processors to only one class at a time. To add virtual
processors for another class, you must run onmode again.
You cannot use ON-Monitor to start additional virtual processors for a user-
defined class. For more information, refer to “Adding Virtual Processors in
Online Mode with onmode.”
% onmode -p -2 cpu
If you attempt to drop a CPU virtual processor that is running a poll thread,
you receive the following message:
onmode: failed when trying to change the number of cpu
virtual processor by -number.
Windows In Windows, you can have only one user-defined virtual processor class at a
time. Omit the number parameter in the onmode -p vpclass command. ♦
onstat -g ath
The onstat -g ath command displays information on system threads and the
virtual-processor classes.
onstat -g glo
Use the onstat -g glo command to display information about each virtual
processor that is currently running, as well as cumulative statistics for each
virtual processor class. Figure 6-2 shows an example of the output from this
option.
Figure 6-2
MT global info: onstat -g glo Output
sessions threads vps lngspins
1 15 8 0
onstat -g ioq
Use the onstat -g ioq option to determine whether you need to allocate
additional AIO virtual processors. The command onstat -g ioq displays the
length of the I/O queues under the column len, as Figure 6-3 shows.
If the length of the I/O queue is growing, I/O requests are accumulating
faster than the AIO virtual processors can process them. If the length of the
I/O queue continues to show that I/O requests are accumulating, consider
adding AIO virtual processors.
Figure 6-3
onstat -g ioq
onstat -g ioq and
AIO I/O queues: onstat -d Output
q name/id len maxlen totalops dskread dskwrite dskcopy
adt 0 0 0 0 0 0 0
msc 0 0 1 12 0 0 0
aio 0 0 4 89 68 0 0
pio 0 0 1 1 0 1 0
lio 0 0 1 17 0 17 0
kio 0 0 0 0 0 0 0
gfd 3 0 3 254 242 12 0
gfd 4 0 17 614 261 353 0
onstat -g rea
Use the onstat -g rea option to monitor the number of threads in the ready
queue. If the number of threads in the ready queue is growing for a class of
virtual processors (for example, the CPU class), you might have to add more
virtual processors to your configuration. Figure 6-4 shows onstat -g rea
output.
Figure 6-4
Ready threads:
tid tcb rstcb prty status vp-class name
onstat -g rea Output
Column Description
Shared Memory
7
In This Chapter . . . . . . . . . . . . . . . . . . . . 7-5
Shared Memory . . . . . . . . . . . . . . . . . . . . 7-5
Shared-Memory Use . . . . . . . . . . . . . . . . . . 7-6
Shared-Memory Allocation. . . . . . . . . . . . . . . 7-7
Shared-Memory Size . . . . . . . . . . . . . . . . . 7-9
Action to Take If SHMTOTAL Is Exceeded . . . . . . . . . 7-10
Shared Memory
Shared memory is an operating-system feature that allows the database
server threads and processes to share data by sharing access to pools of
memory. The database server uses shared memory for the following
purposes:
Shared memory enables the database server to reduce overall memory usage
because the participating processes, in this case, virtual processors, do not
need to maintain private copies of the data that is in shared memory.
Shared memory reduces disk I/O, because buffers, which are managed as a
common pool, are flushed on a database server-wide basis instead of a per-
process basis. Furthermore, a virtual processor can often avoid reading data
from disk because the data is already in shared memory as a result of an
earlier read operation. The reduction in disk I/O reduces execution time.
Shared memory provides the fastest method of interprocess communication,
because it processes read and write messages at the speed of memory
transfers.
Shared-Memory Use
The database server uses shared memory for the following purposes:
Client
Client
Client
Client
Shared-Memory Allocation
The database server creates the following portions of shared memory:
All database server virtual processors have access to the same shared-
memory segments. Each virtual processor manages its work by maintaining
its own set of pointers to shared-memory resources such as buffers, locks,
and latches. Virtual processors attach to shared memory when you take the
database server from offline mode to quiescent mode or from offline mode
directly to online mode. The database server uses locks and latches to
manage concurrent access to shared-memory resources by multiple threads.
Figure 7-2
Contents of Database Server Shared Memory
Virtual portion
Big buffers
Global pool
Unallocated memory
IPC communications
Client/server IPC messages portion (UNIX only)
Shared-Memory Size
Each portion of the database server shared memory consists of one or more
operating-system segments of memory, each one divided into a series of
blocks that are 4 kilobytes in size and managed by a bitmap.
The header-line output by the onstat utility contains the size of the database
server shared memory, expressed in kilobytes. For information on how to use
onstat, refer to the utilities chapter in the Administrator’s Reference. You can
also use onstat -g seg to monitor how much memory the database server
allocates for each portion of shared memory.
You can set the SHMTOTAL parameter in the ONCONFIG file to limit the
amount of memory overhead that the database server can place on your
computer or node. The SHMTOTAL parameter specifies the total amount of
shared memory that the database server can use for all memory allocations.
However, certain operations might fail if the database server needs more
memory than the amount set in SHMTOTAL. If this condition occurs, the
database server displays the following message in the message log:
size of resident + virtual segments x + y > z
total allowed by configuration parameter SHMTOTAL
After the database server sends these messages, it rolls back any partial
results performed by the offending query.
After the database server informs you about the failure to allocate additional
memory, it rolls back the transactions that caused it to exceed the SHMTOTAL
limit. Immediately after the rollback, operations no longer fail from lack of
memory, and the database server continues to process transactions as usual.
If messages indicate on a regular basis that the database server needs more
memory than SHMTOTAL allows, you have not configured the database
server correctly. Lowering the value of BUFFERS or DS_TOTAL_MEMORY is
one possible solution, and increasing the value of SHMTOTAL is another.
The following sections describe how each type of process attaches to the
database server shared memory.
UNIX $INFORMIXDIR/etc/.infos.servername
Windows %INFORMIXDIR%\etc\.infos.servername
The oninit process reads the ONCONFIG file and creates the
file .infos.servername when it starts the database server. The file is removed
when the database server terminates.
The following sections describe how the database server uses the values of
the SERVERNUM and SHMBASE configuration parameters in the process of
attaching shared-memory segments.
To see the key values for shared-memory segments, run the onstat -g seg
command. For more information, see the sections on SHMADD and and the
buffer pool in your Performance Guide.
When a virtual processor requests that the operating system attach the first
shared-memory segment, it supplies the unique key value to identify the
segment. In return, the operating system passes back a shared-memory segment
identifier associated with the key value. Using this identifier, the virtual
processor requests that the operating system attach the segment of shared
memory to the virtual-processor address space.
Warning: It is recommended that you not attempt to change the value of SHMBASE.
The virtual processor repeats this process until it has acquired the total
amount of shared memory.
Given the initial key value of (SERVERNUM * 65536) + shmkey, the database
server can request up to 65,536 shared-memory segments before it could
request a shared-memory key value used by another database server instance
on the same computer.
Figure 7-3 illustrates the problem. If the lower-boundary address is less than
the ending address of the previous segment plus the size of the current
segment, the operating system attaches the current segment at a point
beyond the end of the previous segment. This action creates a gap between
the two segments. Because shared memory must be attached to a virtual
processor so that it looks like contiguous memory, this gap creates problems.
The database server receives errors when this situation occurs. To correct the
problem, check the operating-system kernel parameter that specifies the
lower-boundary address or reconfigure the kernel to allow larger shared-
memory segments. For a description of the operating-system kernel
parameter, refer to “Shared-Memory Lower-Boundary Address” on page 8-5.
Figure 7-3
Operating-system memory Shared-Memory
Lower-Boundary
Virtual processor Address Overview
SHMBASE
Shared-memory
segment
The next segment of shared
memory should attach here.
Gap
The database server requests that the operating system keep the virtual
portions in physical memory when the following two conditions exist:
■ The operating system supports shared-memory residency.
■ The RESIDENT parameter in the ONCONFIG file is set to -1 or a value
that is greater than 0.
Warning: You must consider the use of shared memory by all applications when you
consider whether to set the RESIDENT parameter to -1. Locking all shared memory
for the use of the Informix database server can adversely affect the performance of
other applications, if any, on the same computer.
Shared-Memory Header
The shared-memory header contains a description of all other structures in
shared memory, including internal tables and the buffer pool.
The size of the shared-memory header is about 200 kilobytes, but the size
varies depending on the computer platform. You cannot tune the size of the
header.
Figure 7-4 illustrates the shared-memory header and the buffer pool.
Figure 7-4
Shared-Memory
Shared-memory Buffer Pool
Buffer table
header
Hash table
Buffer pool
You specify the number of buffers in the buffer pool with the BUFFERS
parameter in the ONCONFIG file. BUFFERS defaults to 1000 buffers. To
allocate the proper number of buffers, start with at least four buffers per user.
For more than 500 users, the minimum requirement is 2000 buffers. Too few
buffers can severely impact performance, so you must monitor the database
server and tune the value of BUFFERS to determine an acceptable value. For
more information on tuning the number of buffers, refer to your Performance
Guide.
The status of the buffers is tracked through the buffer table. Within shared
memory, buffers are organized into LRU BUFFER QUEUES. Buffer acquisition
is managed through the use of latches, called mutexes, and lock-access
information.
Buffer Size
Each buffer is the size of one database server page. In general, the database
server performs I/O in full-page units, the size of a buffer. The exceptions are
I/O performed from big buffers, from blobspace buffers, or from lightweight
I/O buffers. (See “Big Buffers” on page 7-28 and “Creation of Blobpage
Buffers” on page 7-48.) For information about when to use private buffers,
see the section on lightweight I/O operations in the chapter on configuration
effects on I/O utilization in your Performance Guide.
The onstat -b command displays information about the buffers. For infor-
mation on onstat, refer to the utilities chapter in the Administrator’s Reference.
Logical-Log Buffer
The database server uses the logical log to store a record of changes to the
database server data since the last dbspace backup. The logical log stores
records that represent logical units of work for the database server. The
logical log contains the following five types of log records, in addition to
many others:
The database server uses only one of the logical-log buffers at a time. This
buffer is the current logical-log buffer. Before the database server flushes the
current logical-log buffer to disk, it makes the second logical-log buffer the
current one so that it can continue writing while the first buffer is flushed. If
the second logical-log buffer fills before the first one finishes flushing, the
third logical-log buffer becomes the current one. This process is illustrated in
Figure 7-5.
Figure 7-5
The Logical-Log
Logical-log buffers Buffer and Its
Writes performed by Relation to the
Current user thread Logical-Log Files
logical-log buffer on Disk
(now filling)
Current
logical-log
Logical-log file
buffer (ready to
accept data) Free
logical-log
file
Logical-log
buffer
Free
(flushing)
logical-log
file
For a description of how the database server flushes the logical-log buffer,
refer to “Flushing the Logical-Log Buffer” on page 7-45.
The LOGBUFF parameter in the ONCONFIG file specifies the size of the
logical-log buffers. Small buffers can create problems if you store records
larger than the size of the buffers (for example, TEXT or BYTE data in
dbspaces). For the possible values that you can assign to this configuration
parameter, refer to the Administrator’s Reference.
For information on the impact of TEXT and BYTE data on shared memory
buffers, refer to “Buffering Large-Object Data” on page 7-46.
Physical-Log Buffer
The database server uses the physical-log buffer to hold before-images of
some of the modified dbspace pages. The before-images in the physical log
and the logical-log records enable the database server to restore consistency
to its databases after a system failure.
The physical-log buffer is actually two buffers. Double buffering permits the
database server processes to write to the active physical-log buffer while the
other buffer is being flushed to the physical log on disk. For a description of
how the database server flushes the physical-log buffer, refer to “Flushing the
Physical-Log Buffer” on page 7-42. For information on monitoring the
physical-log file, refer to “Monitoring Physical and Logical-Logging
Activity” on page 16-6.
The PHYSBUFF parameter in the ONCONFIG file specifies the size of the
physical-log buffers. A write to the physical-log buffer writes exactly one
page. If the specified size of the physical-log buffer is not evenly divisible by
the page size, the database server rounds the size down to the nearest value
that is evenly divisible by the page size. Although some operations require
the buffer to be flushed sooner, in general the database server flushes the
buffer to the physical-log file on disk when the buffer fills. Thus, the size of
the buffer determines how frequently the database server needs to flush it to
disk. For more information on this configuration parameter, refer to the
Administrator’s Reference.
Lock Table
A lock is created when a user thread writes an entry in the lock table. The lock
table is the pool of available locks. Each lock is 44 bytes. A single transaction
can own multiple locks. For an explanation of locking and the SQL statements
associated with locking, see the IBM Informix Guide to SQL: Tutorial.
The following information, which is stored in the lock table, describes the
lock:
To specify the initial size of the lock table, set the LOCKS configuration
parameter.
If the number of locks allocated by sessions exceeds the value of LOCKS, the
database server doubles the size of the lock table, up to 15 times. The
maximum value of LOCKS is 8,000,000. Use the DEF_TABLE_LOCKMODE
configuration parameter to set the lock mode to page or row for new tables.
For more information on using and monitoring locks, see the chapter on
locking in your Performance Guide and the IBM Informix Guide to SQL: Tutorial.
For more information on using LOCKS to specify the number of locks for a
session, see the chapter on configuration parameters in the Administrator’s
Reference and the chapter on configuration effects on memory utilization in
your Performance Guide.
All sessions have one or more memory pools. When the database server
needs memory, it looks first in the specified pool. If insufficient memory is
available in a pool to satisfy a request, the database server adds memory from
the system pool. If the database server cannot find enough memory in the
system pool, it dynamically allocates more segments to the virtual portion.
The database server allocates virtual shared memory for each of its
subsystems (session pools, stacks, heaps, control blocks, system catalog, SPL
routine caches, SQL statement cache, sort pools, and message buffers) from
pools that track free space through a linked list. When the database server
allocates a portion of memory, it first searches the pool free-list for a fragment
of sufficient size. If it finds none, it brings new blocks into the pool from the
virtual portion. When memory is freed, it goes back to the pool as a free
fragment and remains there until the pool is destroyed. When the database
server starts a session for a client application, for example, it allocates
memory for the session pool. When the session terminates, the database
server returns the allocated memory as free fragments.
For more information on determining the size of virtual shared memory, refer
to “Adding a Segment to the Virtual Portion of Shared Memory” on page 8-14
and to the DS_TOTAL_SIZE, SHMVIRTSIZE, and SHMADD configuration
parameters in the Administrator’s Reference.
■ Internal tables
■ Big buffers
■ Session data
■ Thread data (stacks and heaps)
■ Data-distribution cache
■ Dictionary cache
■ SPL routine cache
■ SQL statement cache
■ Sorting pool
■ Global pool
■ Buffer table
■ Chunk table
■ Dbspace table
■ Page-cleaner table
■ Tblspace table
■ Transaction table
■ User table
Buffer Table
The buffer table tracks the addresses and status of the individual buffers in
the shared-memory pool. When a buffer is used, it contains an image of a
data or index page from disk. For more information on the purpose and
content of a disk page, refer to “Pages” on page 9-10.
Each buffer in the buffer table contains the following control information,
which is needed for buffer management:
■ Buffer status
Buffer status is described as empty, unmodified, or modified. An
unmodified buffer contains data, but the data can be overwritten. A
modified (dirty) buffer contains data that must be written to disk
before it can be overwritten.
■ Current lock-access level
Buffers receive lock-access levels depending on the type of operation
that the user thread is executing. The database server supports two
buffer lock-access levels: shared and exclusive.
■ Threads waiting for the buffer
Each buffer header maintains a list of the threads that are waiting for
the buffer and the lock-access level that each waiting thread requires.
Each database server buffer has one entry in the buffer table.
The database server determines the number of entries in the buffer-table hash
table, based on the number of allocated buffers. The maximum number of
hash values is the largest power of 2 that is less than the value of BUFFERS.
Chunk Table
The chunk table tracks all chunks in the database server. If mirroring has been
enabled, a corresponding mirrored chunk table is also created when shared
memory is initialized. The mirrored chunk table tracks all mirrored chunks.
The chunk table in shared memory contains information that enables the
database server to locate chunks on disk. This information includes the
number of the initial chunk and the number of the next chunk in the dbspace.
Flags also describe chunk status: mirror or primary; offline, online, or
recovery mode; and whether this chunk is part of a blobspace. For infor-
mation on monitoring chunks, refer to “Monitoring Chunks” on page 10-41.
The maximum number of entries in the chunk table might be limited by the
maximum number of file descriptors that your operating system allows per
process. You can usually specify the number of file descriptors per process
with an operating-system kernel-configuration parameter. For details,
consult your operating-system manuals.
Dbspace Table
The dbspace table tracks storage spaces in the database server. The dbspace-
table information includes the following information about each dbspace:
■ Dbspace number
■ Dbspace name and owner
■ Dbspace mirror status (mirrored or not)
■ Date and time that the dbspace was created
If the storage space is a blobspace, flags indicate the media where the
blobspace is located: magnetic, removable, or optical media. If the storage
space is an sbspace, it contains internal tables that track metadata for smart
large objects and large contiguous blocks of pages containing user data.
Page-Cleaner Table
The page-cleaner table tracks the state and location of each of the page-
cleaner threads. The number of page-cleaner threads is specified by the
CLEANERS configuration parameter in the ONCONFIG file. For advice on
how many page-cleaner threads to specify, refer to the chapter on configu-
ration parameters in the Administrator’s Reference.
The page-cleaner table always contains 128 entries, regardless of the number
of page-cleaner threads specified by the CLEANERS parameter in the
ONCONFIG file.
Tblspace Table
The tblspace table tracks all active tblspaces in a database server instance. An
active tblspace is one that is currently in use by a database session. Each
active table accounts for one entry in the tblspace table. Active tblspaces
include database tables, temporary tables, and internal control tables, such as
system catalog tables. Each tblspace table entry includes header information
about the tblspace, the tblspace name, and pointers to the tblspace tblspace
in dbspaces on disk. (The shared-memory active tblspace table is different
from the tblspace tblspace.) For information on monitoring tblspaces, refer to
“Monitoring Tblspaces and Extents” on page 10-48.
The database server manages one tblspace table for each dbspace.
Transaction Table
The transaction table tracks all transactions in the database server.
For more information on transactions and the SQL statements that you use
with transactions, refer to the IBM Informix Guide to SQL: Tutorial, the
IBM Informix Guide to SQL: Reference, and the IBM Informix Guide to SQL: Syntax.
UNIX The transaction table also specifically supports the X/Open environment.
Support for the X/Open environment requires TP/XA. For a description of a
transaction in this environment, refer to the TP/XA Programmer’s Manual. ♦
User Table
The user table tracks all user threads and system threads. Each client session
has one primary thread and zero-to-many secondary threads, depending on
the level of parallelism specified. System threads include one to monitor and
control checkpoints, one to process onmode commands, the B-tree scanner
threads, and page-cleaner threads.
The database server increases the number of entries in the user table as
needed. You can monitor user threads with the onstat -u command.
Big Buffers
A big buffer is a single buffer that is made up of several pages. The actual
number of pages is platform dependent. The database server allocates big
buffers to improve performance on large reads and writes.
The database server uses a big buffer whenever it writes to disk multiple
pages that are physically contiguous. For example, the database server tries
to use a big buffer to perform a series of sequential reads (light scans) or to
read into shared memory simple large objects that are stored in a dbspace.
Users do not have control over the big buffers. If the database server uses
light scans, it allocates big buffers from shared memory.
For information on monitoring big buffers with the onstat command, refer to
the chapter on configuration effects on I/O activity in your Performance Guide.
Session Data
When a client application requests a connection to the database server, the
database server begins a session with the client and creates a data structure for
the session in shared memory called the session-control block. The session-
control block stores the session ID, the user ID, the process ID of the client, the
name of the host computer, and various status flags.
Thread Data
When a client connects to the database server, in addition to starting a
session, the database server starts a primary session thread and creates a
thread-control block for it in shared memory.
The database server also starts internal threads on its own behalf and creates
thread-control blocks for them. When the database server switches from
running one thread to running another one (a context switch), it saves infor-
mation about the thread— such as the register contents, program counter
(address of the next instruction), and global pointers—in the thread-control
block. For more information on the thread-control block and how it is used,
refer to “Context Switching” on page 5-13.
Stacks
Each thread in the database server has its own stack area in the virtual
portion of shared memory. For a description of how threads use stacks, refer
to “Stacks” on page 5-15. For information on how to monitor the size of the
stack for a session, refer to monitoring sessions and threads section in your
Performance Guide.
The size of the stack space for user threads is specified by the STACKSIZE
parameter in the ONCONFIG file. The default size of the stack is 32 kilobytes.
You can change the size of the stack for all user threads, if necessary, by
changing the value of STACKSIZE. For information and a warning on setting
the size of the stack, refer to STACKSIZE in the chapter on configuration
parameters in the Administrator’s Reference.
To alter the size of the stack for the primary thread of a specific session, set
the INFORMIXSTACKSIZE environment variable. The value of
INFORMIXSTACKSIZE overrides the value of STACKSIZE for a particular
user. For information on how to override the stack size for a particular user,
refer to the description of the INFORMIXSTACKSIZE environment variable in
the IBM Informix Guide to SQL: Reference.
To more safely alter the size of stack space, use the INFORMIXSTACKSIZE
environment variable rather than alter the configuration parameter
STACKSIZE. The INFORMIXSTACKSIZE environment variable affects the
stack space for only one user, and it is less likely to affect new client applica-
tions that initially were not measured.
Heaps
Each thread has a heap to hold data structures that it creates while it is
running. A heap is dynamically allocated when the thread is created. The size
of the thread heap is not configurable.
Data-Distribution Cache
The database server uses distribution statistics generated by the UPDATE
STATISTICS statement in the MEDIUM or HIGH mode to determine the query
plan with the lowest cost. When the database server accesses the distribution
statistics for a specific column the first time, it reads the distribution statistics
from the sysdistrib system catalog table on disk and stores the statistics in the
data-distribution cache. These statistics can then be read for the optimization
of subsequent queries that access the column.
Dictionary Cache
When a session executes an SQL statement that requires access to a system
catalog table, the database server reads the system catalog tables and stores
them in structures that it can access more efficiently. These structures are
created in the virtual portion of shared memory for use by all sessions. These
structures constitute the dictionary cache.
You can configure the size of the dictionary cache with the DD_HASHSIZE and
DD_HASHMAX configuration parameters. For more information about these
parameters, refer to the chapter on configuration effects on memory in your
Performance Guide.
Sorting Memory
The following database operations can use large amounts of the virtual
portion of shared memory to sort data:
■ Decision-support queries that involve joins, groups, aggregates and
sort operations
■ Index builds
■ UPDATE STATISTICS statement in SQL
The amount of virtual shared memory that the database server allocates for
a sort depends on the number of rows to be sorted and the size of the row,
along with other factors.
You can configure the size of the UDR cache with the PC_HASHSIZE and
PC_POOLSIZE configuration parameters. For information about changing the
default size of the UDR cache, refer to the chapter on queries and the query
optimizer in your Performance Guide.
Global Pool
The global pool stores structures that are global to the database server. For
example, the global pool contains the message queues where poll threads for
network communications deposit messages from clients. The sqlexec threads
pick up the messages from the global pool and process them.
For more information, see the sections on network buffer pools and virtual
portion of shared memory in your Performance Guide.
UNIX
Communications Portion of Shared Memory
The database server allocates memory for the IPC communication portion of
shared memory if you configure at least one of your connections as an IPC
shared-memory connection. The database server performs this allocation
when you initialize shared memory. The communications portion contains
the message buffers for local client applications that use shared memory to
communicate with the database server.
Concurrency Control
The database server threads that run on the same virtual processor and on
separate virtual processors share access to resources in shared memory.
When a thread writes to shared memory, it uses mechanisms called mutexes
and locks to prevent other threads from simultaneously writing to the same
area. A mutex gives a thread the right to access a shared-memory resource. A
lock prevents other threads from writing to a buffer until the thread that
placed the lock is finished with the buffer and releases the lock.
Shared-Memory Mutexes
The database server uses mutexes to coordinate threads as they attempt to
modify data in shared memory. Every modifiable shared-memory resource is
associated with a mutex. Before a thread can modify a shared-memory
resource, it must first acquire the mutex associated with that resource. After
the thread acquires the mutex, it can modify the resource. When the modifi-
cation is complete, the thread releases the mutex.
If a thread tries to obtain a mutex and finds that it is held by another thread,
the incoming thread must wait for the mutex to be released.
For example, two threads can attempt to access the same slot in the chunk
table, but only one can acquire the mutex associated with the chunk table.
Only the thread that holds the mutex can write its entry in the chunk table.
The second thread must wait for the mutex to be released and then acquire it.
■ Share locks
■ Exclusive locks
Each of these lock types enforces the required level of thread isolation during
execution.
Share Lock
A buffer is in share mode, or has a share lock, if multiple threads have access
to the buffer to read the data but none intends to modify the data.
Exclusive Lock
A buffer is in exclusive mode, or has an exclusive lock, if a thread demands
exclusive access to the buffer. All other thread requests that access the buffer
are placed in the wait queue. When the executing thread is ready to release
the exclusive lock, it wakes the next thread in the wait queue.
LRU Queues
A buffer holds data for the purpose of caching. The database server uses the
least-recently used (LRU) queues to replace the cached data.
The LRUS parameter in the ONCONFIG file specifies the number of LRU
queues to create when database server shared memory is initialized. You can
tune the value of the LRUS, LRU_MIN_DIRTY, and LRU_MAX_DIRTY param-
eters, to control how frequently the shared-memory buffers are flushed to
disk.
The free or unmodified page list is referred to as the FLRU queue of the queue
pair, and the modified page list is referred to as the MLRU queue. The two
separate lists eliminate the need to search a queue for a free or unmodified
page. Figure 7-6 illustrates the structure of the LRU queues.
Figure 7-6
LRU Queue
FLRU 1
LRU queue
(composed of two
MLRU 1 queues)
When a user thread needs to acquire a buffer, the database server randomly
selects one of the FLRU queues and uses the oldest or least-recently used
entry in the list. If the least-recently used page can be latched, that page is
removed from the queue.
If the FLRU queue is locked, and the end page cannot be latched, the database
server randomly selects another FLRU queue.
After an executing thread finishes its work, it releases the buffer. If the page
has been modified, the buffer is placed at the most-recently used end of an
MLRU QUEUE. If the page was read but not modified, the buffer is returned
to the FLRU queue at its most-recently used end. For information on how to
monitor LRU queues, refer to “Monitoring Buffer-Pool Activity” on
page 8-20.
Initial values for the LRUS parameter are recommended based on the number
of CPUs that are available on your computer. If your computer is a unipro-
cessor, start by setting the LRUS parameter to 4. If your computer is a
multiprocessor, use the following formula:
LRUS = max(4, (NUMCPUVPS))
After you provide an initial value to the LRUS parameter, monitor your LRU
queues with onstat -R. If you find that the percent of dirty LRU queues consis-
tently exceeds the value of the LRU_MAX_DIRTY parameter, increase the
value of the LRUS configuration parameter to add more LRU queues.
For example, suppose you set LRU_MAX_DIRTY to 70 and find that your LRU
queues are consistently 75 percent dirty. Consider increasing the value of the
LRUS configuration parameter. If you increase the number of LRU queues,
you shorten the length of the queues, thereby reducing the work of the page
cleaners. However, you must allocate a sufficient number of page cleaners
with the CLEANERS configuration parameter, as discussed in the following
section.
For example, suppose that the CLEANERS parameter is set to 8, and you
increase the number of LRU queues from 8 to 12. You can expect little in the
way of a performance gain because the 8 cleaners must now share the work
of cleaning an additional 4 queues. If you increase the number of CLEANERS
to 12, each of the now-shortened queues can be more efficiently cleaned by a
single cleaner.
In practice, page cleaning begins under several conditions, only one of which
is when an MLRU queue reaches the value of LRU_MAX_DIRTY. For more
information on how the database server performs buffer-pool flushing, refer
to “Flushing Data to Disk” on page 7-40.
Figure 7-8 shows how the value of LRU_MIN_DIRTY is applied to the LRU
queue to specify the acceptable percent of buffers in an MLRU queue and the
point at which page cleaning ends.
Figure 7-8
BUFFERS specified as 8000 How
LRUS specified as 8
LRU_MIN_DIRTY specified as 50 percent
LRU_MIN_DIRTY
Specifies the Point
The acceptable number of buffers in the MLRU queue and at Which Page
the point at which page cleaning can end is equal Cleaning Can End
to LRU_MIN_DIRTY.
For more information on how the database server flushes the buffer pool,
refer to “Flushing Data to Disk” on page 7-40.
The database server performs a read-ahead whenever it detects the need for
it during sequential data or index reads.
For an example of the output that the onstat -p command produces to enable
you to monitor the database server use of read-ahead, refer to “Monitoring
the Shared-Memory Profile and Latches” on page 8-15 and to the utilities
chapter in the Administrator’s Reference.
In practice, the physical-log buffer is flushed first and then the buffers that
contain modified pages. Therefore, even when a shared-memory buffer page
needs to be flushed because a user thread is trying to acquire a buffer but
none is available (a foreground write), the buffer pages cannot be flushed
until the before-image of the page has been written to disk.
Both the physical-log buffer and the physical log contribute toward
maintaining the physical and logical consistency of the data. For a
description of physical logging, refer to Chapter 15, “Physical Logging,
Checkpoints, and Fast Recovery.” For a description of checkpoints and fast
recovery, refer to Chapter 15, “Physical Logging, Checkpoints, and Fast
Recovery.”
The contents of the physical-log buffer must always be flushed to disk before
any data buffers. This rule is required for the fast-recovery feature.
The database server uses only one of the two physical-log buffers at a time.
This buffer is the current physical-log buffer. Before the database server
flushes the current physical-log buffer to disk, it makes the other buffer the
current buffer so that it can continue writing while the first buffer is being
flushed.
■ Foreground write
■ LRU write
■ Chunk write
To display the write counts that the database server maintains, use onstat -F
as described in the utilities chapter of the Administrator’s Reference.
If you implement mirroring for the database server, data is always written to
the primary chunk first. The write is then repeated on the mirrored chunk.
Writes to a mirrored chunk are included in the counts. For more information
on monitoring the types of writes that the database server performs, refer to
“Monitoring Buffer-Pool Activity” on page 8-20.
Foreground Write
Whenever an sqlexec thread writes a buffer to disk, it is termed a foreground
write. A foreground write occurs when an sqlexec thread searches through
the LRU queues on behalf of a user but cannot locate an empty or unmodified
buffer. To make space, the sqlexec thread flushes pages, one at a time, to hold
the data to be read from disk. (For more information, refer to “LRU Queues”
on page 7-34.)
If the sqlexec thread must perform buffer flushing just to acquire a shared-
memory buffer, performance can suffer. Foreground writes should be
avoided. To display a count of the number of foreground writes, run
onstat -F. If you find that foreground writes are occurring on a regular basis,
tune the value of the page-cleaning parameters. Either increase the number
of page cleaners or decrease the value of LRU_MAX_DIRTY.
LRU Write
Unlike foreground writes, LRU writes are performed by page cleaners rather
than by sqlexec threads. The database server performs LRU writes as
background writes that typically occur when the percentage of dirty buffers
exceeds the percent you that specified in the LRU_MAX_DIRTY configuration
parameter.
Chunk Write
Chunk writes are commonly performed by page-cleaner threads during a
checkpoint or, possibly, when every page in the shared-memory buffer pool
is modified. Chunk writes, which are performed as sorted writes, are the
most efficient writes available to the database server.
In addition, because user threads must wait for the checkpoint to complete,
the page-cleaner threads are not competing with a large number of threads
for CPU time. As a result, the page-cleaner threads can finish their work with
less context switching.
For a comparison of buffered versus unbuffered logging, refer to the SET LOG
statement in the IBM Informix Guide to SQL: Syntax.
You can also assign simple large objects to a blobspace. The database server
writes simple large objects to a blobspace differently from the way that it
writes other data to a shared-memory buffer and then flushes it to disk. For
a description of blobspaces, refer to the chapter on disk structure and storage
in the Administrator’s Reference.
If blobspace data passed through the shared-memory pool, it might dilute the
effectiveness of the pool by driving out index pages and data pages. Instead,
blobpage data is written directly to disk when it is created.
Blobpages stored on optical media are not written to dbspace and logical-log
backup tapes due to the high reliability of optical media.
When the thread begins writing the first blobspace buffer to disk, it attempts
to perform the I/O based on the user-defined blobpage size. For example, if
the blobpage size is 32 kilobytes, the database server attempts to read or
write the data in 32,768-byte increments. If the underlying hardware (such as
the disk controller) cannot transfer this amount of data in a single operation,
the operating-system kernel loops internally (in kernel mode) until the
transfer is complete.
The blobspace buffers remain until the thread that created them is finished.
When the simple large object is written to disk, the database server
deallocates the pair of blobspace buffers. Figure 7-9 illustrates the process of
writing a simple large object to a blobspace.
Figure 7-9
Database server shared memory Database server disk space Writing Simple
Large Object to a
Blobspace
Client
Blobspace
Virtual processor Temporary blobpage
buffers
Blobspace blobpages are allocated and tracked with the free-map page. Links
that connect the blobpages and pointers to the next blobpage segments are
created as needed.
A smart large object is stored in an sbspace. You cannot store simple large
objects in an sbspace, and you cannot store smart large objects in a blobspace.
An sbspace consists of a user-data area and a metadata area. The user-data
area contains the smart-large-object data. The metadata area contains infor-
mation about the content of the sbspace. For more information on sbspaces,
refer to “Sbspaces” on page 9-21.
Because smart large objects pass through the shared-memory buffer pool and
can be logged, you must consider them when you allocate buffers. Use the
BUFFERS configuration parameter to allocate shared-memory buffers. As a
general rule, try to have enough buffers to hold two smart-large-object pages
for each concurrently open smart large object. (The additional page is
available for read-ahead purposes.) For more information about tuning
buffers for smart large objects, refer to your Performance Guide.
Use the LOGBUFF configuration parameter to specify the size of the logical-
log buffer. For information about setting each of the following configuration
parameters, refer to the Administrator’s Reference:
■ BUFFERS
■ LOGBUFF
The user-data area of smart large objects that are logged does not pass
through the physical log, so the PHYSBUFF parameter need not be adjusted
for smart large objects.
The machine notes for each 64-bit platform lists the maximum values for
these configuration parameters and platform-specific parameters such as
SHMMAX. For more information about the configuration parameters, see the
Administrator’s Reference and the chapter on shared memory in the Perfor-
mance Guide.
On UNIX, the machine notes file contains recommended values that you use
to configure operating-system resources. Use these recommended values
when you configure the operating system. For information on how to set
these operating-system parameters, consult your operating-system manuals.
The database server receives an error from the operating system if the
requested segment size exceeds the maximum size allowed. If the database
server receives an error, it divides the requested size by two and tries again.
Attempts at acquisition continue until the largest segment size that is a
multiple of 8 kilobytes can be created. Then the database server creates as
many additional segments as it requires.
To add the entry, edit the boot.ini file (located in the top level, or root
directory). You can either add a new boot option or use the currently existing
boot option. To enable support for more than two gigabytes, add the
following text to the end of the boot line:
/3GB
The following example has support for more than two gigabytes enabled:
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows NT
Workstation Version 4.00"
/3GB
You might be able to calculate the maximum amount of shared memory that
the operating system can allocate by multiplying the number of
shared-memory identifiers by the maximum shared-memory segment size.
UNIX Semaphores
The database server operation requires one UNIX semaphore for each virtual
processor, one for each user who connects to the database server through
shared memory (ipcshm protocol), six for database server utilities, and
sixteen for other purposes.
LOCKS Specifies the initial number of locks for database objects; for
example, rows, key values, pages, and tables
PC_HASHSIZE Specifies the number of hash buckets for the UDR cache and
other caches that the database server uses. For more infor-
mation about setting PC_HASHSIZE, refer to your
Performance Guide.
STACKSIZE Specifies the stack size for the database server user threads
RA_PAGES Specifies the number of disk pages that the database server
should attempt to read ahead when it performs sequential
scans of data or index records
To determine the page size for your system, choose the Parameters➞Shared-
memory option in ON-Monitor. The database server page size is the last entry
on the page.
Important: The configuration parameters SHMADD and SHMTOTAL affect both the
resident and virtual portions of shared memory.
Use the following onstat options to monitor the SQL statement cache:
To turn off residency immediately for the resident portion of shared memory,
execute the following command:
% onmode -n
These commands do not change the value of the RESIDENT parameter in the
ONCONFIG file. That is, this change is not permanent, and residency reverts
to the state specified by the RESIDENT parameter the next time that you
initialize shared memory. On UNIX, you must be root or user informix to turn
residency on or off. On Windows, you must be a user in the Informix Admin
group to turn residency on or off.
You do not normally need to add segments to virtual shared memory because
the database server automatically adds segments as needed.
The option to add a segment with the onmode utility is useful if the number
of operating-system segments is limited, and the initial segment size is so
low, relative to the amount that is required, that the operating-system limit of
shared-memory segments is nearly exceeded.
You can use the onstat -o utility to capture a static snapshot of database
server shared memory for later analysis and comparison.
You can obtain statistics on latch use and information on specific latches.
These statistics provide a measure of the system activity.
■ onstat -s
■ onstat -p
onstat -s
Use onstat -s command to obtain latch information.
onstat -p
Execute onstat -p to display statistics on database server activity and waiting
latches (see the lchwaits field). Figure 8-6 shows these statistics.
Figure 8-6
Profile
dskreads pagreads bufreads %cached dskwrits pagwrits bufwrits %cached
onstat -p Output
382 400 14438 97.35 381 568 3509 89.14
Monitoring Buffers
You can obtain both statistics on buffer use and information on specific
buffers.
The statistical information includes the percentage of data writes that are
cached to buffers and the number of times that threads had to wait to obtain
a buffer. The percentage of writes cached is an important measure of perfor-
mance. (For information on how to use this statistic to tune the database
server, see your Performance Guide.) The number of waits for buffers gives a
measure of system concurrency.
■ onstat -p
■ onstat -B
■ onstat -b
■ onstat -X
onstat -p
Execute onstat -p to obtain statistics about cached reads and writes. The
following caching statistics appear in four fields on the top row of the output
display:
■ The number of reads from shared-memory buffers (bufreads)
■ The percentage of reads cached (%cached)
■ The number of writes to shared memory (bufwrits)
■ The percentage of writes cached (%cached)
■ Information on generic pages (nonstandard pages in the buffer pool)
The number of reads or writes can appear as a negative number if the number
of occurrences exceeds 232 (depends on the platform).
The onstat -p option also displays a statistic (bufwaits) that indicates the
number of times that sessions had to wait for a buffer.
onstat -B
Execute onstat -B to obtain the following buffer information:
onstat -b
Execute onstat -b to obtain the following information about each buffer:
You can compare the addresses of the user threads to the addresses that
appear in the onstat -u display to obtain the session ID number. Figure 8-9
shows sample output. For more information on the fields that onstat
displays, see the utilities chapter of the Administrator’s Reference.
onstat -X
Execute onstat -X to obtain the same information as for onstat -b, along with
the complete list of all threads that are waiting for buffers, not just the first
waiting thread.
Row Description
buffwts Number of times that any thread had to wait for a buffer
The statistical information includes the number of times that the database
server attempted to exceed the maximum number of buffers and the number
of writes to disk (categorized by the event that caused the buffers to flush).
These statistics help you determine if the number of buffers is appropriate.
For information on tuning database server buffers, see your Performance
Guide.
Information on the buffers in each LRU queue consists of the length of the
queue and the percentage of the buffers in the queue that have been
modified.
For more information about the onstat options, refer to the utilities chapter of
the Administrator’s Reference.
onstat -p
The onstat -p output contains a statistic (ovbuff) that indicates the number of
times the database server attempted to exceed the maximum number of
shared buffers specified by the BUFFERS parameter in the ONCONFIG file.
Figure 8-11 shows onstat -p output, including the ovbuff field.
Figure 8-11
...
onstat -p Output
ovtbls ovlock ovuserthread ovbuff usercpu syscpu numckpts flushes Showing ovbuff
0 0 0 0 13.55 13.02 5 18 Field
...
onstat -F
Execute onstat -F to obtain a count by write type of the writes performed.
(For an explanation of the different write types, see “Describing Flushing
Activity” on page 7-43.) Figure 8-12 on page 8-22 shows an example of the
output. This information tells you when and how the buffers are flushed.
The onstat -F command displays totals for the following write types:
■ Foreground write
■ LRU write
■ Chunk write
The onstat -F command also lists the following information about the page
cleaners:
■ Page-cleaner number
■ Page-cleaner shared-memory address
■ Current state of the page cleaner
■ LRU queue to which the page cleaner was assigned
onstat -R
Execute onstat -R to obtain information about the number of buffers in each
LRU queue and the number and percentage of the buffers that are modified
or free. Figure 8-13 shows an example of onstat -R output.
Figure 8-13
8 buffer LRU queue pairs
# f/m length % of pair total
onstat -R Output
0 f 3 37.5% 8
1 m 5 55.6%
2 f 5 45.5% 11
3 m 6 54.5%
4 f 2 18.2% 11
5 m 9 81.8%
6 f 5 50.0% 10
7 m 5 55.6%
8 F 5 50.0% 10
9 m 5 45.5%
10 f 0 0.0% 10
11 m 10 100.0%
12 f 1 11.1% 9
13 m 8 88.9%
14 f 2 28.6% 7
15 m 5 71.4%
53 dirty, 76 queued, 80 total, 128 hash buckets, 2048 buffer size
start clean at 60% (of pair total) dirty, or 6 buffs dirty, stop at 50%
Row Description
Data Storage
9
In This Chapter . . . . . . . . . . . . . . . . . . . . 9-5
Physical and Logical Units of Storage . . . . . . . . . . . . 9-5
Chunks . . . . . . . . . . . . . . . . . . . . . . . 9-6
Disk Allocation for Chunks . . . . . . . . . . . . . . 9-7
Disk Access on Windows . . . . . . . . . . . . . . 9-7
Unbuffered or Buffered Disk Access on UNIX . . . . . . . 9-8
Offsets . . . . . . . . . . . . . . . . . . . . . . 9-9
Pages . . . . . . . . . . . . . . . . . . . . . . . 9-10
Blobpages . . . . . . . . . . . . . . . . . . . . . . 9-11
Sbpages . . . . . . . . . . . . . . . . . . . . . . . 9-12
Extents . . . . . . . . . . . . . . . . . . . . . . . 9-14
Dbspaces . . . . . . . . . . . . . . . . . . . . . . 9-16
Control of Where Data Is Stored . . . . . . . . . . . . . 9-16
Root Dbspace . . . . . . . . . . . . . . . . . . . 9-18
Temporary Dbspaces . . . . . . . . . . . . . . . . . 9-19
Blobspaces . . . . . . . . . . . . . . . . . . . . . . 9-20
Sbspaces . . . . . . . . . . . . . . . . . . . . . . 9-21
Advantages of Using Sbspaces . . . . . . . . . . . . . 9-21
Sbspaces and Enterprise Replication . . . . . . . . . . . 9-22
Metadata, User Data, and Reserved Area . . . . . . . . . . 9-22
Control of Where Data Is Stored . . . . . . . . . . . . . 9-23
Storage Characteristics of Sbspaces . . . . . . . . . . . . 9-25
Extent Sizes for Sbspaces . . . . . . . . . . . . . . 9-25
Average Smart-Large-Object Size . . . . . . . . . . . 9-26
Buffering Mode . . . . . . . . . . . . . . . . . 9-26
Last-Access Time . . . . . . . . . . . . . . . . . 9-27
Lock Mode . . . . . . . . . . . . . . . . . . . 9-27
Logging . . . . . . . . . . . . . . . . . . . . 9-27
Levels of Inheritance for Sbspace Characteristics . . . . . . . 9-28
More Information About Sbspaces . . . . . . . . . . . . 9-30
Extspaces . . . . . . . . . . . . . . . . . . . . . . 9-35
Databases . . . . . . . . . . . . . . . . . . . . . . 9-35
Tables . . . . . . . . . . . . . . . . . . . . . . . 9-36
Table Types for Dynamic Server . . . . . . . . . . . . . . 9-38
Standard Permanent Tables . . . . . . . . . . . . . . 9-39
RAW Tables . . . . . . . . . . . . . . . . . . . . 9-39
Temp Tables . . . . . . . . . . . . . . . . . . . . 9-40
Properties of Table Types . . . . . . . . . . . . . . . 9-40
Loading of Data Into a Table . . . . . . . . . . . . . 9-40
Fast Recovery of Table Types . . . . . . . . . . . . . 9-41
Backup and Restore of RAW Tables . . . . . . . . . . 9-41
Temporary Tables . . . . . . . . . . . . . . . . . . 9-42
Temporary Tables That You Create . . . . . . . . . . . 9-43
Temporary Tables That the Database Server Creates . . . . . 9-44
Tblspaces . . . . . . . . . . . . . . . . . . . . . . 9-45
Maximum Number of Tblspaces in a Table . . . . . . . . . 9-46
Table and Index Tblspaces . . . . . . . . . . . . . . . 9-46
Extent Interleaving . . . . . . . . . . . . . . . . . 9-48
■ Dbspace
■ Temporary dbspace
■ Blobspace
■ Sbspace
■ Temporary sbspace
■ Extspace
■ Database
■ Table
■ Tblspace
The following sections describe the various data-storage units that the
database server supports and the relationships between those units. For
information about reserved pages, see the disk structures and storage chapter
in the Administrator’s Reference.
Chunks
A chunk is the largest unit of physical disk dedicated to database server data
storage. Chunks provide administrators with a significantly large unit for
allocating disk space. The maximum size of an individual chunk is 4
terabytes. The number of allowable chunks is 32,766. You must run onmode
-BC to enable the maximum size of a chunk and the maximum number
allowable. If onmode -BC is not run, then the maximum chunk size is 2
gigabytes.
The database server administrator adds one or more chunks to the following
storage spaces when they approach full capacity:
For information on chunk names, size, and number, see “Specifying Names
for Storage Spaces and Chunks” on page 10-12 and “Specifying the
Maximum Size of Chunks” on page 10-13.
The database server also uses chunks for mirroring. A primary chunk is a
chunk from which the database server copies data to a mirrored chunk. If the
primary chunk fails, the database server brings the mirrored chunk online
automatically. For more information, see Chapter 17, “Mirroring.”
NTFS Files
You must use NTFS files, not FAT files, for disk space on Windows.For more
information, see “Allocating NTFS File Space on Windows” on page 10-10.
UNIX
Unbuffered or Buffered Disk Access on UNIX
You can allocate disk space in two ways:
■ Use files that are buffered through the operating system, also
referred to as cooked files.
■ Use unbuffered disk access, also called raw disk space.
To create a raw device, configure a block device (hard disk) with a raw
interface. The storage space that the device provides is called raw disk space.
A chunk of raw disk space is physically contiguous.
The name of the chunk is the name of the character-special file in the /dev
directory. In many operating systems, you can distinguish the character-
special file from the block-special file by the first letter in the filename
(typically r). For example, /dev/rsd0f is the character-special device that
corresponds to the /dev/sd0f block-special device.
Cooked Files
A cooked file is a regular file that the operating system manages. Cooked file
chunks and raw disk chunks are equally reliable. Unlike raw disk space, the
logically contiguous blocks of a cooked file might not be physically
contiguous.
You can more easily allocate cooked files than raw disk space. To allocate a
cooked file, you need only create the file on any existing partition. The name
of the chunk is the complete pathname of the file. These steps are described
in detail in “Allocating Cooked File Spaces on UNIX” on page 10-8.
Warning: Chunks located in file systems perform worse than chunks located on raw
disk due to operating-system overhead. For cooked file chunks, the operating system
processes all chunk I/O from its own buffer pool and ensures that all writes to chunks
are physically written to the disk.
Offsets
The system administrator might divide a physical disk into partitions, which
are different parts of a disk that have separate pathnames. Although it is
recommended that you use an entire disk partition when you allocate a
chunk on a raw disk device, you can subdivide partitions or cooked files into
smaller chunks using offsets. For more information, see “Disk-Layout Guide-
lines” on page 9-52.
Tip: With a 4-terabyte limit to the size of a chunk, you can avoid partitioning a disk
by assigning a single chunk per disk drive.
An offset allows you to indicate the location of a given chunk on the disk
partition, file, or device. For example, suppose that you create a 1000-kilobyte
chunk that you want to divide into two chunks of 500 kilobytes each. You can
use an offset of zero kilobytes to mark the beginning of the first chunk and an
offset of 500 kilobytes to mark the beginning of the second chunk.
You can specify an offset whenever you create, add, or drop a chunk from a
a dbspace, blobspace, or sbspace.
You might also need to specify an offset to prevent the database server from
overwriting partition information. “Allocating Raw Disk Space on UNIX” on
page 10-9 explains when and how to specify an offset.
Pages
A page is the physical unit of disk storage that the database server uses to read
from and write to Informix databases. Figure 9-1 illustrates the concept of a
page, represented by a darkened sector of a disk platter.
Figure 9-1
A Page on Disk
On most UNIX platforms, the page size is 2 kilobytes. On Windows, the page
size is 4 kilobytes. Because your hardware determines the size of your page,
you cannot alter this value.
For information on how the database server structures data within a page,
see the chapter on disk structures and storage in the Administrator’s Reference.
Figure 9-2
Chunk A Chunk, Logically
Separated into a
Series of Pages
Page
Blobpages
A blobpage is the unit of disk-space allocation that the database server uses
to store simple large objects (TEXT or BYTE data) within a blobspace. For a
description of blobspaces, refer to “Blobspaces” on page 9-20.
You specify blobpage size as a multiple of the database server page size.
Because the database server allocates blobpages as contiguous spaces, it is
more efficient to store simple large objects in blobpages that are as close to the
size of the data as possible. Figure 9-3 illustrates the concept of a blobpage,
represented as a multiple (three) of a data page.
Figure 9-3
A Blobpage on Disk
Sbpages
An sbpage is the type of page that the database server uses to store smart
large objects within a sbspace. For a description of sbspaces, refer to
“Sbspaces” on page 9-21. Unlike blobpages, sbpages are not configurable. An
sbpage is the same size as the database server page, which is usually
2 kilobytes on UNIX and 4 kilobytes on Windows.
The database server calculates the extent size for a smart large object from a
set of heuristics, such as the number of bytes in a write operation. For more
information, see “Extent Sizes for Sbspaces” on page 9-25.
Extents
When you create a table, the database server allocates a fixed amount of space
to contain the data to be stored in that table. When this space fills, the
database server must allocate space for additional storage. The physical unit
of storage that the database server uses to allocate both the initial and subse-
quent storage space is called an extent. Figure 9-6 illustrates the concept of an
extent.
Figure 9-6
An Extent That
Chunk
Consists of Six
Page Contiguous Pages
on a Raw Disk
Device
Extent
To specify the initial-extent size and next-extent size, use the CREATE TABLE
and ALTER TABLE statements. For more information, see the IBM Informix
Guide to SQL: Syntax and disk structures in the IBM Informix Dynamic Server
Administrator’s Reference.
When you create a table with a column for CLOB or BLOB data types, you also
define extents for an sbspace. For more information, refer to “Storage Charac-
teristics of Sbspaces” on page 9-25.
Figure 9-7 shows how the database server allocates six pages for an extent:
Chunk 1 Chunk 2
Free
page
Extent Used
page
The database server decides The database The database The database server
to allocate an extent and server cannot find server extends finds 6 contiguous free
begins a search for 6 6 contiguous free its search to the pages and allocates an
contiguous free pages. pages in chunk 1. next chunk. extent.
Dbspaces
A dbspace is a logical unit that can contain between 1 and 32,767 chunks. Place
databases, tables, logical-log files, and the physical log in dbspaces.
As Figure 9-8 shows, to control the placement of databases or tables, you can
use the IN dbspace option of the CREATE DATABASE or CREATE TABLE state-
ments. (See “Tables” on page 9-36.)
Figure 9-8
Controlling Table Placement with the CREATE TABLE... IN Statement
Dbspace on UNIX
% onspaces -c -d stores_space -p /dev/rsd0f -o 0 -s 10000
/dev/rsd0f
Before you create a database or table in a dbspace, you must first create the
dbspace. For more information on how to create a dbspace, see “Creating a
Dbspace” on page 10-14.
A dbspace includes one or more chunks, as Figure 9-9 shows. You can add
more chunks at any time. It is a high-priority task of a database server admin-
istrator to monitor dbspace chunks for fullness and to anticipate the need to
allocate more chunks to a dbspace. (See “Monitoring Disk Usage” on
page 10-41.) When a dbspace contains more than one chunk, you cannot
specify the chunk in which the data resides.
Figure 9-9
Logical units of storage Physical units of storage Dbspaces That Link
Logical and Physical
Chunks Units of Storage
Database
System catalog
Dbspace 1 Chunk 1
Table 1
Dbspace 2 Chunk 2
Table 2
Dbspace 3 Chunk 3
Chunk 4
The database server uses the dbspace to store databases and tables. (See
“Tables” on page 9-36.)
You can mirror every chunk in a mirrored dbspace. As soon as the database
server allocates a mirrored chunk, it flags all space in that mirrored chunk as
full. See “Monitoring Disk Usage” on page 10-41.
For information on using ISA or onspaces to perform the following tasks, see
Chapter 10, “Managing Disk Space.”
■ Creating a dbspace
■ Adding a chunk to a dbspace
■ Dropping a chunk
■ Dropping a dbspace, blobspace, or sbspace
Root Dbspace
The root dbspace is the initial dbspace that the database server creates. The
root dbspace is special because it contains reserved pages and internal tables
that describe and track all physical and logical units of storage. (For more
information on these topics, see “Tables” on page 9-36 and the disk structures
and storage chapter in the Administrator’s Reference.) The initial chunk of the
root dbspace and its mirror are the only chunks created during disk-space
initialization. You can add other chunks to the root dbspace after disk-space
initialization.
The root dbspace is also the default dbspace location for any database created
with the CREATE DATABASE statement.
The root dbspace is the default location for all temporary tables created by
the database server to perform requested data management.
“Size of the Root Dbspace” on page 9-49 explains how much space to allocate
for the root dbspace. You can also add extra chunks to the root dbspace after
you initialize database server disk space.
Temporary Dbspaces
A temporary dbspace is a dbspace reserved exclusively for the storage of
temporary tables. You cannot mirror a temporary dbspace.
Whenever you initialize the database server, all temporary dbspaces are
reinitialized. The database server clears any tables that might be left over
from the last time that the database server shut down.
The database server does not perform logical or physical logging for
temporary dbspaces. Because temporary dbspaces are not physically logged,
fewer checkpoints and I/O operations occur, which improves performance.
The database server logs table creation, the allocation of extents, and the
dropping of the table for a temporary table in a standard dbspace. In contrast,
the database server does not log tables stored in temporary dbspaces.
Logical-log suppression in temporary dbspaces reduces the number of log
records to roll forward during logical recovery as well, thus improving the
performance during critical down time.
Using temporary dbspaces to store temporary tables also reduces the size of
your storage-space backup, because the database server does not back up
temporary dbspaces.
If you have more than one temporary dbspace and execute a SELECT
statement into a temporary table, the results of the query are inserted in
round robin order.
Blobspaces
A blobspace is a logical storage unit composed of one or more chunks that
store only TEXT and BYTE data. A blobspace stores TEXT and BYTE data in the
most efficient way possible. You can store TEXT and BYTE columns associated
with distinct tables (see “Tables” on page 9-36) in the same blobspace.
The database server writes data stored in a blobspace directly to disk. This
data does not pass through resident shared memory. If it did, the volume of
data could occupy so many of the buffer-pool pages that other data and index
pages would be forced out. For the same reason, the database server does not
write TEXT or BYTE objects that are assigned to a blobspace to either the
logical or physical log. The database server logs blobspace objects by writing
them directly from disk to the logical-log backup tapes when you back up the
logical logs. Blobspace objects never pass through the logical-log files.
When you create a blobspace, you assign to it one or more chunks. You can
add more chunks at any time. One of the tasks of a database server adminis-
trator is to monitor the chunks for fullness and anticipate the need to allocate
more chunks to a blobspace. For instructions on how to monitor chunks for
fullness, see “Monitoring Simple Large Objects in a Blobspace” on
page 10-49. For instructions on how to create a blobspace, add chunks to a
blobspace, or drop a chunk from a blobspace, see Chapter 10, “Managing
Disk Space.”
For information about the structure of a blobspace, see the chapter on disk
structures and storage in the Administrator’s Reference.
Sbspaces
An sbspace is a logical storage unit composed of one or more chunks that
store smart large objects. Smart large objects consist of CLOB (character large
object) and BLOB (binary large object) data types. User-defined data types can
also use sbspaces. For more information about data types, refer to the
IBM Informix Guide to SQL: Reference.
■ Metadata area
Metadata identifies key aspects of the sbspace and each smart large
object stored in the sbspace, and enables the database server to
manipulate and recover smart large objects stored within.
■ User-data area
User data is the smart large object data stored in the sbspace by user
applications. The chunk has up to two user-data areas.
■ Reserved area
The database server allocates space from the reserved area to either
the metadata or user-data area when more space is needed. The
chunk has up to two reserved areas.
For information on correctly allocating metadata and user data for sbspaces,
see “Sizing Sbspace Metadata” on page 10-25 and the Performance Guide.
When you add a chunk to an sbspace, you can specify whether it contains a
metadata area and user-data area or whether to reserve the chunk exclusively
for user data. You can add more chunks at any time. If you are updating
smart large objects, I/O to the user data is much faster on raw disks than
cooked chunk files. For instructions on how to create a sbspace, add chunks
to a sbspace, or drop a chunk from a sbspace, see Chapter 10, “Managing
Disk Space.”
sbspace on UNIX
s9_sbspc
Before you specify an sbspace in a PUT clause, you must first create the
sbspace. For more information on how to create an sbspace with the
onspaces -c -S utility, see “Adding a Chunk to a Dbspace or Blobspace” on
page 10-17. For more information on how to specify smart large object
characteristics in the PUT clause, refer to the CREATE TABLE statement in the
IBM Informix Guide to SQL: Syntax.
If you do not specify the PUT clause, the database server stores the smart
large objects in the default sbspace that you specify in the SBSPACENAME
configuration parameter. For more information on SBSPACENAME, refer to
the configuration parameter chapter of the Administrator’s Reference.
You can add more chunks at any time. It is a high-priority task of a database
server administrator to monitor sbspace chunks for fullness and to anticipate
the need to allocate more chunks to a sbspace. For more information on
monitoring sbspaces, refer to your Performance Guide.
Figure 9-11
Logical units of storage Physical units of storage Sbspaces That Link
Logical and Physical
Chunks Units of Storage
Table
Dbspace 1 Chunk 1
Column Data Type
1 SERIAL
2 SMALLINT
3 INTEGER
...
n CLOB Sbspace 1 Chunk 1
...
Chunk 2
The database server uses sbspaces to store table columns that contain smart
large objects. The database server uses dbspaces to store the rest of the table
columns.
You can mirror an sbspace to speed recovery in event of a media failure. For
more information, refer to “Mirroring” on page 17-3.
■ Creating an sbspace
■ Adding a chunk to an sbspace
■ Altering storage characteristics of smart large objects
■ Creating a temporary sbspace
■ Dropping an sbspace
Important: For most applications, it is recommended that you use the values that the
database server calculates for the extent size.
If you know the size of the smart large object, you can use one of the
following functions to set the extent size. The database server allocates the
entire smart large object as one extent (if an extent of that size is available in
the chunk):
For information about tuning extent sizes, see smart large objects in the
chapter on configuration effects on I/O utilization in your Performance Guide.
To specify the size and location of the metadata area, specify the -Ms and -Mo
flags in the onspaces command. If you do not use the -Ms flag, the database
server uses the value of AVG_LO_SIZE to estimate the amount of space to
allocate for the metadata area. For more information, refer to “Sizing Sbspace
Metadata” on page 10-25.
Buffering Mode
When you create an sbspace, the default buffering mode is on, which means
to use the buffer pool in the resident portion of shared memory.
As the database administrator, you can specify the buffering mode with the
BUFFERING tag of the onspaces -c -Df option. The default is
“BUFFERING=ON”, which means to use the buffer pool. If you turn off
buffering, the database server uses private buffers in the virtual portion of
shared memory.
Important: In general, if read and write operations to the smart large objects are less
than 8 kilobytes, do not specify a buffering mode when you create the sbspace. If you
are reading or writing short blocks of data, such as 2 kilobytes or 4 kilobytes, leave the
default of “BUFFERING=ON” to obtain better performance.
For information about when to use private buffers, see the section on light-
weight I/O operations in the chapter on configuration effects on I/O utili-
zation in your Performance Guide.
Last-Access Time
When you create an sbspace, you can specify whether or not the database
server should keep the last time that the smart large object was read or
updated with the ACCESSTIME tag of the onspaces -c -Df option. The default
is “ACCESSTIME=OFF”. The database server keeps this last-access time in the
metadata area.
For more information on how programmers use this last-access time, refer to
the IBM Informix DataBlade API Programmer’s Guide and IBM Informix ESQL/C
Programmer’s Manual.
Lock Mode
When you create an sbspace, you can specify whether or not the database
server should lock the whole smart large object or a range of bytes within a
smart large object with the LOCK_MODE tag of the onspaces -c -Df option.
The default is “LOCK_MODE=BLOB”, which means to lock the entire smart
large object. For more information, refer to the locking chapter in your Perfor-
mance Guide.
Logging
When you create an sbspace, you can specify whether or not to turn on
logging for the smart large objects. The default is no logging. For more infor-
mation, refer to “Logging Sbspaces and Smart Large Objects” on page 13-13.
Important: When you use logging databases, turn logging on for the sbspaces. If a
failure occurs that requires log recovery, you can keep the smart large objects
consistent with the rest of the database.
You specify the logging status with the LOGGING tag of the onspaces -c -Df
option. The default is “LOGGING=OFF”. You can change the logging status
with the onspaces -ch -Df option. You can override this logging status with
the PUT clause in the SQL statements CREATE TABLE or ALTER TABLE. For
more information about these SQL statements, refer to the IBM Informix Guide
to SQL: Syntax.
The programmer can override this logging status with functions that the
DataBlade API and ESQL/C provide. For more information on the DataBlade
API functions for smart large objects, refer to the IBM Informix DataBlade API
Function Reference. For more information on the ESQL/C functions for smart
large objects, refer to the IBM Informix ESQL/C Programmer’s Manual.
When you turn on logging for an sbspace, the smart large objects pass
through the resident portion of shared memory. Although applications can
retrieve pieces of a smart large object, you still need to consider the larger size
of data that might pass through the buffer pool and logical-log buffers. For
more information, refer to “Accessing Smart Large Objects” on page 7-49.
Figure 9-12
Database server storage characteristics Storage-
(system defaults) Characteristics
Hierarchy
System-specified
storage characteristics
Figure 9-12 shows that you can override the system default in the following
ways:
Task Reference
Task Reference
Creating a table with CLOB or BLOB IBM Informix Guide to SQL: Syntax
data types
Temporary Sbspaces
Use a temporary sbspace to store temporary smart large objects without
metadata logging and user-data logging. If you store temporary smart large
objects in a standard sbspace, the metadata is logged. Temporary sbspaces
are similar to temporary dbspaces. To create a temporary sbspace, use the
onspaces -c -S command with the -t option. For more information, see
“Creating a Temporary Sbspace” on page 10-27.
Logs user data User data is not logged for temporary User data is not logged
smart large objects but is logged for Creation and deletion of space, and
permanent smart large objects if addition of chunks is logged
LOGGING=ON
You create a temporary smart large object in the same way as a permanent
smart large object, except you set the LO_CREATE_TEMP flag in the
ifx_lo_specset_flags or mi_lo_specset_flags function. Use mi_lo_copy or
ifx_lo_copy to create a permanent smart large object from a temporary smart
large object. For details on creating temporary smart large objects, see the
IBM Informix DataBlade API Programmer’s Guide.
Important: Store pointers to temporary large objects in temporary tables only. If you
store them in standard tables and reboot the database server, it results in an error that
says that the large object does not exist.
Rollback Yes No
Duration Permanent (until user deletes it) Deleted at end of user session or transaction
Extspaces
An extspace is a logical name associated with an arbitrary string that signifies
the location of external data. The resource that the extspace references
depends on a user-defined access method for accessing its contents.
For example, a database user might require access to binary files encoded in
a proprietary format. First, a developer creates an access method, which is a set
of routines that access the data. These routines are responsible for all inter-
action between the database server and the external file. A DBA then adds an
extspace that has the file as its target to the database. Once the DBA creates a
table in the extspace, the users can access the data in the proprietary files via
SQL statements. To locate those files, use the extspace information.
For more information on user-defined access methods, see the IBM Informix
Virtual-Table Interface Programmer’s Guide. For more information on creating
functions and primary access methods, see the IBM Informix Guide to SQL:
Syntax.
Databases
A database is a logical storage unit that contains tables and indexes. (See
“Tables” on page 9-36.) Each database also contains a system catalog that
tracks information about many of the elements in the database, including
tables, indexes, SPL routines, and integrity constraints.
The size limits that apply to databases are related to their location in a
dbspace. To be certain that all tables in a database are created on a specific
physical device, assign only one chunk to the device, and create a dbspace
that contains only that chunk. Place your database in that dbspace. When you
place a database in a chunk assigned to a specific physical device, the
database size is limited to the size of that chunk.
For instructions on how to list the databases that you create, see “Displaying
Databases” on page 10-40.
Tables
In relational database systems, a table is a row of column headings together
with zero or more rows of data values. The row of column headings identifies
one or more columns and a data type for each column.
When users create a table, the database server allocates disk space for the
table in a block of pages called an extent. (See “Extents” on page 9-14.) You
can specify the size of both the first and any subsequent extents.
Users can place the table in a specific dbspace by naming the dbspace when
they create the table (usually with the IN dbspace option of CREATE TABLE).
When the user does not specify the dbspace, the database server places the
table in the dbspace where the database resides.
Users can also fragment a table over more than one dbspace. Users must
define a distribution scheme for the table that specifies which table rows are
located in which dbspaces.
For more information about distribution schemes, see the IBM Informix
Database Design and Implementation Guide. For information on how to fragment
tables and indexes over multiple disks to improve performance, concurrency,
data availability, and backups, refer to your Performance Guide.
Extent 1 Extent 2
Simple large objects reside in blobpages in either the dbspace with the data
pages of the table or in a separate blobspace. When you use the Optical
Subsystem, you can also store simple large objects in an optical storage
subsystem.
Figure 9-18 lists the properties of the types of tables available with Dynamic
Server. The flag values are the hexadecimal values for each table type in the
flags column of systables.
Figure 9-18
Table Types for Dynamic Server
RAW Tables
RAW tables are nonlogging permanent tables and are similar to tables in a
nonlogging database. RAW tables use light appends, which add rows quickly
to the end of each table fragments. Updates, inserts, and deletes in a RAW
table are supported but not logged. RAW tables do not support indexes, refer-
ential constraints, or rollback. You can restore a RAW table from the last
physical backup if it has not been updated since that backup. Fast recovery
rolls back incomplete transactions on STANDARD tables but not on RAW
tables. A RAW table has the same attributes whether stored in a logging or
nonlogging database.
RAW tables are intended for the initial loading and validation of data. To load
RAW tables, you can use any loading utility, including dbexport or the High-
Performance Loader (HPL) in express mode. If an error or failure occurs while
loading a RAW table, the resulting data is whatever was on the disk at the
time of the failure.
It is recommended that you do not use RAW tables within a transaction. Once
you have loaded the data, use the ALTER TABLE statement to change the table
to type STANDARD and perform a level-0 backup before you use the table in
a transaction.
Temp Tables
Temp tables are temporary, logged tables that are dropped when the user
session closes, the database server shuts down, or on reboot after a failure.
Temp tables support indexes, constraints, and rollback. You cannot recover,
back up, or restore temp tables. Temp tables support bulk operations such as
light appends, which add rows quickly to the end of each table fragment. For
more information about light appends, refer to your Performance Guide.
Standard Fast recovery is successful. All committed log records are rolled forward, and all incomplete
transactions are rolled back.
RAW If a checkpoint completed since the RAW table was modified last, all the data is recoverable.
Inserts, updates, and deletions that occurred after the last checkpoint are lost.
Incomplete transactions in a RAW table are not rolled back.
Standard Yes.
Temp No.
RAW Yes. If you update a RAW table, you must back it up so that you can restore all the data in it.
Backing up only the logical logs is not enough.
Important: After you load a RAW table or change a RAW table to type STANDARD,
you must perform a level-0 backup.
Standard Yes. Warm restore, cold restore, and point-in-time restore work.
Temp No.
RAW When you restore a RAW table, it contains only data that was on disk at the time of the last
backup. Because RAW tables are not logged, any changes that occurred since the last backup
are not restored.
Temporary Tables
The database server needs to provide disk space for temporary tables of the
following two kinds:
Make sure that your database server has configured enough temporary space
for both user-created and database server-created temporary tables. Some
uses of the database server might require as much temporary storage space
as permanent storage space, or more.
Important: By default, the database server stores temporary tables in the root
dbspace. If you decide not to store your temporary tables in the root dbspace, use the
DBSPACETEMP environment variable or configuration parameter to specify a list of
dbspaces for temporary tables.
Only the session that creates a temporary table can use the table. When the
session exits, the table is dropped automatically.
When you create a temporary table, the database server uses the following
criteria:
■ If the query used to populate the TEMP table produces no rows, the
database server creates an empty, unfragmented table.
■ If the rows that the query produces do not exceed 8 kilobytes, the
temporary table resides in only one dbspace.
■ If the rows exceed 8 kilobytes, the database server creates multiple
fragments and uses a round-robin fragmentation scheme to populate
them unless you specify a fragmentation method and location for the
table.
For information about creating temporary dbspaces and dbslices, refer to the
onspaces section in the Administrator’s Reference.
If you do not specify the location of a temporary table, the database server
stores the temporary table in one of the spaces that you specify as an
argument to the DBSPACETEMP configuration parameter or environment
variable. The database server keeps track of the name of the last dbspace that
it used for a temporary table. When the database server receives another
request for temporary storage space, it uses the next available dbspace to
spread I/O evenly across the temporary storage space.
For information about where the database stores temporary tables when you
do not list any spaces as an argument to DBSPACETEMP, see the DBSPAC-
ETEMP section in the IBM Informix Dynamic Server Administrator’s Reference.
When you use an application to create a temporary table, you can use the
temporary table until the application exits or performs one of the following
actions:
■ Closes the database in which the table was created and opens a
database in a different database server
■ Closes the database in which the table was created
■ Explicitly drops the temporary table
When the process that initiated the creation of the table is complete, the
database server deletes the temporary tables that it creates.
Important: In addition to temporary tables, the database server uses temporary disk
space to store the before images of data that are overwritten while backups are
occurring and overflow from query processing that occurs in memory. Make sure that
you have configured enough temporary space for all uses.
■ If you created the temporary table with CREATE TEMP TABLE, the
database server stores this table in the dbspace that contains the
database to which the table belongs.
■ If you created the temporary table with the INTO TEMP option of the
SELECT statement, the database server stores this table in the root
dbspace.
Tblspaces
Database server administrators sometimes need to track disk use by a
particular table. A tblspace contains all the disk space allocated to a given
table or table fragment (if the table is fragmented). A separate tblspace
contains the disk space allocated for the associated index.
Figure 9-22 illustrates the tblspaces for three tables that form part of the
stores_demo database. Only one table (or table fragment) exists per tblspace.
An index resides in a separate tblspace from the associated table. Blobpages
represent TEXT or BYTE data stored in a dbspace.
Figure 9-22
stores_demo Database Sample Tblspaces in
customer catalog orders the stores_demo
data tblspace data tblspace data tblspace Database
Extent Interleaving
The database server allocates the pages that belong to a tblspace as extents.
Although the pages within an extent are contiguous, extents might be
scattered throughout the dbspace where the table resides (even on different
chunks). Figure 9-23 depicts this situation with two noncontiguous extents
that belong to the tblspace for table_1 and a third extent that belongs to the
tblspace for table_2. A table_2 extent is positioned between the first table_1
extent and the second table_1 extent. When this situation occurs, the extents
are interleaved. Because sequential access searches across table_1 require the
disk head to seek across the table_2 extent, performance is worse than if the
table_1 extents were contiguous. For instructions on how to avoid and
eliminate interleaving extents, see your Performance Guide.
Figure 9-23
Three Extents That Belong to Two Different Tblspaces in a Single Dbspace
Page
■ Dbspaces
■ Sbspaces
This estimate is the initial root dbspace size before you initialize the database
server. The initial size of the root dbspace depends on whether you plan to
store the physical log, logical logs, and temporary tables in the root dbspace
or in another dbspace. The root dbspace must be large enough for the
minimum size configuration during disk initialization.
It is recommended that you initialize the system with a small log size (for
example, three 1000-kilobyte log files, or 3000 kilobytes for the total log size).
Once initialization is complete, create new dbspaces, move and resize the
logical-log files, and drop the original logs in the root dbspace. Then move
the physical log to another dbspace. This procedure minimizes the impact of
the logs in the root dbspace because:
■ A large amount of space is not left unused in the root dbspace after
you move the logs (if your root dbspace does not grow).
■ The logs do not contend for space and I/O on the same disk as the
root dbspace (if your root dbspace does grow).
For details on how to move the logs, see “Moving a Logical-Log File to
Another Dbspace” on page 14-20 and “Changing the Physical-Log Location
and Size” on page 16-3.
You can add chunks and drop empty chunks in the root dbspace. Start with
a small root dbspace and expand it as your system grows. However, you
cannot start with a large initial root chunk and shrink it.
To calculate the size of the logical-log files, multiply the value of the
ONCONFIG parameter LOGSIZE by the number of logical-log files. For advice
on sizing your logical log, see “Estimating the Size and Number of Log Files”
on page 14-4.
Temporary Tables
Analyze end-user applications to estimate the amount of disk space that the
database server might require for temporary tables. Try to estimate how
many of these statements are to run concurrently. The space occupied by the
rows and columns that are returned provides a good basis for estimating the
amount of space required.
The largest temporary table that the database server creates during a warm
restore is equal to the size of your logical log. You calculate the size of your
logical log by adding the sizes of all logical-log files.
You must also analyze end-user applications to estimate the amount of disk
space that the database server might require for explicit temporary tables.
Critical Data
It is recommended that you do not store databases and tables in the root
dbspace. Mirror the root dbspace and other dbspaces that contain critical
data such as the physical log and logical logs. Estimate the amount of disk
space, if any, that you need to allocate for tables stored in the root dbspace.
Extra Space
Allow extra space in the root dbspace for the system databases to grow, for
the extended reserved pages, and ample free space. The number of extended
reserved pages depends on the number of primary chunks, mirror chunks,
logical-log files, and storage spaces in the database server.
■ Decide how many databases and tables you need to store. Calculate
the amount of space required for each one.
■ Calculate a growth rate for each table and assign some amount of
disk space to each table to accommodate growth.
■ Decide which databases and tables you want to mirror.
For instructions about calculating the size of your tables, refer to your Perfor-
mance Guide.
Disk-Layout Guidelines
The following are typical goals for efficient disk layout:
You must make some trade-offs among these goals when you design your
disk layout. For example, separating the system catalog tables, the logical log,
and the physical log can help reduce contention for these resources.
However, this action can also increase the chances that you have to perform
a system restore. For detailed disk-layout guidelines, see the Performance
Guide.
Table-Location Guidelines
This section lists some strategies for optimizing the disk layout, given certain
characteristics about the tables in a database. You can implement many of
these strategies with a higher degree of control using table fragmentation:
■ Isolate high-use tables on a separate disk.
To isolate a high-use table on its own disk device, assign the device
to a chunk, and assign the same chunk to a dbspace. Finally, place the
frequently used table in the dbspace just created using the IN dbspace
option of CREATE TABLE.
To display the level of I/O operations against each chunk, run the
onstat -g iof option.
■ Fragment high-use tables over multiple disks.
■ Group related tables in a dbspace.
If a device that contains a dbspace fails, all tables in that dbspace are
inaccessible. However, tables in other dbspaces remain accessible.
Although you must perform a cold restore if a dbspace that contains
critical information fails, you need only perform a warm restore if a
noncritical dbspace fails.
■ Place high-use tables on the middle partition of a disk.
■ Optimize table extent sizes.
■ High performance
■ High availability
■ Ease and frequency of backup and restore
Meeting any one of these objectives has trade-offs. For example, configuring
your system for high performance usually results in taking risks regarding
the availability of data. The sections that follow present an example in which
the database server administrator must make disk-layout choices given
limited disk resources. These sections describe two different disk-layout
solutions. The first solution represents a performance optimization, and the
second solution represents an availability-and-restore optimization.
The setting for the sample disk layouts is a fictitious sporting goods database
that uses the structure (but not the volume) of the stores_demo database. In
this example, the database server is configured to handle approximately
350 users and 3 gigabytes of data. The disk space resources are shown in the
following table.
The database includes two large tables: cust_calls and items. Assume that
both of these tables contain more than 1,000,000 rows. The cust_calls table
represents a record of all customer calls made to the distributor. The items
table contains a line item of every order that the distributor ever shipped.
The database includes two high-use tables: items and orders. Both of these
tables are subject to constant access from users around the country.
The remaining tables are low-volume tables that the database server uses to
look up data such as postal code or manufacturer.
Figure 9-24
Disk Layout Optimized for Performance
Disks
Database rootdbs
phys_log_space
Disk 1
(2.5 gigabyte)
cust_calls
cust_calls_space
log_log_space
Disk 2
(3 gigabyte, high
items performance)
items_space
look_up2
orders
orders_space
Disk 4
(1.5 gigabyte)
Figure 9-25
Disk Layout Optimized for Availability
Database Disks
stock catalog manufact
look_up1
disk 11
Disk
rootdbs (1.5 gigabyte)
(2.5
phys_log_space
log_log_space
log_log_space
state call_type customer
disk 44
Disk
look_up2 (1.5 gigabyte)
(1.5 gigabyte)
cust_calls
cust_calls_space
orders
orders_space
Disk
disk 22
(3 gigabyte,high
(2 gigabyte high
performance)
performance)
items
items_space
Disk
disk 33
(2 gigabyte,high
(2 gigabyte high
performance)
performance)
Logical-Volume Manager
A logical-volume manager (LVM) is a utility that allows you to manage your
disk space through user-defined logical volumes.
Most LVMs can manage multiple gigabytes of disk space. The database server
chunks are limited to a size of 4 terabytes, and this size can be attained only
when the chunk being allocated has an offset of zero. Consequently, you
should limit the size of any volumes to be allocated as chunks to a size of 4
terabytes.
Because LVMs allow you to partition a disk drive into multiple volumes, you
can control where data is placed on a given disk. You can improve perfor-
mance by defining a volume that consists of the middle-most cylinders of a
disk drive and placing high-use tables in that volume. (Technically, you do
not place a table directly in a volume. You must first allocate a chunk as a
volume, then assign the chunk to a dbspace, and finally place the table in the
dbspace. For more information, see “Control of Where Data Is Stored” on
page 9-16.)
Tip: If you choose to use large disk drives, you can assign a chunk to one drive and
eliminate the need to partition the disk.
Figure 9-26 illustrates the role of fragments in specifying the location of data.
Figure 9-26
Logical units of storage Physical units of storage Dbspaces That Link
Logical Units
Chunks
Database (Including Table
System catalog Fragments) and
Physical Units of
Dbspace 1 Chunk 1 Storage
Table 1
Dbspace 2 Chunk 2
Table 2
Fragment 2
Fragment 3
Usually you fragment a table when you initially create it. The CREATE TABLE
statement takes one of the following forms:
CREATE TABLE tablename ... FRAGMENT BY ROUND ROBIN IN dbspace1,
dbspace2, dbspace3;
Your Performance Guide also contains information about managing disk space.
In particular, it describes how to eliminate interleaved extents, how to
reclaim space in an empty extent, and how to improve disk I/O.
Before you can create a storage space or chunk, or mirror an existing storage
space, you must allocate disk space for the chunk file. You can allocate either
an empty file or a portion of raw disk for database server disk space.
UNIX On UNIX, if you allocate raw disk space, it is recommended that you use the
UNIX ln command to create a link between the character-special device name
and another filename. For more information on this topic, see “Creating
Symbolic Links to Raw Devices” on page 10-10.
Using a UNIX file and its inherent operating-system interface for database
server disk space also is referred to as using cooked space. ♦
Windows On Windows, it is recommended that you use NTFS files for database server
disk space. For more information on this recommendation, see “Unbuffered
or Buffered Disk Access on UNIX” on page 9-8. ♦
Specifying an Offset
When you allocate a chunk of disk space to the database server, specify an
offset for one of the following two purposes:
■ To prevent the database server from overwriting the partition
information
■ To define multiple chunks on a partition, disk device, or cooked file
If you plan to allocate partitions at the start of a disk, you might need to use
offsets to prevent the database server from overwriting critical information
required by the operating system. For the exact offset required, refer to your
disk-drive manuals.
Warning: If you are running two or more instances of the database server, be
extremely careful not to define chunks that overlap. Overlapping chunks can cause
the database server to overwrite data in one chunk with unrelated data from an
overlapping chunk. This overwrite effectively destroys overlapping data.
For the first chunk, assign any initial offset, if necessary, and specify the size
as an amount that is less than the total size of the allocated disk space. For
each additional chunk, specify the offset to include the sizes of all previously
assigned chunks, plus the initial offset, and assign a size that is less than or
equal to the amount of space remaining in the allocation.
For information on how to create a storage space using the file you have
allocated, refer to “Creating a Dbspace” on page 10-14, “Creating a
Blobspace” on page 10-19, and “Creating an Sbspace” on page 10-23.
Why use symbolic links? If you create chunks on a raw device and that device
fails, you cannot restore from a backup until you replace the raw device and
use the same pathname. All chunks that were accessible at the time of the last
backup must be accessible when you perform the restore.
Symbolic links simplify recovery from disk failure and enable you to replace
quickly the disk where the chunk is located. You can replace a failed device
with another device, link the new device pathname to the same filename that
you previously created for the failed device, and restore the data. You do not
need to wait for the original device to be repaired.
To allocate NTFS file space for database server disk space or mirrored space,
the first step is to create a null (zero bytes) file.
Once you have allocated the file space, you can create the dbspace or other
storage space as you normally would, using onspaces. For information on
how to create a dbspace or a blobspace, refer to “Creating a Dbspace” on
page 10-14 and “Creating a Blobspace” on page 10-19.
1. If the disk partition has not been assigned a drive letter, specify the
following value for ROOTDBS in the ONCONFIG file:
\\.\PhysicalDrive<number>
2. To create a storage space or add a chunk, specify the physical drive
partition.
This example adds a chunk of 5000 kilobytes on PhysicalDrive0, at
an offset of 5200 kilobytes, to dbspace dpspc3.
onspaces -a dbspc3 \\.\PhysicalDrive0 : -o 5200 -s 5000
Warning: If you allocate a formatted drive or disk partition as raw disk space and it
contains data, the database server overwrites the data when it begins to use the disk
space. You must ensure that any data on raw disk space is expendable before you
allocate the disk space to the database server.
Use these naming rules when you create storage spaces or add a chunk. The
filename must have the following characteristics:
The name is case insensitive unless you use quotes around it. By default, the
database server converts uppercase characters in the name to lowercase. If
you want to use uppercase in names, put quotes around them and set the
DELIMIDENT environment variable to ON.
Important: When you add a new logical log, you no longer need to perform a level-0
backup of the root dbspace and modified dbspace to use the new logical log. However,
it is recommended that you perform the level-0 backup to prevent level-1 and level-2
backups from failing.
You must perform a level-0 backup of the modified storage spaces to ensure
that you can restore the unlogged data before you switch to a logging table
type:
Managing Dbspaces
This section discusses creating a standard or temporary dbspace and adding
a chunk to a dbspace or blobspace.
Creating a Dbspace
This section explains how to use onspaces to create a standard dbspace and
a temporary dbspace. For information on using ISA to create a dbspace, see
the ISA online help.
The newly added dbspace (and its mirror, if one exists) is available immedi-
ately. If you are using mirroring, you can mirror the dbspace when you create
it. Mirroring takes effect immediately.
If you are creating a temporary dbspace, you must make the database server
aware of the existence of the newly created temporary dbspace by setting the
DBSPACETEMP configuration variable, the DBSPACETEMP environment
variable, or both. The database server does not begin to use the temporary
dbspace until you take both of the following steps:
The next example adds a 5-megabyte chunk of raw disk space, at an offset of
5200 kilobytes, to dbspace dbspc3.
onspaces -a dbspc3 \\.\e: -o 5200 -s 5120
Managing Blobspaces
This section discusses how to create a blobspace and determine the blobpage
size. The database server stores TEXT and BYTE data in dbspaces or
blobspaces, but blobspaces are more efficient. For information on adding a
chunk, see “Adding a Chunk to a Dbspace or Blobspace” on page 10-17.
Creating a Blobspace
You can use onspaces, ISA, or ON-Monitor to create a blobspace. Specify a
blobspace name of up to 128 characters. The name must be unique and begin
with a letter or underscore. You can use letters, digits, underscores, and
$ characters in the name.
Important: You can mirror the blobspace when you create it if mirroring is enabled
for the database server. Mirroring takes effect immediately.
4. Specify the blobpage size in terms of the number of disk pages per
blobpage in the BLOBPage Size field.
See “Determining Database Server Page Size” on page 10-22. For
example, if your database server instance has a disk-page size of
2 kilobytes, and you want your blobpages to have a size of
10 kilobytes, enter 5 in this field.
5. Enter the complete pathname for the initial primary chunk of the
blobspace in the Full Pathname field of the primary-chunk section.
6. Specify an offset in the Offset field.
7. Enter the size of the chunk, in kilobytes, in the Size field.
8. If you are mirroring this blobspace, enter the full pathname, size, and
optional offset in the mirror-chunk section of the screen.
■ Run the onstat -b utility to display the system page size, given as
buffer size on the last line of the output.
■ To view the contents of the PAGE_PZERO reserved page, run the
oncheck -pr utility.
UNIX ■ In ON-Monitor, select either the Parameters➞Shared-Memory or
Parameters➞Initialize option to display the system page size. ♦
■ oncheck -pe
■ oncheck -pB
The oncheck -pB command lists the following statistics for each table or
database:
■ The number of blobpages used by the table or database in each
blobspace
■ The average fullness of the blobpages used by each simple large
object stored as part of the table or database
For more information, see “Monitoring Blobspace Usage with oncheck -pe”
on page 10-52, “Determining Blobpage Fullness with oncheck -pB” on
page 10-51, and optimizing blobspace blobpage size in the chapter on table
performance considerations in the Performance Guide.
Managing Sbspaces
This section describes how to create a standard or temporary sbspace,
monitor the metadata and user-data areas, add a chunk to an sbspace, and
alter storage characteristics of smart large objects.
Creating an Sbspace
Use the onspaces utility or ISA to create an sbspace.
For information about creating an sbspace and default options for smart large
objects, see onspaces in the utilities chapter of the Administrator’s Reference.
For information on creating smart large objects, see the IBM Informix
DataBlade API Programmer’s Guide and IBM Informix ESQL/C Programmer’s
Manual.
1. Create the sbspace using ISA. For more information, see the ISA
online help.
2. Back up the new sbspace and the root dbspace.
It is important to size the metadata area for an sbspace correctly to ensure that
the sbspace does not run out of metadata space. You can either:
■ Let the database server calculate the size of the metadata area for the
new sbspace chunk.
■ Specify the size of the metadata area explicitly.
For instructions on estimating the size of the sbspace and metadata area, see
table performance considerations in the Performance Guide. Also see
“Monitoring the Metadata and User-Data Areas” on page 10-59.
■ Extent sizes
■ Average smart-large-object size
■ Buffering mode
■ Last-access time
■ Lock mode
■ Logging
1. Allocate space for the temporary sbspace. For details, see “Allocating
Disk Space” on page 10-6.
For information on SBSPACETEMP, see the configuration parameters
chapter in the Administrator’s Reference.
2. Create the temporary sbspace as the following example shows:
onspaces -c -S tempsbsp -t -p ./tempsbsp -o 0 -s 1000
You can specify any of the following onspaces options:
a. Specify a metadata area and offset (-Ms and -Mo).
b. Specify storage characteristics (-Df).
You cannot turn on logging for a temporary sbspace.
3. Set the SBSPACETEMP configuration parameter to the name of the
default temporary sbspace storage area.
Restart the database server.
4. Use onstat -d to display the temporary sbspace.
In Figure 10-1, note the values of 0xa001 in the first flags column and
N S in the second flags column for the temporary sbspace.
5. Specify the LO_CREATE_TEMP flag when you create a temporary
smart large object.
Using DataBlade API:
mi_lo_specset_flags(lo_spec,LO_CREATE_TEMP);
Using ESQL/C:
ifx_lo_specset_flags(lo_spec,LO_CREATE_TEMP);
For information on creating smart large objects, see the IBM Informix
DataBlade API Programmer’s Guide and IBM Informix ESQL/C Programmer’s
Manual.
Figure 10-1
Dbspaces
address number flags fchunk nchunks flags owner name
Output of onstat -d
ab01660 5 0xa001 5 1 N S informix tempsbsp Showing the
Temporary Sbspace
Chunks
address chk/dbs offset size free bpages flags pathname
ab01a50 5 5 0 500 347 347 POS ./tempsbsp
Metadata 100 74 100
Dropping a Chunk
Use onspaces or ISA to drop a chunk from a dbspace.
Before you drop a chunk, ensure that the database server is in the correct
mode, using the following table as a guideline.
If this situation occurs, you must determine which table or other entity still
occupies space in the chunk by executing oncheck -pe to list contents of the
extent.
Usually, the pages can be removed when you drop the table that owns them.
Then reenter the utility command.
You cannot drop the initial chunk of a dbspace with the syntax in the
previous example. Instead, you must drop the dbspace. Use the fchunk
column of onstat -d to determine which is the initial chunk of a dbspace. For
more information about onstat, see the utilities chapter of the Administrator’s
Reference.
For information about dropping a chunk from a dbspace with onspaces, see
the utilities chapter of the Administrator’s Reference.
You cannot drop the initial chunk of an sbspace with the syntax in the
previous example. Instead, you must drop the sbspace. Use the fchunk
column of onstat -d to determine which chunk is the initial chunk of an
sbspace.
Warning: If you force the drop of an sbspace, you might introduce consistency
problems between tables and sbspaces.
Rarely, a smart large object with a reference count of 0 remains. You can use
the onspaces -cl command to delete all smart large objects that have a
reference count of 0, if it is not open by any application.
For information on using onspaces -cl, see the utilities chapter of the Admin-
istrator’s Reference.
You can drop a storage space only when the database server is in either online
or quiescent mode.
Before you drop a blobspace, you must drop all tables that have a TEXT or
BYTE column that references the blobspace.
Execute oncheck -pe to verify that no tables or log files reside in the dbspace
or blobspace.
Before you drop an sbspace, you must drop all tables that have a CLOB or
BLOB column that reference objects that are stored in the sbspace. For
sbspaces, you need not delete columns that point to an sbspace, but these
columns must be null; that is, all smart large objects must be deallocated from
the sbspace.
Tip: If you drop tables on dbspaces where light appends are occurring, the light
appends might be slower than you expect. The symptom of this problem is physical
logging activity. If light appends are slower than you expect, make sure that no tables
are dropped in the dbspace either before or during the light appends. If you have
dropped tables, force a checkpoint with onmode -c before you perform the light
append.
If you want to drop only a storage-space mirror, turn off mirroring. (See
“Ending Mirroring” on page 18-11.) This action drops the dbspace,
blobspace, or sbspace mirrors and frees the chunks for other uses.
Use the -d option with the -f option if you want to drop an sbspace that
contains data. If you omit the -f option, you cannot drop an sbspace that
contains data. This example drops an sbspace called sbspc4 and its mirrors.
onspaces -d sbspc4 -f
Warning: If you use the -f option, the tables in the database server might have dead
pointers to the deleted smart large objects.
For information on dropping a storage space with onspaces, see the utilities
chapter of the Administrator’s Reference.
You are asked to confirm that you want to drop the dbspace or blobspace.
Warning: After you drop a dbspace, blobspace, or sbspace, the newly freed chunks are
available for reassignment to other dbspaces, blobspaces, or sbspaces. However, before
you reassign the newly freed chunks, you must perform a level-0 backup of the root
dbspace and the modified storage space. If you do not perform this backup, and you
subsequently need to perform a restore, the restore might fail because the backup
reserved pages are not up-to-date.
Managing Extspaces
An extspace does not require allocation of disk space. You create and drop
extspaces using the onspaces utility. For more information about extspaces,
refer to “Extspaces” on page 9-35.
Creating an Extspace
You create an extspace with the onspaces utility. But you should first have a
valid datasource and a valid access method with which to access that data
source. Although you can create an extspace without a valid access method
or a valid datasource, any attempts to retrieve data from the extspace will
generate an error. For information on access methods, see the IBM Informix
Virtual-Table Interface Programmer’s Guide.
Important: The preceding example assumes that you have coded a routine that
provides functions for correctly accessing the file passwd and that the file itself
exists. Once you have created the extspace, you must use the appropriate commands
to allow access to the data in the file passwd. For more information on user-defined
access methods, see the “IBM Informix Virtual-Table Interface Programmer’s
Guide.”
Dropping an Extspace
To drop an extspace with onspaces, use the -d option as illustrated in the
following examples. An extspace cannot be dropped if it is associated with
an existing table or index.
For the complete syntax of this onspaces option, see the utilities chapter in
the Administrator’s Reference.
If the database server finds that both dbspace1 and dbspace5 are
unavailable, it skips both dbspaces.
The DEFAULT setting for the SET DATASKIP statement allows a database
server administrator to control the dataskip feature. Suppose that an appli-
cation developer includes the following statement in an application:
SET DATASKIP DEFAULT
When you want to skip fragments, use the ON dbspace-list setting to specify a
list of dbspaces with the fragments that the database server should skip.
The administrator can monitor the distribution of data over table fragments.
If the goal of fragmentation is improved single-user response time, it is
important for data to be distributed evenly over the fragments. To monitor
fragmentation disk use, you must monitor database server tblspaces, because
the unit of disk storage for a fragment is a tblspace. (For information on how
to monitor the data distribution for a fragmented table, see “Monitoring
Tblspaces and Extents” on page 10-48.)
The administrator must monitor I/O request queues for data that is contained
in fragments. When I/O queues become unbalanced, the administrator
should work with the DBA to tune the fragmentation strategy. (For a
discussion of how to monitor chunk use, including the I/O queues for each
chunk, see “Monitoring Chunks” on page 10-41.)
The administrator must monitor fragments for availability and take appro-
priate steps when a dbspace that contains one or more fragments fails. For
how to determine if a chunk is down, see “Monitoring Chunks” on
page 10-41.
Displaying Databases
You can display databases that you create with the following tools:
■ SMI tables
■ ISA
■ ON-Monitor
Using ISA
To query sysdatabases using ISA, follow these steps:
1. Choose SQL➞Query.
2. Select the sysmaster data in the Database list.
3. Enter the following command and click Submit:
select * from sysdatabases;
Monitoring Chunks
You can monitor chunks for the following information:
■ Chunk size
■ Number of free pages
■ Tables within the chunk
This information allows you to track the disk space used by chunks, monitor
chunk I/O activity, and check for fragmentation.
onstat -d
The onstat -d utility lists all dbspaces, blobspaces, and sbspaces and the
following information for the chunks within those spaces.
Figure 10-2 shows sample onstat -d output. The flags column in the chunk
section provides the following information:
■ Whether the chunk is the primary chunk or the mirrored chunk
■ Whether the chunk is online, is down, is being recovered, or is a new
chunk
Important: You must perform a level-0 backup of the root dbspace and the modified
dbspace before mirroring can become active and after turning off mirroring.
Figure 10-2
Dbspaces
address number flags fchunk nchunks flags owner name
onstat -d Output
40c980 1 0x1 1 1 N informix rootdbs
40c9c4 2 0x1 2 1 N informix fstdbs
40ca08 3 0x11 3 1 N B informix fstblob
3 active, 2047 maximum
Note: For BLOB chunks, the number of free pages shown is out of date. Run
‘onstat -d update’ for current stats.
Chunks
address chk/dbs offset size free bpages flags pathname
40c224 1 1 0 20000 14001 PO- /home/server/root_chunk
40c2bc 2 2 0 2000 1659 PO- /home/server/fst_chunk
40c354 3 3 0 12500 ~6250 6250 POB /home/server/blob_chunk
3 active, 2047 maximum
onstat -d update
The onstat -d update option displays the same information as onstat -d and
an accurate number of free blobpages for each blobspace chunk. In
Figure 10-3, a blobspace called fstblob contains a single chunk called
blob_chunk.
Figure 10-3
Dbspaces
address number flags fchunk nchunks flags owner name
onstat -d update
a7317d8 1 0x1 1 1 N informix rootdbs Output with
40c9c4 2 0x1 2 1 N informix fstdbs Information
40ca08 3 0x11 3 1 N B informix fstblob About
3 active, 2047 maximum
Blobspaces
Waiting for server to update BLOB chunk statistics:
Chunks
address chk/dbs offset size free bpages flags pathname
40c224 1 1 0 20000 14001 PO- /home/server/root_chunk
40c2bc 2 2 0 2000 1659 PO- /home/server/fst_chunk
40c354 3 3 0 12500 ~6237 6250 POB /home/server/blob_chunk
3 active, 2047 maximum
onstat -D
The onstat -D option displays the same information as onstat -d, plus the
number of pages read from the chunk (in the page Rd field).
Chunks
address chk/dbs offset page Rd page Wr pathname
40c274 1 1 0 146 4 /home/server/root_chunk
40c30c 2 2 0 1 0 /home/server/test_chunk
40c8fc 2 2 0 36 0 /home/server/test_mirr
40c3a4 3 3 0 4 0 /home/server/blob_chunk
3 active, 2047 maximum
onstat -g iof
The onstat -g iof option displays the number of reads from each chunk and
the number of writes to each chunk. If one chunk has a disproportionate
amount of I/O activity against it, this chunk might be a system bottleneck.
This option is useful for monitoring the distribution of I/O requests against
the different fragments of a fragmented table. Figure 10-5 shows sample
output.
... Figure 10-5
AIO global files:
gfd pathname totalops dskread dskwrite io/s
onstat -g iof Output
3 raw_chunk 38808 27241 11567 6.7
4 cooked_chk1 7925 5660 2265 1.4
5 cooked_chk2 3729 2622 1107 0.6
oncheck -pr
The database server stores chunk information in the reserved pages
PAGE_1PCHUNK and PAGE_2PCHUNK.
To list the contents of the reserve pages, execute oncheck -pr. Figure 10-6
shows sample output for oncheck -pr. This output is essentially the same as
the onstat -d output; however, if the chunk information has changed since the
last checkpoint, these changes do not appear in the oncheck -pr output.
Figure 10-6
Validating PAGE_1DBSP & PAGE_2DBSP...
Using dbspace page PAGE_2DBSP.
oncheck -pr Output
Showing Dbspace
DBspace number 1 and Chunk
DBspace name rootdbs Information
Flags 0x20001 No mirror chunks
Number of chunks 2
First chunk 1
Date/Time created 07/28/2000 14:46:55
Partition table page number 14
Logical Log Unique Id 0
Logical Log Position 0
Oldest Logical Log Unique Id 0
Last Logical Log Unique Id 0
Dbspace archive status No archives have occurred
.
.
Validating PAGE_1PCHUNK & PAGE_2PCHUNK...
Using primary chunk page PAGE_2PCHUNK.
Chunk number 1
Flags 0x40 Chunk is online
Chunk path /home/server/root_chunk
Chunk offset 0 (p)
Chunk size 75000 (p)
Number of free pages 40502
DBSpace number 1
.
.
.
oncheck -pe
To obtain the physical layout of information in the chunk, execute oncheck
-pe. The dbspaces, blobspaces, and sbspaces are listed. Figure 10-7 on
page 10-46 shows sample output for oncheck -pe.
The tables within a chunk are listed sequentially. This output is useful for
determining chunk fragmentation. If the database server is unable to allocate
an extent in a chunk despite an adequate number of free pages, the chunk
might be badly fragmented.
Figure 10-7
DBSpace Usage Report: rootdbs Owner: informix Created: 08/08/2000
oncheck -pe Output
Chunk Pathname Size Used Free
1 /home/server/root_chunk 75000 19420 55580
Using ON-Monitor
UNIX
You can perform the following tasks using ON-Monitor commands.
Column Description
Column Description
Execute oncheck -pt to obtain extent information. The oncheck -pT option
returns all the information from the oncheck -pt option as well as the
additional information about page and index usage.
Query the sysextents table to obtain information about each extent. The
sysextents table has columns that indicate the database and the table that the
extent belongs to, as well as the physical address and size of the extent.
onstat -O
The onstat -O option displays information about the staging-area blobspace
and the Optical Subsystem memory cache. Figure 10-8 shows an example of
the output from this option. The totals shown in the display accumulate from
session to session. The database server resets the totals to 0 only when you
execute onstat -z.
Figure 10-8
Subsystem not available
onstat -O Output
Optical StageBlob Cache
System Cache Totals: System Blob Totals:
Size Alloc Avail. Number Kbytes Number Kbytes
0 0 0 0 0 0 0
The first section of the display describes the following system-cache totals
information.
Column Description
alloc Number of 1-kilobyte pieces that the database server allocated to the
cache
number Number of simple large objects that the database server successfully
put into the cache without overflowing
kbytes Number of kilobytes of the simple large objects that the database
server put into the cache without overflowing
number Number of simple large objects that the database server wrote to the
staging-area blobspace
kbytes Number of kilobytes of simple large objects that the database server
wrote to the staging-area blobspace
Although the size output indicates the amount of memory that is specified in
the configuration parameter OPCACHEMAX, the database server does not
allocate memory to OPCACHEMAX until necessary. Therefore, the alloc
output reflects only the number of 1-kilobyte pieces of the largest simple
large object that has been processed. When the values in the alloc and avail
output are equal, the cache is empty.
The second section of the display describes the following user-cache totals
information.
Column Description
number Number of simple large objects that the database server put into cache
without overflowing
kbytes Number of kilobytes of simple large objects that the database server
put into the cache without overflowing
number Number of simple large objects that the database server wrote to the
staging-area blobspace
kbytes Size of the simple large objects (in kilobytes) that the database server
wrote to the staging-area blobspace
For detailed information about interpreting the oncheck -pB output, see
optimizing blobspace blobpage size in the chapter on table performance
considerations in the Performance Guide.
■ Names of the tables that store TEXT and BYTE data, by chunk
■ Number of disk pages (not blobpages) used, by table
■ Number of free disk pages remaining, by chunk
■ Number of overhead pages used, by chunk
The database server can store more than one simple large object on the same
blobpage. Therefore, you can count the number of pages that store TEXT or
BYTE data in the tblspace, but you cannot estimate the number of simple large
objects in the table.
Average Average
Level Total No. Keys Free Bytes
----- -------- -------- ----------
1 1 74 1058
----- -------- -------- ----------
Total 1 74 1058
Average Average
Level Total No. Keys Free Bytes
----- -------- -------- ----------
1 1 74 984
----- -------- -------- ----------
Total 1 74 984
Monitoring Sbspaces
One of the most important areas to monitor in an sbspace is the metadata
page use. When you create an sbspace, you specify the size of the metadata
area. Also, any time that you add a chunk to the sbspace, you can specify that
metadata space be added to the chunk.
If you attempt to insert a new smart large object, but no metadata space is
available, you receive an error. The administrator should monitor metadata
space availability to prevent this situation from occurring.
Command Description
onstat -g smb s Displays the storage attributes for all sbspaces in the system:
■ sbspace name, flags, owner
■ logging status
■ average smart-large-object size
■ first extent size, next extent size, and minimum extent size
■ maximum I/O access time
■ lock mode
Command Description
onstat -d Displays the following information about the chunks in each sbspace:
■ Number of free sbpages in each sbspace chunk, in the metadata area, and in the user-
data areas
■ Total number of sbpages in each sbspace chunk, in the metadata area, and in the user-
data areas
See “Using onstat -d,”following.
oncheck -cs Validates and displays information about the metadata areas for sbspaces. See “Using
oncheck -ps oncheck -cs” on page 10-57 and “Using oncheck -ps” on page 10-58.
oncheck -cS Displays information about smart-large-object extents and user-data areas for sbspaces.
oncheck -pS Displays information about smart-large-object extents, user-data areas, and metadata
areas for sbspaces. For more information on oncheck -cS and -pS, see managing sbspaces
in the chapter on table performance considerations in your Performance Guide.
(2 of 2)
Using onstat -d
Use the onstat -d option to display the following information about the
chunks in each sbspace:
In Figure 10-11, the onstat -d output displays information about the rootdbs
and the sbspace s9_sbspc. The 8000 and S flags in the Flags columns indicate
an sbspace. For each sbspace chunk, the first row displays information about
the whole sbspace and user-data area. The second row displays information
about the metadata area. In this example, the Size column shows a total of
1000 pages for s9_sbspc. The user-data area is 842 pages with 726 pages free.
The metadata area is 105 pages with 60 pages free.
To find out the total amount of used space, execute the oncheck -pe
command. For more information, see “Using oncheck -ce and oncheck -pe”
on page 10-56.
Figure 10-11
Dbspaces
address number flags fchunk nchunks flags owner name
onstat -d Output
a1b01d8 1 1 1 1 N informix rootdbs with Information
a1b0658 2 8000 2 1 N S informix s9_sbspc About Sbspaces
2 active, 2047 maximum
Chunks
address chk/dbs offset size free bpages flags pathname
a1b0320 1 1 0 75000 64588 PO-
/ix/ids9.2/root_chunk
a1b04f8 2 2 0 1000 726 842 POS
/ix/ids9.2/./s9_sbspc
Metadata 105 60 105
2 active, 2047 maximum
The onstat -d option does not register an sbpage as available until the logical
log in which a deletion occurred is backed up and the sbpage is freed.
Therefore, if you delete 25 smart large objects and immediately execute
onstat -d, the newly freed space does not appear in the onstat output.
■ Total number of used pages for the user-data area, metadata area,
and reserved area
The system adds an extra 53 pages for the reserved area to the totals
for the user-data area and metadata area.
■ Number of free pages that remain in the metadata area
■ Number of free pages that remain in the user-data area
Tip: The oncheck -pe option provides information about sbspace use in terms of
database server pages, not sbpages.
Figure 10-12 shows sample output. In this example, the sbspace s9_sbspc has
a total of 214 used pages, 60 free pages in the metadata area, and 726 free
pages in the user-data area.
Figure 10-12
Chunk Pathname Size Used Free
2 /ix/ids9.2/./s9_sbspc 1000 940 60
oncheck -pe Output
That Shows
Description Offset Size Sbspace Use
-------------------------------------------------- -------- --------
RESERVED PAGES 0 2
CHUNK FREELIST PAGE 2 1
s9_sbspc:'informix'.TBLSpace 3 50
SBLOBSpace LO [2,2,1] 53 8
SBLOBSpace LO [2,2,2] 61 1
...
SBLOBSpace LO [2,2,79] 168 1
SBLOBSpace FREE USER DATA 169 305
s9_sbspc:'informix'.sbspace_desc 474 4
s9_sbspc:'informix'.chunk_adjunc 478 4
s9_sbspc:'informix'.LO_hdr_partn 482 8
s9_sbspc:'informix'.LO_ud_free 490 5
s9_sbspc:'informix'.LO_hdr_partn 495 24
FREE 519 60
SBLOBSpace FREE USER DATA 579 421
Use the oncheck -cs output to see how much space is left in the metadata
area. If it is full, allocate another chunk with adequate space for the metadata
area. To find the number of used pages in the metadata area, total the
numbers in the Used column. To find the number of free pages in the
metadata area, total the numbers in the Free column.
For example, based on the field values displayed in Figure 10-13, the total
number of used pages in the metadata area for s9_sbspc is 33 two-kilobyte
pages (or 66 kilobytes). The metadata area contains a total of 62 free pages (or
124 kilobytes).
Figure 10-13
Validating space 's9_sbspc' ... oncheck -cs Output
SBLOBspace Metadata Partition Partnum Used Free
s9_sbspc:'informix'.TBLSpace 0x200001 6 44
s9_sbspc:'informix'.sbspace_desc 0x200002 2 2
s9_sbspc:'informix'.chunk_adjunc 0x200003 2 2
s9_sbspc:'informix'.LO_hdr_partn 0x200004 21 11
s9_sbspc:'informix'.LO_ud_free 0x200005 2 3
To monitor the amount of free metadata space, run the following command:
oncheck -ps spacename
The -ps output includes information about the locking granularity, partnum,
number of pages allocated and used, extent size, and number of rows in the
metadata area. Use the oncheck -ps output to see how much space is left in
the metadata area. If it is full, allocate another chunk with adequate space for
the metadata area.
If you run oncheck -ps for the dbspace that contains the tables where the
smart large objects are stored, you can find the number of rows in the table.
Figure 10-14
Validating space 's9_sbspc' ... oncheck -ps Output
TBLSpace Report for
TBLspace Flags 2801 Page Locking
TBLspace use 4 bit bit-maps
Permanent System TBLspace
When all of the reserve area is used up, the database server cannot move
space to the metadata area, even if the user-data area contains free space.
1. As you add smart large objects to the sbspace, use oncheck -pe or
onstat -g smb c to monitor the space in the metadata area, user-data
area, and reserved area. For an example, see “Using oncheck -ce and
oncheck -pe” on page 10-56.
2. Use the message log to monitor metadata stealing.
The database server prints messages about the number of pages allo-
cated from the reserved area to the metadata area.
3. Add another chunk to the sbspace before the sbspace runs out of
space in the metadata and reserved areas.
For more information, see “Adding a Chunk to an Sbspace” on
page 10-26.
4. The database server writes the FREE_RE and CHKADJUP log records
when it moves space from the reserve area to the metadata or user-
data area.
start pg npages
Ud1 : 53 1126
Md : 1179 194
Ud2 : 1373 1127
Important: The database server does not contain any mechanisms for compressing
TEXT and BYTE data after the data has been loaded into a database.
Chapter 11 Logging
Logging
11
In This Chapter . . . . . . . . . . . . . . . . . . . . 11-3
Database Server Processes That Require Logging . . . . . . . . 11-3
Transaction Logging . . . . . . . . . . . . . . . . . . 11-6
Logging of SQL Statements and Database Server Activity . . . . . 11-6
Activity That is Always Logged . . . . . . . . . . . . . 11-7
Activity Logged for Databases with Transaction Logging . . . . 11-9
Activity That is Not Logged . . . . . . . . . . . . . . 11-10
All the databases managed by a single database server instance store their log
records in the same logical log, regardless of whether they use transaction
logging. Most database users might be concerned with whether transaction
logging is buffered or whether a table uses logging.
Logging 11-3
Database Server Processes That Require Logging
The database server stores the logical-log records in a logical log. The logical
log is made up of logical-log files that the database server manages on disk
until they have been safely transferred offline (backed up). The database server
administrator keeps the backed up logical-log files until they are needed
during a data restore, or until the administrator decides that the records are
no longer needed for a restore. For more information, see Chapter 13,
“Logical Log.”
■ Transaction rollback
If a database is using transaction logging and a transaction must be
rolled back, the database server uses the logical-log records to
reverse the changes made during the transaction. For more informa-
tion, see “Transaction Logging” on page 11-6.
■ Fast recovery
If the database server shuts down in an uncontrolled manner, the
database server uses the logical-log records to recover all transac-
tions that occurred since the oldest update not yet flushed to disk
and to roll back any uncommitted transactions. (When all the data in
shared memory and on disk are the same, they are physically consis-
tent.) The database server uses the logical-log records in fast recovery
when it returns the entire database server to a state of logical consis-
tency up to the point of the most recent logical-log record. (For more
information, see “Details of Fast Recovery After A Full Checkpoint”
on page 15-20.)
■ Data restoration
The database server uses the most recent storage-space and logical-
log backups to re-create the database server system up to the point of
the most recently backed-up logical-log record. The logical restore
applies all the log records since the last storage-space backup.
■ Deferred checking
If a transaction uses the SET CONSTRAINTS statement to set checking
to DEFERRED, the database server does not check the constraints
until the transaction is committed. If a constraint error occurs while
the transaction is being committed, the database server uses logical-
log records to roll back the transaction. For more information, see SET
Database Object Mode in the IBM Informix Guide to SQL: Syntax.
■ Cascading deletes
Cascading deletes on referential constraints use logical-log records to
ensure that a transaction can be rolled back if a parent row is deleted
and the system fails before the children rows are deleted. For infor-
mation on table inheritance, see the IBM Informix Database Design and
Implementation Guide. For information on primary key and foreign
key constraints, see the IBM Informix Guide to SQL: Tutorial.
■ Distributed transactions
Each database server involved in a distributed transaction keeps log-
ical-log records of the transaction. This process ensures data integrity
and consistency, even if a failure occurs on one of the database serv-
ers that is performing the transaction. For more information, see
“Two-Phase Commit and Logical-Log Records” on page 22-23.
■ High-Availability Data Replication (HDR)
High-Availability Data Replication uses logical-log records to main-
tain consistent data on two different database servers so that one of
the database servers can be used quickly as a backup database server
if the other fails. For more details, see “How HDR Works” on
page 19-9.
■ Enterprise Replication
You must use database logging with Enterprise Replication because
it replicates the data from the logical-log records. For more informa-
tion, see the IBM Informix Dynamic Server Enterprise Replication Guide.
Logging 11-5
Transaction Logging
Transaction Logging
A database or table is said to have or use transaction logging when SQL data
manipulation statements in a database generate logical-log records.
When you create a database, you specify whether it uses transaction logging
and, if it does, what log-buffering mechanism it uses. After the database is
created, you can turn off database logging or change to buffered logging, for
example. Even if you turn off transaction logging for all databases, the
database server always logs some events. For more information, see
“Activity That is Always Logged” on page 11-7 and “Database Logging in an
X/Open DTP Environment” on page 11-13.
You can use logging or nonlogging tables within a database. The user who
creates the table specifies the type of table. Even if you use nonlogging tables,
the database server always logs some events. For more information, see
“Table Types for Dynamic Server” on page 9-38.
Logging 11-7
Activity That is Always Logged
BEGIN WORK Returns an error unless the database uses transaction logging.
A log record is produced if the transaction does some other
logging work.
COMMIT WORK Returns an error unless the database uses transaction logging.
A log record is produced if the transaction does some other
logging work.
Logging 11-9
Activity That is Not Logged
For temp tables in temporary dbspaces, nothing is logged, not even the SQL
statements listed in “Activity That is Always Logged” on page 11-7. If you
include temporary (nonlogging) dbspaces in DBSPACETEMP, the database
server places nonlogging tables in these temporary dbspaces first. For more
information, see “Temporary Tables” on page 9-51.
Database-Logging Status
You must use transaction logging with a database to take advantage of any
of the features listed in “Database Server Processes That Require Logging” on
page 11-3.
Every database that the database server manages has a logging status. The
logging status indicates whether the database uses transaction logging and,
if so, which log-buffering mechanism the database employs. To find out the
transaction-logging status of a database, use the database server utilities, as
explained in “Monitoring the Logging Mode of a Database” on page 12-11.
The database-logging status indicates any of the following types of logging:
All logical-log records pass through the logical-log buffer in shared memory
before the database server writes them to the logical log on disk. However,
the point at which the database server flushes the logical-log buffer is
different for buffered transaction logging and unbuffered transaction
logging. For more information, see “How the Database Server Uses Shared
Memory” on page 7-6 and “Flushing the Logical-Log Buffer” on page 7-45.
When the database server flushes the buffer, only the used pages are written
to disk. Used pages include pages that are only partially full, however, so
some space is wasted. For this reason, the logical-log files on disk fill up faster
than if all the databases on the same database server use buffered logging.
Logging 11-11
Buffered Transaction Logging
If you use buffered logging and a failure occurs, you cannot expect the
database server to recover the transactions that were in the logical-log buffer
when the failure occurred. Thus, you could lose some committed transac-
tions. In return for this risk, performance during alterations improves
slightly. Buffered logging is best for databases that are updated frequently
(when the speed of updating is important), as long as you can re-create the
updates in the event of failure. You can tune the size of the logical-log buffer
to find an acceptable balance for your system between performance and the
risk of losing transactions to system failure.
No Database Logging
If you turn off logging for a database, transactions are not logged, but other
operations are logged. For more information, see “Activity That is Always
Logged” on page 11-7. Usually, you would turn off logging for a database
when you are loading data, or just executing queries.
If you are satisfied with your recovery source, you can decide not to use
transaction logging for a database to reduce the amount of database server
processing. For example, if you are loading many rows into a database from
a recoverable source such as tape or an ASCII file, you might not need trans-
action logging, and the loading would proceed faster without it. However, if
other users are active in the database, you would not have logical-log records
of their transactions until you reinitiate logging, which must wait for a level-0
backup.
Logging 11-13
Settings or Changes for Logging Status or Mode
If the CREATE DATABASE statement does not specify a logging status, the
database is created without logging.
If a database does not use logging, you do not need to consider whether
buffered or unbuffered logging is more appropriate. If you specify logging
but do not specify the buffering mode for a database, the default is unbuf-
fered logging.
End users can switch from unbuffered to buffered (but not ANSI-compliant)
logging and from buffered to unbuffered logging for the duration of a session.
The SET LOG statement performs this change within an application. For more
information on the SET LOG statement, see the IBM Informix Guide to SQL:
Syntax.
Managing Database-Logging
Mode 12
In This Chapter . . . . . . . . . . . . . . . . . . . . 12-3
Changing Database-Logging Mode . . . . . . . . . . . . . 12-4
Modifying Database-Logging Mode with ondblog . . . . . . . . 12-5
Changing Buffering Mode with ondblog . . . . . . . . . . 12-5
Canceling a Logging Mode Change with ondblog . . . . . . . 12-6
Ending Logging with ondblog . . . . . . . . . . . . . 12-6
Making a Database ANSI Compliant with ondblog . . . . . . 12-6
Changing the Logging Mode of an ANSI-Compliant Database . . 12-7
For information on ON-Bar and ontape, see the IBM Informix Backup and
Restore Guide.
Figure 12-1 shows how the database server administrator can change the
database-logging mode. Certain logging mode changes take place
immediately, while other changes require a level-0 backup.
Figure 12-1
Logging Mode Transitions
Converting to:
■ While the logging status is being changed, the database server places
an exclusive lock on the database to prevent other users from
accessing the database, and frees the lock when the change is
complete.
■ If a failure occurs during a logging-mode change, check the logging
mode in ISA or the flags in the sysdatabases table in the sysmaster
database, after you restore the database server data. For more infor-
mation, see “Monitoring the Logging Mode of a Database” on
page 12-11. Then retry the logging-mode change.
■ Once you choose either buffered or unbuffered logging, an appli-
cation can use the SQL statement SET LOG to change from one
logging mode to the other. This change lasts for the duration of the
session. For information on SET LOG, see the IBM Informix Guide to
SQL: Syntax.
■ If you add logging to a database, the change is not complete until the
next level-0 backup of all the storage spaces for the database.
Note that you cannot cancel the logging changes that are executed
immediately.
1. To unload the data, use dbexport or any other migration utility. The
dbexport utility creates the schema file.
For information about how to load and unload data, see the
IBM Informix Migration Guide.
2. To re-create a database with buffered logging and load the data, use
the dbimport -l buffered command.
To re-create a database with unbuffered logging and load the data,
use the dbimport -l command.
You add logging to a database with ontape at the same time that you create
a level-0 backup.
Tip: With ontape, you must perform a level-0 backup of all storage spaces.
To make a database called stores_demo, which does not already use trans-
action logging, into an ANSI-compliant database with ontape, execute the
following command:
ontape -s -A stores_demo
Tip: Once you change the logging mode to ANSI compliant, you cannot easily
change it again. To change the logging mode of ANSI-compliant databases, unload the
data, re-create the database with the new logging mode, and reload the data. For
details, see “Changing the Logging Mode of an ANSI-Compliant Database” on
page 12-7.
Warning: When you alter a table to STANDARD, you turn logging on for that table.
After you alter the table, perform a level-0 backup if you need to be able to restore the
table.
Monitoring Transactions
This section discusses ways to monitor transactions.
onstat -g sql Monitor SQL statements, listed by session Performance monitoring in the Performance
ID and database. Guide
onstat -g stm Monitor memory usage of prepared SQL Memory utilization in the Performance Guide
statements.
Logical Log
13
In This Chapter . . . . . . . . . . . . . . . . . . . . 13-3
What Is the Logical Log? . . . . . . . . . . . . . . . . . 13-3
Location of Logical-Log Files . . . . . . . . . . . . . . . 13-4
Identification of Logical-Log Files . . . . . . . . . . . . . . 13-5
Status Flags of Logical-Log Files . . . . . . . . . . . . . . 13-6
Size of the Logical Log . . . . . . . . . . . . . . . . . 13-7
Number of Logical-Log Files . . . . . . . . . . . . . . 13-7
Performance Considerations . . . . . . . . . . . . . . 13-8
As the database server administrator, you must configure and manage the
logical log. For example, if you do not back up the log files regularly, the
logical log fills and the database server suspends processing.
The logical-log files contain critical information and should be mirrored for
maximum data protection. If you move logical-log files to a different
dbspace, plan to start mirroring on that dbspace.
The actual disk space allocated for each logical-log file has an identification
number known as the log file number. For example, if you configure six
logical-log files, these files have log numbers one through six. The log
numbers might be out of sequence. As logical-log files are backed up and
freed, the database server reuses the disk space for the logical-log files.
Figure 13-1 illustrates the relationship between the log numbers and the
unique ID numbers. Log 7 is inserted after log 5 and used for the first time in
the second rotation.
Figure 13-1
Logical-Log File-Numbering Sequence
1 1 7 14
2 2 8 15
3 3 9 16
4 4 10 17
5 5 11 18
7 0 12 19
6 6 13 20
A------ Log file has been added, and is available, but has not yet been used.
D------ If you drop a log file with a status of U-B, it is marked as deleted. This log file is dropped and
its space is freed for reuse when you take a level-0 backup of all storage spaces.
U-B---- Log file is backed up but still needed for recovery. (The log file is freed when it is no longer
needed for recovery.)
U-B---L Log is backed up but still needed for recovery. Contains the last checkpoint record.
U---C-L This current log file contains the last checkpoint record.
Use the onstat -l command to list the log files by number and monitor the
status flags and percentage of log space used. For more details, see “onstat -l”
on page 14-11.
■ You must always have at least three logical-log files and a maximum
of 32,767 log files. The number of log files depends on the size of the
log files.
■ The number of log files affects the frequency of logical-log backups.
■ The number of logical-log files affects the rate at which blobspace
blobpages can be reclaimed. See “Backing Up Log Files to Free
Blobpages” on page 13-12.
Performance Considerations
For a given level of system activity, the less logical-log disk space that you
allocate, the sooner that logical-log space fills up, and the greater the
likelihood that user activity is blocked due to backups and checkpoints. Tune
the logical-log size to find the optimum value for your system.
■ Logical-log backups
When the logical-log files fill, you have to back them up. The backup
process can hinder transaction processing that involves data located
on the same disk as the logical-log files. Put the physical log, logical
logs, and user data on separate disks. (See the IBM Informix Backup
and Restore Guide.)
■ Checkpoints
Checkpoints block user processing briefly. If log files are backed up
and freed more frequently, the checkpoints occur more frequently.
■ Size of the logical log
A smaller logical log fills faster than a larger logical log. You can add
a larger logical-log file, as explained in “Adding Logical-Log Files
Manually” on page 14-16.
■ Size of individual logical-log records
The sizes of the logical-log records vary, depending on both the pro-
cessing operation and the database server environment. In general,
the longer the data rows, the larger the logical-log records. The logi-
cal log contains images of rows that have been inserted, updated, or
deleted. Updates can use up to twice as much space as inserts and
deletes because they might contain both before-images and after-
images. (Inserts store only the after-image and deletes store only the
before-image.)
■ Number of logical-log records
The more logical-log records written to the logical log, the faster it
fills. Databases with transaction logging fill the logical log faster than
transactions against databases without transaction logging.
■ Type of log buffering
Databases that use unbuffered transaction logging fill the logical log
faster than databases that use buffered transaction logging.
The database server automatically (dynamically) allocates a log file after the
current log file when the next log file contains an open transaction. Dynamic
log allocation allows you to do the following actions:
The best way to test dynamic log allocation is to produce a transaction that
spans all the log files and then use onstat -l to check for newly added log files.
For more information, see “Allocating Log Files” on page 14-14.
Important: You still must back up log files to prevent them from filling. If the log files
fill, the system hangs until you perform a backup.
The logical-log file might be in use for any of the following reasons:
■ The file contains the latest checkpoint or the oldest update not yet
flushed to disk.
Issue the onmode -c command to perform a full checkpoint and free
the logical-log file. For more information, see “Forcing a Full Check-
point” on page 16-9.
■ The file contains an open transaction.
The open transaction is the long transaction discussed in “Setting
High-Watermarks for Rolling Back Long Transactions” on
page 14-25.
■ The file is not backed up.
If the logical-log file is not backed up, processing resumes when you
use ON-Bar or ontape to back up the logical-log files.
1 U-B----
2 U---C--
3 F
4 U-B---L
The database server assumes that you designed your databases so that
smaller simple large objects are stored in dbspaces and larger simple large
objects are stored in blobspaces:
The database server requires that the statement that creates a blobspace, the
statement that creates a chunk in the blobspace, and the statements that insert
simple large objects into that blobspace appear in separate logical-log files.
This requirement is independent of the database-logging status.
For instructions on switching to the next log file, see “Switching to the Next
Logical-Log File” on page 14-7.
When you turn on logging for a database, the database server does not begin
logging until you perform a level-0 backup. However, when you turn on
logging for a smart large object, the database server begins logging changes
to it immediately. To reduce the volume of log entries, you could load smart
large objects with logging turned off and then turn logging back on to capture
updates to the smart large objects.
Warning: When you turn logging on for a smart large object, you must immediately
perform a level-0 backup to be able to recover and restore the smart large object.
For more information, see “Backing Up Sbspaces” on page 14-7 and the
IBM Informix Backup and Restore Guide.
To increase performance, turn off logging for smart large objects. Also turn
off logging if users are primarily analyzing the data and updating it infre-
quently, or if the data is not critical to recover.
■ If Y is set to the end of the large object, the database server logs X
bytes (the updated byte range).
■ If Y is at the beginning or in the middle of the large object, the
database server logs the smallest of these choices:
❑ Difference between the old and new image
❑ Before-image and after-image
❑ Nothing is logged if the before- and after-images are the same
To verify that smart large objects in an sbspace are logged, use the following
command:
oncheck -pS sbspace | grep “Create Flags”
If you create smart large objects in the sbspace with the default logging
option and you see the LO_NOLOG flag in the output, the smart large objects
in this sbspace are not logged. If you see the LO_LOG flag in the output, all
smart large objects in this sbspace are logged.
You can modify the logging status of an sbspace in any of the following ways.
onspaces -ch -Df Turns logging on or off for an “Altering Storage Characteristics
LOGGING=ON existing sbspace of Smart Large Objects” on
page 10-27
Administrator’s Reference
LOG option in the PUT clause of Turns on logging for all smart “Logging” on page 9-27
the CREATE TABLE or ALTER large objects that you load into the IBM Informix Guide to SQL: Syntax
TABLE statement column
mi_lo_create DataBlade API Turns off logging for a smart large IBM Informix DataBlade API
function object when it is initially loaded Function Reference
mi_lo_alter DataBlade API Turns on logging after the load is IBM Informix DataBlade API
function complete Function Reference
ifx_lo_create ESQL/C function Turns off logging for a smart large IBM Informix ESQL/C
object when it is initially loaded Programmer’s Manual
ifx_lo_alter ESQL/C function Turns on logging after the load is IBM Informix ESQL/C
complete Programmer’s Manual
Warning: Be careful about enabling logging for smart large objects that are updated
frequently. This logging overhead might significantly slow down the database server.
For information on the log records for smart large objects, see the chapter on
interpreting logical-log records in the Administrator’s Reference.
Logging Process
This section describes in detail the logging process for dbspaces, blobspaces,
and sbspaces. This information is not required for performing normal
database server administration tasks.
Dbspace Logging
The database server uses the following logging process for operations that
involve data stored in dbspaces:
1. Reads the data page from disk to the shared-memory page buffer
2. Copies the unchanged page to the physical-log buffer, if needed
3. Writes the new data to the page buffer and creates a logical-log
record of the transaction, if needed
4. Flushes the physical-log buffer to the physical log on disk
5. Flushes the logical-log buffer to a logical-log file on disk
6. Flushes the page buffer and writes it back to disk
Blobspace Logging
The database server logs blobspace data, but the data does not pass through
either shared memory or the logical-log files on disk. The database server
copies data stored in a blobspace directly from disk to tape. Records of
modifications to the blobspace overhead pages (the free-map and bitmap
pages) are the only blobspace data that reaches the logical log.
You must log in as either informix or root on UNIX to make any of the
changes described in this chapter. You must be a member of the Informix-
Admin group on Windows.
You would perform these tasks when setting up your logical log:
The easiest way to increase the amount of space for the logical log is to add
another logical-log file. See “Adding Logical-Log Files Manually” on
page 14-16.
connections Specifies the maximum number of connections for all network types that you specify in the
sqlhosts file or registry and in the NETTYPE parameter. If you configured more than one
connection by setting multiple NETTYPE configuration parameters in your configuration
file, sum the users fields for each NETTYPE, and substitute this total for connections in the
preceding formula.
rowsize Specifies the average size of a table row in bytes. To calculate the rowsize, add up the length
(from the syscolumns system catalog table) of the columns in the row.
If the database server contains log files of different sizes, you cannot use the
(LOGFILES * LOGSIZE) expression to calculate the size of the logical log.
Instead, you need to add the sizes for each individual log file on disk. Check
the size field in the onstat -l output. For more information, see “onstat -l” on
page 14-11.
Backing Up Blobspaces
It does not matter whether you back up the logical logs or blobspaces first.
Backing Up Sbspaces
When you turn on logging for smart large objects, you must perform a level-0
backup of the sbspace.
Figure 14-1 shows what happens if you turn on logging in an sbspace that is
not backed up. The unlogged changes to smart large object LO1 are lost
during the failure, although the logged changes are recoverable. You will not
be able to fully restore LO1.
During fast recovery, the database server rolls forward all committed trans-
actions for LO1. If LO1 is unlogged, the database server would be unable to
roll back uncommitted transactions. Then the LO1 contents would be
incorrect. For more information, refer to “Fast Recovery” on page 15-18.
Figure 14-1
Logging is off Turning On Logging
in an Sbspace
These updates are lost when
database server fails.
Turn on logging
The database server can be in online mode to make this change. Execute the
following command to switch to the next available log file:
onmode -l
The change takes effect immediately. (Be sure that you type a lowercase L on
the command line, not a number 1.)
You might want to free a logical-log file for the following reasons:
■ So that the database server does not stop processing
■ To free the space used by deleted blobpages
The procedures for freeing log files vary, depending on the status of the log
file. Each procedure is described in the following sections. To find out the
status of logical-log files, see “Status Flags of Logical-Log Files” on page 13-6
and “Monitoring Logging Activity” on page 14-10.
Tip: For information using ON-Bar or ontape to back up storage spaces and logical
logs, refer to the “IBM Informix Backup and Restore Guide.”
To delete the log file, create a level-0 backup of all storage spaces.
If backing up the log file does not change the status to free (F), its status
changes to either U-B or U-B-L. See “Freeing a Log File with Status U-B or F,”
following, or “Freeing a Log File with Status U-B-L” on page 14-10.
1. If you do not want to wait until the transactions complete, take the
database server to quiescent mode. See “Immediately from Online to
Quiescent” on page 4-18. Any active transactions are rolled back.
2. Because a log file with status U-B might contain the oldest update,
you must use the onmode -c command to force a full checkpoint.
A log file that is backed up but not in use (status U-B) does not need to be
freed. In the following example, log 34 does not need to be freed, but logs 35
and 36 do. Log 35 contains the last checkpoint, and log 36 is backed up but
still in use.
34 U-B-- Log is used, backed up, and not in use
35 U-B-L Log is used, backed up, contains last checkpoint
36 U-B-- Log is used, backed up, and not in use
37 U-C-- This is the current log file, not backed up
Tip: You can free a logical log with a status of U-B (and not L) only if it is not spanned
by an active transaction and does not contain the oldest update.
1. Execute the following command to switch the current log file to the
next available log file:
onmode -l
2. Back up the original log file with ON-Bar or ontape.
3. After all full log files are backed up, you are prompted to switch to
the next available log file and back up the new current log file.
You do not need to do the backup because you just switched to this
log file.
After you free the current log file, if the log file has status U-B or U-B-L, refer
to “Freeing a Log File with Status U-B or F” on page 14-9 or “Freeing a Log
File with Status U-B-L.”
To free log files with a status U-B-L, the database server must create a new
checkpoint. You can execute the following command to force a checkpoint:
onmode -c
onstat -l
The onstat -l utility display consists of the following three sections: physical-
log information, logical-log information (general), and information on the
individual logical-log files.
The section that contains the information on each logical-log file displays the
following:
■ The address of the logical-log file descriptor
■ The log file number
■ Status flags that indicate the status of each log (free, backed up,
current, and so on)
■ The unique ID of the log file
■ The beginning page of the file
■ The size of the file in pages, the number of pages used, and the
percentage of pages used
The log file numbers (numbers field) can also get out of sequence if you drop
several logs in the middle of the list or if the database server dynamically
adds log files. For more information on onstat -l, see the utilities chapter in
the Administrator’s Reference.
oncheck -pr
The database server stores logical-log file information in the reserved pages
dedicated to checkpoint information. Because the database server updates
this information only during a checkpoint, it is not as recent as the infor-
mation that the onstat -l option displays. For more details on using these
options to display reserved page information, see the utilities chapter in the
Administrator’s Reference.
You can view the checkpoint reserved pages with the oncheck -pr command.
Figure 14-3 shows sample output for one of the logical-log files.
Column Description
is_used Flag that indicates whether the log file is being used
is_backed_up Flag that indicates whether the log file has been backed up
is_new Flag that indicates whether the log file has been added since the
last storage space backup
is_archived Flag that indicates whether the log file has been written to the
archive tape
is_temp Flag that indicates whether the log file is flagged as a temporary
log file
If the DYNAMIC_LOGS parameter is set to 1 and the next active log file
contains records from an open transaction, the database server prompts you
to add a log file manually and sets off an alarm. After you add the log file, the
database server resumes processing the transaction.
If the DYNAMIC_LOGS parameter is set to 0 and the logical log runs out of
space during a long transaction rollback, the database server can hang. (The
long transaction prevents the first logical-log file from becoming free and
available for reuse.) To fix the problem, set DYNAMIC_LOGS to 2 and restart
the database server. Then the long transaction should be able to complete.
For more information, see “Monitoring Events for Dynamically Added Logs”
on page 14-23 and “Setting High-Watermarks for Rolling Back Long Transac-
tions” on page 14-25.
If the logical log is low on space, the database server adds as many log files
as needed to complete the transaction. The number of log files is limited by:
If the database server stops adding new log files because it is out of disk
space, it writes an error message and sets off an alarm. Add a dbspace or
chunk to an existing dbspace. Then the database server automatically
resumes processing the transaction.
The reserve pages in the root chunk store information about each log file. The
extents that contain this information expand as more log files are added. The
root chunk requires two extents of 1.4 megabytes each to track 32,767 log
files, the maximum number supported.
If during reversion, the chunk reserve page extent is allocated from a non-
root chunk, the server attempts to put it back in the root chunk. If not enough
space is available in the root chunk, the reversion fails. A message containing
the required space displays in the online log. The required space needs to be
freed from the root chunk before trying the reversion again.
2 Mirrored dbspace that contains log files (but excluding the root dbspace)
3 All dbspaces that already contain log files (excluding the root dbspace)
7 Any dbspace
If you do not want to use this search order to allocate the new log file, you
must set the DYNAMIC_LOGS parameter to 1 and execute onparams -a -i with
the location you want to use for the new log. For details, refer to “Monitoring
Events for Dynamically Added Logs” on page 14-23.
■ To the end of the file list using the onparams -a command or ISA
■ After the current logical-log file using the onparams -a -i command
or ISA
For more information on using onparams to add a logical-log file, see the
utilities chapter in the Administrator’s Reference.
For information on using onparams to drop a logical-log file, see the utilities
chapter in the Administrator’s Reference.
For information on using onlog to display the logical-log files and unique ID
numbers, see “Displaying Logical-Log Records” on page 14-23.
■ Use onparams with the -s option to add a new log file of a different
size.
See “Adding Logical-Log Files Manually” on page 14-16.
■ Increase the LOGSIZE value in the ONCONFIG file if you want the
database server to create larger log files.
See “Changing Logging Configuration Parameters” on page 14-21.
3. Take a level-0 backup of all storage spaces to free all log files except
the current log file.
(If you use onbar -l -b -c, you back up all log files including the cur-
rent log file.) See “Freeing a Logical-Log File” on page 14-8.
4. Use onmode -l to switch to a new current log file.
See “Switching to the Next Logical-Log File” on page 14-7.
5. Drop all six logical-log files in the root dbspace.
You cannot drop the current logical-log file.
See “Dropping Logical-Log Files” on page 14-18.
6. Create a level-0 backup of the root dbspace and dbspace_1.
For more information, see the IBM Informix Backup and Restore Guide.
DYNAMIC_LOGS 0 or 1 2 2
Important: The change to LOGFILES does not take effect until you reinitialize the
disk space.
You can include the onparams command to add log files in your alarm script
for event class ID 27, log file required. Your script can also execute the
onstat -d command to check for adequate space and execute the
onparams a -i command with the location that has enough space. You must
use the -i option to add the new log right after the current log file.
Figure 14-4
Event Alarms for Dynamically Added Log Files
26 3 Dynamically added This message displays when the database server dynamically
log file adds a log file.
log_number
Dynamically added log file log_number to DBspace
dbspace_number.
27 4 Log file required This message displays when DYNAMIC_LOGS is set to 1 and
the database server is waiting for you to add a log file.
ALERT: The oldest logical log log_number contains
records from an open transaction
transaction_address. Logical logging will remain
blocked until a log file is added. Add the log file
with the onparams -a command, using the -i (insert)
option, as in:
onparams -a -d dbspace -s size -i
Then complete the transaction as soon as possible.
28 4 No space for log ALERT: Because the oldest logical log log_number
file contains records from an open transaction
transaction_address, the server is attempting to
dynamically add a log file. But there is no space
available. Please add a DBspace or chunk. Then
complete the transaction as soon as possible.
Figure 14-5 shows the actions that the database server takes for each setting
of the DYNAMIC_LOGS configuration parameter.
Figure 14-5
DYNAMIC_LOGS Settings
DYNAMIC_LOGS Meaning Event Alarm Wait to Add Log Dynamic Log Add
2 (default) Allows automatic allocation of new log Yes (26, 28) No Yes
files to prevent open transactions from
hanging the system.
For example, the database server has ten logical logs and LTXHWM is set to
98. A transaction begins in log file 1 and update activity fills logs 1 through 9.
The database server dynamically adds log file 11 after log file 10. As long as
the transaction does not complete, this process continues until the database
server has added 40 log files. When the database server adds the fiftieth log,
the transaction has caught up to the high-watermark and the database server
rolls it back.
Warning: If you set both LTXHWM and LTXEHWM to 100, long transactions are
never aborted. It is recommended that you set LTXHWM to below 100 for normal
database server operations. Set LTXHWM to 100 to run scheduled transactions of
unknown length. Set LTXEHWM to 100 if you never want to block other users while
a long transaction is rolling back and you have ample disk space.
If the log files are too small, the database server might run out of log space
while rolling back a long transaction. In this case, the database server cannot
block fast enough to add a new log file before the last one fills. If the last log
file fills, the system will hang and display an error message. To fix the
problem, shut down and restart the database server. For details, see “Recov-
ering from a Long Transaction Hang” on page 14-27.
A transaction might hang because the database server has run out of disk
space. The database server stops adding new log files, writes an error
message, and sets off an alarm.
If you cannot add more disk space to the database server, abort the
transaction.
1. Add more disk space or another disk until the transaction is success-
fully rolled back.
2. Perform a point-in time restore to a time before the long transaction
began or early enough for the database server to roll back the
transaction.
3. Drop the extra log files, dbspaces, or chunks from the database server
instance.
4. Perform a complete level-0 backup to free the logical-log space.
The physical log is a set of disk pages where the database server stores an
unmodified copy of the page called a before-image. Physical logging is the
process of storing a before-image of a page that the database server is going
to change. A checkpoint refers to a point when the database server synchro-
nizes the pages on disk with the pages in the shared-memory buffers. Fast
recovery is an automatic procedure that restores the database server to a
consistent state after it goes offline under uncontrolled conditions.
These procedures ensure that multiple, logically related writes are recorded
as a unit, and that data in shared memory is periodically made consistent
with data on disk.
For the tasks to manage and monitor the physical log and checkpoints, see
Chapter 16, “Managing the Physical Log.”
Critical Sections
A critical section is a section of code (or machine instructions) that must be
performed as a single unit. A critical section ensures the integrity of a thread
by allowing it to execute a series of instructions before it is swapped out.
Physical Logging
Physical logging is the process of storing the pages that the database server is
going to change before the changed pages are actually recorded on disk.
Before the database server modifies certain pages in the shared-memory
buffer pool, it stores before-images of the pages in the physical-log buffer in
shared memory.
The database server empties the physical log at each checkpoint (except in
the special circumstances explained in “Configuring the Size of the Physical
Log” on page 15-8). For more information on checkpoints, see “Checkpoints”
on page 15-11.
The database server stores the before-images in the physical log only until the
next checkpoint. To control the amount of data that the database server logs,
you can tune the checkpoint interval configuration parameter CKPTINTVL.
When the fast recovery completes, the database server logs the following
message:
Physical recovery complete: number pages examined, number pages
restored.
If the number of pages examined is much larger than the number of pages restored,
increase the size of the buffer pool to reduce the number of duplicate before-
images. For more information, see the messages appendix in the Adminis-
trator’s Reference.
Overhead pages also include blobspace free-map pages and blobspace bit-
map pages. Blobspace blobpages are not logged in the physical log. For
further information about blobspace logging, see “Logging Blobspaces and
Simple Large Objects” on page 13-11.
Because the physical log is critical, it is recommended that you mirror the
dbspace that contains the physical log.
pagesize System page size in bytes that you can obtain with
oncheck -pr
This formula is based on how much physical logging space the database
server needs in a worst-case scenario. This scenario takes place when a check-
point occurs because the log becomes 75 percent full. This size might be too
small or large for your actual workload or configuration.
For more information on monitoring and tuning the physical log, refer to the
chapter on configuration effects on I/O utilization in your Performance Guide.
Fuzzy checkpoints keep the physical log from filling up too quickly when
applications are doing intensive updates. (See “Fuzzy Checkpoint” on
page 15-12.) However, the physical log could still become full, as the
following sections describe.
When the database server processes these simple large objects, each portion
of the simple large object that the database server stores on disk can be logged
separately, allowing the thread to exit the critical sections of code between
each portion. However, if logging is turned off, the database server must
carry out all operations on the simple large object in one critical section. If the
simple large object is large and the physical log small, this scenario can cause
the physical log to become full. If this situation occurs, the database server
sends the following message to the message log:
Physical log file overflow
The database server then initiates a shutdown. For the suggested corrective
action, refer to this message in your message log.
The database server performs physical logging in the following six steps:
1. Reads the data page from disk to the shared-memory page buffer (if
the data page is not there already)
2. Copies the unchanged page to the physical-log buffer
3. Reflects the change in the page buffer after an application modifies
data
4. Flushes the physical-log buffer to the physical log on disk
Checkpoints
The database server performs two types of checkpoints: full checkpoints
(also known as sync checkpoints) and fuzzy checkpoints. The term checkpoint
refers to the point in the database server operation when the pages on disk
are synchronized with the pages in the shared-memory buffer pool. The
default checkpoint type is fuzzy.
The database server generates at least one checkpoint for each span of the
logical-log space to guarantee that it has a checkpoint at which to begin fast
recovery.
Full Checkpoint
In a full checkpoint, the database server flushes all modified pages in the
shared-memory buffer pool to disk. When a full checkpoint completes, all
physical operations are complete, the MLRU queue is empty, and the database
server is said to be physically consistent.
Fuzzy Checkpoint
In a fuzzy checkpoint, the database server does not flush the modified pages in
the shared-memory buffer pool to disk for certain types of operations, called
fuzzy operations. When a fuzzy checkpoint completes, the pages might not be
consistent with each other, because the database server does not flush all data
pages to disk. A fuzzy checkpoint completes much more quickly than a full
checkpoint and reduces the amount of physical logging during heavy update
activity. When necessary, the database server performs a full checkpoint to
ensure the physical consistency of all data on disk.
Fuzzy Operations
The following commonly used operations are fuzzy for built-in data types:
■ Inserts
■ Updates
■ Deletes
■ Inserts, updates, and deletes for rows that contain user-defined data
types, smart large objects (CLOB and BLOB data types), or simple
large objects (TEXT and BYTE data types)
■ Table alters and loads
■ Operations that create or modify indexes (B-tree, R-tree, or user-
defined indexes)
The database server flushes all the modified data pages for nonfuzzy opera-
tions to disk during a fuzzy checkpoint in the same way as for a full
checkpoint.
Important: Fuzzy checkpoints are disabled for the primary and secondary servers in
a High-Availability Data Replication pair.
The database server skips a full checkpoint if all data is physically consistent
when the checkpoint interval expires. It skips a fuzzy checkpoint only if no
pages have been dirtied since the last checkpoint.
■ When you issue onmode -ky to shut down the database server
■ When you force a checkpoint using onmode -c or ISA
For more information, see “Forcing a Full Checkpoint” on page 16-9.
■ When you convert the database server to a newer version or revert to
a previous version
■ When you perform a backup or restore using ON-Bar or ontape
The backup tool performs a full checkpoint automatically to ensure
the physical consistency of all data before it writes it to the backup
media.
■ At the end of fast recovery or full recovery
■ If the database server is about to switch to the next free log and the
log following the free log contains the oldest update
For example, suppose four logical-log files have the status shown in
the following list. The database server forces a full checkpoint when
it switches to logical-log file 3 if the logical-log file 4 has the oldest
update. The full checkpoint advances the oldest update to logical-log
file 3.
1 U-B----
2 U---C--
3 F
4 U-B---L
For a list of situations in which you should initiate a full checkpoint, see the
following section.
Storage space
In a full checkpoint, the database server flushes all modified pages in the
shared-memory buffer pool to disk.
Important: Because the logical log contains records of fuzzy operations not yet
written to disk, you must back up the logical logs regularly.
For information on ON-Bar or ontape, see the IBM Informix Backup and Restore
Guide.
Fast Recovery
Fast recovery is an automatic, fault-tolerant feature that the database server
executes every time that it moves from offline to quiescent mode or from
offline to online mode. You do not need to take any administrative actions for
fast recovery; it is an automatic feature.
The fast-recovery process checks if, the last time that the database server
went offline, it did so in uncontrolled conditions. If so, fast recovery returns
the database server to a state of physical and logical consistency, as described
in “Details of Fast Recovery After A Full Checkpoint” on page 15-20.
If the fast-recovery process finds that the database server came offline in a
controlled manner, the fast-recovery process terminates, and the database
server moves to online mode.
1. Uses the data in the physical log to return all disk pages to their
condition at the time of the most recent checkpoint.
2. Locates the most recent checkpoint record in the logical-log files.
3. Rolls forward all logical-log records written after the most recent
checkpoint record.
4. Rolls back transactions that do not have an associated COMMIT or
BEGCOM record in the logical log.
The database server writes the BEGCOM record when a transaction
commits. For details, see the chapter on logical-log records in the
Administrator’s Reference.
Transactions that have completed the first phase of a two-phase commit are
exceptional cases. For more information, see “How the Two-Phase Commit
Protocol Handles Failures” on page 22-9.
Uncommitted changes
rolled back
Disk A
■ The database server uses the physical log to return to the most recent
checkpoint. The database server might not be physically consistent
at this point in fast recovery because fuzzy operations do not physi-
cally log the before-image of pages.
■ The database server processes the logical-log records starting with
the oldest update that has not yet been flushed to disk, rather than
starting with the previous checkpoint.
■ The database server uses the logical-log files to return to logical
consistency by rolling forward all committed transactions that
occurred after the last checkpoint and rolling back all transactions
that were left incomplete.
1. Uses the data in the physical log to return disk pages for nonfuzzy
operations to their condition at the time of the most recent
checkpoint.
2. Locates the oldest update in the logical log that is not yet flushed to
disk.
3. Applies the log records for fuzzy operations that occurred before the
most recent checkpoint.
4. Rolls forward all logical-log records written after the most recent
checkpoint record.
5. Rolls back transactions that do not have an associated COMMIT or
BEGIN COMMIT record in the logical log.
Although fast recovery after a fuzzy checkpoint takes longer than after a full
checkpoint, you can optimize it. For details, see your Performance Guide.
The LSN cannot be further back in the log than one logical-log file and two
checkpoints. At each fuzzy checkpoint, the database server writes pages with
time stamps earlier than the oldest LSN and moves forward the LSN.
You cannot free the logical log that contains the oldest update record until
after the changes are recorded on disk. The database server automatically
performs a full checkpoint to prevent problems with fast recovery of very old
log records.
Figure 15-12 illustrates how the database server processes fuzzy records only
prior to checkpoint.
Figure 15-12
Logical log Applying the Log
Records for Fuzzy
Operations
Dbspace
Changes not flushed to Records after the
disk since the oldest oldest update
update was applied
Figure 15-13
Logical log Rolling Forward the
Dbspace Logical-Log
Records after the Records Written
Changes since the oldest update Since the Most
fuzzy checkpoint Recent Fuzzy
rolled forward Checkpoint
Uncommitted changes
rolled back
For background information about the physical log, checkpoints, and fast
recovery, see Chapter 15, “Physical Logging, Checkpoints, and Fast
Recovery.”
To activate the changes to the size or location of the physical log as soon as
you make them, shut down and restart the database server. The onparams
utility automatically shuts down and restarts the database server.
Create a level-0 backup immediately after you restart the database server.
This storage-space backup is critical for database server recovery.
You can move the physical-log file to try to improve performance. When the
database server initializes disk space, it places the disk pages allocated for the
logical log and the physical log in the root dbspace. You might improve
performance by moving the physical log, the logical-log files, or both to other
dbspaces.
For advice on where to place the physical log, see “Specifying the Location of
the Physical Log” on page 15-6. For advice on sizing the physical log, see
“Size and Location of the Physical Log” on page 15-6. To obtain information
about the physical log, see “Monitoring Physical and Logical-Logging
Activity” on page 16-6.
If this error occurs, resize the physical log, or choose another dbspace with
adequate contiguous space and then shut down and restart the database
server.
Parameter Description
The changes do not take effect until you shut down and restart the database
server. Then create a level-0 backup immediately to ensure that all recovery
mechanisms are available.
The following example changes the size and location of the physical log. The
new physical-log size is 400 kilobytes, and the log will reside in the dbspace6
dbspace. The command also reinitializes shared memory with the -y option
so that the change takes effect immediately, as follows:
onparams -p -s 400 -d dbspace6 -y
After you shut down and restart the database server, create a level-0 backup
to ensure that all recovery mechanisms are available.
For information on using the onparams utility to modify the physical log, see
the utilities chapter in the Administrator’s Reference.
Then, create a level-0 backup immediately to ensure that all recovery mecha-
nisms are available.
Command line onstat -l The first line displays the following information for each
or ISA physical-log buffer:
■ The number of buffer pages used (bufused)
■ The size of each physical log buffer in pages (bufsize)
■ The number of pages written to the buffer (numpages)
■ The number of writes from the buffer to disk (numwrits)
■ The ratio of pages written to the buffer to the number of writes
to disk (pages/IO)
Command line onstat -m View the last 20 lines in the message log. If a checkpoint message
or ISA does not appear in the last 20 lines, read the message log directly
with a text editor. The database server writes individual check-
point messages to the log when the checkpoint ends. If a
checkpoint occurs, but the database server has no pages to write
to disk, the database server does not write any messages to the
message log.
ON-Monitor Status➞Profile The Checkpoints and Check Waits fields display the same infor-
(UNIX) mation as the numckpts and ckpwaits fields in onstat -p.
ON-Monitor Force-Ckpt option The time in the Last Checkpoint Done field does not change
(UNIX) from the main menu until a checkpoint occurs. The Last Checkpoint Check field
shows the time of the last checkpoint check. If no modifica-
tions have been made since the time of the last checkpoint, the
database server does not perform a checkpoint.
Row Description
plgwrites Number of writes from the physical-log buffer to the physical log
file
Chapter 17 Mirroring
Mirroring
17
In This Chapter . . . . . . . . . . . . . . . . . . . . 17-3
Mirroring . . . . . . . . . . . . . . . . . . . . . . 17-3
Benefits of Mirroring . . . . . . . . . . . . . . . . . 17-4
Costs of Mirroring . . . . . . . . . . . . . . . . . . 17-4
Consequences of Not Mirroring . . . . . . . . . . . . . 17-4
Data to Mirror . . . . . . . . . . . . . . . . . . . 17-5
Alternatives to Mirroring . . . . . . . . . . . . . . . 17-6
Logical Volume Managers . . . . . . . . . . . . . . 17-6
Hardware Mirroring. . . . . . . . . . . . . . . . 17-6
External Backup and Restore . . . . . . . . . . . . . 17-7
Mirroring Process . . . . . . . . . . . . . . . . . . . 17-7
Creation of a Mirrored Chunk. . . . . . . . . . . . . . 17-7
Mirror Status Flags . . . . . . . . . . . . . . . . . 17-8
Recovery . . . . . . . . . . . . . . . . . . . . . 17-9
Actions During Processing . . . . . . . . . . . . . . . 17-9
Disk Writes to Mirrored Chunks . . . . . . . . . . . 17-9
Disk Reads from Mirrored Chunks. . . . . . . . . . . 17-10
Detection of Media Failures . . . . . . . . . . . . . 17-10
Chunk Recovery . . . . . . . . . . . . . . . . . 17-11
Result of Stopping Mirroring . . . . . . . . . . . . . . 17-11
Structure of a Mirrored Chunk . . . . . . . . . . . . . 17-11
17-2 IBM Informix Dynamic Server Administrator’s Guide
In This Chapter
This chapter describes the database server mirroring feature. For instructions
on how to perform mirroring tasks, refer to Chapter 18, “Using Mirroring.”
Mirroring
Mirroring is a strategy that pairs a primary chunk of one defined dbspace,
blobspace, or sbspace with an equal-sized mirrored chunk.
Writes
Mirroring is not supported on disks that are managed over a network. The
same database server instance must manage all the chunks of a mirrored set.
Mirroring 17-3
Benefits of Mirroring
Benefits of Mirroring
If media failure occurs, mirroring provides the database server administrator
with a means of recovering data without having to take the database server
offline. This feature results in greater reliability and less system downtime.
Furthermore, applications can continue to read from and write to a database
whose primary chunks are on the affected media, provided that the chunks
that mirror this data are located on separate media.
Any critical database should be located in a mirrored dbspace. Above all, the
root dbspace, which contains the database server reserved pages, should be
mirrored.
Costs of Mirroring
Disk-space costs as well as performance costs are associated with mirroring.
The disk-space cost is due to the additional space required for storing the
mirror data. The performance cost results from having to perform writes to
both the primary and mirrored chunks. The use of multiple virtual
processors for disk writes reduces this performance cost. The use of split
reads, whereby the database server reads data from either the primary chunk
or the mirrored chunk, depending on the location of the data within the
chunk, actually causes performance to improve for read-only data. For more
information on how the database server performs reads and writes for
mirrored chunks, see “Actions During Processing” on page 17-9.
When a mirrored chunk suffers media failure, the database server reads
exclusively from the chunk that is still online until you bring the down chunk
back online. On the other hand, when an unmirrored chunk goes down, the
database server cannot access the data stored on that chunk. If the chunk
contains logical-log files, the physical log, or the root dbspace, the database
server goes offline immediately. If the chunk does not contain logical-log
files, the physical log, or the root dbspace, the database server can continue
to operate, but threads cannot read from or write to the down chunk. Unmir-
rored chunks that go down must be restored by recovering the dbspace from
a backup.
Data to Mirror
Ideally, you should mirror all of your data. If disk space is an issue, however,
you might not be able to do so. In this case, select certain critical chunks to
mirror.
Critical chunks always include the chunks that are part of the root dbspace,
the chunk that stores the logical-log files, and the chunk that stores the
physical logs. If any one of these critical chunks fail, the database server goes
offline immediately.
If some chunks hold data that is critical to your business, give these chunks
high priority for mirroring.
Also give priority for mirroring to chunks that store frequently used data.
This action ensures that the activities of many users would not be halted if
one widely used chunk goes down.
Mirroring 17-5
Alternatives to Mirroring
Alternatives to Mirroring
Mirroring, as discussed in this manual, is a database server feature. Your
operating system or hardware might provide alternative mirroring solutions.
Hardware Mirroring
Another solution is to use hardware mirroring such as RAID (redundant
array of inexpensive disks). An advantage of this type of hardware mirroring
is that it requires less disk space than database server mirroring does to store
the same amount of data to prevent media failure.
Some hardware mirroring systems support hot swapping. You can swap a bad
disk while keeping the database server online. Reducing I/O activity before
performing a hot swap is recommended.
Important: If problems occur with the database server while using hardware
mirroring, refer to the operating-system or disk documentation or technical support
for assistance.
Mirroring Process
This section describes the mirroring process in greater detail. For instructions
on how to perform mirroring operations such as creating mirrored chunks,
starting mirroring, changing the status of mirrored chunks, and so forth, see
Chapter 18, “Using Mirroring.”
Mirroring 17-7
Mirror Status Flags
The level-0 backup copies the updated database server configuration infor-
mation, including information about the new mirrored chunk, from the root
dbspace reserved pages to the backup. If you perform a data restore, the
updated configuration information at the beginning of the backup directs the
database server to look for the mirrored copies of the logical-log files if the
primary chunk becomes unavailable. If this new storage-space backup infor-
mation does not exist, the database server is unable to take advantage of the
mirrored log files.
For similar reasons, you cannot mirror a dbspace that contains a logical-log
file while a dbspace backup is being created. The new information that must
appear in the first block of the dbspace backup tape cannot be copied there
once the backup has begun.
You must perform a level-0 backup of the root dbspace before mirroring
starts.
For descriptions of these chunk status flags, refer to the description of the
onstat -d option in the utilities chapter of the Administrator’s Reference. For
information on how to display these status flags, refer to “Monitoring Disk
Usage” on page 10-41.
Recovery
When the database server recovers a mirrored chunk, it performs the same
recovery procedure that it uses when mirroring begins. The mirror-recovery
process consists of copying the data from the existing online chunk onto the
new, repaired chunk until the two are identical.
When you initiate recovery, the database server puts the down chunk in
recovery mode and copies the information from the online chunk to the
recovery chunk. When the recovery is complete, the chunk automatically
receives online status. You perform the same steps whether you are recov-
ering the primary chunk of a mirrored pair or recovering the mirrored chunk.
Tip: You can still use the online chunk during the recovery process. If data is written
to a page that has already been copied to the recovery chunk, the database server
updates the corresponding page on the recovery chunk before it continues with the
recovery process.
Mirroring 17-9
Actions During Processing
Data on this half of the chunk is Data on this half of the chunk is
read from the primary chunk. read from the mirrored chunk.
If the database server detects that a primary (or mirror) chunk device has
failed, reads and writes continue for the one chunk that remains online. This
statement is true even if the administrator intentionally brings down one of
the chunks.
Once the administrator recovers the down chunk and returns it to online
status, reads are again split between the primary and mirrored chunks, and
writes are made to both chunks.
Chunk Recovery
The database server uses asynchronous I/O to minimize the time required for
recovering a chunk. The read from the chunk that is online can overlap with
the write to the down chunk, instead of the two processes occurring serially.
That is, the thread that performs the read does not have to wait until the
thread that performs the write has finished before it reads more data.
Create a level-0 backup of the root dbspace after you end mirroring to ensure
that the reserved pages with the updated mirror-chunk information are
copied to the backup. This action prevents the restore procedure from
assuming that mirrored data is still available.
Mirroring 17-11
Structure of a Mirrored Chunk
If the primary chunk goes down and the mirrored chunk becomes the
primary chunk, disk-space allocation reports then accurately describe the
fullness of the new primary chunk.
Using Mirroring
18
In This Chapter . . . . . . . . . . . . . . . . . . . . 18-3
Preparing to Mirror Data . . . . . . . . . . . . . . . . . 18-3
Enabling the MIRROR Configuration Parameter. . . . . . . . . 18-4
Changing the MIRROR Parameter with ON-Monitor. . . . . . 18-4
Enable mirroring when you initialize the database server if you plan to create
a mirror for the root dbspace as part of initialization; otherwise, leave
mirroring disabled. If you later decide to mirror a storage space, you can
change the value of the MIRROR configuration parameter.
To enable mirroring for the database server, you must set the MIRROR
parameter in ONCONFIG to 1. The default value of MIRROR is 0, indicating
that mirroring is disabled.
To change the value of MIRROR, you can edit the ONCONFIG file with a text
editor or ISA while the database server is in online mode. After you change
the ONCONFIG file, take the database server offline and then to quiescent
mode for the change to take effect.
After the last of these screens, a prompt appears to confirm that you want to
continue (to initialize the database server disk space and destroy all existing
data). Respond N (no) to this prompt.
Warning: If you respond Y (yes) at this prompt, you lose all your existing data.
Take the database server offline and then to quiescent mode for the change to
take effect.
Always allocate disk space for a mirrored chunk on a different disk than the
corresponding primary chunk with, ideally, a different controller. This setup
allows you to access the mirrored chunk if the disk on which the primary
chunk is located goes down, or vice versa.
The original setup consists of a primary root chunk and a mirror root chunk,
which are linked to the actual raw disk devices, as follows:
ln -l
lrwxrwxrwx 1 informix 10 May 3 13:38 /dev/root@->/dev/rxy0h
lrwxrwxrwx 1 informix 10 May 3 13:40 /dev/mirror_root@->/dev/rsd2b
Assume that the disk on which the raw device /dev/rsd2b resides has gone
down. You can use the rm command to remove the corresponding symbolic
link, as follows:
rm /dev/mirror_root
Now you can relink the mirrored chunk pathname to a raw disk device, on a
disk that is running, and proceed to recover the chunk, as follows:
ln -s /dev/rab0a /dev/mirror_root
Using Mirroring
Mirroring starts when you create a mirrored chunk for each primary chunk
in a dbspace, blobspace, or sbspace.
When you create a mirrored chunk, the database server copies data from the
primary chunk to the mirrored chunk. When this process is complete, the
database server begins mirroring data. If the primary chunk contains logical-
log files, the database server does not copy the data immediately after you
create the mirrored chunk but waits until you perform a level-0 backup. For
an explanation of this behavior see “Creation of a Mirrored Chunk” on
page 17-7.
Important: You must always start mirroring for an entire dbspace, blobspace, or
sbspace. The database server does not permit you to select particular chunks in a
dbspace, blobspace, or sbspace to mirror. You must create mirrored chunks for every
chunk in the space.
You start mirroring a storage space when you perform the following
operations:
Each of these operations requires you to create mirrored chunks for the
existing chunks in the storage space.
To specify the root mirror pathname and offset, set the values of
MIRRORPATH and MIRROROFFSET in the ONCONFIG file before you bring up
the database server.
If you do not provide a mirror pathname and offset, but you do want to start
mirroring the root dbspace, you must change the mirroring status of the root
dbspace once the database server is initialized.
You can take down or restore a chunk only if it is part of a mirrored pair. You
can take down either the primary chunk or the mirrored chunk, as long as the
other chunk in the pair is online.
Managing Mirroring
You can use the onspaces utility to manage mirroring. On UNIX, you can also
use ON-Monitor to manage mirroring. For a full description of the onspaces
syntax, see the utilities chapter of the Administrator’s Reference.
You can use the onspaces utility to start mirroring a dbspace, blobspace, or
sbspace. For example, the following onspaces command starts mirroring for
the dbspace db_project, which contains two chunks, data1 and data2:
onspaces -m db_project\
-p /dev/data1 -o 0 -m /dev/mirror_data1 0\
-p /dev/data2 -o 5000 -m /dev/mirror_data2 5000
The following example shows how to turn on mirroring for a dbspace called
sp1. You can either specify the primary path, primary offset, mirror path, and
mirror offset in the command or in a file.
onspaces -m sp1 -f mirfile
You can use the onspaces utility to create a mirrored dbspace. For example,
the following command creates the dbspace db_acct with an initial chunk
/dev/chunk1 and a mirrored chunk /dev/mirror_chk1:
onspaces -c -d db_acct -p /dev/chunk1 -o 0 -s 2500 -m /dev/mirror_chk1 0
1. Select Storage➞Spaces.
2. Click Add Dbspace, Add Blobspace, or Add Sbspace.
3. Enter the path and offset for the mirror chunk.
You can use the onspaces utility to add a primary chunk and its mirrored
chunk to a dbspace, blobspace, or sbspace. The following example adds a
chunk, chunk2, to the db_acct dbspace. Because the dbspace is mirrored, a
mirrored chunk, mirror_chk2, is also added.
onspaces -a db_acct -p /dev/chunk2 -o 5000 -s 2500 -m /dev/mirror_chk2 5000
1. Select Storage➞Chunks.
2. Select the dbspace name and click Add Chunk.
3. Enter the path and offset for the mirror chunk.
Taking down a chunk is not the same as ending mirroring. You end mirroring
for a complete dbspace, which causes the database server to drop all the
mirrored chunks for that dbspace.
You can use the onspaces utility to take down a chunk. The following
example takes down a chunk that is part of the dbspace db_acct:
onspaces -s db_acct -p /dev/mirror_chk1 -o 0 -D
You can use the onspaces -s utility to recover a down chunk. For example, to
recover a chunk that has the pathname /dev/mirror_chk1 and an offset of 0
kilobytes, issue the following command:
onspaces -s db_acct -p /dev/mirror_chk1 -o 0 -O
Ending Mirroring
When you end mirroring for a dbspace, blobspace, or sbspace, the database
server immediately releases the mirrored chunks of that space. These chunks
are immediately available for reassignment to other storage spaces.
You cannot end mirroring if any of the primary chunks in the dbspace are
down. The system can be in online mode when you end mirroring.
You can end mirroring with the onspaces utility. For example, to end
mirroring for the root dbspace, enter the following command:
onspaces -r rootdbs
1. Select Storage➞Chunks.
2. Select the dbspace name and click Stop Mirroring.
High-Availability Data
Replication 19
In This Chapter . . . . . . . . . . . . . . . . . . . . 19-3
High-Availability Data Replication . . . . . . . . . . . . . 19-4
Type of Data Replicated . . . . . . . . . . . . . . . . 19-4
Advantages of Data Replication . . . . . . . . . . . . . 19-5
Primary and Secondary Database Servers . . . . . . . . 19-5
HDR Versus Mirroring . . . . . . . . . . . . . . . 19-7
HDR Versus Two-Phase Commit . . . . . . . . . . . 19-8
HDR and Enterprise Replication . . . . . . . . . . . 19-9
How HDR Works . . . . . . . . . . . . . . . . . . . 19-9
How Data Initially Replicates . . . . . . . . . . . . . . 19-9
Reproduction of Updates to the Primary Database Server . . . . 19-10
How the Log Records Are Sent . . . . . . . . . . . . 19-11
HDR Buffers . . . . . . . . . . . . . . . . . . 19-11
When Log Records Are Sent . . . . . . . . . . . . . 19-12
Synchronous Updating . . . . . . . . . . . . . . . 19-12
Asynchronous Updating . . . . . . . . . . . . . . 19-12
Threads That Handle HDR . . . . . . . . . . . . . . . 19-15
Checkpoints Between Database Servers . . . . . . . . . . 19-16
How Data Synchronization Is Tracked . . . . . . . . . . . 19-16
■ What HDR is
■ How HDR works
■ How HDR handles failures
■ How to redirect a client to connect to the other database server in the
HDR pair (also called a replication pair)
■ What the design considerations are for applications that connect to
the secondary database server
Tip: If you want to use asynchronous data replication, see the “IBM Informix
Dynamic Server Enterprise Replication Guide.”
HDR replicates all built-in and extended data types. User-defined types
(UDTs) must be logged and reside in a single database server. Data types with
out-of-row data are replicated if the data is stored in an sbspace or in a
different table on the same database server. For data stored in an sbspace to
be replicated, the sbspace must be logged.
HDR does not replicate data stored in operating system files or persistent
external files or memory objects associated with user-defined routines.
During normal operation, clients can connect to the primary database server
and use it as they would an ordinary database server. Clients can also use the
secondary database server during normal operation, but only to read data.
The secondary database server does not permit updates from client
applications.
If one of the database servers fails, as Figure 19-2 shows, you can redirect the
clients that use that database server to the other database server in the pair.
Figure 19-2
Client Database Servers in
an HDR Pair and
Clients After a
Client Failure
Primary Secondary
Client
Client
If a primary database server fails, you can change the secondary database
server to a standard database server so that it can accept updates.
On the other hand, HDR duplicates on an entirely separate database server all
the data that a database server manages (not just specified dbspaces).
Because HDR involves two separate database servers, it protects the data that
these database servers manage, not just against disk failures, but against all
types of database server failures, including a computer failure or the
catastrophic failure of an entire site.
Figure 19-3
A Comparison of Mirroring and HDR
Mirroring
dis
dis
Database server
dis
dis
Disks
Computer
dis
dis dis
dis
dis
dis dis
dis
When you combine HDR and Enterprise Replication, only the primary HDR
server is connected to the Enterprise Replication system. The secondary HDR
server does not participate in Enterprise Replication unless the primary HDR
server fails.
For more information, see IBM Informix Dynamic Server Enterprise Replication
Guide.
To replicate data
You must perform the initial HDR with a storage-space backup. You cannot
use data-migration utilities such as onload and onunload to replicate data
because the physical page layout of tables on each database server must be
identical in order for HDR to work.
When HDR is working, the primary database server is online and accepts
updates and queries just as a standard database server does. The secondary
database server is in logical-recovery mode and cannot accept SQL state-
ments that result in writes to disk (except for sorting and temporary tables).
Important: The database server cannot replicate updates to databases that do not use
transaction logging.
The secondary database server receives the logical-log records from the
primary database server into a shared-memory reception buffer (which the
database server automatically adjusts to an appropriate size for the amount
of data being sent). The secondary database server then applies the logical-
log records through logical recovery.
HDR Buffers
The HDR buffers are part of the virtual shared memory that the primary
database server manages. The HDR buffers hold logical-log records before the
primary database server sends them to the secondary database server. The
HDR buffers are the same size as the logical-log buffers. Figure 19-4 shows
this concept.
Figure 19-4
Primary Secondary How Logical-Log
Records Are Sent
from the Primary
Shared memory Shared memory Database Server to
the Secondary
Logical-log Recovery Database Server
buffer buffer
dis dis
dis
dis
Disk Disk
Synchronous Updating
If you set DRINTERVAL to -1, HDR occurs synchronously. As soon as the
primary database server writes the logical-log buffer contents to the HDR
buffer, it sends those records from the HDR buffer to the secondary database
server. The logical-log buffer flush on the primary database server completes
only after the primary database server receives acknowledgment from the
secondary database server that the records were received.
Asynchronous Updating
If you set DRINTERVAL to any value other than -1, data replication occurs
asynchronously. The primary database server flushes the logical-log buffer
after it copies the logical-log buffer contents to the HDR buffer. Independent
of that action, the primary database server sends the contents of the HDR
buffer across the network when one of the following conditions occurs:
Lost-and-Found Transactions
With asynchronous updating, a transaction committed on the primary
database server might not be replicated on the secondary database server.
This situation can result if a failure occurs after the primary database server
copies a commit record to the HDR buffer but before the primary database
server sends that commit record to the secondary database server.
Figure 19-5
Using a Lost-and-Found File
Records in Records in
primary logical secondary
log logical log
Records for
transaction Secondary
committed on switched to
primary but Records in standard
rolled back on primary logical
secondary log after recovery
Records in
lost-and-found
file after recovery
sqlexec
drsecapply
drprsend drsecrcv
logrecvr
drprping drsecping
The remaining threads that the database server starts for HDR are the
drprping and drsecping threads, which are responsible for sending and
receiving the messages that indicate if the two database servers are
connected.
HDR Failures
This section discusses the causes and consequences of an HDR failure, as well
as the administrator’s options for managing failure and restarting data
replication.
To redirect clients that use the secondary database server to the primary
database server, use any of the methods explained in “Redirection and
Connectivity for Data-Replication Clients” on page 19-21. If you redirect
these clients, the primary database server might require an additional
temporary dbspace for temporary tables and sorting.
You do not need to change the type of the primary database server to
standard.
Manual Switchover
Manual switchover means that the administrator of the secondary database
server changes the type of the secondary database server to standard. The
secondary database server rolls back any open transactions and then comes
into online mode as a standard database server, so that it can accept updates
from client applications. For an explanation of how to perform the
switchover, see “Changing the Database Server Type” on page 20-21.
After a failure of one of the database servers in a pair, you might want to
redirect the clients that use the failed database server. (You might not want
clients to be redirected. For example, if you anticipate that the database
servers will be functioning again in a short time, redirecting clients might not
be appropriate.)
The database server does not have a transparent mechanism for directing
client requests to different database servers in a replication pair, but you can
automate this action from within the application, as described in “Handling
Redirection Within an Application” on page 19-28. Some of the client connec-
tivity drivers included in the IBM Informix Client Software Developer’s Kit
have specific mechanisms for automating redirection. For details, see the
IBM Informix Client Software Developer’s Kit documentation.
The mechanism that you employ determines which CONNECT syntax you
can use in your application. The following sections describe each of the three
redirection mechanisms.
Because the DBPATH environment variable is read only (if needed) when an
application issues a CONNECT statement, applications must restart in order
for redirection to occur.
An application can contain code that tests whether a connection has failed
and, if so, attempts to reconnect. If an application has this code, you do not
need to restart it.
You can use the CONNECT TO database statement with this method of
redirection. For this method to work, you cannot use any of the following
statements:
■ CONNECT TO DEFAULT
■ CONNECT TO database@dbserver
■ CONNECT TO @dbserver
The reason for this restriction is that an application does not use DBPATH if a
CONNECT statement specifies a database server. For more information about
DBPATH, refer to the IBM Informix Guide to SQL: Reference.
If your applications do not include such code, users who are running clients
must quit and restart all applications.
UNIX The INFORMIXSQLHOSTS environment variable specifies the full pathname and
filename of the connection information in $INFORMIXDIR/etc/sqlhosts. For more
information about INFORMIXSQLHOSTS, see the IBM Informix Guide to SQL:
Reference.
■ CONNECT TO database@dbserver
■ CONNECT TO @dbserver
■ CONNECT TO DEFAULT
■ CONNECT TO database
Figure 19-7 on page 19-26 shows how connectivity values might be modified
to redirect clients.
You also must ensure that the following statements are true on the client
computer before that client can reconnect to the other database server.
1. The /etc/hosts file on UNIX or hosts file on Windows has an entry for
the hostname of the computer that is running the database server to
which you are redirecting clients.
2. The /etc/services file on UNIX or services file on Windows has an
entry for the servicename of the database server to which you are
redirecting clients.
Figure 19-7
Connectivity Values Before and After a Failure of the cliff_ol Database Server
Client
Client Client
Client
cliff beach
cliff_ol beach_ol
Client
Client Client
Client
cliff beach
/etc/hosts
beach
cliff_ol beach_ol
/etc/services
ol_bc
If your applications contain code that tests if a connection has failed and
issues a reconnect statement if necessary, redirection is handled automati-
cally. The user has no responsibilities. If your applications do not include
such code, users who are running clients must quit and restart all
applications.
To support this method of redirection, you can use the following connectivity
statements:
■ CONNECT TO DEFAULT
■ CONNECT TO database
main()
{
int connected = 0;
int tries;
for (tries = 0;tries < MAXTRIES && connected == 0;tries++)
{
EXEC SQL CONNECT TO "superstores";
if (strcmp(SQLSTATE,"00000"))
{
if (sqlca.sqlwarn.sqlwarn6 != 'W')
{
notify_admin();
if (tries < MAXTRIES - 1)
sleep(SLEEPTIME);
}
else connected =1;
}
}
return ((tries == MAXTRIES)? -1:0);
}
This example assumes the DBPATH redirection mechanism and uses a form
of the CONNECT statement that supports the DBPATH redirection method. If
you used the connectivity information to redirect, you might have a different
connection statement, as follows:
EXEC SQL CONNECT TO "superstores@cliff_ol";
When is a client When the client next tries After the administrator changes the When the client
redirected? to connect with a connectivity information, when the restarts and reads a
specified database client next tries to establish a new value for the
connection with a database server INFORMIXSERVER
environment
variable
What is the Individual Individual All clients that use Individual Individual clients
scope of the clients clients a given database clients redirected
redirection? redirected redirected server redirected redirected
If applications do not have lock mode set to WAIT, some unexpected errors
might occur. For example, many SQL statements cause updates to the catalog
table indexes. The following sequence of SQL statements fails if the lock mode
of the application is not set to WAIT:
CREATE DATABASE db_name;
DATABASE db_name;
CREATE TABLE tab_name;
These SQL statements would fail because the CREATE DATABASE statement
creates indexes on the systables catalog table and, therefore, places a lock on
the table until the indexes are copied over to the secondary database server.
Meanwhile, the CREATE TABLE statement tries to insert a row into the
systables catalog table. The insert fails, however, because the table is locked.
This application would fail because both the CREATE DATABASE and CREATE
TABLE statements cause updates to the systables catalog table index.
To prevent clients that are using the secondary database server from issuing
updating statements, you can take either of the following actions:
To make statements that perform an update conditional, make sure that client
applications test slqwarn6 of the sqlwarn field in the ESQL/C sqlca structure
(and equivalent values for other SQL APIs). The database server sets
slqwarn6 to W when it runs as a secondary database server.
Important: All queries on the secondary database server are dirty reads. Do not run
queries on the secondary database server while log records that contain data
definition language (DDL) statements are being replicated and applied on the
secondary database server.
Chapter 19, “High-Availability Data Replication,” explains what HDR is, how
it works, and how to design client applications for an HDR environment.
■ The computers that run the primary and secondary database servers
must be identical (same vendor and architecture).
■ The operating systems on the computers that run the primary and
secondary database servers must be identical.
■ The hardware that runs the primary and secondary database servers
must support network capabilities.
■ The amount of disk space allocated to dbspaces for the primary and
secondary database servers must be equal. The type of disk space is
irrelevant; you can use any mixture of raw or cooked spaces on the
two database servers.
UNIX You should use symbolic links for the chunk pathnames, as explained in
“Allocating Raw Disk Space on UNIX” on page 10-9.
Important: If you do not use symbolic links for chunk pathnames, you cannot easily
change the pathname of a chunk. For more information, see “Renaming Chunks” on
page 20-16. ♦
The following ONCONFIG parameters must have the same value on each
database server:
■ ROOTNAME
■ ROOTOFFSET
■ ROOTPATH
■ ROOTSIZE
Mirroring
You do not have to set the MIRROR parameter to the same value on the two
database servers; you can enable mirroring on one database server and
disable mirroring on the other. However, if you specify a mirrored chunk for
the root chunk of the primary database server, you must also specify a
mirrored chunk for the root chunk on the secondary database server.
Therefore, the following ONCONFIG parameters must be set to the same
value on both database servers:
■ MIRROROFFSET
■ MIRRORPATH
Physical-Log Configuration
The physical log should be identical on both database servers. The following
ONCONFIG parameters must have the same value on each database server:
■ PHYSDBS
■ PHYSFILE
If you use ON-Bar, set the ON-Bar configuration parameters to the same value
on both database servers. For information on the ON-Bar parameters, see the
IBM Informix Backup and Restore Guide.
If you use ontape, the tape size and tape block size for the storage-space and
logical-log backup devices should be identical. The following ONCONFIG
parameters must have the same value on each database server:
■ LTAPEBLK
■ LTAPESIZE
■ TAPEBLK
■ TAPESIZE
To use a tape to its full physical capacity, set LTAPESIZE and TAPESIZE to 0.
Logical-Log Configuration
All log records are replicated to the secondary server. You must configure the
same number of logical-log files and the same logical-log size for both
database servers. The following ONCONFIG parameters must have the same
value on each database server:
■ LOGFILES
■ LOGSIZE
■ DYNAMIC_LOGS
The database server logs the addition of logical-log files. Logical-log files
added dynamically on the primary server are automatically replicated on the
secondary server. Although the DYNAMIC_LOGS value on the secondary
server has no effect, keep DYNAMIC_LOGS in sync with the value on the
primary server, in case their roles switch.
Shared-Memory Configuration
Set all the shared-memory configuration parameters (SHMADD, SHMTOTAL,
SHMVIRTSIZE) to the same values on the two database servers.
HDR Parameters
The following HDR parameters must be set to the same value on both
database servers in the replication pair:
■ DRINTERVAL
■ DRLOSTFOUND
■ DRTIMEOUT
Suppose you want to start HDR on two database servers, ServerA and
ServerB. The procedure for starting HDR, using ServerA as the primary
database server and ServerB as the secondary database server, is described
in the following steps. Figure 20-1 on page 20-12 lists the commands required
to perform each step and the messages sent to the message log. You can use
ontape or ON-Bar to perform the backup and restore. You must use the same
utility throughout the procedure, however.
Important: If you use ON-Bar to perform the backup and restore, ontape is required
on both database servers. You cannot remove ontape from database servers partici-
pating in HDR.
Tip: For the procedure on how to start HDR using external backup and restore, see
the “IBM Informix Backup and Restore Guide.”
To start HDR
Figure 20-1
Steps to Start HDR for the First Time
1 Install UDRs, UDTs, and DataBlade Install UDRs, UDTs, and DataBlade modules.
modules.
Register UDRs, UDTs, and DataBlade
modules.
2 ontape command
ontape -s -L 0
ON-Bar command
onbar -b -L 0
Messages to message log
Level 0 archive started on rootdbs.
Archive on rootdbs completed.
3 ontape command
ontape -p
Answer no when you are prompted to back up the
logs.
ON-Bar command
onbar -r -p
Messages to message log
IBM Informix Database Server Initialized --
Shared Memory Initialized
Recovery Mode
Physical restore of rootdbs started.
Physical restore of rootdbs completed.
(1 of 3)
4 onmode command
onmode -d secondary prim_name
Messages to message log
DR: new type = secondary, primary
server name = prim_name
If all the logical-log records written to the primary
database server since step 1 still reside on the
primary database server disk, the secondary
database server reads these records to perform
logical recovery. (Otherwise, step 5 must be
performed).
5 ontape command
ontape -l
ON-Bar command
onbar -l
(3 of 3)
If you need to change a configuration parameter that must have the same
value on both database servers, you must change the value of that parameter
in the ONCONFIG file of both database servers.
If the configuration parameter does not need to have the same value on each
database server in the replication pair, you can change the value on the
primary or secondary database server individually.
You must use the same backup and restore tool on both database servers.
The block size and tape size used (for both storage-space backups and
logical-log backups) must be identical on the primary and secondary
database servers.
You can use ontape to set the tape size to 0 to automatically use the full
physical capacity of a tape.
The directory pathname or the actual file for chunks must exist before you
create them. Make sure the pathnames (and offsets, if applicable) exist on the
secondary database server before you create a chunk on the primary
database server, or else the database server turns off data replication.
Renaming Chunks
If you use symbolic links for chunk pathnames, you can rename chunks
while HDR is operating. For instructions on renaming chunks, see the
IBM Informix Backup and Restore Guide.
If you do not use symbolic links for chunk pathnames, you must take both
database servers offline while renaming the chunks, for the time that it take
to complete a cold restore of the database server.
To ensure that the new chunk status is flushed to the reserved pages on the
secondary database server, force a checkpoint on the primary database server
and verify that a checkpoint also completes on the secondary database server.
The new chunk status is now retained even if the secondary database server
is restarted.
If the primary chunk on the secondary database server is down, you can
recover the primary chunk from the mirror chunk.
Once you complete these steps, the primary chunk will be online when you
restart the secondary database server.
Before you can add a mirrored chunk, the disk space for that chunk must
already be allocated on both the primary and secondary database servers. If
you want to mirror a dbspace on one of the database servers in the replication
pair, you must create mirrored chunks for that dbspace on both database
servers. For general information on allocating disk space, see “Allocating
Disk Space” on page 10-6.
You can perform disk-layout operations from the primary database server
only. Thus, you can add or drop a mirrored chunk only from the primary
database server. A mirrored chunk that you add to or drop from the primary
database server is added to or dropped from the secondary database server
as well. You must perform mirror recovery for the newly added mirror chunk
on the secondary database server. For more information, see “Recovering a
Mirrored Chunk” on page 18-11.
When you drop a chunk from the primary database server, Dynamic Server
automatically drops the corresponding chunk on the secondary database
server. This applies to both primary and mirror chunks.
When you turn mirroring off for a dbspace on the primary database server,
Dynamic Server does not turn mirroring off for the corresponding dbspace
on the secondary database server. To turn off mirroring for a dbspace on the
secondary database server independent of the primary server, use
onspaces -r. For more information about turning off mirroring, see “Ending
Mirroring” on page 18-11.
You can take down a mirrored chunk or recover a mirrored chunk on either
the primary or secondary database server. These processes are transparent to
HDR.
For information on changing the size and location of the physical log, refer to
Chapter 16, “Managing the Physical Log.”
If you add a logical-log file to the primary database server, this file is
available for use and flagged F as soon as you perform the level-0 backup.
The new logical-log file on the secondary database server is still flagged A.
However, this condition does not prevent the secondary database server
from writing to the file.
Figure 20-2 summarizes the effects of changing the mode of the primary
database server.
Figure 20-2
Mode Changes on the Primary Database Server
Any mode offline Secondary displays: Treat it like a failure of the primary. Two
(onmode -k) DR: Receive error. different scenarios are possible, depending
HDR is turned off. on what you do with the secondary while the
primary is offline:
The mode remains read-only.
“The Secondary Database Server Was Not
Changed to a Standard Database Server” on
page 20-31
“The Secondary Database Server Is Changed
to a Standard Database Server” on
page 20-31
online or quiescent Secondary does not receive Use onmode -m on the primary.
(onmode-s / onmode-u) errors.
HDR remains on.
Mode remains read-only.
Figure 20-3 summarizes the effects of changing the mode of the secondary
database server.
Figure 20-3
Mode Changes on the Secondary Database Server
Read-only offline Primary displays: Treat it as you would a failure of the secondary.
(onmode -k) DR: Receive error. Follow the procedures in “Restarting If the
HDR is turned off. Secondary Database Server Fails” on
page 20-31.
You can change the database server type from secondary to standard only if
HDR is turned off on the secondary database server. HDR is turned off when
the data replication connection to the primary database server breaks or data
replication fails on the secondary database server. When you take the
standard database server offline and bring it back online, it does not attempt
to connect to the other database server in the replication pair.
To switch the database server type using hdrmkpri and hdrmksec scripts
1. Shut down the primary database server (ServerA):
onmode -ky
2. With the secondary database server (ServerB) online, run the
hdrmkpri.sh script on UNIX or hdrmkpri.bat script on Windows.
Now ServerB is a primary database server.
3. For ServerA, run the hdrmksec.sh script on UNIX or hdrmksec.bat
script on Windows. Now ServerA is a secondary database server.
4. Bring ServerB (primary database server) online.
The following example shows a header for a database server that is the
primary database server in a replication pair, and in online mode:
IBM Informix Dynamic Server Version 9.30.UC1 -- online(Prim) -- Up
45:08:57
This example shows a database server that is the secondary database server
in a replication pair, and in read-only mode.
IBM Informix Dynamic Server Version 9.30.UC1 -- Read-Only (Sec) -- Up
45:08:57
The following example shows a header for a database server that is not
involved in HDR. The type for this database server is standard.
IBM Informix Dynamic Server Version 9.30.UC1 -- online -- Up 20:10:57
onstat -g dri
To obtain full HDR monitoring information, execute the onstat -g dri option.
The following fields are displayed:
Figure 20-4
Data Replication:
Type State Paired server Last DR CKPT (id/pg)
onstat -g dri Output
primary off beach_ol 4/741
DRINTERVAL 30
DRTIMEOUT 300
DRLOSTFOUND /usr/informix/etc/dr.lostfound
oncheck -pr
If your database server is running HDR, the reserved pages PAGE_1ARCH and
PAGE_2ARCH store the checkpoint information that HDR uses to synchronize
the primary and secondary database servers. An example of the relevant
oncheck -pr output is given in Figure 20-5.
Figure 20-5
Validating Informix Database Server reserved pages - PAGE_1ARCH & PAGE_2ARCH
Using archive page PAGE_1ARCH.
oncheck -pr
PAGE_1ARCH
Archive Level 0 Output for Database
Real Time Archive Began 01/11/95 16:54:07 Server Running
Time Stamp Archive Began 11913
Logical Log Unique Id 3 HDR
Logical Log Position b018
Column Description
■ If chunks are mirrored, you can perform recovery just as you would
for a standard database server that used mirroring.
■ In cases where the chunks are not mirrored, the procedure for
restoring the primary database server depends on whether the disk
that failed contains critical media.
If the disk contains critical media, the primary database server fails.
You have to perform a full restore using the primary dbspace back-
ups (or the secondary dbspace backups if the secondary database
server was switched to standard mode and activity redirected). See
“Restarting After Critical Data Is Damaged” on page 20-27.
If the disk does not contain critical media, you can restore the
affected dbspaces individually with a warm restore. A warm restore
consists of two parts: first a restore of the failed dbspace from a
backup and next a logical restore of all logical-log records written
since that dbspace backup. For more information on performing a
warm restore, see the IBM Informix Backup and Restore Guide. You
must back up all logical-log files before you perform the warm
restore.
Figure 20-6
Scenarios for Media Failure on the Primary Database Server
Primary Yes No Primary database server fails. Follow the procedure in “Restarting
After Critical Data Is Damaged” on page 20-27.
Primary Yes Yes Primary database server remains online. Follow the procedures in
“Recovering a Mirrored Chunk” on page 18-11.
Primary No Yes Primary database server remains online. Follow the procedures in
“Recovering a Mirrored Chunk” on page 18-11.
■ If chunks are mirrored, you can perform recovery just as you would
for a standard database server that uses mirroring.
■ In cases where the chunks are not mirrored, the secondary database
server fails if the disk contains critical media but remains online if the
disk does not contain critical media. In both cases, you have to
perform a full restore using the dbspace backups on the primary
database server. (See “Restarting After Critical Data Is Damaged” on
page 20-27.) In the second case, you cannot restore selected dbspaces
from the secondary dbspace backup because they might now deviate
from the corresponding dbspaces on the primary database server.
You must perform a full restore.
Figure 20-7
Scenarios for Media Failure on the Secondary Database Server
Secondary Yes Yes Secondary database server remains online in read-only mode.
Follow the procedures in “Recovering a Mirrored Chunk” on
page 18-11.
Figure 20-8
Steps for Restarting HDR After a Critical Media Failure on the Primary Database Server
1. onmode command
onmode -s
onmode -d secondary prim_name
2. ON-Bar command
onbar -r -p
ontape command
ontape -p
3. onmode command
onmode -d primary sec_name
4. ontape command
ontape -l
1. Restore the primary database server from the storage space and
logical-log backup.
2. After you restore the primary database server, treat the other failed
database server as if it had no data on the disks and you were starting
HDR for the first time.
(See “Starting HDR for the First Time” on page 20-9.) Use the func-
tioning database server with the intact disks as the database server
with the data.
2. ontape command
ontape -l
Figure 20-10
Steps to Restart If You Changed the Secondary Database Server to Standard
1. onmode -s
This step takes the secondary
database server (now standard) to
quiescent mode. All clients that are
connected to this database server
must disconnect. Applications that
perform updates must be
redirected to the primary. See
“Redirection and Connectivity for
Data-Replication Clients” on
page 19-21.
3. oninit
If all the logical-log records that were written to the secondary
database server are still on the secondary database server disk,
the primary database server recovers these records from that
disk when you issue the oninit command.
If you have backed up and freed the logical-log files on the
secondary, the records in these files are no longer on disk. In
this case, you are prompted to recover these logical-log files
from tape (step 4).
For ontape users:
If you want to read the logical-log records over the network,
set the logical-log tape device to a device on the computer that
is running the secondary database server.
Consistency Checking
21
In This Chapter . . . . . . . . . . . . . . . . . . . . 21-3
Performing Periodic Consistency Checking . . . . . . . . . . 21-4
Verifying Consistency . . . . . . . . . . . . . . . . 21-4
Validating System Catalog Tables . . . . . . . . . . . 21-5
Validating Data Pages . . . . . . . . . . . . . . . 21-5
Validating Extents . . . . . . . . . . . . . . . . 21-6
Validating Indexes . . . . . . . . . . . . . . . . 21-6
Validating Logical Logs . . . . . . . . . . . . . . 21-6
Validating Reserved Pages . . . . . . . . . . . . . 21-6
Validating Metadata . . . . . . . . . . . . . . . . 21-6
Monitoring for Data Inconsistency . . . . . . . . . . . . 21-7
Reading Assertion Failures in the Message Log and
Dump Files . . . . . . . . . . . . . . . . 21-7
Validating Table and Tablespace Data . . . . . . . . . . 21-8
Retaining Consistent Level-0 Backups . . . . . . . . . . . 21-9
When one of these checks finds that the contents are not what they should be,
the database server reports an assertion failure and writes text that describes
the check that failed in the database server message log. The database server
also collects further diagnostics information in a separate file that might be
useful to IBM Informix Technical Support staff.
This chapter provides an overview of consistency-checking measures and
ways of handling inconsistencies. It covers the following topics:
■ Verify that all data and the database server overhead information is
consistent.
■ Check the message log for assertion failures while you verify
consistency.
■ Create a level-0 dbspace backup after you verify consistency.
Verifying Consistency
Because of the time needed for this check and the possible contention that the
check can cause, schedule this check for times when activity is at its lowest.
It is recommended that you perform this check just before you create a level-0
backup.
Run the commands shown in Figure 21-1 as part of the consistency check.
Figure 21-1
Checking Data Consistency
You can run each of these commands while the database server is in online
mode. For information about how each command locks objects as it checks
them and which users can perform validations, see oncheck in the Adminis-
trator’s Reference.
Each database contains its own system catalog, which contains information
about the database tables, columns, indexes, views, constraints, stored proce-
dures, and privileges.
However, if you receive an error message when you validate system catalog
tables, the situation is quite different. Contact IBM Informix Technical
Support immediately.
If data-page validation detects errors, try to unload the data from the
specified table, drop the table, re-create the table, and reload the data. For
information about loading and unloading data, see the IBM Informix Migration
Guide. If this procedure does not succeed, perform a data restore from a
storage-space backup.
Validating Extents
To validate extents in every database, use the oncheck -ce command.
Extents must not overlap. If this command detects errors, perform a data
restore from a storage-space backup.
Validating Indexes
To validate indexes on each of the tables in the database, use the oncheck -cI
command.
If this command detects errors, drop and re-create the affected index.
Reserved pages are pages that reside at the beginning of the initial chunk of
the root dbspace. These pages contain the primary database server overhead
information. If this command detects errors, perform a data restore from
storage-space backup.
This command might provide warnings. In most cases, these warnings call
your attention to situations of which you are already aware.
Validating Metadata
Execute oncheck -cs for each database to validate metadata for all smart large
objects in a database. If necessary, restore the data from a dbspace backup.
The See Also: line contains one or more of the following filenames:
■ af.xxx
■ shmem.xxx
UNIX ■ gcore.xxx
■ gcore.xxx
■ /pathname/core ♦
In all cases, xxx is a hexadecimal number common to all files associated with
the assertion failures of a single thread. The files af.xxx, shmem.xxx, and
gcore.xxx are in the directory that the ONCONFIG parameter DUMPDIR
specifies.
The file af.xxx contains a copy of the assertion-failure message that was sent
to the message log, as well as the contents of the current, relevant structures
and data buffers.
The file shmem.xxx contains a complete copy of the database server shared
memory at the time of the assertion failure, but only if the ONCONFIG
parameter DUMPSHMEM is set to 1.
UNIX On UNIX, gcore.xxx contains a core dump of the database server virtual
process on which the thread was running at the time, but only if the
ONCONFIG parameter DUMPGCORE is set to 1 and your operating system
supports the gcore utility. The core file contains a core dump of the database
server virtual process on which the thread was running at the time, but only
if the ONCONFIG parameter DUMPCORE is set to 1. The pathname for the
core file is the directory from which the database server was last invoked. ♦
In many cases, the database server stops immediately when an assertion fails.
However, when failures appear to be specific to a table or smaller entity, the
database server continues to run.
For additional details about the objectives and contents of messages, see the
chapter on message-log messages in the Administrator’s Reference.
If you check indexes while the database server is in online mode, oncheck
detects the corruption but does not prompt you for repairs. If corruption
exists, you can drop and re-create the indexes using SQL statements while
you are in online mode (the database server locks the table and index). If you
run oncheck -cI in quiescent mode and corruption is detected, you are
prompted to confirm whether the utility should attempt to repair the
corruption.
Chunks
address chk/dbs offset size free bpages flags pathname
40c224 1 1 0 20000 14001 PO-
/home/server/root_chunk
40c2bc 2 2 0 2000 1659 PD-
/home/server/fst_chunk
2 active, 8192 maximum
Additionally, the message log lists a message with the location of the error
and a suggested solution. The listed solution is a possible fix, but does not
always correct the problem.
If the down chunk is mirrored, the database server continues to operate using
the mirrored chunk. Use operating-system utilities to determine what is
wrong with the down chunk and correct the problem. You must then direct
the database server to restore mirrored chunk data.
If the down chunk is not mirrored and contains logical-log files, the physical
log, or the root dbspace, the database server immediately initiates an abort.
Otherwise, the database server can continue to operate but cannot write to or
read from the down chunk or any other chunks in the dbspace of that chunk.
You must take steps to determine why the I/O error occurred, correct the
problem, and restore the dbspace from a backup.
If you take the database server to offline mode when a chunk is marked as
down (D), you can reinitialize the database server, provided that the chunk
marked as down does not contain critical data (logical-log files, the physical
log, or the root dbspace).
To determine the cause of the problem that triggered the assertion failure, it
is critically important that you not destroy diagnostic information until
IBM Informix Technical Support indicates that you can do so. Send email with
the af.xxx file to IBM Informix Technical Support at [email protected]. The
af.xxx file often contains information that they need to resolve the problem.
For more information about the configuration parameters, see the Adminis-
trator’s Reference.
You decide whether to set these parameters. Diagnostic output can consume
a large amount of disk space. (The exact content depends on the environment
variables set and your operating system.) The elements of the output could
include a copy of shared memory and a core dump.
Tip: A core dump is an image of a process in memory at the time that the assertion
failed. On some systems, core dumps include a copy of shared memory. Core dumps
are useful only if this is the case.
A disabling I/O error is nondestructive when the error does not threaten the
integrity of your data. Nondestructive errors occur when someone acciden-
tally disconnects a cable, you somehow erase the symbolic link that you set
up to point to a chunk, or a disk controller becomes damaged.
Before the database server considers an I/O error to be disabling, the error
must meet two criteria. First, the error must occur when the database server
attempts to perform an operation on a chunk that has at least one of the
following characteristics:
Second, the error must occur when the database server attempts unsuccess-
fully to perform one of the following operations:
You can prevent the database server from marking a dbspace as down while
you investigate disabling I/O errors. If you find that the problem is trivial,
such as a loose cable, you can bring the database server offline and then
online again without restoring the affected dbspace from backup. If you find
that the problem is more serious, such as a damaged disk, you can use
onmode -O to mark the affected dbspace as down and continue processing.
■ Message log
■ Event alarms
ONDBSPACEDOWN
Setting Result Action
For more information about interpreting messages that the database server
sends to the message log, see the chapter about message-log messages in the
Administrator’s Reference.
Parameter Value
Severity 4 (Emergency)
Class 5
If you want the database server to use event alarms to notify you about
disabling I/O errors, write a script that the database server executes when it
detects a disabling I/O error. For information about how to set up this
executable file that you write, see the appendix on event alarms and the
chapter on configuration parameters in the Administrator’s Reference.
The database server cannot take any action to identify the bad cylinder, track,
or sector location because the only information available is the byte
displacement within the chunk where the I/O operation was attempted.
If the database server detects an I/O error on a chunk that is not mirrored, it
marks the chunk as down. If the down chunk contains logical-log files, the
physical log, or the root dbspace, the database server immediately initiates an
abort. Otherwise, the database server can continue to operate, but applica-
tions cannot access the down chunk until its dbspace is restored.
Transaction Managers
Transaction managers support two-phase commit and roll back. For example,
if your database is Informix, your accounting system is Oracle, and your
remittance system is Sybase, you can use a transaction manager to commu-
nicate between the different databases. You also can use transaction
managers to ensure data consistency between Informix or non-Informix
databases by using distributed transactions instead of Enterprise Replication
or High-Availability Data Replication.
Loosely coupled mode means that the different database servers coordinate
transactions, but do not share resources. The records from all branches of the
transactions display as separate transactions in the logical log.
Tightly coupled mode means that the different database servers coordinate
transactions and share resources such as locking and logging. The records
from all branches of the transactions display as a single transaction in the
logical log.
If any database server is unable to commit its portion of the transaction, all
database servers participating in the transaction must be prevented from
committing their work.
france australia
If you execute the commands shown in Figure 22-2, the result is one update
and two inserts at three different database servers.
Figure 22-2
CONNECT TO stores_demo@italy
BEGIN WORK
Example of a
UPDATE stores_demo:manufact SET manu_code = 'SHM' WHERE manu_name = Distributed
'Shimara' Transaction
INSERT INTO stores_demo@france:manufact VALUES ('SHM', 'Shimara', '30')
INSERT INTO stores_demo@australia:manufact VALUES ('SHM', 'Shimara', '30')
COMMIT WORK
Precommit Phase
During the precommit phase, the coordinator and participants perform the
following dialog:
Postdecision Phase
During the postdecision phase, the coordinator and participants perform the
following dialog:
Important: A slow network cannot, and should not, trigger automatic recovery.
None of the recovery mechanisms described here go into effect unless a coordinator
system fails, a network fails, or the administrator terminates the coordinating thread.
Presumed-Abort Optimization
Presumed-abort optimization is the term that describes how the two-phase
commit protocol handles the rollback of a transaction (an abort).
Independent Actions
An independent action in the context of two-phase commit is an action that
occurs independently of the two-phase commit protocol. Independent
actions might or might not be in opposition to the actions that the two-phase
commit protocol specifies. If the action is in opposition to the two-phase
commit protocol, the action results in an error or a heuristic decision. Heuristic
decisions can result in an inconsistent database and require manual two-
phase commit recovery. Manual recovery is an extremely complicated
administrative procedure that you should try to avoid. (For a discussion of
the manual-recovery process, see Chapter 23, “Recovering Manually from
Failed Two-Phase Commit.”)
This action is not considered a heuristic decision because it does not interfere
with the two-phase protocol; it is either acceptable, or it interferes with
participant recovery and causes an error.
The action is acceptable any time that all participants are able to commit the
transaction without difficulty. In this case, your action to end the transaction
forcibly is superfluous. The indication that you executed onmode -Z reaches
the coordinator only when the coordinator is preparing to terminate the
transaction.
When both conditions are true, the net result is a global transaction that is
inconsistently implemented (committed by one or more database servers and
rolled back by another). The database becomes inconsistent.
■ The logical log fills to the point defined by the LTXEHWM configu-
ration parameter. (See the chapter on configuration parameters in the
Administrator’s Reference.) The source of the long-transaction
condition is a piece of work being performed on behalf of a global
transaction.
■ An administrator executes onmode -z session_id to kill a database
server thread that is executing a piece of work being performed on
behalf of a global transaction.
In either case, if the piece of work has already sent a can commit message to
its coordinator, the action is considered a heuristic decision.
Under two-phase commit, the logical-log files that contain records associated
with the piece of work are considered open until an ENDTRANS logical-log
record is written. This type of transaction differs from a transaction involving
a single database server where a rollback actually closes the transaction.
The logical log might continue to fill until the exclusive high-watermark is
reached (LTXEHWM). If this happens, all user threads are suspended except
those that are currently rolling back or currently committing. In the two-
phase commit scenario, the open transaction prevents you from backing up
the logical-log files and freeing space in the logical log. Under these specific
circumstances, the logical log can fill completely. If this happens, the partic-
ipant database server shuts down, and you must perform a data restore.
In this situation, examine the logical log at each participant database server
site and determine whether your database system is consistent. (See “Deter-
mining If a Transaction Was Implemented Inconsistently” on page 23-4.)
If the coordinator contacts the participant and directs it to end the transaction
in a reasonable period of time, no problem develops. The serious problem
arises if the heuristic rollback occurs at a participant database server and
subsequently the coordinator fails, preventing the coordinator from directing
the participant to end the transaction.
You must decide whether to kill the transaction and protect your system
against the possibility of filling the logical log, despite all the problems
associated with executing onmode -Z, or to wait and see if communication
with the coordinator can be reestablished in time to end the transaction
before the logical log fills.
The address parameter is obtained from onstat -x output. For more infor-
mation on the onstat -x option, see the utilities chapter of the Administrator’s
Reference.
Two records are written in the logical log to document the action. The records
are type ROLLBACK and ENDTRANS, or if the transaction was already heuris-
tically rolled back, ENDTRANS only. The following message is written to the
participant database server message log:
(time_stamp) Transaction Completed Abnormally (endtx): tx=address
flags:0xnn user username tty ttyid
The coordinator receives an error message from the participant where the
onmode -Z occurred, in response to its COMMIT instruction. The coordinator
queries the participant database server, which no longer has information
about the transaction. The lack of a transaction-table entry at the participant
database server indicates that the transaction committed. The coordinator
assumes that the acknowledgment message was sent from the participant,
but somehow it was not received. Because the coordinator does not know that
this participant’s piece of work did not commit, it does not generate
messages indicating that the global transaction was inconsistently imple-
mented. Only the administrator who executed the onmode -Z command is
aware of the inconsistent implementation.
The H flag in the third position of the flags field means a heuristic rollback and
the G flag in the fifth position means a global transaction. The flag in the
second position indicates the mode that the transaction is running in (L flag
indicates loosely-coupled mode and T flag indicates tightly-coupled mode).
The curlog and logposit fields provide the exact position of a logical-log
record. If a transaction is not rolling back, curlog and logposit describe the
position of the most recently written log record. When a transaction is rolling
back, these fields describe the position of the most recently “undone” log
record. This record is in log 20 at page offset 2 (the third page in the log) and
byte offset 0x218. As the transaction rolls back, the curlog and logposit
values decrease. In a long transaction, the rate at which the logposit and
beginlg values converge can help you estimate how much longer the
rollback is going to take.
Figure 22-3
IBM Informix Dynamic Server Version 9.40.U -- Online (LONGTX)
onstat -x Output
Transactions
address flags userthread locks beginlg curlog logposit isol retrys
coord
a733018 A---- a701018 0 0 20 0x11a0 COMMIT 0
a7331e4 A---- a701638 0 0 0 0x0 COMMIT 0
a7333b0 A---- a701c58 0 0 0 0x0 COMMIT 0
a73357c A---- a702278 0 0 0 0x0 COMMIT 0
a733748 --H-G 0 0 17 20 0x2218 COMMIT 0
a733ae0 A---- a7034d8 0 0 0 0x0 COMMIT 0
6 active, 128 total, 10 maximum concurrent
You also can use the onstat -u and onstat -k commands to track transactions
and the locks that they hold. For details, see the monitoring transactions
section in your Performance Guide. For a description of the fields that onstat -x
displays, see the utilities chapter of the Administrator’s Reference.
-698 If you receive error -698, a heuristic rollback has occurred and has
caused an inconsistently implemented transaction. The
circumstances leading up to this event are described in “Results of
a Heuristic Rollback” on page 22-17. For an explanation of how the
inconsistent transaction developed and to learn the options
available to you, refer to this discussion.
-699 If you receive error -699, a heuristic rollback has occurred. The
circumstances leading up to this event are described in “Results of
a Heuristic Rollback” on page 22-17. For an explanation of how the
inconsistent transaction developed, refer to this discussion.
-716 If you receive error -716, the coordinating thread has been
terminated by administrator action after it issued its final decision.
This scenario is described under “Independent Actions That Result
in an Error Condition” on page 22-13.
For information about these logical-log records, see the chapter on inter-
preting the logical log in the Administrator’s Reference.
This section examines the sequence of logical-log records that are written
during the following database server scenarios:
■ A transaction is committed.
■ A piece of work is heuristically rolled back.
■ A piece of work is heuristically ended.
All participants:
P1 P2 P3
Write log record: TABLOCKS.
Write and flush log record: PREPARE.
Send message: can commit.
Coordinator:
C Writes log record: COMMIT.
Flushes logical-log buffer.
Sends message: commit.
All participants:
P1 P2 P3
Writes log record: COMMIT
Flushes logical-log buffer.
Send message: committed.
Coordinator:
C Writes log record: ENDTRANS.
End protocol
Some of the logical-log records must be flushed from the logical-log buffer
immediately; for others, flushing is not critical.
The participants in Figure 22-4 on page 22-25 must immediately flush both
the PREPARE and the COMMIT logical-log records. Flushing the PREPARE
record ensures that, if the participant’s host computer fails, fast recovery is
able to determine that this participant is part of a global transaction. As part
of recovery, the participant might query the coordinator to learn the final
disposition of this transaction.
Figure 22-5
Start protocol Logical-Log
Records Written
Coordinator: During a Heuristic
C Writes log record: BEGPREP. Rollback
Sends message: precommit.
All Participants:
P1 P2 P3 Write log record: TABLOCKS.
Write log record: PREPARE.
Flush logical log.
Send message: commit ok.
Within P1 participant’s environment:
The database server detects long
transaction condition. Rollback starts.
Writes log record: HEURTX.
Writes log record: ROLLBACK.
Message written in message log.
Coordinator:
C Writes log record: COMMIT.
Flushes log record.
Sends message: commit.
P1 P2 P3 Participant 1:
Sends message: Transaction heuristically rolled back. Cannot commit.
Participants 2 and 3:
Write and flush log record: COMMIT.
Send message: committed.
Coordinator:
C Writes message in message log (-698).
Sends message to Participant 1: end-transaction.
Participant 1
P1 P2 P3
Writes log record: ENDTRANS.
Sends message: Transaction ended.
Coordinator
C Writes log record: ENDTRANS.
Returns error message to user: Error -698.
End protocol
Figure 22-6
Start protocol Logical-Log
Records Written
Coordinator: During a Heuristic
C Writes log record: BEGPREP. End Transaction
Sends message: precommit.
All participants:
P1 P2 P3 Write log record: TABLOCKS.
Write and flush log record: PREPARE.
Send message: can commit.
P1 participant’s environment:
Transaction is killed.
Writes log record: ROLLBACK.
Writes log record: ENDTRANS.
Message is written in the database server message log.
Coordinator:
C Writes log record: COMMIT.
Flushes logical-log buffer.
Sends message: commit.
Participant 1:
P1 P2 P3 Returns error message.
Participants 2 and 3:
Write log record: COMMIT.
Flush logical-log buffer.
Send message: committed.
Coordinator:
C Receives error message from P1.
Establishes new connection to P1 and sends TX Inquire message to P1.
Participant 1:
P1 P2 P3 Sends transaction status unknown message back to the coordinator.
Coordinator:
C Assumes unknown status means committed.
Writes log record: ENDTRANS.
End protocol
■ DEADLOCK_TIMEOUT
■ TXTIMEOUT
The database server uses heterogeneous commit protocol when the following
criteria are met:
Database server
...
Database server
The following table lists the gateways and corresponding database servers
that can participate in a transaction in which the database server uses the
heterogeneous commit protocol.
IBM Informix Enterprise Gateway with DRDA IBM DB2, OS/400, SQL/DS
IBM Informix Enterprise Gateway Managerr Any database server with ODBC
connectivity
HETERO_COMMIT
Setting Gateway Participant Updated Database Server Protocol
The following sections explain the modification to the precommit phase and
the gateway commit phase. For a detailed explanation of the postdecision
phases, see “Postdecision Phase” on page 22-9.
Precommit Phase
The coordinator directs each update participant (except the gateway partic-
ipant) to prepare to commit the transaction.
If the updates satisfy all deferred constraints, all participants (except the
gateway participant) return messages to the coordinator indicating that they
can commit their piece of work.
Figure 22-8
Start gateway commit phase Heterogeneous
Commit Phase
Coordinator:
C That Results in a
Sends a commit message to the gateway participant.
Committed
Transaction
Gateway
Gateway Participant:
GP Commits the work. Returns message: committed.
Gateway
Coordinator:
C Receives gateway committed message.
If the gateway fails to commit the transaction, the coordinator rolls back the
entire transaction, as Figure 22-8 illustrates.
If the coordinator fails after it writes the commit log record, the entire trans-
action is committed successfully upon recovery, as is the case with two-phase
commit.
If the coordinator fails after it sends the commit message to the gateway but
before it writes the commit log record, the remote Informix database server
sites in the transaction are aborted upon recovery. This abort might result in
inconsistencies if the gateway received the commit message and committed
the transaction.
After the coordinator writes the PREPARE log Data consistency is maintained.
record and before the gateway commit phase
After gateway commit phase but before the Data consistency is lost. No
coordinator writes a COMMIT record to the indication of data inconsistency
logical log from the coordinator.
Participant Failure
Whenever a participant in a distributed transaction that uses the heteroge-
neous protocol fails, the coordinator sends the following error message:
-441 Possible inconsistent data at the target DBMS name due to an
aborted commit.
In addition, the database server sends the following message to the message
log:
Data source accessed using gateway name might be in an
inconsistent state.
After participant commits the transaction and If the communications link fails
sends a reply to coordinator before the coordinator receives
the reply, then data is incon-
sistent. If the coordinator
receives the reply, then data is
consistent (provided the
coordinator does not fail before
writing the COMMIT record).
The recovery procedure that the database server follows when a participant
fails is identical to the procedure that is followed in two-phase commit. For
more information on this procedure, see “Participant Failure” on page 22-37.
If you receive this error message, rewrite the offending application so that it
updates at most one gateway participant in a single distributed transaction.
When such a failure occurs, the coordinator returns the following message:
-441 Possible inconsistent data at the target DBMS name due to an
aborted commit.
After the database server sends this message, it rolls back all update sites that
are participating in the transaction, with the possible exception of the work
done at the site of the gateway participant. The gateway participant might
have committed its updates if the failure occurred after the gateway partic-
ipant processed the commit message. If the gateway participant committed
the updates, you must manually rollback these updates.
This message lists all the database servers that were participants. Examine
the logical log of each participant. If at least one participant performed a
commit and one performed a rollback, the transaction was inconsistently
implemented.
Heuristic Rollback
You can determine the specific database server participants affected by a
heuristic decision to roll back a transaction in the following ways:
■ Examine the return code from the COMMIT WORK statement in the
application.
The following message indicates that one of the participants per-
formed a heuristic rollback:
-698 Inconsistent transaction. Number and names of servers
rolled back.
■ Examine the messages in the database server message-log file.
If a database inconsistency is possible because of a heuristic decision
at a participating database server, the following message appears in
the database server message-log file of the coordinator:
Mixed transaction result. (pid=nn user=user_id)
This message is written whenever error -698 is returned. Associated
with this message is a list of the participant database servers where
the transaction was rolled back. This is the complete list. The list that
appears with the -698 error message could be truncated if a large
number of participants rolled back the transaction.
■ Examine the logical log for each participant.
If at least one participant rolls back its piece of work and one partic-
ipant commits its piece of work, the transaction is implemented
incorrectly.
Before you proceed, consider the transaction that caused the error. Are the
pieces of data that were updated and rolled back dependent on one another?
Multiple updates might be included in a single transaction for reasons other
than maintaining data integrity. For example, three possible reasons are as
follows:
Verify also that every participant database server that is assumed to have
committed the transaction actually modified data. A read-only database
server might be listed as a participant that committed a transaction.
After you follow this procedure, you know what all the participants for the
transaction were, which pieces of work were assigned to each participant,
and whether each piece of work was rolled back or committed. From this
information, you can determine if the independent action affected data
integrity.
To see the GTRID, use the onlog -l option. The GTRID is offset 20 bytes into the
data portion of the record and is 144 bytes long. Figure 23-1 shows the
onlog -l output for a BEGPREP record. The coordinator is chrisw.
Figure 23-1
4a064 188 BEGPREP 4 0 4a038 0 1
000000bc 00000043 00000004 0004a038 .......C .......8
Output of the
00087ef0 00000002 63687269 73770000 ..~..... chrisw.. onlog -l Option for a
00000000 00000000 00000000 00087eeb ........ ......~. BEGPREP Record
00006b16 00000000 00000000 00000000 ..k..... ........
00000000 00000000 00000000 00000000 ........ ........
00000000 00000000 00000000 00000000 ........ ........
00000000 00000000 00000000 00000000 ........ ........
00000000 00000000 00000000 00000000 ........ ........
00000000 00000000 00000000 00000000 ........ ........
00000000 00000000 00000000 00000000 ........ ........
00000000 00000001 6a756469 74685f73 ........ judith_s
6f630000 736f6374 63700000 oc..soct cp..
The first 32 bytes of the GTRID are identical for the BEGPREP record on the
coordinator and the PREPARE records on participants, which are part of the
same global transaction. For example, compare the GTRID for the PREPARE
record in Figure 23-2 with that of the BEGPREP record in Figure 23-1.
Figure 23-2
c7064 184 PREPARE 4 0 c7038 chrisw
000000b8 00000044 00000004 000c7038 .......D ......p8
Output of the
00005cd6 00000002 63687269 73770000 ..˙.... chrisw.. onlog -l Option for a
00000000 00000000 00000069 00087eeb ........ ...i..~. PREPARE Record
00006b16 00000000 00000010 00ba5a10 ..k..... ......Z.
00000002 00ba3a0c 00000006 00000000 ......:. ........
00ba5a10 00ba5a1c 00000000 00000000 ..Z...Z. ........
00ba3a0e 00254554 00ba2090 00000001 ..:..%ET .. .....
00000000 00ab8148 0005fd70 00ab8148 .......H ...p...H
0005fe34 0000003c 00000000 00000000 ...4...< ........
00000000 00ab80cc 00000000 00ab80c4 ........ ........
00ba002f 63687269 73770000 00120018 .../chrisw......
00120018 00ba0000 ........
You can leave the database in its inconsistent state if the transaction does not
significantly affect database data. You might encounter this situation if the
application that is performing the transaction can continue as it is, and you
decide that the price (in time and effort) of returning the database to a
consistent state by either removing the effects or reapplying the transaction
is too high.
You do not have to reach this decision immediately. You can use the methods
described in the following paragraphs to determine what data the trans-
action was updating and which records are affected.
As you make your decision, consider that no automatic process or utility can
perform a rollback of a committed transaction or can commit part of a trans-
action that has been rolled back. The following paragraphs describe how to
look through the database server message log and the logical log to locate
affected records. Without detailed knowledge of the application, messages
are not enough to determine what has happened. Based on your knowledge
of your application and your system, you must determine whether to roll
back or to commit the transaction. You must also program the compensating
transaction that will perform the rollback or the commit.
The following excerpt is taken from the logical log at the current database
server:
addr lentype xid id link
.....
17018 16CKPOINT 0 0 13018 0
18018 20BEGIN 2 1 0 08/27/91 10:56:57 3482 nhowe
1802c 32HINSERT 2 0 18018 1000018 102 4
1804c 40CKPOINT 0 0 17018 1
begin xid id addr user
1 2 1 1802c nhowe
19018 72BEGPREP 2 0 1802c 6d69 1
19060 16COMMIT 2 0 19018 08/27/91 11:01:38
1a018 16ENDTRANS 2 0 19060 580543
The following excerpt is taken from the logical log at the database server
apex:
addr lentype xid id link
.....
16018 20BEGIN 2 1 0 08/27/91 10:57:07 3483 pault
1602c 32HINSERT 2 0 16018 1000018 102 4
1604c 68PREPARE 2 0 1602c eh
17018 16HEURTX 2 0 1604c 1
17028 12CLR 2 0 1602c
17034 16ROLLBACK 2 0 17018 08/27/91 11:01:22
17044 40CKPOINT 0 0 15018 1
begin xid id addr user
1 2 1 17034 --------
18018 16ENDTRANS 2 0 17034 8806c3
....
First, you would try to match the transactions in the current database server
log with the transactions in the apex database server log. The BEGPREP and
PREPARE log records each contain the GTRID. You can extract the GTRID by
using onlog -l and looking at the data portion of the BEGPREP and PREPARE
log records. The GTRID is offset 22 bytes into the data portion and is 68 bytes
long. A more simple, though less precise, approach is to look at the time of
the COMMIT or ROLLBACK records. The times should be close, although there
is a slight delay because of the time taken to transmit the commit (or rollback)
message from the coordinator to the participant. (This second approach lacks
precision because concurrent transactions could commit at the same time
although concurrent transactions from one coordinator would probably not
commit at the same time.)
In this example, the time stamps on the COMMIT and ROLLBACK records in
the different logs are close. No other active transactions introduce the possi-
bility of another concurrent commit or rollback. In this case, an insert
(HINSERT) of assigned rowid 102 hex (258 decimal) was committed on the
current database server. Therefore, the compensating transaction is as
follows:
DELETE FROM t WHERE rowid = 258
Notices
A
IBM may not offer the products, services, or features discussed
in this document in all countries. Consult your local IBM repre-
sentative for information on the products and services currently
available in your area. Any reference to an IBM product,
program, or service is not intended to state or imply that only
that IBM product, program, or service may be used. Any
functionally equivalent product, program, or service that does
not infringe on any IBM intellectual property right may be used
instead. However, it is the user’s responsibility to evaluate and
verify the operation of any non-IBM product, program, or
service.
IBM may have patents or pending patent applications covering
subject matter described in this document. The furnishing of this
document does not give you any license to these patents. You can
send license inquiries, in writing, to:
Any references in this information to non-IBM Web sites are provided for
convenience only and do not in any manner serve as an endorsement of those
Web sites. The materials at those Web sites are not part of the materials for
this IBM product and use of those Web sites is at your own risk.
IBM may use or distribute any of the information you supply in any way it
believes appropriate without incurring any obligation to you.
Licensees of this program who wish to have information about it for the
purpose of enabling: (i) the exchange of information between independently
created programs and other programs (including this one) and (ii) the mutual
use of the information which has been exchanged, should contact:
IBM Corporation
J46A/G4
555 Bailey Avenue
San Jose, CA 95141-1003
U.S.A.
The licensed program described in this information and all licensed material
available for it are provided by IBM under terms of the IBM Customer
Agreement, IBM International Program License Agreement, or any equiv-
alent agreement between us.
All IBM prices shown are IBM’s suggested retail prices, are current and are
subject to change without notice. Dealer prices may vary.
Notices A-3
Trademarks
Each copy or any portion of these sample programs or any derivative work,
must include a copyright notice as follows:
If you are viewing this information softcopy, the photographs and color illus-
trations may not appear.
Trademarks
AIX; DB2; DB2 Universal Database; Distributed Relational Database
Architecture; NUMA-Q; OS/2, OS/390, and OS/400; IBM Informix;
C-ISAM; Foundation.2000TM; IBM Informix 4GL; IBM Informix
DataBlade Module; Client SDKTM; CloudscapeTM; CloudsyncTM;
IBM Informix Connect; IBM Informix Driver for JDBC; Dynamic
ConnectTM; IBM Informix Dynamic Scalable ArchitectureTM (DSA);
IBM Informix Dynamic ServerTM; IBM Informix Enterprise Gateway
Manager (Enterprise Gateway Manager); IBM Informix Extended Parallel
ServerTM; i.Financial ServicesTM; J/FoundationTM; MaxConnectTM; Object
TranslatorTM; Red Brick Decision ServerTM; IBM Informix SE;
IBM Informix SQL; InformiXMLTM; RedBack; SystemBuilderTM; U2TM;
UniData; UniVerse; wintegrate are trademarks or registered trademarks
of International Business Machines Corporation.
Java and all Java-based trademarks and logos are trademarks or registered
trademarks of Sun Microsystems, Inc. in the United States and other
countries.
Windows, Windows NT, and Excel are either registered trademarks or trade-
marks of Microsoft Corporation in the United States and/or other countries.
Other company, product, and service names used in this publication may be
trademarks or service marks of others.
Index
Index
Boot file. See Startup script. Buffered transaction logging logging mode, ANSI
B-tree index when flushed 11-12 database 12-7
cleaner thread 7-27 See also Logging. Character large object. See Smart
See also the Performance Guide. BUFFERING tag, onspaces 9-26 large object.
Buffer BUFFERS parameter Character-special devices 1-9
64-bit maximum number 7-18 64-bit addressing 7-18 Checkpoint
big buffers 7-28 description 7-18 backup considerations 15-18
blobpage buffer 7-48 smart large objects and 7-49 chunk writes 7-44
concurrent access 7-40 Buffer-size option 3-41 data replication 20-17
current lock-access level for 7-25 BUFFSIZE. See Page. description of 4-9, 15-11
data replication 7-21, 19-11 Built-in data types, fuzzy events that initiate 15-14
dirty 7-40 operations 15-12 flushing of regular buffers 7-41
exclusive mode 7-34 BYTE data type. See TEXT and forced 20-17
flushing 7-40 BYTE data; Simple large object. full 15-12
how a thread Byte-range locking 7-22, 9-27 fuzzy 15-12
accesses a buffer page 7-40 how it works 15-15 to 15-17
acquires 7-36 light appends 10-32
least-recently used 7-35 C logical-log buffer 7-19
lock types 7-34 logical-log file 15-14
Cache
logical-log buffer 7-19 maximum connections 4-12
data distribution 7-30, 8-8
monitoring statistics and use monitoring activity 16-8
monitoring shared-memory
of 8-17 physical-log buffer 7-42, 15-11,
buffer 8-17, 8-19
most-recently used 7-35 15-14
Optical Subsystem memory 10-49
not dirty 7-40 role in data replication 19-16
SPL routine cache
physical-log buffer 7-20 role in fast recovery 15-20, 15-21
hash size 2-10, 8-8
share lock 7-34 step in shared-memory
pool size 8-8
smart large objects 7-49, 9-26, initialization 4-9, 4-12
SQL statement cache
9-27 CHKADJUP log record 10-26,
configuration parameters 2-11
status 7-25 10-60
enabling 8-11
synchronizing flushing 7-41, 7-42 chkenv utility 1-14
specifying size 8-11
threads waiting for 7-25 CHRESERV log record 10-26
See also Buffer.
write types during flushing 7-43 Chunk
Calculating size
Buffer pool activity during mirror
blobpages 10-21
64-bit addressing 7-18 recovery 17-9
metadata 9-31, 10-25
bypassed by blobspace data 7-47 adding to
page size 10-22
contents of 7-17 dbspace 10-17
root dbspace 9-49
description of 7-17 mirrored dbspace 18-10
smart large objects 9-26
flushing 7-41 sbspace 9-30, 10-26
Cascading deletes 11-5
full checkpoint 15-12 using ISA or onspaces 10-17
CDR_QDATA_SBFLAGS
fuzzy checkpoint 15-12, 15-13 adding with
parameter 9-22
LRU queues management 7-36 ON-Monitor 10-18
CDR_QDATA_SBSPACE
minimum requirement 7-18 allocating initial 10-10
parameter 9-22
monitoring activity 8-20 backing up 10-17
Central registry, sqlhosts 3-31
read-ahead 7-39 changing mirror chunk
Changing
size of buffer 7-18 status 18-7
chunk status 20-17
smart large objects 7-49 checking status 10-41, 10-43,
configuration parameters 2-18
synchronizing buffer 21-10
database server type, HDR 20-21
flushing 7-42 concepts 9-6
Buffer table, described 7-25 definition of 1-25
Index 3
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z @
disk layout guidelines 9-53 connections supported 3-8 network security 3-13
dropping from defined 3-3 password encryption 3-20
blobspace 10-30 global transaction 22-4 sqlhosts option field 3-43
dbspace 10-30 host name field 3-37 Communication support services,
sbspace 10-30 local-loopback connection 3-12 message confidentiality and
exceeding size limits with multiplexed connections 3-7 integrity 3-12
LVM 9-60 network security files 3-17 Communications, shared memory
extents 9-15 ONCONFIG environment description of 7-32
I/O errors during variable 1-13 how client attaches 7-11
processing 21-10 options field 3-40 size of 7-32
linking to the pathname 1-11, reacting to HDR failure 19-19 Communication, client to database
10-9, 10-10, 18-5 redirecting in data server. See Connectivity.
maximum number 10-13 replication 19-19, 19-21 Compliance
maximum size 10-13 remote hosts 3-17 icons Intro-12
monitoring 10-41, 10-44, 21-10 shared-memory connection 3-10 with industry standards Intro-16
name, when allocated as raw specifying a dbservername 3-54 concsm.cfg file
device 9-8 sqlhosts entries 3-29, 3-32, 3-50 building SMI tables 3-23
recovering a down chunk 18-7 using CSM 3-21, 3-24 description of 3-21
saving status on secondary using data replication 19-5 entry for network data
server 20-17 wildcard addressing 3-52 encryption 3-29
specifying metadata area 10-26 Window network domains 3-6 entry for password
Chunk free list Client/server configuration encryption 3-23
combining and splitting example format of entries 3-21
pages 11-7 local loopback 3-58 location of 3-21
monitoring 16-4 multiple connection types 3-60 Concurrency control 7-33
Chunk table, description of 7-25 multiple database servers 3-62 Confidentiality, of communication
Chunk write multiple residency 3-62 messages 3-12
checkpoints 7-44 network connection 3-59 Configuration
monitoring 8-21 shared memory 3-57 database server environment 1-5
CKPTINTVL parameter using IPX/SPX 3-60 dbspaces 10-14
description of 2-10 listen and poll threads 5-33 estimating required disk
initiating checkpoints 15-14 local loopback 3-12 space 9-52
Classes of virtual processor 5-5 shared memory 3-10 files for network 1-17
CLASSPATH environment CLIENT_LOCALE environment J/Foundation 1-21
variable 1-12, 1-15 variable 1-13 monitoring 2-18
CLEANERS parameter CLOB data type. See Smart large multiple ports 3-16
description of 2-11 object. planning for the database
purpose of 7-26 CLOSE statement 11-10 server 1-6
Client application Code, sample, conventions requirements 1-5
attaching to shared memory 7-11 for Intro-12 sqlhosts information 1-17
beginning a session 7-28 Comment icons Intro-11 storage devices 1-27
configuring connectivity 1-16, COMMIT statement 11-9, 11-11 using Server Setup 1-20
1-25, 3-13 Commit, heterogeneous 22-32 Windows 1-8
configuring environment 1-13 Communication configuration file. Configuration file
configuring stack size 7-29 See ONCONFIG configuration avoid modifying
connecting to a host 3-29 file. onconfig.std 1-18
connecting to primary or Communication Support Module connectivity 3-13
secondary server 19-5 concsm.cfg entry 3-23, 3-29 editing 2-18
connection type field 3-34 CSM configuration file 3-21 onconfig.std 1-18
Index 5
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z @
See also DUMPCNT; DUMPDIR; CREATE TABLE statement read-only mode 4-13
DUMPGCORE; connecting to clients 3-54 See also High-Availability Data
DUMPSHMEM. IN dbspace option 9-16 Replication (HDR).
core file 21-7 logging 11-8 using database server
Corruption, resolving I/O specifying sbspaces in a PUT groups 3-44
errors 21-10 clause 9-23 wait time for response 2-15
CPU virtual processor CREATE TEMPORARY TABLE Data restore. See Restore.
adding and dropping in online statement 11-8 Data storage
mode 5-22, 5-26 CREATE TRIGGER statement 11-8 concepts 9-5
AFF_NPROCS parameter 5-22 CREATE VIEW statement 11-8 control of 9-16, 9-23
AFF_SPROC parameter 5-22 Creating maximum chunk
binding to 5-12 blobspaces 10-19 number 10-13
DataBlade module on 5-20 dbspaces 10-14 size 10-13
description of 5-19 ONCONFIG file 1-18 maximum chunk size 10-6
how many 5-20 sbspaces 10-23 See also Disk space.
multiprocessor computer 5-21 smart large objects 9-23, 10-24 Data Type segment. See Disk space.
on a single-processor tables with CLOB or BLOB data Data types
computer 5-21 types 9-31 CLOB and BLOB 9-23, 15-13
poll threads 5-32, 5-33 temporary dbspaces 10-16 fuzzy operations 15-12
restrictions on 5-25 Critical dbspaces nonfuzzy operations 15-13
single-processor computer 5-21 mirroring 9-53, 9-58 replicated by HDR 19-4
threads 5-4 storage of 9-16 user-defined 9-23
types of threads run by 5-19 Critical section of code Database
user-defined routine on 5-20 checkpoints 15-16 ANSI-compliant 11-13
CREATE ACCESS METHOD description of 15-3 asynchronous I/O 5-29
statement 11-8 cron utility 1-38 description of 9-35
CREATE AGGREGATE CSM configuration file 3-13, 3-21 displaying logging status 12-12
statement 11-8 curlog field 22-22 estimating size of 9-52
CREATE CAST statement 11-8 fragmentation 9-37
CREATE DATABASE location of 9-35
statement 9-16, 11-8 D migration. See the IBM Informix
CREATE DISTINCT TYPE Migration Guide.
Data backup. See Backup.
statement 11-8 monitoring 10-40, 12-11
Data block. See Page.
CREATE EXTERNAL TABLE purpose of 9-35
Data consistency
statement 11-8 recovery. See Recovery.
fast recovery 15-18
CREATE FUNCTION size limits 9-36
how achieved 15-3
statement 5-25, 11-8 sysutils 4-12
monitoring for 21-7
CREATE INDEX statement 11-8 tuning. See Performance tuning.
symptoms of corruption 21-9
CREATE OPAQUE CLASS See also Recovery.
verifying consistency 21-4
statement 11-8 Database administrator. See
Data definition language (DDL)
CREATE OPCLASS statement 11-8 Administrative tasks.
statements 11-7, 19-34
CREATE PROCEDURE Database logging
Data files. See Logging.
statement 11-8 backups 10-14
Data replication
CREATE ROLE statement 11-8 DTP environment 11-13
Enterprise Replication 1-32
CREATE ROUTINE statement 11-7 Enterprise Replication 11-5
flush interval 2-15
CREATE ROW statement 11-7 Database logging status
High-Availability Data
CREATE SCHEMA statement 11-7 ANSI-compliant 11-12
Replication, about 1-32
CREATE SYNONYM changing mode 12-7
mentioned 11-5
statement 11-7 buffered logging 11-12
Index 7
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z @
Index 9
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z @
External backup and restore. See the sqlhosts 1-16 last available log 13-11
Backup and Restore Guide and the File Allocation Table (FAT) oldest update 15-15
Administrator’s Reference. partitions 1-10 Fuzzy checkpoint
External space. See Extspace. File I/O. See Disk I/O. definition of 15-11
Extspace finderr utility Intro-15 description 15-12
creating 10-34 FLRU queues during initialization 4-12
dropping with onspaces 10-35 description of 7-35 emptying the physical log 15-17
See also LRU queues. fast recovery 15-23 to 15-28
FLUSH statement 11-9 flushing buffer pool 15-13, 15-17
F Flushing forcing 16-10
before-images 7-41 how it works 15-15 to 15-17
Fast recovery
buffers 7-40 logical-log buffer 7-19
cleanup phase 14-17
data-replication buffer, maximum oldest update 13-11
description of 15-18
interval 2-15 physical logging 15-8 to 15-11
details of process 15-20, 15-23
Forced residency, setting 4-10 physical-log buffer 7-42
effects of buffered logging 15-19
Forcing a checkpoint. See Fuzzy operations
how database server detects need
Checkpoint. buffer pool 15-17
for 15-19
Foreground write description 15-12
mentioned 4-9, 4-13, 11-4
before-image 7-41
no logging 15-19
description of 7-43
overview 1-30
purpose of 15-18
monitoring 7-43, 8-21 G
Formula
sbspaces 9-21 Gateway, Informix, in
logical-log size 14-4
smart large objects 9-33 heterogeneous commit 22-32
physical-log size 15-7
table types 9-41 gcore file 21-7
Fragment
when occurs 15-18 GET DESCRIPTOR
monitoring
Fault tolerance statement 11-10
disk usage 10-48
data replication 19-4, 19-7 GET DIAGNOSTICS
I/O requests for 10-44
fast recovery 15-18 statement 11-10
skipping
Feature icons Intro-11 Global Language Support
selected fragments 10-38
Features in 9.3 Intro-6 (GLS) Intro-4, 1-13
unavailable fragments 10-39
FETCH statement 11-10 Global pool, description of 7-32
using DATASKIP 10-36
File Global transaction identifier 23-7
See also Fragmentation.
configuration 1-18 GRANT FRAGMENT
Fragmentation
connectivity configuration 3-13 statement 11-8
over multiple disks 9-54
cooked 1-10 GRANT statement 11-8
skipping inaccessible
core 21-7 Group
fragments 10-35
hosts 1-17 database server 3-44
tables and indexes 9-37
hosts.equiv 3-17 parallel processing of 5-10
See also Fragment.
JVP properties 1-21 GTRID 23-8
Free list. See Chunk free list.
network configuration 1-17
FREE statement 11-10
network security 1-17, 3-17
Freeing log files 14-9 to 14-10
NTFS 9-7
FREE_RE log record 10-60
H
oncfg_servername.servernum 4-10
Full checkpoint Hardware mirroring 17-7
ONCONFIG 1-18, 4-6
description 15-12 Hash table 7-25
passwd 1-17
emptying the physical log 15-17 hdrmkpri script 20-21
perfmon.exe 1-39
events that initiate 15-14 hdrmksec script 20-21
permissions 10-8
flushing buffer pool 15-13, 15-17 Heaps 7-30
services 1-17
forcing 16-9, 16-10 Help Intro-13
Index 11
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z @
Index 13
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z @
Index 15
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z @
Index 17
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z @
user thread servicing requests -d option 10-30, 10-33, 10-35 overview 1-37
from 5-5 definition of 1-25 -p option 8-16
using in ISA 20-20 -Df tags 9-25, 9-30 profiling user activity 22-22
-W parameters 8-11 dropping sbspace chunks 10-30 -s option 8-15
ON-Monitor ending mirroring 18-12 temporary sbspace flags 10-28
adding -f option 10-31, 10-36 tracking
chunk 10-18 modifying DATASKIP 10-36 global transaction 22-22
logical-log file 14-18 recovering a down chunk 18-11 locks 22-22
mirror chunks 18-10 -s option 20-17 -u option 15-7, 22-22
changing database server starting mirroring 18-9 updating blobpage
modes 4-16 -t option 9-53 statistics 10-42, 10-43
copying the configuration 2-18 taking a chunk down 18-10 -x option 12-11, 22-22
creating blobspaces 10-20 -U option 10-26 ontape utility
creating dbspaces 10-15 onstat utility backing up logical-log files 13-10
dropping a logical-log file 14-19 -c option 2-18 modifying database logging
dropping storage spaces 10-33 CPU virtual processors 5-20 status 12-7
overview 1-36 -d option 10-55 setting up 1-27
recovering a chunk 18-11 -d update option 10-42, 10-43 ontliimc protocol 3-37
setting parameters displaying messages 1-35 onunload utility. See the IBM
performance options 8-10 -g ath option 6-10 Informix Migration Guide.
shared memory 8-10 -g cac stmt 8-11 ON_RECVRY_THREADS
virtual processors 6-6 -g imc 3-64 parameter 2-14
starting mirroring 18-9 -g seg option 8-6 OPCACHEMAX parameter
taking a chunk down 18-11 -g smb c option 10-54, 10-60 configuring memory 10-50
onparams utility -g sql option 12-11 description of 2-17
adding a logical-log file 14-17 -g ssc options 8-11 OPEN statement 11-10
changing physical log -g stm option 12-11 Operating system
location 16-5 -k option 22-22 32-bit and 64-bit versions 1-7
size 16-5 -l option 14-17 parameters 8-3
dropping a logical-log file 14-19 -m option 1-35 tools 1-38
onperf utility 1-36 monitoring Operating-system files. See Cooked
onpladm utility 10-61 blobspace 10-43 file space.
onsmsync utility. See the Backup and buffer use 8-17, 8-18, 8-19 Operational tables, altering 12-10
Restore Guide. buffer-pool 8-21, 8-22 Optical (OPT) virtual
onsocimc protocol 3-37 chunk status 10-41 processor 5-38
onspaces utility configuration 2-18 Optical Subsystem memory cache
-a option 10-17, 10-26 data replication 20-22 allocation 10-50
adding a mirror chunk 18-10 database server profile 8-15, kilobytes of TEXT and BYTE data
adding sbspace chunks 10-26 8-16 written 10-50, 10-51
-c -b option 10-19 fragment load 10-44 number of objects written 10-50,
-c -d option 10-15 latches 8-15 10-51
-c -S option 9-23, 10-23 logical-log buffer 16-7 session ID for user 10-51
-c -t option 10-16 logical-log files 14-11, 14-17 size 10-50
-c -x option 10-34 physical log 16-7 specifying size of 2-17
-ch option 9-25, 9-28, 9-30, 10-27 shared memory 8-14, 8-15 user ID of client 10-51
change chunk status 20-17 SQL statement cache 8-11 Options field
-cl option 10-31 SQL statements 12-11 buffer-size option 3-41
creating sbspaces 10-23 transactions 12-11 connection-redirection 3-42
creating temporary sbspace 9-32 virtual processors 6-10 CSM option 3-43
Index 19
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z @
events that prompt flushing 7-42 Release notes Intro-15 consistency checking 21-4
flushing of 7-42, 15-10 Protocol, specifying 5-32 mirroring the physical log 15-7
monitoring 16-6 PSWDCSM. See Password Recovery
number of 7-21 encryption. from media failure 17-4
PHYSBUFF parameter 7-21 PUT statement 11-9 mode, description of 4-13
PIO virtual processors parallel processing of 5-10
description of 5-28 RAW tables 9-39
how many 5-29 Q STANDARD tables 9-39
Planning for resources 1-6 two-phase commit protocol 22-9
Query plans 7-30
Platform icons Intro-11 Redundant array of inexpensive
Queues
Point-in-time restore disks (RAID) 17-6
description of 5-16
logging 9-39 Referential constraints 11-5
disk I/O 5-31
Point-in-time restore. See the Backup Registry
ready 5-17
and Restore Guide. changing the hostname 1-40
sleep 5-17
Poll threads defining multiple network
wait 5-18
DBSERVERNAME addresses 5-36
parameter 5-32 Regular buffers
description of 5-33 events that prompt flushing 7-41
how many 5-33
R monitoring status of 7-18
message queues 7-32 RAID. See Redundant array of Relay module. See the IBM Informix
multiple for a protocol 5-32 inexpensive disks. Migration Guide.
nettype entry 5-32 Raw disk space Release notes Intro-14
on CPU or network virtual allocating on UNIX 10-9 Release notes, program
processors 5-32 allocating on Windows 9-8 item Intro-15
Post-decision phase 22-8 character-special interface 9-8 Remote client 3-17
Precommit phase 22-8 definition of 9-8 Remote hosts and clients 3-17
PREPARE statement 11-10 RAW table RENAME COLUMN
Preparing ONCONFIG file 1-18 altering 12-10 statement 11-8
Presumed-abort backup 9-41 RENAME DATABASE
optimization 22-10 fast recovery 9-41 statement 11-8
Primary database server 19-5 mentioned 9-38 RENAME INDEX statement 11-8
Priority overview 1-29 RENAME TABLE statement 11-8
aging, preventing 5-22 properties of 9-39 Replication server. See Data
disk I/O 5-27 RA_PAGES parameter 7-39 replication.
scheduling 1-21 RA_THRESHOLD parameter 7-40 Requirements, configuration 1-5
Processes Read-ahead Reserved area
attaching to shared memory 7-10 description of 7-39 described 9-22
comparison to threads 5-3 IDX_RA_PAGES parameter 7-39 monitoring size of 10-54, 10-60
DSA versus dual process RA_THRESHOLD moving space to metadata
architecture 5-9 parameter 7-40 area 10-59
Processor affinity when used 7-39 Reserved pages
description of 5-12 Read-only mode, description chunk status for secondary 20-17
using 5-22 of 4-13 validating 21-6
Product icons Intro-11 Ready queue Residency. See Multiple residency.
Profile statistics 8-15 description of 5-17 RESIDENT parameter
Program counter and thread moving a thread to 5-17, 5-18 during initialization 4-10
data 7-29 Reception buffer 19-11 setting with onmode 8-13
Program group Recommendations on Resident shared memory
Documentation notes Intro-15 allocation of disk space 9-9 description 4-7, 7-16
Index 21
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z @
Index 23
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z @
network connection example 3-59 used 14-9 to 14-10, 14-19 sysmaster database
options field 3-40 STMT_CACHE parameter 2-11, creation 4-11
security options 3-47 8-11 SMI tables 1-37
service name field 3-38 STMT_CACHE_HITS See also SMI table.
shared-memory example 3-57 parameter 2-11, 8-11 See SMI table; System-monitoring
specifying network poll STMT_CACHE_NOLIMIT interface.
threads 5-32 parameter 2-11, 8-11 sysprofile table 8-15
sqlhosts registry STMT_CACHE_NUMPOOL systables, flag values 9-38
description of 3-31 parameter 2-11, 8-11 System catalog tables
INFORMIXSQLHOSTS STMT_CACHE_SIZE dictionary cache 7-30
environment variable 3-31 parameter 2-11, 8-11 location of 9-35
location of 3-31 STOP VIOLATIONS TABLE optimal storage of 9-54
Stack statement 11-8 sysdistrib 7-30
and thread control block 5-16 Storage characteristics validating 21-5
description of 5-15 hierarchy 9-29 System console 1-37
INFORMIXSTACKSIZE onspaces -ch 10-27 System failure, defined 15-18
environment variable 7-29 onspaces -Df 10-24 System requirements
pointer 5-16 sbspaces 9-25 database Intro-4
size of 7-29 smart large objects 9-31, 10-24 software Intro-4
STACKSIZE parameter 7-29 storage spaces 10-46 System timer 5-17
thread 7-29 Storage devices, setup 1-27 System-monitoring interface (SMI)
STACKSIZE parameter Storage manager using to monitor database
changing the stack size 7-29 ISM 1-27 server 1-37
description 7-29 role in ON-Bar system 1-27 See also SMI table.
Standard database server 19-5 Storage space sysutils database, creation 4-12
STANDARD table backup schedule 1-27, 1-28
altering 12-10 definition of 1-25
backup 9-41 ending mirroring 18-12 T
fast recovery 9-41 starting mirroring 18-8, 18-9,
Table
mentioned 9-38 18-10
altering to standard 12-10
overview 1-29 storing NTFS partitions 1-10
creating with CLOB or BLOB data
properties of 9-39 Storage statistics, blobspaces 10-22
types 9-31
restore 9-42 Stored procedure. See SPL routine.
description of 9-36
START VIOLATIONS TABLE Stored-procedure cache. See UDR
disk-layout guidelines 9-54
statement 11-8 cache. 7-31
dropping 10-32
Starting the database server stores_demo database Intro-5
extent and 9-36
automatically 1-23 Stream-pipe connection
fragmentation 9-37
initializing disk space 1-22 advantages and
isolating high-use 9-54
starts dbservername disadvantages 3-11
middle partitions of disks 9-54
command 1-22 in servicename field 3-39
migration. See the IBM Informix
Startup script 1-24 Structured Query Language. See
Migration Guide.
Statistics. See onstat utility. SQL statements.
standard 9-39
Status, log file superstores_demo database Intro-5
storage considerations 9-37
added 14-8, 14-17, 14-19 Swapping memory 7-16
storage on middle partition of
backed up 14-9 to 14-10 Switching between threads 5-16
disk 9-58
checkpoint 14-10 Switching to next log file 14-7
temporary
current 14-10 Sync checkpoint. See Checkpoint.
cleanup during restart 9-44
deleted 14-8, 14-19 sysdistrib table 7-30
estimating disk space for 9-51
free 14-19 syslogs table 14-13
Index 25
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z @
Index 27