
oracle11gr2的官方文档上写的是错的,当上说default是none,而且是审计到db级别的,这样就会
往aud$表里记录统计信息。
1.如果审计不是必须的,可以关掉审计功能;
sql>
show
parameter
audit_trail
name
type
value
------------------------------------
-----------
------------------------------
audit_trail
string
db
sql>
alter
system
set
audit_trail=none
scope=spfile
sql>
shut
immediate
sql>startup
2.删除已有的审计信息
可以直接truncate表aud$,
truncate
table
sys.aud$
3.或者将aud$表移到另外一个表空间下,以减少system表空间的压力和被撑爆的风险。
附:11g中有关audit_trail参数的设置说明:
audit_trail
property
description
parameter
type
string
syntax
audit_trail
=
{
none
|
os
|
db
[,
extended]
|
xml
[,
extended]
}
default
value
none
modifiable
no
basic
no
audit_trail
enables
or
disables
database
auditing.
values:
none
disables
standard
auditing.
this
value
is
the
default
if
the
audit_trail
parameter
was
not
set
in
the
initialization
parameter
file
or
if
you
created
the
database
using
a
method
other
than
database
configuration
assistant.
if
you
created
the
database
using
database
configuration
assistant,
then
the
default
is
db.
os
directs
all
audit
records
to
an
operating
system
file.
oracle
recommends
that
you
use
the
os
setting,
particularly
if
you
are
using
an
ultra-secure
database
configuration.
db
directs
audit
records
to
the
database
audit
trail
(the
sys.aud$
table),
except
for
records
that
are
always
written
to
the
operating
system
audit
trail.
use
this
setting
for
a
general
database
for
manageability.
if
the
database
was
started
in
read-only
mode
with
audit_trail
set
to
db,
then
oracle
database
internally
sets
audit_trail
to
os.
check
the
alert
log
for
details.
db,
extended
performs
all
actions
of
audit_trail=db,
and
also
populates
the
sql
bind
and
sql
text
clob-type
columns
of
the
sys.aud$
table,
when
available.
these
two
columns
are
populated
only
when
this
parameter
is
specified.
if
the
database
was
started
in
read-only
mode
with
audit_trail
set
to
db,
extended,
then
oracle
database
internally
sets
audit_trail
to
os.
check
the
alert
log
for
details.
xml
writes
to
the
operating
system
audit
record
file
in
xml
format.
records
all
elements
of
the
auditrecord
node
except
sql_text
and
sql_bind
to
the
operating
system
xml
audit
file.
xml,
extended
performs
all
actions
of
audit_trail=xml,
and
populates
the
sql
bind
and
sql
text
clob-type
columns
of
the
sys.aud$
table,
wherever
possible.
these
columns
are
populated
only
when
this
parameter
is
specified.
you
can
use
the
sql
audit
statement
to
set
auditing
options
regardless
of
the
setting
of
this
parameter.
1 、如何启用审计?修改数据库的初始化参数audit_trail ,从none 修改为你需要的值。
它的可选项有很多,如下所示:
AUDIT_TRAIL = { none | os | db | db,extended | xml | xml,extended }
我们选择db 值作为该参数值。使得审计功能处于打开状态,将审计记录保存在数据库sys.aud$表中。
修改初始化参数文件spfile 中的此参数配置值
ALTER SYSTEM SET audit_trail=db SCOPE=SPFILE sid='*'
注意,这个参数需要数据库实例重启之后才能生效。
2 、审计有哪些功能
可以审计数据库对象的DML 和DDL *** 作,以及查询、执行和一些系统事件如登录和退出。
如下所示:
DDL (CREATE, ALTER &DROP of objects)
DML (INSERT UPDATE, DELETE)
SELECT
EXECUTE
SYSTEM EVENTS (LOGON, LOGOFF etc)
每个功能还有选项,如在每个会话还是每个访问中审计,是成功或不成功时审计。
完整的audit 的语法如下:
AUDIT
{ sql_statement_clause | schema_object_clause | NETWORK }
[ BY { SESSION | ACCESS } ]
[ WHENEVER [ NOT ] SUCCESSFUL ]
3 、如何审计某表的数据插入 *** 作
现在的问题是找出什么应用向表插入了记录。在应用程序的逻辑上,这个表的数据只会更新,不会插入。
因此,在审计功能打开后,使用这个下列命令审计某表的插入 *** 作。
audit insert on table_name by access
执行成功后,此表上每一次插入 *** 作都会被记录在sys.aud$ 表中。
4 、如何查看审计结果
可以查询dba_audit_trail 系统视图,该视图显示就是sys.aud$ 表保存的审计结果。这个表的存储空间是system ,如果你需要大量长期审计某些 *** 作,请注意维护这张表。
一般维护方法有两个,定期执行truncate *** 作和将表的存储表空间移植到一个新建的独立表空间上。
5 、如何取消审计
使用noaudit 代替audit 命令符就可, 如noaudit insert on table_name by access
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)