Spool script

This is relatively handy, particularly when running the same thing against multiple databases. I’ve saved this in a script called spool.sql, so I can type @spool to start spooling to a file which has the database name in the middle

undef prefix
column name new_value dbname
select name from v$database;
spool &&prefix._&dbname
prompt Spooling:
host dir /b &&prefix._&dbname..lst

Advertisements