Er der en grund til, at du vil genopfinde hjulet? Hvorfor ikke gøre brug af Oracles indbyggede revision?
Oracle Base giver nogle grundlæggende oplysninger om, hvordan du kommer i gang med revision:
AUDIT_TRAIL = { none | os | db | db,extended | xml | xml,extended }
Følgende liste giver en beskrivelse af hver indstilling:
none or false - Auditing is disabled.
db or true - Auditing is enabled, with all audit records stored in the database audit trial (SYS.AUD$).
db,extended - As db, but the SQL_BIND and SQL_TEXT columns are also populated.
xml- Auditing is enabled, with all audit records stored as XML format OS files.
xml,extended - As xml, but the SQL_BIND and SQL_TEXT columns are also populated.
os- Auditing is enabled, with all audit records directed to the operating system's audit trail.
For at aktivere revision til database revisionsspor skal du aktivere revision til db
SQL> ALTER SYSTEM SET audit_trail=db,extended SCOPE=SPFILE;
System altered.
Luk og genstart db
SQL> SHUTDOWN
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP
ORACLE instance started.
Nu til revision af SELECTS
, INSERTS
, UPDATES
, DELETES
af bruger cube
gør dette:
CONNECT sys/password AS SYSDBA
AUDIT ALL BY cube BY ACCESS;
AUDIT SELECT TABLE, UPDATE TABLE, INSERT TABLE, DELETE TABLE BY cube BY ACCESS;
De reviderede logfiler kan hentes frem ved at forespørge DBA_AUDIT_TRAIL
Yderligere læsning: