SQL*Plus Tasks - SPOOL command
You want to save output from a SQL*Plus session to a file to get record of your actions, or because you are dynamically generating commands to execute later. This can be done in SQL*Plus with the help of SPOOL command: SQL> SPOOL report.txt SQL> @run_report.sql ...output scrolls past and gets written to the file report.txt... SQL> SPOOL OFF The first command, SPOOL report, tells SQL*Plus to save everything from that point forward into the file report.txt. The file extension of .lst is the default and can be overridden by supplying your own extension in the SPOOL command like specified above. SPOOL OFF tells SQL*Plus to stop saving the output and to close the file.