The SPOOL is a command causes SQLPlus to write the results to a file on the operating system.
Once spool is set, SQLPlus will continue to spool the output until the command SPOOL OFF.
Note that the file cannot be seen or used until the SPOOL OFF command.
The spool command is very useful when you want to generate SQL from the data dictionary. Here is the Syntax of a SQLPlus spool command:
SPOOL <output file path> SPOOL OFF
spool begin_backup.log; alter database begin backup; spool off;
Also published on Medium.