[20140529]11g下参数audit_trail的修改.txt
--前一天看了11g下审计的内容,因为要修改参数audit_trail,又遇到一些奇怪的问题,自己做一个记录。
--主要问题是可能今年要上11G,11G下缺省audit_trail=DB,打开了许多审计,其中比如用户登录审计可能是不需要的,需要关闭。
--我遇到问题做一个简单记录:
SYS@test> @ver
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
SYS@test> show parameter service
NAME TYPE VALUE
-------------- ------- -------------
service_names string test.com
SYS@test> show parameter audit_trail
NAME TYPE VALUE
--------------- ------- -------------
audit_trail string DB
--可以发现参数这两个参数都是字符类型。
SYS@test> alter system set audit_trail="db,extended" scope=spfile ;
alter system set audit_trail="db,extended" scope=spfile
*
ERROR at line 1:
ORA-00096: invalid value db,extended for parameter audit_trail, must be from among extended, xml, db_extended, false, true, none, os, db
SYS@test> alter system set audit_trail='db,extended' scope=spfile ;
alter system set audit_trail='db,extended' scope=spfile
*
ERROR at line 1:
ORA-00096: invalid value db,extended for parameter audit_trail, must be from among extended, xml, db_extended, false, true, none, os, db
SYS@test> alter system set service_names='a,b,test.com' scope=memory ;
System altered.
SYS@test> show parameter service
NAME TYPE VALUE
------------------------------------ ---------------------------------------- ---------------
service_names string a,b,test.com
--可以发现修改service_names成功,而修改参数audit_trail失败。
--当然可以修改audit_trail='db_extended'可以。
SYS@test> alter system set audit_trail='db_extended' scope=spfile ;
System altered.
SYS@test> alter system set audit_trail=db,extended scope=spfile ;
System altered.
--昏,不加引号才可以通过,这个行为太怪异了。
--我再来修改service_names参数看看。
SYS@test> alter system set service_names=a,b,test.com scope=memory ;
alter system set service_names=a,b,test.com scope=memory
*
ERROR at line 1:
ORA-00922: missing or invalid option
SYS@test> alter system set service_names="a,b,test.com" scope=memory ;
System altered.
SYS@test> alter system set service_names='a,b,test.com' scope=memory ;
System altered.
SYS@test> alter system set service_names=a,b,test.com scope=memory ;
alter system set service_names=a,b,test.com scope=memory
*
ERROR at line 1:
ORA-00922: missing or invalid option
--oracle修改参数的行为实在是太怪异了。我也测试12c,问题一样。
重启看看修改是否生效:
SYS@test> show parameter audit_trail
NAME TYPE VALUE
------------ ------- --------------
audit_trail string DB, EXTENDED
--另外我看了我的dataguard的audit_trail,即使你spfile文件设置
$ strings spfiletestdg.ora | grep audit_trail
*.audit_trail='DB_EXTENDED'
--实际上启动后是
SYS@testdg> show parameter audit_trail
NAME TYPE VALUE
------------------------------------ ---------------------------------------- ------
audit_trail string OS
--看来以后要注意这些细节。