auditdb(1sql)
Name
auditdb − print changes recorded in database journal files
Syntax
auditdb [options] dbname
Description
The auditdb command allows the user to print selected portions of the journal for a database or to create an ULTRIX/SQL readable audit trail of the changes made to a particular table. The auditdb command operates on all journal entries that have been moved to the journal files.
Options
−bdd-mmm-yyyy:hh:mm:ss
Print journal entries for ULTRIX/SQL transactions committed after the time specified by dd-mmm-yyyy:hh:mm:ss.
−edd-mmm-yyyy:hh:mm:ss
Print journal entries for ULTRIX/SQL transactions committed before the time specified by dd-mmm-yyyy:hh:mm:ss.
−fCreate a file named audit.trl in your current directory. You can use the −f option only if you also specify the −t option and the table that you specify with the −t option has fewer than 120 columns and 1948 bytes per row. The audit.trl file is in binary (bulk copy) format and contains rows appended to, deleted from or copied into the table specified with the −t option. You can copy this file into a database table that has been created in the following manner:
create table auditrel
(date date not null with default,
usrname char(24) not null with default,
operation char(8) not null with default,
tranid1 integer not null with default,
tranid2 integer not null with default,
table_id1 integer not null with default,
table_id2 integer not null with default,
{ add definitions for columns in table specified
with -t option }
)
To copy the file audit.trl into the table auditrel, use the following command:
copy table auditrel () from ’/usr/mydir/audit.trl’
When the copy is finished, auditrel will have a row for each operation against the specified table. The values in each row, corresponding to the columns in the table, are:
dateThe start date and time of the transaction that contained the operation.
usrnameThe ULTRIX/SQL username of the user who performed the operation.
operationOne of the following: select, insert, update, delete
transaction idThis is an 8-byte value composed of two 4-byte integers concatenated together. The column tranid1 holds the high order 4 bytes and the column tranid2 holds the low order 4 bytes of the transaction id.
table idTable_id1 and table_id2 are two 4-byte integers whose values correspond to the values in the columns table_reltid and table_reltidx, respectively, from the iitables system catalog entry for a table.
−iusername
Print journal entries for actions taken by username only.
−sInvoke ULTRIX/SQL superuser status for system-wide access to any database.
−ttablename
Print the journal entries for tablename only.
−uusername
Print the journals, taking into account other specified options, only for databases owned by username.
Restrictions
Only the database administrator (defined as the user who created the database) or the ULTRIX/SQL system administrator (if the −s flag is specified), may run the auditdb command on a database.
Note that auditdb does not necessarily give you a complete list of all transactions since the last checkpoint. There are two reasons for this. Because auditdb does not exclusively lock the database, other users may complete a transaction while auditdb is running. In addition, a transaction may have been completed but not yet been moved to the journal files before you run auditdb. If you need an absolutely accurate list of transactions completed since the last checkpoint, make sure all users exit the database before you run auditdb.
Files
$II_DATABASE/ingres/data/default/dbname
Default directory for database files associated with dbname. (The default location ii_database is mapped to this directory.)
$II_JOURNAL/ingres/jnl/default/dbname
Default directory for journal files associated with dbname. (The default location ii_journal is mapped to this directory.)
See Also
ULTRIX/SQL Database Administrator’s Guide
ULTRIX/SQL Reference Manual