Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003
    Posts
    156

    Unanswered: rename spool file

    Hi there,

    Ora8i, WinNT.

    I have a process that I run once a month. A query run on 9 instances. I run the query through SQL*PLus, as I have a script that lets me connect to the different instances by selecting a number from a menu (lazy, I know). I need to spool the results to a flat file (.txt) - that is not a problem. When I move on to the next instance, i need to spool the results, and rename the spool file appended with the name of the instance that i get by using, thereby knowing which instance has been queried, and not overwriting the spool file from the previous query:

    i get the name of the instance by:

    select substr(name,1,15)||'_' v_db_name from v$database;

    Any advice?
    rgs,

    Ghostman

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    spool tmp7_spool.sql
    select 'spool '||name||'_'||to_char(sysdate,'yymondd')||'.dat'
    from sys.v_$database;
    spool off
    @tmp7_spool.sql
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Sep 2003
    Posts
    156

    Thumbs up thanks

    Thanks for the advice/reply...

    i ended up doing this...

    SELECT SUBSTR(name,1,15) v_db_name FROM v$database;
    COLUMN v_db_name FORMAT A15 new_value v_name FORMAT A15 NOPRINT
    SPOOL C:\&& v_name..txt
    rgs,

    Ghostman

Posting Permissions

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