Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 937801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:32:10+00:00 2026-05-15T21:32:10+00:00

I have the below shell script in which sql file is called which has

  • 0

I have the below shell script in which sql file is called which has set of select and insert statements. Right now it’s spooling output/error of the sql select /insert commands to the csv file. I want the output and error of the sql commands redirected to the shell script LOGFILE instead of spool file. How can i do it.

LOGPATH=${TEST_LOG}
LOGFILE=${SCRIPTNAME}.$(date '+%Y%m%d_%H%M%S').log

sql_test=${REPORT_HOME}/month_report.sql

exec > ${LOGPATH}/${LOGFILE} 2>&1

main "$@"

exit 0

main()
{   
    SPOOLTEST="${REPORT}/testreports/report_`date +%Y%m%d_%H%M%S`.csv"

    $ORACLE_HOME/bin/sqlplus -s << ENDSQL
                    ${DBLOGIN}@${DBNAME}
                    WHENEVER SQLERROR EXIT 1 ROLLBACK
                    WHENEVER OSERROR EXIT 1 ROLLBACK
                    SPOOL ${SPOOLTEST}
                    @${sql_test}
                    SPOOL OFF
    ENDSQL

    return
}

spool logs after a delay. after shell script logs i am able to find the spool logs. I tried the below one it’s not working
$ORACLE_HOME/bin/sqlplus -s << ENDSQL >> ${LOGPATH}/${LOGFILE} 2>&1

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T21:32:11+00:00Added an answer on May 15, 2026 at 9:32 pm

    when i do the below in shell script it writes to the logfiles
    SET TRIMSPOOL ON

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 542k
  • Answers 542k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Strictly speaking, the problem is not caused by the DB… May 17, 2026 at 3:15 am
  • Editorial Team
    Editorial Team added an answer $14/2 - A template-declaration can appear only as a namespace… May 17, 2026 at 3:15 am
  • Editorial Team
    Editorial Team added an answer You should use XLIST command, Google and Apple developed a… May 17, 2026 at 3:15 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

i have unix shell script which is need to be run like below test_sh
I have a bash shell script which calls some python scripts. I am running
I have a server table which has a column named 'SN' in mysql, when
I have a text file like below iv_destination_code_10 TAP310_mapping_RATERUSG_iv_destination_code_10 RATERUSG.iv_destination_code_10 = WORK.maf_feature_info[53,6] iv_destination_code_2 TAP310_mapping_RATERUSG_iv_destination_code_2
I have a requirement in a shell script. I get this location information from
I have a shell which looks like toolbar and defines my main region (a
Update: The link below does not have a complete answer . Having to set
I've been writing some shell script and I would find it useful if there
I have the following code example below. Whereby you can enter a command to
I have created this "shell" in jQuery: Code: link text Demo: link text I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.