如何开启和关闭oracle数据库中的审计功能

如何开启和关闭oracle数据库中的审计功能,第1张

在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.

Oracle 的审计实在是鸡肋,审计日志增加猛速,而且加大系统负荷,降低系统性能。

依我们在生产系统的作法就是禁用审计,禁用后清除审计日志。

处理方法:

1、查看审计功能是否开启

sqlplus "/as sysdba"

SQL> show  parameter  audit

NAME          TYPE    VALUE

--------------------     -------    --------------------------------

audit_file_dest         string   /u01/app/oracle/admin/ORCL/adump

audit_sys_operations   boolean   TRUE

audit_syslog_level    string

audit_trail       string   DB

说明:表明审计功能为开启的状态

 

2、关闭oracle的审计功能

SQL> alter  system  set audit_sys_operations=FALSE  scope=spfile

System altered.

SQL> alter system set  audit_trail=NONE  scope=spfile

System altered.

 

3、重启数据库

SQL> shutdown immediate

SQL> startup

 

4、验证审计是否已经被关闭

SQL> show parameter audit

NAME          TYPE    VALUE

--------------------     -------    --------------------------------

audit_file_dest         string   /u01/app/oracle/admin/ORCL/adump

audit_sys_operations   boolean   FALSE

audit_syslog_level    string

audit_trail       string   NONE

说明:表明审计功能为关闭的状态

 

5、清空审计表数据

SQL>  truncate  table SYS.AUD$

linux下可以用ipcs查看,windows下可以查看服务,也可以进到数据库里面看数据库当前状态 select status from v$instance,如果status = open 就说明oracle服务正常。

oracle数据库文件结构:

1、控制文件:存储实例、数据文件及日志文件等信息的二进制文件。alter system set control_files=“路径”。V$CONTROLFILE。

2、数据文件:存储数据,以.dbf做后缀。一句话:一个表空间对多个数据文件,一个数据文件只对一个表空间。dba_data_files/v$datafile。

3、日志文件:即Redo Log Files和Archivelog Files。记录数据库修改信息。ALTER SYSTEM SWITCH LOGFILE。V$LOG。

4、参数文件:记录基本参数。spfile和pfile。

5、警告文件:show parameter background_dump_dest=使用共享服务器连接

6、跟踪文件:show parameter user_dump_dest=使用专用服务器连接


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/6760389.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-27
下一篇 2023-03-27

发表评论

登录后才能评论

评论列表(0条)

保存