oracle数据库审计,如何关闭Oracle11g数据库的审计功能
其实oracle数据库审计的问题并不复杂,但是又很多的朋友都不太了解如何关闭Oracle11g数据库的审计功能,因此呢,今天小编就来为大家分享oracle数据库审计的一些知识,希望可以帮助到大家,下面我们一起来看看这个问题的分析吧!
oracle 审计包括哪几种,都是什么
1、什么是审计
审计(Audit)用于监视用户所执行的数据库操作,并且Oracle会将审计跟踪结果存放到OS文件(默认位置为$ ORACLE_BASE/admin/$ORACLE_SID/adump/)或数据库(存储在system表空间中的SYS.AUD$表中,可通过视图 dba_audit_trail查看)中。默认情况下审计是没有开启的。
不管你是否打开数据库的审计功能,以下这些操作系统会强制记录:用管理员权限连接Instance;启动数据库;关闭数据库。
2、和审计相关的两个主要参数
Audit_sys_operations:
默认为false,当设置为true时,所有sys用户(包括以sysdba,sysoper身份登录的用户)的操作都会被记录,audit trail不会写在aud$表中,这个很好理解,如果数据库还未启动aud$不可用,那么像conn/as sysdba这样的连接信息,只能记录在其它地方。如果是windows平台,audti trail会记录在windows的事件管理中,如果是linux/unix平台则会记录在audit_file_dest参数指定的文件中。
Audit_trail:
None:是默认值,不做审计;
DB:将audit trail记录在数据库的审计相关表中,如aud$,审计的结果只有连接信息;
DB,Extended:这样审计结果里面除了连接信息还包含了当时执行的具体语句;
OS:将audit trail记录在操作系统文件中,文件名由audit_file_dest参数指定;
XML:10g里新增的。
注:这两个参数是static参数,需要重新启动数据库才能生效。
3、审计级别
当开启审计功能后,可在三个级别对数据库进行审计:Statement(语句)、Privilege(权限)、object(对象)。
Statement:
按语句来审计,比如audit table会审计数据库中所有的create table,drop table,truncate table语句,alter session by cmy会审计cmy用户所有的数据库连接。
Privilege:
按权限来审计,当用户使用了该权限则被审计,如执行grant select any table to a,当执行了audit select any table语句后,当用户a访问了用户b的表时(如select* from b.t)会用到select any table权限,故会被审计。注意用户是自己表的所有者,所以用户访问自己的表不会被审计。
Object:
按对象审计,只审计on关键字指定对象的相关操作,如aduit alter,delete,drop,insert on cmy.t by scott;这里会对cmy用户的t表进行审计,但同时使用了by子句,所以只会对scott用户发起的操作进行审计。注意Oracle没有提供对schema中所有对象的审计功能,只能一个一个对象审计,对于后面创建的对象,Oracle则提供on default子句来实现自动审计,比如执行audit drop on default by access;后,对于随后创建的对象的drop操作都会审计。但这个default会对之后创建的所有数据库对象有效,似乎没办法指定只对某个用户创建的对象有效,想比 trigger可以对schema的DDL进行“审计”,这个功能稍显不足。
oracle数据库的审计功能
在oracle11g中,数据库的审计功能是默认开启的(这和oracle10g的不一样,10g默认是关闭的),
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.
如何关闭Oracle11g数据库的审计功能
在oracle11g中,数据库的审计功能是默认开启的(这和oracle10g的不一样,10g默认是关闭的),
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.
好了,文章到此结束,希望可以帮助到大家。