First, create a text file containing your query.
Always start with
SET PAGESIZE 50000 SET MARKUP HTML ON TABLE "class=detail cellspacing=0" ENTMAP OFF SPOOL output.htmlThen, place your query under that. Then, end with
; SPOOL OFF quit;To run the query, ssh into your server,
nohup sqlplus username/password@oracleServer @nameOfTheQuery.sql &
Once the query is complete, you should be able to open the resulting HTML file with OpenOffice Sheet to view as a spreadsheet. I like to paste the query into the second sheet for reference, reformat the columns to the proper space, and re-save as an XLS for a customer or an OpenDocument workbook for myself (because it's smaller and open).