Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Using a shell 'Here' document is the usual solution, i.e.</p> <pre><code> cat MyCommand.sh #!/bin/bash # (or ksh, sh, etc) PATH=.../path/to/sqlplusdir:${PATH} sqlplus username/pwd@instance &lt;&lt;EOS SPOOL /home/sadmin/sqlmail/spool.out set linesize 2000 set wrap off @/home/sadmin/sqlmail/query.sql SPOOL OFF exit EOS mail -s "Subject" email@address.com &lt; /home/sadmin/sqlmail/spool.out </code></pre> <p>You'll need to set your PATH env to include the path to you sqlplus executable.</p> <p>Then you need a userID with access to the cron facility. Do you know how to use the 'vi' editor? When you call <code>crontab</code>, you will be looking at the current users scheduled jobs and you will need to manipulate the file with 'vi' commands. (It may be possible to override which editor to use, but not recommended)</p> <p>You need to read the man page for cron, i.e. <code>man cron</code>, and you will be call the above a a complete script. A cron entry will look like</p> <pre><code>59 23 31 12 * { var=x; export var ; myCommand ; } &gt; /tmp/myWorkDir/myCommand.trace 2&gt;&amp;1 min hr day mon (DayOfWeek) </code></pre> <p>values for date/times can be comma separated lists (0,15,30,45), hyphen separated ranges (4-6) or * to indicate all valid values.</p> <p>This captures any output including stderr, from the 1 time run of myCommand into the file in the tmpDir.</p> <p>The bare minimum version of the above would be</p> <pre><code>59 23 12 31 * var=x; export var ; myCommand </code></pre> <p>and then any output is sent to the user's local mailbox.</p> <p>I hope this helps.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload