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

  • SEARCH
  • Home
  • 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

Related Questions

I have a master shell script which called a child script for each iteration
i have unix shell script which is need to be run like below test_sh
I have a shell script which has a for loop that prints the value
I have a shell script testShell.sh which uses getopts as below: #!/bin/bash while getopts
I have the below line in the unix shell script. I want to exclude
Can we have multiple SQL* PLUS connections in a shell script? I have written
I have shell scripting knowledge. I have written a small shell script which will
I have a bash shell script which calls some python scripts. I am running
I have some shell script as below, I want to run this process for
I have below snippet of code in which TestClass is extending jPanel which is

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.