阻止 Oracle 生成 sqlnet.log 文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/848166/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 18:12:48  来源:igfitidea点击:

Stop Oracle from generating sqlnet.log file

perloracle

提问by Mathieu Longtin

I'm using DBD::Oracle in perl, and whenever a connection fails, the client generates a sqlnet.log file with error details.

我在 perl 中使用 DBD::Oracle,每当连接失败时,客户端都会生成一个包含错误详细信息的 sqlnet.log 文件。

The thing is, I already have the error trapped by perl, and in my own log file. I really don't need this extra information.

问题是,我已经有 perl 捕获的错误,并且在我自己的日志文件中。我真的不需要这些额外的信息。

So, is there a flag or environment for stopping the creation of sqlnet.log?

那么,是否有停止创建 sqlnet.log 的标志或环境?

采纳答案by Thomas Jones-Low

From the metalink

从金属链接

The logging is automatic, there is no way to turn logging off, but since you are on Unix server, you can redirect the log file to a null device, thus eliminating the problem of disk space consumption.

In the SQLNET.ORA file, set LOG_DIRECTORY_CLIENT and LOG_DIRECTORY_SERVER equal to a null device.

For example:

LOG_DIRECTORY_CLIENT = /dev/null
LOG_FILE_CLIENT = /dev/null

in SQLNET.ORA suppresses client logging completely.

To disable the listener from logging, set this parameter in the LISTENER.ORA file:

logging_listener = off 

日志是自动的,没有办法关闭日志,但是由于你在Unix服务器上,你可以将日志文件重定向到一个空设备,从而消除磁盘空间消耗的问题。

在 SQLNET.ORA 文件中,将 LOG_DIRECTORY_CLIENT 和 LOG_DIRECTORY_SERVER 设置为空设备。

例如:

LOG_DIRECTORY_CLIENT = /dev/null
LOG_FILE_CLIENT = /dev/null

在 SQLNET.ORA 中完全禁止客户端日志记录。

要禁用监听器的日志记录,请在 LISTENER.ORA 文件中设置此参数:

logging_listener = off 

回答by Thomas Jones-Low

As the Oracle Documentationstates: To ensure that all errors are recorded, logging cannot be disabled on clients or Names Servers.

正如Oracle 文档所述:为确保记录所有错误,不能在客户端或名称服务器上禁用日志记录。

You can follow the suggestion of DCookie and use the /dev/null as the log directory. You can use NUL: on windows machines.

您可以按照 DCookie 的建议使用 /dev/null 作为日志目录。您可以在 Windows 机器上使用 NUL:。

回答by DCookie

Are your clients on Windows, or *nix? If in *nix, you can set LOG_DIRECTORY_CLIENT=/dev/null in your sqlnet.ora file. Not sure if you can do much for a windows client.

你的客户端是 Windows 还是 *nix?如果在 *nix 中,您可以在 sqlnet.ora 文件中设置 LOG_DIRECTORY_CLIENT=/dev/null。不确定您是否可以为 Windows 客户端做很多事情。

EDIT: Doesn't look like it's possible in Windows. The best you could do would be to set the sqlnet.ora parameter above to a fixed location and create a scheduled task to delete the file as desired.

编辑:在 Windows 中看起来不可能。您能做的最好的事情是将上面的 sqlnet.ora 参数设置为固定位置,并创建计划任务以根据需要删除文件。

Okay, as Thomas points out there is a null device on windows, use the same paradigm.

好的,正如 Thomas 指出的 Windows 上有一个空设备,请使用相同的范例。

回答by Elan Ruusam?e

IMPORTANT: DO NOT SET "LOG_FILE_CLIENT=/dev/null", this will cause permissions of /dev/null be reset each time your initialize oracle library, and when your umask is something that does not permit world readable-writable bits, those get removed from /dev/null and if you have permission to chmod that file: i.e running as root.

重要提示:请勿设置“LOG_FILE_CLIENT=/dev/null”,这将导致每次初始化 oracle 库时重置 /dev/null 的权限,并且当您的 umask 不允许世界可读可写位时,那些得到从 /dev/null 中删除,并且如果您有权 chmod 该文件:即以 root 身份运行。

and running as root maybe something trivial, like php --version having oci php-extension present!

并以 root 身份运行可能是一些微不足道的事情,比如 php --version 存在 oci php-extension !

full details here: http://lists.pld-linux.org/mailman/pipermail/pld-devel-en/2014-May/023931.html

完整详细信息:http: //lists.pld-linux.org/mailman/pipermail/pld-devel-en/2014-May/023931.html

you should use path inside directory that doesn't exist:

您应该在不存在的目录中使用路径:

LOG_FILE_CLIENT = /dev/impossible/path

and hope nobody creates dir /dev/impossible:)

并希望没有人创建目录/dev/impossible:)

for Windows NULprobably is fine as it's not actual file there...

对于 WindowsNUL可能很好,因为它不是那里的实际文件......