Oracle SQLPlus:如何显示 sqlplus 命令的输出,而不必先发出 spool off 命令?

发布于 2024-09-05 06:32:32 字数 266 浏览 11 评论 0原文

有没有办法显示 sqlplus 命令的输出,而不必先发出 spool off 命令?

我将 sqlplus 会话的结果假脱机到一个文件,同时跟踪该文件。这样做的原因是,对于具有很长行的表,格式更容易从文件中查看。问题是要查看输出,每次在 sqlplus 中运行命令时,我都必须发出 spool off 命令。

我可以配置 sqlplus 以便在发出 spool 命令后所有输出都可以立即在文件中查看。

(格式化行在屏幕上显示的方式不是一个选项。)

谢谢

Is there a way to display the output of a sqlplus command without having to first issue the spool off command?

I am spooling the results of a sqlplus session to a file while at the same time tailing the file. The reason for this is that for table with very long rows the format is easier to look at from a file. The problem is to see the output i have to issue the spool off command everytime i run a command in sqlplus.

Can i configure sqlplus so that after i have issued the spool command all the output is viewable straight away on the file.

(Formating the way the rows are displayed on the screen is not an option. )

THanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

年华零落成诗 2024-09-12 06:32:32

SPOOL 实际上是为了创建 SQL*Plus 输出文件,用于任何目的:日志记录、输入到另一个进程等。没有用于实时查看其输出的工具。

有多种方法可以解决这个特定问题,但最简单的肯定是使用包含数据浏览器的 IDE,从而无需尾部文件。市场上有很多这样的产品,包括 Quest 的 TOADAllround Automation 的 PL/SQL Developer,但如果您不想收取许可费,那么您应该看看 Oracle 自己的(免费)SQL Developer

SPOOL is really intended for creating a file of SQL*Plus output, for whatever purpose: logging, input to another process, etc. There is no facility for inflight viewing of its output.

There are a number of ways of solving this particular problem, but the easiest is surely to use an IDE which includes a data browser, thus obviating the need to tail a file. There are a number on the market, including Quest's TOAD and Allround Automation's PL/SQL Developer, but if you don't want to spring for a license fee then you should have a look at Oracle's own (free) SQL Developer.

孤云独去闲 2024-09-12 06:32:32

如果要对多个语句的结果进行假脱机处理,则可以关闭假脱机功能,然后在每个语句之间将其重新打开。当您重新打开假脱机时,请添加附加关键字,以便它将继续在同一文件中而不是覆盖它。

如果您想在假脱机文件中查看一个查询的结果,您可以将该查询分解为多个返回特定数据范围的查询。这会比较慢,但您可以循环假脱机以获得更快的反馈。

If you are spooling the results of multiple statements you could turn spooling off and then turn it back on between each statement. When you turn spooling back on add the append keyword so that it will continue in the same file rather than overwriting it.

If you want to see the results of one query in your spool file you could break the query up into multiple queries that returned specific ranges of the data. This would be slower, but you could cycle spooling to get faster feedback.

绅士风度i 2024-09-12 06:32:32

如果您的问题是无法打开输出文件(因为假脱机进程已锁定),请尝试将文件输出复制到另一个文件并打开该文件。

If your problem is that you can't open the output file (as the spool process has a lock on it) then try copying the file output to another file and opening that file instead.

弱骨蛰伏 2024-09-12 06:32:32

因为听起来您真正的问题是在 SQLPlus 中格式化输出 - 您能否使 SQLPlus 窗口更宽并设置 LINESIZE 以便输出在 SQLPlus 中看起来更好?那么你可能根本不需要假脱机。

Since it sounds like your real problem is formatting of output in SQLPlus -- can you make your SQLPlus window wider and SET LINESIZE so the output looks better in SQLPlus to start with? Then you might not need to spool at all.

旧情别恋 2024-09-12 06:32:32

我尝试添加评论,但由于某种原因它没有保存它,所以我尝试“回答你的问题”选项:)

我确实使用 SQLDeveloper,但在某些情况下我必须使用 sqlplus,而 SQLDeveloper 不可用,那么我就陷入困境普通的旧sqlplus。

还有其他情况,我会使用 sqlplus 而不是 sqldeveloper,纯粹是因为我需要 1/2 分钟才能找到我在 sqlplus 中寻找的内容,而不是使用 SQLDeveloper 几分钟,因为它需要很长时间才能加载。

我检查了输出被刷新之前所花费的时间,看起来它确实在一定数量的行之后将其刷新。有没有办法减少缓冲区以便更快地刷新它们?

打开文件没有问题,问题是即使打开文件,我也看不到输出,除非我发出“spool off”命令或输出有数百行。我正在使用一个名为 baretail (http://www.baretail.com) 的免费程序来尾部假脱机文件在窗户上。

谢谢

I tried to add a comment but for some reason it doesnt save it so ill try the "Answer your question" option :)

I do use SQLDeveloper but there are situations where i have to use sqlplus where SQLDeveloper is not available then i am stuck with plain old sqlplus.

There are other situations where i would use sqlplus over sqldeveloper purely for the fact that it would take me 1/2 minute to find out what i am looking for in sqlplus rather than several minutes with SQLDeveloper as it would take ages to load.

I have checked the time it takes before the output is flushed out and it looks like it does flush it out after a certain number of rows. Isnt there a way to reduce the buffer so that they are flushed out quicker?

There is no problem opening the file the problem is even with the file opened i cant see the output unless i issue the "spool off" command or the output has several hundred rows. I am using a free program called baretail (http://www.baretail.com) to tail the spool file on windows.

Thanks

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文