oracle 数据库 AUDIT 不显示 SQL 文本和绑定值
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13100054/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
oracle database AUDIT doesn't show SQL text and bind values
提问by Majid Azimi
Based on this tutorialI have configured auditing on a database with these options:
根据本教程,我使用以下选项配置了对数据库的审计:
AUDIT ALL BY db BY ACCESS;
AUDIT SELECT TABLE, UPDATE TABLE, INSERT TABLE, DELETE TABLE BY db BY ACCESS;
AUDIT EXECUTE PROCEDURE BY db BY ACCESS;
I prepare query from java and run a SELECT
query. DBA_AUDIT_TRAIL
table shows my SELECT
query but SQL_TEXT
and SQL_BIND
fields are empty. How can I see them? Should I enable any other option? I'm using Oracle 11.2 Express Edition. Is this because It is express edition?
我从 java 准备查询并运行SELECT
查询。DBA_AUDIT_TRAIL
表格显示我的SELECT
查询,但SQL_TEXT
和SQL_BIND
字段为空。我怎么能看到他们?我应该启用任何其他选项吗?我正在使用 Oracle 11.2 快捷版。这是因为它是速成版吗?
回答by Nick Krasnov
The column SQLTEXT
and SQLBIND
are populated only when AUDIT_TRAIL
option is set to db, extended
. Here is an example:
The column SQLTEXT
and SQLBIND
are populated only when AUDIT_TRAIL
option is set to db, extended
. 下面是一个例子:
SQL> alter system set audit_trail=db,extended scope=spfile;
System altered
Restart the instance.
重启实例。
SQL> audit select on your_table;
Audit succeeded
SQL> select sqltext from sys.aud$ where obj$name = 'YOUR_TABLE';
SQLTEXT
--------------------------------------------------------------------------------
null
SQL> select count(*) from your_table;
COUNT(*)
----------
3
SQL> select sqltext from sys.aud$ where obj$name = 'YOUR_TABLE';
SQLTEXT
--------------------------------------------------------------------------------
select count(*) from your_table
SQL>