Informix onlog命令详解

当数据库服务器在联机模式下从磁盘读取状态为U的逻辑日志文件时,数据库服务器将拒绝对逻辑日志文件的所有访问,从而有效地停止所有会话的数据库活动。(有关详细信息,请参阅onstat-l命令:打印物理和逻辑日志信息

来源:https://www.ibm.com/docs/zh/informix-servers/12.10?topic=utilities-onlog-utility#ids_adr_0402

The onlog utility displays the contents of a logical-log
file, either on disk or on backup.

onlog: Display Logical-Log Contents

The onlog output
is useful in debugging situations when you want to track a specific
transaction or see what changes have been made to a specific tblspace.
(For information about interpreting the logical-log file contents,
see Interpreting Logical-Log Records.)

Any
user can run all of the onlog options except the -l option.
Only user informix on UNIX or
a member of the Informix-Admin group on Windows can
run the -l option.

If the database server is in offline
mode when you execute onlog, only the files on disk are read.
If the database server is in quiescent or online mode, onlog also
reads the logical-log records stored in the logical-log buffers in
shared memory (after all records on disk have been read).

When
the database server reads a logical-log file with status U from
disk while in online mode, the database server denies all access to
the logical-log files, effectively stopping database activity for
all sessions. (For more information, see onstat -l command: Print physical and logical log information.) For this reason, it
is recommended that you wait until the files have been backed up and
then read the contents of the logical-log files from backup.

The onlog utility does not have a functionally equivalent
SQL administration API command string.

当您想要跟踪特定事务或查看对特定tblspace进行了哪些更改时,联机日志输出在调试情况下很有用。(有关解释逻辑日志文件内容的信息,请参阅解释逻辑日志记录。)
任何用户都可以运行除-l选项之外的所有onlog选项。只有UNIX上的用户informix或Windows上informix Admin组的成员才能运行-l选项。
如果在执行联机时数据库服务器处于脱机模式,则只读取磁盘上的文件。如果数据库服务器处于静态或联机模式,onlog还会读取存储在共享内存中逻辑日志缓冲区中的逻辑日志记录(在读取磁盘上的所有记录之后)。
当数据库服务器在联机模式下从磁盘读取状态为U的逻辑日志文件时,数据库服务器将拒绝对逻辑日志文件的所有访问,从而有效地停止所有会话的数据库活动。(有关详细信息,请参阅onstat-l命令:打印物理和逻辑日志信息。)因此,建议您等待文件备份完成,然后从备份中读取逻辑日志文件的内容。
onlog实用程序没有功能等效的SQL管理API命令字符串。

onlog Syntax

>>-onlog--+-------------------------+--------------------------->
          |                     (1) |   
          '-|  -FILE option   |-----'   

                               (2)                                 (3)   
>--| Log-Record Read Filters |------| Log-Record Display Filters |------>

>--+-----+--+-----------+--------------------------------------><
   '- -q-'  +- -V-------+   
            '- -version-'

Notes:

  1. See The -FILE option.

  2. see Log-Record Read Filters

  3. see Log-Record Display Filters

Element

Purpose

Key Considerations

q Suppresses the initial header and the one-line
header that appears every 18 records by default
None.
V Displays the software version number and the serial
number
See Obtaining utility version information.
version Displays the build version, host, OS, number and
date, as well as the GLS version
See Obtaining utility version information.

You direct onlog to read the following portions
of the logical log as it searches for records to display:

  • Records stored on disk

  • Records stored on backup media

  • Records from the specified logical-log file

By default, onlog displays the logical-log record
header, which describes the transaction number and the record type.
The record type identifies the type of operation performed.

In
addition to the header, you can use the read filters to direct onlog to
display the following information:

  • Logical-log record header and data (including copies of simple
    large objects stored in a dbspace or tblspace)

  • Copies of blobpages from blobspaces

    They are copied from
    the logical-log backup only. They are not available from disk.

You can display every logical-log record header, or you
can specify output based on the following criteria:

  • Records associated with a specific table

  • Records initiated by a specific user

  • Records associated with a specific transaction

If onlog detects an error in the log file, such
as an unrecognizable log type, it displays the entire log page in
hexadecimal format and terminates.

您可以指示联机日志在搜索要显示的记录时读取逻辑日志的以下部分:
存储在磁盘上的记录
存储在备份介质上的记录
指定逻辑日志文件中的记录
默认情况下,onlog显示逻辑日志记录头,其中描述了事务编号和记录类型。记录类型标识所执行操作的类型。
除了标头之外,您还可以使用读取筛选器来引导联机日志显示以下信息:
逻辑日志记录头和数据(包括存储在dbspace或tblspace中的简单大型对象的副本)
Blob空间中Blob页面的副本
它们仅从逻辑日志备份中复制。它们在磁盘上不可用。
您可以显示每个逻辑日志记录头,也可以根据以下条件指定输出:
与特定表关联的记录
由特定用户发起的记录
与特定交易相关联的记录
如果联机日志在日志文件中检测到错误,例如无法识别的日志类型,它将以十六进制格式显示整个日志页并终止。

Log-Record Read Filters

The onlog utility
uses the pathnames that are stored in the root dbspace reserved pages
to locate the logical-log files. If you use ON-Bar to
back up the logical logs, onlog asks the storage manager to
retrieve the appropriate logical-log records from the backup media.

Syntax

|--+----------------------+------------------------------------->
   '- -d--device--+-----+-'   
                  '- -b-'     

   .-------------------------------------------.   
   V                                           |   
>----+---------------------------------------+-+----------------|
     '- -n--starting_uniqid - ending_uniquid-'

Element

Purpose

Key Considerations

b Displays logical-log records associated with blobspace
blobpages
The database server stores these records on the
logical-log backup media as part of blobspace logging.
d device Names the pathname of the storage device where
the desired logical-log backup is mounted
If you use ontape, the device that you name
must be the same as the pathname of the device assigned to the configuration
parameter LTAPEDEV. If the -d option is not used, onlog reads
the logical-log files stored on disk, starting with the logical-log
file with the lowest logid.

If you use ON-Bar to
back up logical logs, use the onbar -P command to view the
contents of a logical-log file. See theIBM
Informix Backup and Restore Guide
.

For
pathname syntax, see your operating-system documentation.

n starting_uniqid-ending_uniqid Directs onlog to read all the logical-log
records contained in the log file that you specified from starting
uniqid
to the ending uniqid.

The starting_uniqid and the ending_uniqid are
the unique ID numbers of the logical log. To determine the uniqid of
a particular logical-log file, use the onstat -l command.

If
you do not use the -n option, onlog reads all the logical-log
files that are available (either on disk or on tape).

For
information about the onstat utility, see Monitor the database server status.

Log-Record Display Filters

Syntax

   .------------------------------------------.   
   V                                          |   
|----+--------------------------------------+-+-----------------|
     |     (1)                              |     
     +- -l----------------------------------+     
     |                   (1)                |     
     +- -t--tblspace_num--------------------+     
     |               (1)                    |     
     +- -u--username------------------------+     
     |                     (1)              |     
     +- -x--transaction_id------------------+     
     |                                  (1) |     
     '- -c--compression_dictionary_file-----'

Notes:

  1. Only one occurrence of this item allowed

Element

Purpose

Key Considerations

l Displays the long listing of the logical-log record. The long listing of a log record includes a complex
hexadecimal and ASCII dump of the entire log record. The listing is
not intended for casual use.
ttblspace_num Displays records associated with the tblspace that
you specify.
Unsigned integer. Number, greater than 0, must
be in the partnum column of the systables system catalog
table.

Specify this value as either an integer or hexadecimal
value. (If you do not use a 0x prefix, the value is interpreted as
an integer.) To determine the tblspace number of a particular tblspace,
query the systables system catalog table as described in Tblspace Numbers.

u username Displays records for a specific user. User name must be an existing login name. User
name must conform to operating-system-specific rules for login name.
x transaction_id Displays only records associated with the transaction
that you specify.
Value must be an unsigned integer between 0 and
TRANSACTIONS – 1, inclusive.

You should need to use the -x option
only in the unlikely case that an error is generated during a rollforward.
When this situation occurs, the database server sends a message to
the message log that includes the transaction ID of the offending
transaction. You can use this transaction ID with the -x option
of onlog to investigate the cause of the error.

-c

compression_
dictionary_file

Uses the compression dictionary to expand compressed
data and display uncompressed data.
If the onlog command contains
the -l option and the -c option and there are compressed
images in the log records, the onlog utility uses the compression
dictionary to expand all expandable images in the log records.

A
compressed image is expandable only if there is a valid compression
dictionary for that log record in the compression dictionary file.
If -c is not specified or the compression dictionary file does
not contain a valid compression dictionary for the compressed image,
the onlog utility will display the row image in its compressed
format.

If you do not have a compression dictionary
file, you can use an UNLOAD statement to unload the compression dictionary,
which is contained in the syscompdicts_full table in the sysmaster database,
to a compression dictionary file, as follows:

UNLOAD TO 'compression_dictionary_file'
   SELECT * FROM sysmaster:syscompdicts_full;

If you do not specify any options, onlog displays
a short listing of all the records in the log. You can combine options
with any other options to produce more selective filters. For example,
if you use both the -u and -x options, onlog displays
only the activities that the specified user initiated during the specified
transaction. If you use both the -u and -t options, onlog displays
only the activities initiated by the specified user and associated
with the specified tblspace.

作者: admin

为您推荐

返回顶部