How to dump Oracle sqlplus output to a file

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 begin_backup.log;
alter database begin backup;
spool off;

Also published on Medium.

Default image
Vignesh A Sathiyanantham
AWS Certified developer with 8 years of extensive experience working for Cloud and Datacenter solutions and leading a small team in a lean startup based on Bangalore, India