资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

oracle如何审计功能,oracle打开审计功能

在oracle中开启审计功能

sqlplus "/ as sysdba"

创新互联致力于互联网品牌建设与网络营销,包括网站建设、成都做网站、SEO优化、网络推广、整站优化营销策划推广、电子商务、移动互联网营销等。创新互联为不同类型的客户提供良好的互联网应用定制及解决方案,创新互联核心团队十余年专注互联网开发,积累了丰富的网站经验,为广大企业客户提供一站式企业网站建设服务,在网站建设行业内树立了良好口碑。

show parameter audit

alter system set audit_sys_operations=TRUE scope=spfile;

alter system set audit_trail=DB scope=spfile;

shutdown immediate;

startup force;

Oracle 11g起audit是自动开启的。我很烦这个审计开启,审计日志半个月10G,烦烦烦。我一把都关闭Oracle的审计功能,提高Oracle的空闲率。

怎样用程序实现oracle数据库审计

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;

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;

sqlstartup

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、什么是审计

审计(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进行“审计”,这个功能稍显不足。

如何关闭Oracle11g数据库的审计功能?

在oracle11g中,数据库的审计功能是默认开启的(这和oracle10g的不一样,10g默认是关闭的),\x0d\x0aoracle11gR2的官方文档上写的是错的,当上说default是none,而且是审计到DB级别的,这样就会\x0d\x0a往aud$表里记录统计信息。\x0d\x0a \x0d\x0a1.如果审计不是必须的,可以关掉审计功能;\x0d\x0a\x0d\x0aSQL show parameter audit_trail;\x0d\x0a\x0d\x0aNAME TYPE VALUE\x0d\x0a------------------------------------ ----------- ------------------------------\x0d\x0aaudit_trail string DB\x0d\x0a\x0d\x0aSQL alter system set audit_trail=none scope=spfile;\x0d\x0aSQL shut immediate;\x0d\x0aSQLstartup\x0d\x0a2.删除已有的审计信息\x0d\x0a可以直接truncate表aud$,\x0d\x0atruncate table SYS.AUD$;\x0d\x0a\x0d\x0a3.或者将aud$表移到另外一个表空间下,以减少system表空间的压力和被撑爆的风险。\x0d\x0a \x0d\x0a附:11g中有关audit_trail参数的设置说明:\x0d\x0aAUDIT_TRAIL\x0d\x0aProperty Description\x0d\x0aParameter type String\x0d\x0aSyntaxAUDIT_TRAIL = { none | os | db [, extended] | xml [, extended] }\x0d\x0aDefault valuenone\x0d\x0aModifiable No\x0d\x0aBasic No\x0d\x0aAUDIT_TRAIL enables or disables database auditing.\x0d\x0aValues:\x0d\x0anone\x0d\x0aDisables standard auditing. This value is the default if the AUDIT_TRAIL parameter was not set \x0d\x0ain the initialization parameter file or if you created the database using a method other than \x0d\x0aDatabase Configuration Assistant. If you created the database using Database Configuration \x0d\x0aAssistant, then the default is db.\x0d\x0aos\x0d\x0aDirects all audit records to an operating system file. Oracle recommends that you use the os \x0d\x0asetting, particularly if you are using an ultra-secure database configuration.\x0d\x0adb\x0d\x0aDirects audit records to the database audit trail (the SYS.AUD$ table), except for records \x0d\x0athat are always written to the operating system audit trail. Use this setting for a general \x0d\x0adatabase for manageability.\x0d\x0aIf the database was started in read-only mode with AUDIT_TRAIL set to db, then Oracle Database \x0d\x0ainternally sets AUDIT_TRAIL to os. Check the alert log for details.\x0d\x0adb, extended\x0d\x0aPerforms all actions of AUDIT_TRAIL=db, and also populates the SQL bind and SQL text CLOB-type \x0d\x0acolumns of the SYS.AUD$ table, when available. These two columns are populated only when this \x0d\x0aparameter is specified.\x0d\x0aIf the database was started in read-only mode with AUDIT_TRAIL set to db, extended, then Oracle \x0d\x0aDatabase internally sets AUDIT_TRAIL to os. Check the alert log for details.\x0d\x0axml\x0d\x0aWrites to the operating system audit record file in XML format. Records all elements of the \x0d\x0aAuditRecord node except Sql_Text and Sql_Bind to the operating system XML audit file.\x0d\x0axml, extended\x0d\x0aPerforms all actions of AUDIT_TRAIL=xml, and populates the SQL bind and SQL text CLOB-type columns\x0d\x0a of the SYS.AUD$ table, wherever possible. These columns are populated only when this parameter \x0d\x0ais specified.\x0d\x0aYou can use the SQL AUDIT statement to set auditing options regardless of the setting of this \x0d\x0aparameter.


网站栏目:oracle如何审计功能,oracle打开审计功能
浏览路径:http://cdkjz.cn/article/dsgsggs.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220