Advanced Operations : Creating a Virtual Database

Creating a Virtual Database
This section gives the steps for using the qdmg utility to create a virtual database for direct queries of audit data. The example uses the Demodata database installed with Pervasive PSQL.
1
In this example, importing has already been done for Demodata as part of the AuditMaster installation.
If you need instructions to import the schema from your own database, see the section “Managing Schemas” in Chapter 4: “Working with Audit Configurations” of Pervasive AuditMaster User’s Guide.
2
a.
b.
c.
3
a.
b.
Select Admin Audit Configuration and in the window that appears, find the product name in the list of configurations on the left. The product name is the name you entered when you imported the schema into AuditMaster. In this example, the product name is “Pervasive PSQL Demo,” which was already imported when AuditMaster was installed.
4
In this example, we name the folder DemodataV, adding the V for “virtual,” but you can choose your own name. The script to populate the virtual database will be saved here, as well as the database itself.
5
Now use qdmg to generate the script based on the following:
w
w
w
w
The command looks like this:
qdmg -d C:\<installation directory>\Demodata -p "Pervasive PSQL Demo" ‑o C:\<installation directory>\DemodataV\script
6
The prompt returns the following message:
Query Data-Model Generator Utility for Pervasive AuditMaster
Copyright (C) Pervasive Software Inc. 2004
Query Data-Model was generated into C:\<installation directory>\DemodataV\script.sql
Next, create the database in which to run the script.
7
8
The Create Database Wizard appears.
9
Note You must place the virtual database on the same volume as the AuditMaster installation directory.
10
Click Finish to complete database creation.
11
12
The Select Database dialog box appears.
13
SQL Editor displays the SQL statements in script.sql.
14
Select SQL Execute All SQL Statements.
The statements in script.sql populate DemodataV with views to audit records.
The virtual database DemodataV now supports queries on audit record columns, as well as on data columns from Demodata.
You may now do any of the following:
n
n
n
n
The Structure of an Audit Record
The columns of an audit record are described in this section. Its structure is representative of the result returned by a query such as SELECT * FROM vstudent.
The following facts should be noted in the example:
n
n
After the AM$ audit data columns, the rest of the row consists of data fields from the audited table and contain values captured from that table at the time of the audit event.
n
n
Once you have reviewed the audit record structure, see Running a Query on the Current View File for steps to run a query on the DemodataV example.
The following table compares the columns of an audit record with those displayed in the AuditMaster Viewer grid.