ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 10g初始化参数AUDIT_TRAIL变化(一)

10g初始化参数AUDIT_TRAIL变化(一)

原创 Linux操作系统 作者:yangtingkun 时间:2010-12-06 23:59:25 0 删除 编辑

9i中,初始化参数AUDIT_TRAIL只有NONEDBOS三个可选值,而在10g中,Oracle又增加了几个新的选项。

这篇介绍XML选项。

 

 

数据库版本和默认AUDIT_TRAIL参数设置:

SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
PL/SQL Release 10.2.0.3.0 - Production
CORE    10.2.0.3.0      Production
TNS for Linux: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production

SQL> show parameter audit_trail

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
audit_trail                          string      NONE

下面设置参数为XML,并重启数据库:

SQL> alter system set audit_trail = xml scope = spfile;

System altered.

SQL> conn / as sysdba
Connected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 2147483648 bytes
Fixed Size                  2074112 bytes
Variable Size             486541824 bytes
Database Buffers         1644167168 bytes
Redo Buffers               14700544 bytes
Database mounted.
Database opened.
SQL> show parameter audit

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
audit_file_dest                      string      /opt/ora10g/admin/primary/adump
audit_sys_operations                 boolean     FALSE
audit_syslog_level                   string
audit_trail                          string      XML

数据库中开启审计并触发:

SQL> audit create table;

Audit succeeded.

SQL> conn test/test
Connected.
SQL> create table t_audit (id number);

Table created.

虽然XML参数设置会使得审计信息写到操作系统中,不过Oracle仍然提供了视图可以访问到所有的AUDIT记录:

SQL> select audit_type, db_user, object_name, statement_type, sql_text, os_privilege
  2  from dba_common_audit_trail;

AUDIT_TYPE             DB_USER  OBJECT_NAME  STATEMENT_TYPE  SQL_TEXT             OS_PRIV
---------------------- -------- ------------ --------------- -------------------- -------
Mandatory XML Audit    /                                     CONNECT              SYSDBA
Mandatory XML Audit    /                                     CONNECT              SYSDBA
Standard XML Audit     TEST     T_AUDIT      CREATE TABLE

DBA_COMMON_AUDIT_TRAIL视图提供了包括OSDBXML所有目的地的AUDIT_TRAIL,而V$XML_AUDIT_TRAIL则只包含XML格式的记录。

SQL> select audit_type, db_user, object_name, statement_type, sql_text, os_privilege
  2  from v$xml_audit_trail;

AUDIT_TYPE DB_USER  OBJECT_NAME  STATEMENT_TYPE SQL_TEXT                       OS_PRIV
---------- -------- ------------ -------------- ------------------------------ -------
         8 /                                  0 CONNECT                        SYSDBA
         8 /                                  0 CONNECT                        SYSDBA
         1 TEST     T_AUDIT                   0

也可以在操作系统上检查对应的AUDIT_TRAILXML文件:

[oracle@yans1 ~]$ cd /opt/ora10g/admin/primary/adump/
[oracle@yans1 adump]$ more ora_3221182856.xml

     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://xmlns.oracle.com/oracleas/schema/dbserver_audittrail-10_2.xsd">
   10.2
12000271tamp>2010-12-06T21:34:29.880932TESToracleyans1ocess>8655pts/20TEST>T_AUDIT110001E00030000000
0

 

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/4227/viewspace-681035/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
暂无介绍

注册时间:2007-12-29

  • 博文量
    1955
  • 访问量
    10454787