DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: Spool with Timestamp

  1. #1
    Join Date
    Oct 2001
    Location
    Hornchurch, Essex UK
    Posts
    132
    I've written a sql to run a few heartbeat checks on our oracle database. Within the sql I've added a spool command. I'd like the filename to include the today's date so that it does not overwrite other outputs from the previous days. A batch file will run the sql. Here is the sample:

    spool u:\oracle\analyzescripts\heartbeat&timestamp.lis

    --
    --
    spool off

    Haven't run the script yet but would like to know if I've missed anything. Will this work with batch files?

    Thanks

    x indicates an ampersand.

    [Edited by pando on 03-18-2002 at 09:14 AM]

  2. #2
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    Duplicate Thread, closing.
    Jeff Hunter

  3. #3
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    ops I deleted the other one

    anyways it should be smth like


    define s_srd1=srd1
    define s_spool=c:\tmp\monitor\
    column today new_value _date
    select to_char(sysdate, '_yyyy_fmmonth_dd') today
    from dual;

    spool xs_spoolxs_srd1x_DATE

    x indicates an ampersand

  4. #4
    Join Date
    Apr 2001
    Posts
    107
    make a batch that will run sql 1:

    sql 1:
    ------------------------------------------
    alter session set nls_date_format='whatyouwant';
    set head off
    spool aaa.sql
    select 'spool u:\oracle\analyzescripts'||sysdate||'.lis' from dual;
    select '@sql2' from dual;
    select 'spool off' from dual;
    spool off
    set head on
    @aaa.sql

    ----------------------------------------------------------
    sql2 being the script you want to launch

    Hope it helps

    Cheers

    Fabien





  5. #5
    Join Date
    Oct 2001
    Location
    Hornchurch, Essex UK
    Posts
    132
    Thanks for the prompt reply. I prefer using this forum as one gets replies as soon as a question is posted. Thanks everyone for all your hard work.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width