Previous Topic

Next Topic

auditdb Command—Audit a Database

Permission required: DBA or system administrator. On VMS, to use this command against a database in a group level installation, you must have the VMS CMK RNL privilege.

The auditdb command prints selected portions of the journal for a database. It also creates an audit trail of the changes made to particular tables.

Auditdb does not necessarily give you a complete list of all transactions since the last checkpoint. Reasons for this are:

If you need an accurate list of transactions since the last checkpoint, make sure all users exit the database before you run auditdb, or use the –wait flag. If you run auditdb with the –wait flag, and a large amount of unarchived information is in the log file, there will be a delay before the request is processed.

The auditdb command has the following format:

auditdb dbname[/server_class] [-a][-all] | [-table=tablename
{,tablename} [-file[=filename {,filename}]]] [-bdd-mmm-yyyy[:hh:mm:ss]]
[-edd-mmm-yyyy[:hh:mm:ss]] [#cn] [-iusername] [-inconsistent] [-wait]
[-uusername] [-help]

Previous Topic

Next Topic

auditdb Example: Audit a Database

This command audits the empdata database:

auditdb empdata

Previous Topic

Next Topic

auditdb Example: Audit a Database and Write Output to Files

This command audits the empdata database, which contains the employee and address tables, and writes the output to the default files employee.trl and address.trl:

auditdb empdata –table=employee,address –file

This command does the same as the previous example, but specifies names for the output files:

auditdb empdata –table=employee,address -file=aud2.trl,aud3.trl

Previous Topic

Next Topic

auditdb Example: Create Audit Trail for a Table and Copy Output to a New Table

This command creates an audit trail for the employee table in the empdata database, and then uses SQL commands to create a table and copy the default auditdb output files into it.

auditdb empdata –table=employee –file sql empdata

create table empaudit 
  (date        date not null with default,
  usrname      char(32) 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,
  eno          I2,
  ename        char(10),
  age          I1,
  job          I2,
  salary       money,
  dept         I2);

Windows:

copy table empaudit () from 'C:\WINNT\Profiles\user1\employee.trl'

UNIX:

copy table empaudit () from "/usr/directory/employee.trl";

VMS:

copy table empaudit () from "dev:[directory]employee.trl";


© 2007 Ingres Corporation. All rights reserved.