Calling sql script through shell script
Hi All
I am trying to run one shell script it will execute the sql file which is in UNIX box. Problem here i am facing is
when i submit the program through front end it taking time to execute and the status in running even for hours and hours. Manually i am terminating the concurrent program.
But when same shell script when i tried to execute in putty it generating the output with in seconds
Can you help what may be the error? I used the syntax like this
Can you help what may be the error? need to change any syntax
Thanks
Prem Raj Dasari
Edited by: Sravprem on Sep 20, 2012 12:43 AM
Pl post details of OS, database and EBS versions. In your shell script, insert this line as the first line
set -xthen run the concurrent program and paste the contents of the log of the concurrent program here
HTH
Srini
Similar Messages
-
How to execute sql-queries through shell scripting in linux?
How to execute sql-queries through shell scripting in linux?
http://www.oracle.com/technology/pub/articles/saternos_scripting.html
Two simple examples:
#!/usr/bin/env bash
set_orafra () {
orafra=`echo 'set heading off
select name from v$recovery_file_dest;
exit' | sqlplus -s / as sysdba`
set_orafra
echo $orafra
#!/usr/bin/env bash
export ORACLE_SID=instance_name
export ORACLE_HOME=/path_to_oracle_home_directory
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=/$ORACLE_HOME/bin/$PATH
$ORACLE_HOME/bin/sqlplus -s <<EOF
connect scott/tiger@my_instance_name
INSERT INTO table VALUES (sysdate);
exit
EOFEdited by: Markus Waldorf on Sep 17, 2010 12:19 AM -
How to Call Multiple Sessions through Shell scripting
Dear Members,
I have a scenario where I load data into target table from 20 different source tables.
For this I have written three procedures where there exists an bulk insert executed on a same table in every procedure. Now I have to call these procedures simultaneously so that
all three bulk loads are executed at once in different sessions.
For this I have to write a shell script which opens 3 different sessions and execute all these packages at once.
Can you guide me through.When you call sqlplus in your shell script, put a & at the end so that it runs the SQL scripts in the background. For instance:
#!/bin/bash
...oracle home stuff
$ORACLE_HOME/bin/sqlplus user/pass @script.sql &
$ORACLE_HOME/bin/sqlplus user/pass @script2.sql &
$ORACLE_HOME/bin/sqlplus user/pass @script3.sql & -
Calling SQL statements from Shell scripts
Hi,
I want to call external package procedures, declare some variables & do some oracle validations in the shell script.
How SQL environment is set in shell script & is this one time process or I have to write few statements before every SQL statement.
Please explain with an example.
Thanks..is this one time process Yes. Example :
$ cat script.sh
export ORACLE_HOME=/home/oracle/base/OraHome10
export ORACLE_SID=db102
export PATH=$ORACLE_HOME/bin:$PATH
sqlplus -s / as sysdba << EOF
select to_char(sysdate,'dd/mm/yyyy hh24:mi:ss') date_time
from dual;
exit
EOF
sqlplus -s / as sysdba << EOF
col global_name for a60
select * from global_name;
exit
EOF
$ ./script.sh
DATE_TIME
27/02/2008 11:11:27
GLOBAL_NAME
DB102
$ -
Error while calling sql loader from shell script.
In the table DBMS_SCHEDULER_JOB_RUN_DETAILS im getting the error as ""SQL*Loader-128: unable to begin a session ORA-01017: invalid username/password; logon denied""....do we need previliges for creating session of the db user????.....or wht other settings we require to do.....if the username and password used is right.
user1122577 wrote:
SQL*Loader-128: unable to begin a session ORA-01017: invalid username/password; logon deniedI don't know, but somehow the error you recived looks like ORA-01017 : )
[oracle@dell ~]$ sqlplus ring/ring
SQL*Plus: Release 10.2.0.4.0 - Production on Thu Jul 22 11:50:58 2010
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Data Mining and Real Application Testing options
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Data Mining and Real Application Testing options
[oracle@dell ~]$
[oracle@dell ~]$
[oracle@dell ~]$ sqlldr ring/ring
control = i don't have it
SQL*Loader: Release 10.2.0.4.0 - Production on Thu Jul 22 11:51:08 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
SQL*Loader-500: Unable to open file (i don't have it.ctl)
SQL*Loader-553: file not found
SQL*Loader-509: System error: No such file or directory
[oracle@dell ~]$
[oracle@dell ~]$
[oracle@dell ~]$ sqlldr ring/wrongpassword
control = i don't have it again
SQL*Loader: Release 10.2.0.4.0 - Production on Thu Jul 22 11:51:38 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
SQL*Loader-128: unable to begin a session
ORA-01017: invalid username/password; logon denied
[oracle@dell ~]$ -
Calling sql from a shell script
I have code like the following
sqlplus -s /nolog >> EOF
select 1 from dual;
EOF
Is it possible for me to pass result set to a shell variable or do I have to spool it to a file and then read the file?what is the best way to parse a multi-column, multi-row result set. lets say i have a query that has 9 rows and 2 columns.
this query was
select sysdate, 1
from user_objects
where rownum < 10
07-DEC-2007 16:01:16 1 07-DEC-2007 16:01:16 1 07-DEC-2007 16:01:16 1 07-DEC-2007 16:01:16 1 07-DEC-2007 16:01:16 1 07-DEC-2007 16:01:16 1 07-DEC-2007 16:01:16 1 07-DEC-2007 16:01:16 1 07-DEC-2007 16:01:16 1 -
Calling sql through shell script
How do i call a sql file through shell script in unix ?
Rahul India wrote:
export ORACLE_HOME=$ORACLE_BASE/product/10g
cd $ORACLE_HOME
set `sqlplus -s <SCHEMA_NAME>/<SCHEMA_PASSWORD> <<EOF
@r_100.sql
exit;
EOF`THIS SCRIPT IS OK?You'll also need to set ORACLE_SID
And I don't know why everyone is putting the reference to sqlplus inside a "set" valuation, nor why they are putting the reference to the script in a redirected input stream. All you need is
sqlplus -s user/password @r_100.sqlAnd to insure the invironment is correctly set:
export ORACLE_SID=whatever
export ORAENV_ASK=NO
. oraenv
unset ORAENV_ASK=NO
sqlplus -s user/password @r_100.sql -
How we can call or execute a SHELL script through Oracle forms or Reports
How we can call or execute a SHELL script through Oracle forms or Reports.Its urgent.......
Use HOST command.
-
Pl/sql procedure with shell script
Hi Guys,
I will be updating some of the columns in the database thru SQL UPDATE stament. I want to make this process automatic. I.e instead of running manually this uodate process, i want to write a unix script which run on cron job. In the update stament I have to compare date like e_create_date > to_date (........, 'yymmdd') and date should be 2 days previous then to date and I would ike to create the spool file which I would like to send through mail.the script will run automatically.
I am confused how to write shell script & sql procedure and how to call it inside the shell script. How can this be done.
Help Appreciated.
Thanks
sonusave the Store procedure as a create_SP.sql in OS
save another testrun.sql
as follows
begin
sp_test('&p_test');
end;
If you are on a Unix or Solaris OS then
open a Shell Script as follows :
and name as test.sh or test.ksh
var='SYSTEM'
export var
sqlplus username/password
@create_SP.sql
-- this created a store procedure on the database
@testrun.sql $var
This will execute the SP with parameter from OS Variable. -
Unable to see the sql serveroutput from shell script
Hello experts,
I have a shell script which I am using to call a pl/sql proc.
This proc writes to dbms_output.
I would like to capture the dbms_output to a file when calling sqlplus from my shell script.
Here is the code:
===============================
echo "
sqlplus apps/$APPS_PWD << ENDOFSQL
set serveroutput ON
set feedback off
set verify off
set linesize 250
set pagesize 250
begin
jdr_utils.listcustomizations('$i');
end;
exit
ENDOFSQL
" >> new.log
===============================
What I get in the 'new.log' is given below:
===============================
sqlplus apps/prj08app << ENDOFSQL
set serveroutput ON
set feedback off
set verify off
set linesize 250
set pagesize 250
begin
jdr_utils.listcustomizations('/oracle/apps/irc/candidateSelfService/webui/VisVacDispPG');
end;
exit
===============================
ENDOFSQL
What I would like to get is the dbms_output given by the procedure.
Please suggest.
Thanks,
VinodVinod wrote:
Hello experts,
I have a shell script which I am using to call a pl/sql proc.
This proc writes to dbms_output.
I would like to capture the dbms_output to a file when calling sqlplus from my shell script.
Here is the code:
===============================
echo "
sqlplus apps/$APPS_PWD << ENDOFSQL
set serveroutput ON
set feedback off
set verify off
set linesize 250
set pagesize 250
begin
jdr_utils.listcustomizations('$i');
end;
exit
ENDOFSQL
" >> new.log
===============================
What I get in the 'new.log' is given below:
===============================
sqlplus apps/prj08app << ENDOFSQL
set serveroutput ON
set feedback off
set verify off
set linesize 250
set pagesize 250
begin
jdr_utils.listcustomizations('/oracle/apps/irc/candidateSelfService/webui/VisVacDispPG');
end;
exit
===============================
ENDOFSQL
What I would like to get is the dbms_output given by the procedure.
Please suggest.
Thanks,
VinodYou need to realize & understand that EVERY command line command runs in its own separate OS process.
So the results from DBMS_OUTPUT get sent to Standard Out for the sqlplus process; which is NOT attached to your terminal.
The bottom line is you can't get there from here. -
Calling HTML File in Shell Script.
Hi
I have a shell script and a HTML file.
HTML file is to create a Table.
the HTML Script is as follows
<html>
<body>
<table border="1">
<tr>
<td>Requisition Number</td><td>$PARAM0</td>
</tr>
<tr>
<td>Purcahse Order Number</td><td>$PARAM4</td>
</tr>
<tr>
<td>Purchase Line Number</td><td>$PARAM5</td>
</tr>
<tr>
<td>Hold Reason</td><td>$PARAM3</td>
</tr>
<tr>
<td>Hold Date</td><td>$PARAM2</td>
</tr>
</table>
</body>
</html>
The output of this HTML file is a table with 5 rows and 2 columns.
I saved this file as mail.html and placed it in the server where i have placed the Shell Script.
When i call this HTML in Shell Script ... as follow
cat /FND_TOP/bin/mail.html
the output is not the table but infact the html tags are displayed.
I need the table when i run this shell script.
It would be of great help if anyone has a good solution for this.
Thanks in AdvanceFirst, you need to put the file where your httpd server (you will need apache running) can find it. This is usually some place like:
/var/www/html/table.htmlThen use a text-mode browser as Frits suggested to render it so your script can read it:
#!/bin/sh
lynx -dump http://localhost/table.html | while read row; do
echo "${row}"
doneor how ever you want to process the data.
Another approach is to use XML transformations. First write an XML stylesheet:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/02/xpath-functions" version="1.0">
<xsl:output indent="no" method="text" standalone="yes" version="1.0"/>
<xsl:template match="*">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="td">
<xsl:text> </xsl:text>
<xsl:value-of select="normalize-space()"/>
</xsl:template>
</xsl:stylesheet>and then run your HTML through the {font:Courier}xsltproc{font} processor:
$ xsltproc table.xsl table.html
Requisition Number $PARAM0
Purcahse Order Number $PARAM4
Purchase Line Number $PARAM5
Hold Reason $PARAM3
Hold Date $PARAM2To be neat, I have omitted the many blank lines that were also output.
HTH -
Creating user account and setting password in Solaris9 through shell script
I need to create and set password of user through shell scripts.
User can be added successfully through "useradd" command but password cant be set through "passwd" command in script.
Is there any other alternative for the same.Hi,
Did you get the answere for this ? I have the same problem as urs , like I want to creat the users by using useradd and want to hardcode there password in one script.
But I cant use expect utility which would have made my work easier -
Reading contents of asm through shell script
How to read contents of asm through shell script?
Please paste one small example also.
Thanks
BalaHello Bala,
The ASM contents is not visible from the operating system or its utilities. Only visible to database instances, RMAN, and other Oracle-supplied tools.
Please see http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/glossary.htm#sthref4105
Regards,
Rodrigo Mufalani
http://mufalani.blogspot.com -
Can I call host file ( Unix Shell script ) from Oracle 10g trigger
Hi,
I am new to Oracle 10g. Can I call host file ( unix shell script ) from Oracle 10g trigger ?. I know it is possible. Pl explain me with small example
thanks & regards
paraguser12009546 wrote:
Hi,
I am new to Oracle 10g. Can I call host file ( unix shell script ) from Oracle 10g trigger ?. I know it is possible. Pl explain me with small example
thanks & regards
paragIf you are in 10g, you can simple call shell script from DBMS_SCHEDULER:
BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'TEST_SCRIPT',
job_type => 'EXECUTABLE',
job_action => 'PATH_OF_YOUR_SCRIPT',
start_date => SYSDATE,
repeat_interval => 'FREQ=MINUTELY; INTERVAL=1',
enabled => TRUE,
comments => 'Shell script from Oracle'
END;
/ -
Issues in calling Sql Loader through forms developer (10g)
Hi,
I am developing a form(in 10g) ,in which I am calling sql loader for loading data onto a oracle database table from external source (e.g. data file is a .CSV file).
But , somehow the sql loader is not getting executed.
Here , I am giving the environment settings , approach i am taking;
This is a distributed system , both the application server,and database server are mounted on two different servers.
The form is delpoyed on the application server.
The database table , and the sql loader are configured on the databse side.
I am using host(<sql loader command>) command to invoke the Operating System command through forms.
The sql loader is working ok , and the data is getting loaded successfully onto the required database table when I am executing the sql loader command on Unix prompt , but through the forms , it's not working.
Do I need to change some environmental setting to make this work...
Any quick help in this regard is highly appreciated.
Thanks.Hi Craig,
I have already tried out the option of calling sql loader through stored procedure,but this is not working ...
could you please share any examples to do so ...
code snippet i am using in forms:
declare
usid get_application_property(userid);
pwd get_application_property(password);
db get_application_property(host);
msqlldr varchar2(250);
begin
msqlldr:='/u01/oracle/formss/bin/sqlldr' username=<uid/pwd@db> control=<control file name> data=<data file name> log=<log file name>
hosts(msqlldr);
end;
Note that sqlldr command ,for that matter any unix shell command is not working through the hosts() command ...
could you please suggest any way out ...
Thanks.
Maybe you are looking for
-
I do not like the new iphoto, it will not let you burn a photo cd directly from iphoto like it used to. It use to be simple, now it's not. I also think the faces feature is a waste of time and you can't disable it. Overall i am not happy with this ne
-
Mail Session configuration authorization
Hi, I hava deployed the confirmer app from tutorial. I got exception when sending a message saying I have to use authorization. I know how to do it the hard way (in code obtain other mail session) I tried to add a single property to the mail session,
-
Numbers on my iOS devices have recently been updated but not on my iMac is this correct ?
Numbers on both our iPads and our iPhone were recently updated but there has been no update for our iMac is this correct ?
-
Hi I am using apache.common.fileupload and managed to upload multiple images to my server; Following is my code, I rename my files before I save them. %> // String imageid = request.getParameter("imgageID"); boolean isMultipart = ServletFileUplo
-
I just updated to the new version of Firefox. I now cannot access two sites that I previously including gwweb.pwcs.edu and fafsa.gov. I need to be able to access them and for some reason I am no longer able to. Can you please help? Thanks, Artise Gil