Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Posts
    1

    Unanswered: Spool Service Name

    HI,

    I wonder if you can help? I am querying against an Oracle Database and have been trying to create some SQL which will automatically spool a file name which contains the Service Name. I do not want to manually enter the Service Name, I would like it to automatically feed through. Any ideas?

  2. #2
    Join Date
    Jan 2004
    Location
    Scottsdale, AZ
    Posts
    106
    This works in 8.1.7 - There may be unsupported SQLPLUS commands at other versions.

    ttitle ' '
    column instnc new_value v_inst noprint
    column instdate new_value v_instdate noprint
    SELECT name instnc
    FROM v$database;
    SELECT TO_CHAR(sysdate,'-dd-Mon-yyyy-hh24-mi-ss') instdate FROM dual;
    prompt
    prompt Looking at your &v_inst instance...
    prompt
    rem
    rem
    rem CHANGE THE SPOOL FILE NAME TO A DIRECTORY LOCATION
    REM THAT IS PART OF YOUR STRUCTURE (NT VS. UNIX),
    REM OR IT WILL DEFAULT TO current DIRECTORY
    rem
    rem
    spool db_alert_info_for_&v_inst&v_instdate;
    prompt Report is in file: db_alert_info_for_&&v_inst&&v_instdate..lst
    prompt
    SELECT ('---Database Information as of : '
    ||TO_CHAR(sysdate,'dd-Mon-yyyy, hh24:mi:ss')) "Start"
    FROM dual;
    prompt
    select 'Run by ',user from dual;
    prompt
    prompt
    REM put your sql here
    spool off
    /
    "Take Control!
    Make The Choice!
    Accept The Consequences!
    Deal With The Results! "

Posting Permissions

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