1

I am logging my SQLPLUS session to a file.

SPOOL mylog.txt

But if I doing commands with a short output

e.g.

SELECT * FROM DUAL;

it is not immediately put into the file. It takes some commands. If it is a command with a large output it happens instantly.

So I think it is some sort of buffer that needs to be filled before writing to the file.

I tried

SET FLUSH ON

but is did not do the trick.

How can I tell SPOOL to flush the buffer immediately?

chris01
  • 10,921
  • 9
  • 54
  • 93
  • Possible duplicate of [Is there any way to flush output from PL/SQL in Oracle?](https://stackoverflow.com/questions/1472587/is-there-any-way-to-flush-output-from-pl-sql-in-oracle) – Ori Marko Jul 22 '19 at 07:26
  • Hi, Maybe you can watch for Oracle's [utl_file](https://docs.oracle.com/cd/B19306_01/appdev.102/b14258/u_file.htm) package – tdaget Feb 18 '20 at 09:37

1 Answers1

4

You can't (as far as I can tell).

Data is spooled in chunks of 8K (typically, as Ask Tom says) so, until you fill the buffer (or issue spool off), you won't see anything.

Littlefoot
  • 131,892
  • 15
  • 35
  • 57