Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

shell script exiting before completing

Shell Programming and Scripting


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 07-02-2009
welldone welldone is offline
Registered User
 
Join Date: Jun 2009
Last Activity: 17 July 2014, 11:19 AM EDT
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
shell script exiting before completing

I have a script which has the following statement,

/opt/oracle/product/9i/bin/sqlplus << EOC >> $LOG_FILE 2>&1
username/password ---- Enters the SQL prompt
@/export/home/oracle/shells/grant_userview.sql ---Runs the SQL script
@/export/home/oracle/shells/grant_proc_userview.sql ---Runs the SQL script
@/export/home/oracle/shells/createindex.sql ---Runs the SQL script
exit --- Exits the SQL prompt
EOC

imp system/password file=/oradata/temp/user.dmp fromuser=user 1 touser=user2 indexes=y log=user.log -- Runs on $ prompt.

The statement in red above doesnt run. When run out of the script manually it succeeds, I am trying to figure if i have to move this "exit" below the last line, Please advice
Sponsored Links
    #2  
Old Unix and Linux 07-02-2009
Scott's Unix or Linux Image
Scott Scott is offline Forum Staff  
Administrator
 
Join Date: Jun 2009
Last Activity: 20 October 2017, 3:31 AM EDT
Location: Zürich
Posts: 8,750
Thanks: 356
Thanked 1,161 Times in 995 Posts
Does it produce an error?

(and what is the 1 between the fromuser and touser part)?

Code:
fromuser=user 1 touser=user2

Just as a thought: Is that imp command you show exactly the command you run from the script, or is the username/password, for example, in a variable? If so, did you export the varaible?

The exit isn't neccessary either in the SQL*Plus or the script. You should replace it with a / in the SQL.
Sponsored Links
    #3  
Old Unix and Linux 07-02-2009
fpmurphy's Unix or Linux Image
fpmurphy fpmurphy is offline
Registered User
 
Join Date: Dec 2003
Last Activity: 12 June 2016, 11:03 PM EDT
Location: /dev/ph
Posts: 4,996
Thanks: 73
Thanked 475 Times in 437 Posts
What happens if you add the full pathname to imp?
    #4  
Old Unix and Linux 07-02-2009
welldone welldone is offline
Registered User
 
Join Date: Jun 2009
Last Activity: 17 July 2014, 11:19 AM EDT
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Hi Scottn/fpmurhpy,

No there is no export of username/password required in the script because it contains the original username and password.

This script was running and since couple of days it terminates and doesnt run that imp command.

Thanks.
Sponsored Links
    #5  
Old Unix and Linux 07-02-2009
Scott's Unix or Linux Image
Scott Scott is offline Forum Staff  
Administrator
 
Join Date: Jun 2009
Last Activity: 20 October 2017, 3:31 AM EDT
Location: Zürich
Posts: 8,750
Thanks: 356
Thanked 1,161 Times in 995 Posts
What does user.log say?

Remove the exit anyway, as it's not required.
Sponsored Links
    #6  
Old Unix and Linux 07-02-2009
vidyadhar85's Unix or Linux Image
vidyadhar85 vidyadhar85 is offline Forum Advisor  
The Tutor
 
Join Date: Jun 2008
Last Activity: 24 April 2017, 5:14 AM EDT
Location: INDIA, Bangalore
Posts: 2,050
Thanks: 16
Thanked 105 Times in 102 Posts
file=/oradata/temp/user.dmp
is this file available in that location..
Sponsored Links
    #7  
Old Unix and Linux 07-02-2009
radoulov's Unix or Linux Image
radoulov radoulov is offline
Registered User
 
Join Date: Jan 2007
Last Activity: 9 January 2017, 4:40 AM EST
Location: Варна, България / Milano, Italia
Posts: 5,690
Thanks: 184
Thanked 630 Times in 587 Posts
Quote:
Originally Posted by welldone View Post
[...]
This script was running and since couple of days it terminates and doesnt run that imp command.
If you enable tracing, you should be able to see what happens.
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Exiting a script lassimanji Shell Programming and Scripting 7 05-05-2009 02:02 PM
Shell script..invoking command and exiting at fixed intervals rajuak12 Shell Programming and Scripting 1 07-19-2008 09:34 AM
Shell script not exiting Gracefully smithK Shell Programming and Scripting 5 02-08-2007 05:48 PM
Terminate session on completing script deepsteptom Shell Programming and Scripting 4 06-08-2004 10:47 AM



All times are GMT -4. The time now is 06:33 AM.