如何在ORACLE中获取所有执行的SQL查询?

时间:2023-02-13 15:46:47

Is possible to find out all SQL queries and their return code, which was executed in Oracle database? Specially I want to get all sql queries which has negative sql code (error).

有可能找出所有在Oracle数据库中执行的SQL查询及其返回码吗?特别是我想获得所有具有负sql代码的SQL查询(错误)。

Thank you for answer.

谢谢你的答案。

3 个解决方案

#1


2  

Everything which was executed? That would require enabling auditing, and fine-grained auditing to boot - and auditing every statement in a database can generate a lot of data.

所有被执行的东西?这需要启用审计和细粒度审计才能启动 - 审计数据库中的每个语句都可以生成大量数据。

#2


0  

Maybe you can execute your queries within a (anonymous) PL/SQL block, and then use the its exception handler to catch "negative" statements:

也许您可以在(匿名)PL / SQL块中执行查询,然后使用其异常处理程序来捕获“否定”语句:

begin
  insert into a values (1, 4/0);
exception when others then
  ... error has happened,
  ... use 'sqlerrm' and 'sqlcode' 
  ... for further analysis
end;

#3


-1  

if you want any solution of error code than please check out Oracle docs for Error message pdf, in which you were find out various error code with its description....

如果你想要任何错误代码的解决方案,请查看Oracle文档的错误消息pdf,其中你找到了各种错误代码及其描述....

#1


2  

Everything which was executed? That would require enabling auditing, and fine-grained auditing to boot - and auditing every statement in a database can generate a lot of data.

所有被执行的东西?这需要启用审计和细粒度审计才能启动 - 审计数据库中的每个语句都可以生成大量数据。

#2


0  

Maybe you can execute your queries within a (anonymous) PL/SQL block, and then use the its exception handler to catch "negative" statements:

也许您可以在(匿名)PL / SQL块中执行查询,然后使用其异常处理程序来捕获“否定”语句:

begin
  insert into a values (1, 4/0);
exception when others then
  ... error has happened,
  ... use 'sqlerrm' and 'sqlcode' 
  ... for further analysis
end;

#3


-1  

if you want any solution of error code than please check out Oracle docs for Error message pdf, in which you were find out various error code with its description....

如果你想要任何错误代码的解决方案,请查看Oracle文档的错误消息pdf,其中你找到了各种错误代码及其描述....