月度存档: 一月 2010

Oracle Audit

最近有人在问要怎么查询audit的数据,在网上找了点资料,还是纪录下来的好..

View Audit Trail
The audit trail is stored in the SYS.AUD$ table. It's contents can be viewed directly or via the following views:

DBA_AUDIT_EXISTS
DBA_AUDIT_OBJECT
DBA_AUDIT_SESSION
DBA_AUDIT_STATEMENT
DBA_AUDIT_TRAIL
DBA_OBJ_AUDIT_OPTS
DBA_PRIV_AUDIT_OPTS
DBA_STMT_AUDIT_OPTS

The audit trail contains alot of data, but the following are most likely to be of interest:

Username : oracle Username.
Terminal : Machine that the user performed the action from.
Timestamp : When the action occured.
Object Owner : The owner of the object that was interacted with.
Object Name : The name of the object that was interacted with.
Action Name : The action that occured against the object. (Insert, Update, Delete, Select, EXECUTE)

V$SESSION_LONGOPS

发现一个很好用的view, 就是 V$SESSION_LONGOPS, 如果你在做一个用时很久的操作,但是你又需要给你的老板,客户一个estimation, 你就可以查询这个view拉~~

这个是我常用的query ,
select sid, serial#, target, target_desc,sofar, TIME_REMAINING  from v$session_longops ;

TIME_REMAINING 是以s为单位的,所以也可以将上述改成,

select sid, serial#, target, target_desc,sofar, TIME_REMAINING/60/60 Remain_Hour  
from v$session_longops ;

不想上班

好累, 好烦, 却还得坚持.
是不是这个环境真的不适合我?
谁来回答?!!
好想休息一下…