HomeSearchE-MailPrint
French English Chinese

Auditing users in Oracle 10g R2

This tip shows how to audit users using Oracle 10g R2.

Votes: 2

Comments: 0

Visits: 1007

Administration 07-MAY-2007 02:37 PM, Marien Monnier

The first thing to do is to activate audit which is disabled by default. To do so, use the command:

ALTER SYSTEM SET audit_trail=db SCOPE=SPFILE;

Then, you have to restart the database, using SHUTDOWN, and STARTUP to start it up again.

If you want informations about the AUDIT command, please visit http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_4007.htm, , in other case, let's audit!

First of all, we create a new user:

CONNECT sys/pass AS SYSDBA

CREATE USER audit_user IDENTIFIED BY pass
DEFAULT TABLESPACE users
TEMPORARY TABLESPACE temp
QUOTA UNLIMITED ON users;

GRAND connect TO audit_user;
GRAND create table, create procedure TO audit_user;

Then, let's audit all operations of our user:

AUDIT ALL BY audit_user BY ACCESS;
AUDIT SELECT TABLE, UPDATE TABLE, INSERT TABLE, DELETE TABLE BY audit_user BY ACCESS;

This will audit all DDL and DML queries, and some system events, like logon/logoff.

Now, we connect with the user and make some operations, in order to be audited.

CONNECT audit_user/pass

CREATE TABLE tabTest ( id NUMBER );
INSERT INTO tabTest (id) VALUES (1);
UPDATE tabTest SET id = id;
SELECT * FROM tabTest;
DELETE FROM tabTest;
DROP TABLE tabTest;

Now that we have some interesting stuff to look at in the audit trail, let's go!

COLUMN username FORMAT A10
COLUMN owner FORMAT A10
COLUMN obj_name FORMAT A10
COLUMN extended_timestamp FORMAT A35

SELECT username, extended_timestamp, owner, obj_name, action_name
FROM dba_audit_trail
WHERE owner = 'AUDIT_USER'
ORDER BY timestamp;

And the result is:


USERNAME EXTENDED_TIMESTAMP OWNER OBJ_NAME ACTION_NAME
---------- ----------------------------------- ---------- -------- ----------------------------
AUDIT_USER 25-APR-2007 19:22:06.992930 +01:00 AUDIT_USER TABTEST CREATE TABLE
AUDIT_USER 25-APR-2007 19:22:19.296248 +01:00 AUDIT_USER TABTEST INSERT
AUDIT_USER 25-APR-2007 19:22:34.234981 +01:00 AUDIT_USER TABTEST UPDATE
AUDIT_USER 25-APR-2007 19:22:46.776770 +01:00 AUDIT_USER TABTEST SELECT
AUDIT_USER 25-APR-2007 19:22:57.049840 +01:00 AUDIT_USER TABTEST DELETE
AUDIT_USER 25-APR-2007 19:23:03.705906 +01:00 AUDIT_USER TABTEST DROP TABLE

6 rows selected.

We used the view dba_audit_trail, but there are other views where you can find some more information about audit.
For further information, please see the source of the article.

Source : Oracle-base.com

Next Previous

Comments

Login to leave a comment.

Articles

Oracle Installation on SUSE Linux Enterprise Server

Administration 14-JUN-2008 07:03 PM, Fabien Loudet

We will follow step-by-step the installation of Oracle Database 10g on SUSE Linux Enterprise Server. We choose here to install Oracle Enterprise Edition and create a database.


Articles RSS
Source Codes

Add Multi-language support

Portal 25-NOV-2004 10:30 AM, Pierre-Henry Tupin

Instant Messenger

Communication 24-NOV-2004 10:31 AM, Arnaud Bontemps

Who is online

Portal 24-NOV-2004 10:26 AM, Arnaud Bontemps

Change the Portal CSS

Portal 15-JUN-2004 04:15 PM, Arnaud Bontemps, Yoan Sultan


Source Codes RSS
News

Oracle VM Templates

02-SEP-2008 12:15 PM, Jérémie Hodnik

Further enabling customers to benefit from server consolidation, energy and space cost savings by using enterprise-class server virtualization, Oracle today announced Oracle® VM Templates.

Oracle Unbreakable Linux

02-SEP-2008 12:08 PM, Thibaut Maxant

Oracle's Linux commitment began in 1998 with the first commercial database on Linux.

Oracle's Industry Strategy

01-SEP-2008 12:01 PM, Thibaut Maxant

Oracle is the #1 in Relational Database

20-AUG-2008 07:26 PM, Thibaut Maxant

Gartner 2007 Worldwide RDBMS Market Share Reports 48.6% Share for Oracle.

Oracle Buys Skywire Software

02-AUG-2008 11:18 AM, Zhen Dong

June 23, 2008, Oracle announced that it has reached an agreement with Skywire Software and buys of its business application software.


News RSS