audit_trail與extended!

warehouse發表於2011-06-23
在修改引數audit_trail=xml,extended時千萬不要加單引號...[@more@]

受到v$parameter_valid_values顯示結果的誤導,我以為EXTENDED是一個單獨的引數內容,所以
直接修改audit_trail=extended時例項無法啟動,最後修改audit_trail='XML,EXTENDED'重啟例項時依然發生了
錯誤ORA-01078,原因就是加上了單引號:
SQL> select * from v$parameter_valid_values where name='audit_trail';

NUM NAME ORDINAL VALUE ISDEFAULT
---------- --------------- ---------- -------------------- ----------
907 audit_trail 1 DB FALSE
907 audit_trail 2 OS FALSE
907 audit_trail 3 NONE FALSE
907 audit_trail 4 TRUE FALSE
907 audit_trail 5 FALSE FALSE
907 audit_trail 6 DB_EXTENDED FALSE
907 audit_trail 7 XML FALSE
907 audit_trail 8 EXTENDED FALSE

已選擇8行。

SQL>
--================================
doc對引數audit_trail的解釋:
AUDIT_TRAILProperty Description
Parameter type String
Syntax AUDIT_TRAIL = { none | os | db | db,extended | xml | xml,extended }
Default value none
Modifiable No
Basic No


AUDIT_TRAIL enables or disables database auditing.

Values:

none

Disables database auditing.

os

Enables database auditing and directs all audit records to the operating system's audit trail.

db

Enables database auditing and directs all audit records to the database audit trail (the SYS.AUD$ table).

db,extended

Enables database auditing and directs all audit records to the database audit trail (the SYS.AUD$ table). In addition, populates the SQLBIND and SQLTEXT CLOB columns of the SYS.AUD$ table.

xml

Enables database auditing and writes all audit records to XML format OS files.

xml,extended

Enables database auditing and prints all columns of the audit trail, including SqlText and SqlBind values.

You can use the SQL statement AUDIT to set auditing options regardless of the setting of this parameter.
--=================================
SQL> show parameter audit

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
audit_file_dest string G:ORACLEPRODUCT10.2.0ADMIN
TESTADUMP
audit_sys_operations boolean FALSE
audit_trail string NONE
SQL> alter system set audit_trail=xml,extended scope=spfile;

系統已更改。

SQL> shutdown immediate
資料庫已經關閉。
已經解除安裝資料庫。
ORACLE 例程已經關閉。
SQL> startup
ORACLE 例程已經啟動。

Total System Global Area 209715200 bytes
Fixed Size 1248116 bytes
Variable Size 79692940 bytes
Database Buffers 121634816 bytes
Redo Buffers 7139328 bytes
資料庫裝載完畢。
資料庫已經開啟。
SQL> show parameter audit

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
audit_file_dest string G:ORACLEPRODUCT10.2.0ADMIN
TESTADUMP
audit_sys_operations boolean FALSE
audit_trail string XML, EXTENDED
SQL>
--===========================
oracle太噁心了,db_extended是個獨立的引數選項,而xml和extended結合呢又是
xml,extended,真實莫名其妙,另外v$parameter_valid_values的顯示結果又把extended單獨列了出來,
不看文件的話還真不知道extended是對xml的擴充套件。

--===============================

SQL> show parameter audit

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
audit_file_dest string G:ORACLEPRODUCT10.2.0ADMIN
TESTADUMP
audit_sys_operations boolean FALSE
audit_trail string XML, EXTENDED
SQL>
SQL>
SQL>
SQL> alter system set audit_trail=db,extended scope=spfile;

系統已更改。

SQL> shutdown immediate
資料庫已經關閉。
已經解除安裝資料庫。
ORACLE 例程已經關閉。
SQL> startup
ORACLE 例程已經啟動。

Total System Global Area 209715200 bytes
Fixed Size 1248116 bytes
Variable Size 79692940 bytes
Database Buffers 121634816 bytes
Redo Buffers 7139328 bytes
資料庫裝載完畢。
資料庫已經開啟。
SQL>

--=============================

後來的補充:

其實EXTENDED還可以和db組合起來使用,所以oracle把EXTENDED單獨列出來可能也是有道理的,EXTENDED不能和os組合:

SQL> alter system set audit_trail=db,extended scope=spfile;

System altered.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 313860096 bytes
Fixed Size 1374304 bytes
Variable Size 159385504 bytes
Database Buffers 146800640 bytes
Redo Buffers 6299648 bytes
Database mounted.
Database opened.
SQL> show parameter audit

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
audit_file_dest string E:ORACLEADMINTESTADUMP
audit_sys_operations boolean FALSE
audit_trail string DB, EXTENDED

SQL> alter system set audit_trail=os,extended scope=spfile;
alter system set audit_trail=os,extended scope=spfile
*
ERROR at line 1:
ORA-32017: failure in updating SPFILE
ORA-00096: invalid value OS,EXTENDED for parameter audit_trail, must be from
among NONE | OS | DB | DB,EXTENDED | XML | XML,EXTENDED


SQL>

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/19602/viewspace-1051505/,如需轉載,請註明出處,否則將追究法律責任。

相關文章