LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-13-2017, 03:51 AM   #1
Debudev
LQ Newbie
 
Registered: Jul 2017
Posts: 1

Rep: Reputation: Disabled
Unable to run script


Hi,

I have a script that will accept a SQL script present in same path as that of script. The script will run taking an SID as argument during runtime.
However after ist step i.e. running the script I am getting an SQL command prompt in next line in unix screen.

For example:

ua00106:/local/orabck/CEGID1/daily:<CEGID1>: sh dist.sh CEGID1
SQL*Plus: Release 1.0.2 .....
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g - 64 bit
SQL>

I am not sure what to put in SQL> line.

Please help
 
Old 07-13-2017, 07:45 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 23,943

Rep: Reputation: 7029Reputation: 7029Reputation: 7029Reputation: 7029Reputation: 7029Reputation: 7029Reputation: 7029Reputation: 7029Reputation: 7029Reputation: 7029Reputation: 7029
Quote:
Originally Posted by Debudev View Post
Hi,
I have a script that will accept a SQL script present in same path as that of script. The script will run taking an SID as argument during runtime.
However after ist step i.e. running the script I am getting an SQL command prompt in next line in unix screen.

For example:

ua00106:/local/orabck/CEGID1/daily:<CEGID1>: sh dist.sh CEGID1
SQL*Plus: Release 1.0.2 .....
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g - 64 bit
SQL>

I am not sure what to put in SQL> line.
Right, because the SQL> is the Oracle interactive prompt...its asking you to type something in. Your script is running in the background at this point, waiting for the SQL process to end.

Read the "Question Guidelines" link in my posting signature. We're happy to help, but you need to provide details, like version/distro of Linux, the contents of your script, etc. We can't guess as to the details of your script past "its not working", based on what you posted. Look into using expect for such things, and look on Google for one of MANY sample scripts that interact with Oracle.
 
Old 07-13-2017, 12:43 PM   #3
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,356
Blog Entries: 13

Rep: Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411
This is something very old that I used when I had a script which invoked fdisk to create partitions, because fdisk requires user interaction.
Code:
create_partitions()
{
   cat<<EOF|sudo fdisk $1
n
p
1
1
+32M
n
p
2


w
EOF
}
I found the concept to do the passing of the arguments somewhere on the web and refined it to do what I needed.

Perhaps this technique will work for injecting commands to the SQL part of your script.

To know more or help you more, we'd need to see the part of the script which calls SQL as well as know what you need to type into the SQL application to fulfill the needs for it.

As best as you can, instead of trying this, if you can find ways to invoke SQL with arguments in the command line which make it run to completion, that would be a more clean option.

And in direct contradiction to what I just wrote ... I got this working long ago and never modified it. There may be a better way.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Unable to run a script. fanoflq Linux - Newbie 1 10-31-2016 11:02 PM
Unable to run another command from within shell script, when run from home directory blackray1 Linux - Newbie 7 07-01-2013 09:42 AM
[SOLVED] unable to run script amartlk Linux - Newbie 4 08-02-2011 06:20 AM
Unable to run script. Unexpected token. andremun Programming 2 09-15-2008 02:47 PM
Unable to run script on Ubuntu64 donovanv Linux - Software 4 05-24-2008 09:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration