run a package through shell script
Hi trying to run a package through shell script.But it is failling. Some may point out why?
Here is the code im with
==================
sqlplus user/pwd s < < EOF
coil file.log
START the user. PKG_Name.RUN_job;
commit; END;
spool off
output
EXPRESSIONS OF FOLKLORE
===========================
I am able to run using the code below Toad.
'BEGIN user. PKG_Name.RUN_job;
commit; END; »
What error do you get? Use
sqlplus user/pwd s<>
coil file.log
START the user. PKG_Name.RUN_job;
commit; END;
/
spool off
output
EXPRESSIONS OF FOLKLORE
Kind regards.
Tags: Database
Similar Questions
-
Component sql through shell script
How to call a sql through UNIX shell script file?Rahul India wrote:
export ORACLE_HOME=$ORACLE_BASE/product/10g cd $ORACLE_HOME set `sqlplus -s
/ < THIS SCRIPT IS OK?
You will also need to set ORACLE_SID
And I don't know why everyone puts the reference to sqlplus context of a 'set' assessment, nor why they put the reference to Scripture in a redirected input stream. What you need is
sqlplus -s user/password @r_100.sql
And to make sure the environment is set correctly:
export ORACLE_SID=whatever export ORAENV_ASK=NO . oraenv unset ORAENV_ASK=NO sqlplus -s user/password @r_100.sql
-
How to connect to remote Oracle through shell script server.
Hi, I'm new to Shell scripting. I try to connect to remote oracle system, but I think Sqlplus not found error. I have sqlplus executable inside bin under oracle home, but still, I get the same error. can someone guide me to get this thing done.
export ORACLE_HOME=/opt/oracle/oracle11g/product/11.2.0
export NLS_LANG = American_America.US7ASCII
export LD_LIBRARY_PATH = $ORACLE_HOME/lib: $LD_LIBRARY_PATH
Export ORACLE_PATH = $ORACLE_HOME/bin
export PATH = $ORACLE_HOME/bin: $PATH
sqlplus-s/nolog < < EOF
connect wcadmin / [email protected]:1521 / wctest98
Select * twice;
output
EXPRESSIONS OF FOLKLOREPlease describe in more detail what you are doing. You run scripts 2 or is it in a script? If you set the variables of Oracle in a separate script, you need to run the script.
Source to run a script, the commands in the script are executed as if you type to the current command prompt. A script that is not executed source will lose the variables that you define in the script when the script stops. You can source run a script using the '. '. "
script" or "source" (bash). The export command adds variables to the environment of the executed orders later. See the following examples:
cat > shelltest <
Test1: $ a=a $ ./shelltest $ echo $a a Test2: $ export a=a $ ./shelltest a $ echo $a a Test3: $ . ./shelltest a $ echo $a b
-
Query does not not in shell scripts
Hi Experts,
I created a query to check the temp tablespace use in production servers and I wanted to run the query using shell scripts, but when I run the query in the script I get no error or output I am unale to correct where exactly, I make the mistake
This is the query
SELECT A.tablespace_name 'space', D.gb_total, ROUND (SUM (A.used_blocks * D.block_size) / 1024 / 1024/1024,2) "gb_used", ROUND (D.gb_total - SUM (A.used_blocks * D.block_size) / 1024 / 1024/1024,2) 'gb_free' v$ \sort_segment A, (SELECT B.name, C.block_size, ROUND(SUM (C.bytes) / 1024 / 1024/1024,2) 'gb_total' v$ \tablespace B, v$ \tempfile C WHERE B.ts #= C.ts # GROUP BY B.name, C.block_size) D WHERE A.tablespace_name = D.name GROUP by A.tablespace_name D.gb_total
You can help in this.
Thank you...
Basic Linux/Unix shell script format
#! / bin/sh
oracle set environment #.
Export ORACLE_HOME =...
export of SID =... or TWO_TASK = export
.. etc.
# launch sqlplus
sqlplus-s/nolog<>
Connect scott/tiger
together... environment of sqlplus
-execution of script sql (or sql query)
@script.sql
output
EXPRESSIONS OF FOLKLORE
#end script
Character $ is interpreted by the shell as environment variables, you must escape the $ character is as well as it not assimilated to the variable approx.
For example, v$ instance should be written as v$ instance.
-
Database remote stop using shell script
Hi all
I need to close a remote database through shell script. I won't know SYS password and so cannot connect directly.
I need to SSH to the remote database will define ORACLE_SID and then stop the database.
Note Please I want to achieve this without calling any other SQL or shell script I have ssh.
Pointers or help is much appreciated.
Kind regards
Nagendra ChillaleHi Nagendra,
following works for me...
SSH otherhost ".» \$home/.bash_profile
export ORACLE_SID = MYSID
echo \"shutdown abort\ | sqlplus------' / as sysdba\.
"SSH otherhost ".» \$home/.bash_profile
export ORACLE_SID = MYSID
sqlplus------' / as sysdba\.<>
startup
EXPRESSIONS OF FOLKLORE
"HTH Mathias
Published by: mzarick on August 13, 2009 11:27
-
CDF to run commands / Shell scripts
Hi friends,
I need help serious here regarding the CDF function.
I created a JAR file to run batch/shell scripts via the calculation script.
I tested the JAR file and it works perfectly well that run without the calculation script, but I get errors including in Calc script, I get the error message.
Initially, the error was: error of Machine virtual Java and later, it is class not found.
Here are the steps to register the CDF:
1. place the JAR file in the location: E:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseServer\java\udf\
2. update the file udf.policy with the following statement:
Grants all permissions to BatEx
give the code "file:${essbase.java.home}/BatEx.jar" {}
permission java.security.AllPermission;
};
3 restart the Essbase services.
4. I am trying to create this function at Global level so no mention is not the name of the Application in the MaxL at registration:
create or replace function '@BatEx' as
"BatEx.
Spec '@BatEx(Complete path in double quotes) '.
Comment "Functions A CDF that runs the batch file in Essbase Server";
5 this is the calc script:
@BatEx 'E:/Oracle/Middleware/EPMSystem11R1/common/utilities/Test.bat '; -It gives an error: error: invalid syntax 1012000 - not a command CALC [@BatEx]
I tried another way:
RUNJAVA @BatEx 'E:/Oracle/Middleware/EPMSystem11R1/common/utilities/Test.bat '; -Gives an error: problem running [@BatEx 'E:/Oracle/Middleware/EPMSystem11R1/common/utilities/Test.bat']: [can't find @BatEx class]
Where I am wrong here? Please help me out here.
Kind regards
RB
Thanks much Amit and Jake! I finally cracked!
Sad thing is that I have found no OTN correct information regarding function Java Custom, rather there was a lot of information about CDFs pre-existing provided by Oracle, so I decided to write a complete solution of CDF, where Java code too was created by the developer of Essbase applications.
The requirement that I had was to trigger the batch file in the calculation script. Here is the detailed requirement:
Update Variable of Substitution by planning web form.
1. the user enters the data in the form of the planning web and saves it.
2. the calc script attached to the web form, extracts data and records the flat file on Essbase server.
3. earlier we were executing the script batch on the web server as the workflow will identify the lots on the web server and not on Essbase server, but after the development of this CDF to run the batch job, the batch files can be run directly Essbase server.
4. the idea is to keep the user limited to the tasks list, so that it does not jump to the to-do list to SubVar web form, workflow and then return to the task list for a simple job to change SubVar.
There were a few challenges that I encountered during the development of this JAVA function, namely:
1 function CDF records do not : I tested JAVA code separately using command line and the executable Jar file will execute the batch, as expected. But I couldn't get why my CDF is not have recorded trace. After a lot of searching on Google and analysis, I found that it was the difference between the Version of JAVA (the JAVA compiler I used to compile and create my JAR file) and JAVA (JVM Essbase) virtual machine. I used JDK 1.7 update 65 to compile and create my POT so that the JVM used in the Essbase Server Update 1.6 is 35. I uninstalled JDK 1.7 of my machine, downloaded Update 1.6 35 archives of the Oracle and recompiled the code. Guess what! My CDF function was recorded first.
So always check the compatibility of the Version of the JDK you used to compile and create the JAR file and JVM on your Essbase server.
You can check the version of the JVM in console EAS-> EssbaseCluster-> right click-> Edit-> properties-> tab environment. There is a line that appears something like:
; JvmModuleLocation $J (EPM_ORACLE_HOME)-...-jdk160_35\jre\bin\server\jvm.dll (the bold is your version of the JVM).
2. "main class not found" error after successful registration of CDF:
I haven't had that one category of Public in my JAVA code and this error took me by surprise. I also checked the "public static void main" section in my code and everything seems to be OK. Please note that JAVA is case sensitive - 'hand' and 'Hand' aren't even in JAVA.
I did some further research and one of John's response to a CDF request, I came to know that I need to include another argument (context) in the main section of my Java code and recompile with classpath "essbase.jar" (I will explain the controls in the next steps). I changed the main section of my JAVA code and included the argument:
Public Shared Sub main (paramContext context, String [] paramArrayOfString)
The following JAVA code to perform the batch in Essbase Server:
import com.hyperion.essbase.calculator.Context;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
public class BatEx
{
Public Shared Sub main (context, paramContext, String [] paramArrayOfString)
{
Try
{
String str1 = paramArrayOfString [0];
LocalProcess process = Runtime.getRuntime () .exec (str1);
InputStream localInputStream1 = localProcess.getInputStream ();
OutputStream localOutputStream = localProcess.getOutputStream ();
InputStream localInputStream2 = localProcess.getErrorStream ();
BufferedReader in = new BufferedReader (new InputStreamReader (localInputStream1)) localBufferedReader;
String str2;
While ((str2 = localBufferedReader.readLine ())! = null) {}
System.out.println (str2);
}
System.out.println ("package executed successfully.");
}
catch (Exception localException)
{
System.out.println ("error!:" + localException);
localException.printStackTrace ();
}
}
}
Install the (compatible to Essbase JVM) compatible version of the JDK on your machine. Compile the above code by using the following command:
C:\ >javac - classpath essbase.jar BatEx.java - please specify the path to the file "essbase.jar". It generally to the location:
: \Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseServer\java\ The code should compile without any problem, and a .class file must be created with the same name.
Now is the time to create the JAR file. Use the following command:
C:\ >jar cf BatEx.jar BatEx.class
Now the executable JAR file must also be created.
Place this JAR file:
: \Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseServer\java\udf\ Restart the service of Essbase and application (the only Application Restarting should work, but I didn't take any chances to restart both).
Check the log of function CDF recording applications. The application log should be at the location:
: \Oracle\Middleware\user_projects\epmsystem3\diagnostics\logs\essbase\essbase\app\ - The CDF enrollment message should be something like:
External function of [GLOBAL] [@BatEx] saved OK
I used the following MaxL to register my function in Essbase:
create or replace function '@BatEx' as
"BatEx.
Spec '@BatEx (StringArray).
Comment "Functions A CDF that runs the batch file in Essbase Server"
I used the following script to calc to run my CDF (fairly simple however):
ESS_LOCALE English_UnitedStates.Latin1@Binary
RUNJAVA BatEx ""
: / Oracle/Middleware/EPMSystem11R1/common/utilities/Test.bat ";" -Note: please replacewith the name of the physical drive. I went and checked the logs that the Test.bat written and "wallah! The log file had some content and 1 KB in size. I deleted the contents of the log file and checked again, the result was the same.
Hope this answer helps all of us who work on CDF that is clean.
Please like this post if this can help you in some way.
Thanks again to Amit, Jake and John for helping me solve this puzzle.
Kind regards
Amit Kumar Singh
-
Error 1720. There is a problem with this windows package install. a script required fpr this installation to complete could not be run. Contact your provider to support personal or package. action Coustom DelAppData error script-2146828283. Argument or appeal of Microsoft VbScript runtime error: invalid procedures: "Left" line 22, column 1.
Contact the technical support for the program that you are trying to install. MS - MVP - Elephant Boy computers - don't panic!
-
Original title: problem with the Windows Installer Package
I am trying to install an update for my video FlipShare program and I get the following error message "there is a problem with this Windows Installer package. A script required for this install to complete could not be run. Contact your provider to support personal or package. Anyone has any ideas to fix this?
Would be - what your anti-virus program blocks scripts? See:
Error a Script required for this install to Complete could not be run when you run a Microsoft Fix it Solution! -Microsoft Fix it BLOG - Site Home - TechNet Blogs:
http://blogs.technet.com/b/fixit4me/archive/2009/03/31/error-a-script-required-for-this-install-to-complete-could-not-be-run-when-running-a-Microsoft-fix-it-solution.aspxRamesh Srinivasan . The Winhelponline Blog
Microsoft MVP, Windows desktop experience -
Problem to run the shell script procedure
Hello
I wrote a shell script which needs to execute the stored procedure
The shell script:
The script gets two parameters: id (1) (2) the procedure that I have to runcat bi_loading2.sh #!/usr/bin/ksh export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=/u01/app/oracle/product/11.2.0/DWH11gR2 export ORACLE_SID=DWH export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib echo "zero arg is :$0" echo "First arg is :$1" echo "Second arg is :$2" /u01/app/oracle/product/11.2.0/DWH11gR2/bin/sqlplus system/xxx@dwh << EOF insert into SYSTEM.POC_EXDATA_RESULTS values($1,'$2',sysdate,null); commit; execute system.$2; update SYSTEM.POC_EXDATA_RESULTS set end_date=sysdate where id= $1; commit; EOF exit 0
As you can see below oracle is to omit the 'run' command
Please notice why I can't run the stored procedure.
$ 83 poc_cf54xbx6cchf2 bi_loading2.shzero arg is :bi_loading2.sh First arg is :83 Second arg is :poc_cf54xbx6cchf2 SQL*Plus: Release 11.2.0.2.0 Production on Thu Dec 15 17:46:37 2011 Copyright (c) 1982, 2010, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production With the Partitioning, Automatic Storage Management and Real Application Testing options SQL> 1 row created. SQL> Commit complete. SQL> SQL> SQL> BEGIN system.poc_cf54xbx6cchf2; END; * ERROR at line 1: ORA-06550: line 1, column 17: PLS-00103: Encountered the symbol "SYSTEM" when expecting one of the following: := . ( @ % ; The symbol ":=" was substituted for "SYSTEM" to continue. SQL> SQL> 2 3 4 rows updated. SQL> Commit complete.
Read the error stack.
ORA-06512: at "SYSTEM.POC_CF54XBX6CCHF2", line 3
The error is on line 3 of the POC_CF54XBX6CCHF2 procedure
If the procedure is called.----------
Sybrand Bakker
Senior Oracle DBA -
Capture to users running sql in shell script after every 10 minutes
Hi all
We have a strange problem. crash of database, so decided to check that users make when OS/DB crashes.
I need your RACE/SCHEDULING of entry into such a script, which includes all active users with SQL running and add to a log file so that we are aware of what has past when DB/OS crashed.
I can run this race a query V$ SESSION, V$ SQL and V$ PROCESS but I need your ideas in writing a SHELL Script and scheduling can work via CRON.
Kind regards.Or better yet
sqlplus /some_report_file. 'date + %m-%d - hour %M %Y'
-
Can we not run 2 programs of sqlplus in shell script?
Hello
I have 2 coil programs that must be called from a shell script.
When I try to do, only the first reel program works but not the other. Is their any reason?
#! / usr/bin/bash
ORACLE_HOME=/Oracle10g/product/10.2.0/Client_1
Export ORACLE_HOME
sqlplus-s abcdata/daddy@DevOra < lit_fac.sh > output.log 2 > & 1
sqlplus-s abcdata/daddy@DevOra < lit_fac_cat.sh. output_cat.log 2 > & 1
output
How to run 2 scripts containing select questions each of sqlplus in another shell script?
Thanks in advance...Without trying the script, the second line
sqlplus -s abcdata/daddy@DevOra < lit_fac_cat.sh . output_cat.log 2>&1
seems to have a typo and should probably be:
sqlplus -s abcdata/daddy@DevOra < lit_fac_cat.sh > output_cat.log 2>&1
-Andy
-
Run the emca in linux shell script command
Hello everyone,
I would like to launch emca to create dbconsole in my Production database, so I have to run this command in the script, because this command causes the base of data either in passive mode.
my gaze of script like:
#/ bin/sh
Su - oraprod-c"sh /oraprod/db/tech_st/10.2.0/bin/emca - config dbcontrol db-rest create" > > /backora/log.log "
but the problem is how to interact with this command (provide the parameters of database SID, Port of the database, sys password...)And the MAIL_SERVER_NAME too. But using "" can do the trick.
Eric
-
Create SQLNET.ora file throug shell script
How to create a file sqlnet.ora through Solaris shell script?
I have a little bit of our 11g databases created by another team without sqlnet.ora files and they are now in production.
I am looking for a simple way to create a file sqlnet.ora via a solaris shell script and send it in the field to be set up by one of our certification authorities.
OR
How to write a simple SQL script to create the sqlnet.ora? Then I can create a shell script to run.
Any ideas will be appreciated?
Published by: Albert Zaza October 7, 2010 14:06Albert Zaza wrote:
The spec is a little different from what we have vascular. I need to set up some security configuration as well.
What kind of security config? It will vary from one facility to the other?
SQLNET.ora is a very simple text file. I have to agree that you should be able to just build one and then distribute it.
Maybe I didn't explain well enough.
The problem is that the work will be done my Solaris System Admin (SA) who go out once a month. He takes with him are preparing with the difference, including work on Oracle and work when the package is installed, the work of the Oracle will be as well.
So what I want is a syntax used to create the file below and then executed by a shell script when the package is installed by the SA.
#################################################
sqlnet.ora # Network Configuration file: $ORACLE_HOME/network/sqlnet.ora
# Generated by Oracle configuration tools.NAMES. DIRECTORY_PATH = (TNSNAMES, EZCONNECT)
SQLNET. INBOUND_CONNECT_TIMEOUT = 60
SQLNET. EXPIRE_TIME = 300Ok...
echo "#################################################" > $ORACLE_HOME/network/admin/sqlnet.ora echo "# sqlnet.ora Network Configuration File: $ORACLE_HOME/network/sqlnet.ora" >> $ORACLE_HOME/network/admin/sqlnet.ora echo "# Generated by Oracle configuration tools." >> $ORACLE_HOME/network/admin/sqlnet.ora echo "" >> $ORACLE_HOME/network/admin/sqlnet.ora echo "NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)" >> $ORACLE_HOME/network/admin/sqlnet.ora echo "SQLNET.INBOUND_CONNECT_TIMEOUT=60" >> $ORACLE_HOME/network/admin/sqlnet.ora echo "SQLNET.EXPIRE_TIME=300" >> $ORACLE_HOME/network/admin/sqlnet.ora
or just to have a copy of the sqlnet.ora and
cp $source_dir/sqlnet.ora $ORACLE_HOME/network/admin/sqlnet.ora
Published by: EdStevens on October 8, 2010 11:33
-
Need an example of loop with sql statement in shell script values
Hello
I have to present a simultaneous program to each line of the table through script shell (only).
The table has all the parameters required to pass to the concurrent program.
I have trouble in a loop with the lines of sql statement results.
Could someone give me an example of a shell script with a loop with the sql statement values.
appreciate your time and your help.
Thank you
Ganesh
Hello
Here is a guide using 3 parameters:
{
sqlplus-s $OA_USR / $OA_PWD<>
SET THE OFF POSITION;
SET FEEDBACK OFF;
SET LINESIZE 300;
SELECT param1, param2, param3
Of your_param_table;
ENDOFSQL
} | while reading line
do
If ['$line'] # line non-NULL
then
set $line
param1 = "$1."
param2 = "$2."
param3 = "$3."
# Pass parameters to a script, sql more
sqlplus-s $apps_usr / $apps_pwd @SUBMIT_CONC_PROG.sql $param1 $param2 $param3
FI
fact
}
In your SQL * more script you run 3 parameters into variables:
declare
VARCHAR2 (10) param1: = ' & &1';
VARCHAR2 (10) param2: = ' & &2';
param3 varchar2 (10): = ' & &3';
.....
-
pl/sql to java shell script
This issue crosses many boundaries, but it begins with PL/SQL, and I hope that there is sufficient expertise here in order to cover the basics.
System: Oracle 11.2.0.1.0 on Oracle 5, 64 - bit Linux
I have a PL/SQL, java appeal procedure, which in turn calls a shell script. I put a few diagnostic output in the shell script, the redirection of stdout to a file in / tmp. running the script from the command line works perfectly. When it is called by procedures, no output.
Here is the 'chain of traceability', somehow...
In the PL/SQL:
where the variable v_command = /opt/u01/app/oracle/admin/control/sqlldr3_test.scriptHost_Command (p_command => v_command||v_control_file||v_orasid);
So this is 'Host_command', the whole procedure procedure:
And the shell script /opt/u01/app/oracle/admin/control/sqlldr3_test.script:CREATE OR REPLACE PROCEDURE "DW"."HOST_COMMAND" (p_command IN VARCHAR2) AS LANGUAGE JAVA NAME 'Host.executeCommand (java.lang.String)';
but in the end, there is no /tmp/edstest.* file#!/bin/ksh export trcfle=/tmp/edstest.$$ export ORACLE_SID=$2 export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dwdev export PATH=$PATH:/u01/app/oracle/product/11.2.0/dwdev/bin export ORACLE_BASE=/u01/app/oracle export SQLLDR_CONTROLFILE=$1 # echo input parms are $* >> $trcfle echo environment is: >> $trcfle env|grep -i ORACLE|grep -v grep|sort >> $trcfle # exit
open to all ideas.oracle$ ls -ltr /tmp/eds* ls: /tmp/eds*: No such file or directory oracle$
I cut things down to their bases, but with the exception of the line of the high level process, the code above is finished... is that my test cut original scripts to exactly what is show. Requriement of business is to take existing scripts and remove some of the stuff that is hard coded, allowing procedures move from dev to qa to prod without hardcoded values unique to each environment.
I'm very comfortable with PL/SQL and more with shell scripts, but the java link is a black hole for me.When the proc of Java runs the external command, a child process of Unix/Linux is created for it. This process inherits the environment settings of the parent process - that would be a dedicated server process, a work process or shared in the pool of the MTS server process.
These processes have parameters of environment of bare bones and something fundamental that + $PATH + should not be approved as being valid and usable.
If the Java code should fully qualify the path to the executable file to run.
Java code should do 2 things - stdout (and stderr if possible) back to the appellant to PL/SQL as vacrhar2 of the parameters out. And return the exit code of the child process.
They help a lot in troubleshooting why an outgoing external call failed.
We use these external calls widely enough (through a number of interfaces, treatments to distance running and pulling on the release of data by the latter in the database). All driven from PL/SQL using the proc of Java to make an outgoing call. If the basics are working-, but there seems to be a constant learning and troubleshooting curve to follow to get this working in a robust way.
Maybe you are looking for
-
No sound on Equium - driver corrupted or missing (Code 39)
Hello My name is Fanta.I recently wanted to play music on my computer using windows media player, but no sound from the speakers of the laptop, I checked the Device Manager and there is a sign less next to the audio, video recorders and game when I s
-
Windows Vista - August 2010 update
Windows Vista - August 2010 update. Stuck at 17 of 18 updates. Hard drive is occupied after 17 hours of update.
-
HP Photosmart 7520 problem installation (left side black) black ink cartridge
I replaced the ink cartridges in the HP Photosmart the 7520 front unit and had no problem. It is very easy. Now, I had to replace the print cartridge black on the left side of the ink cartridges. The old man is very good, but I can't get the new cart
-
Security update for Windows XP (KB2724197) is constantly updated.
I have updated several times, but it is all a few minutes. It shows the 0Ko so I don't understand what is happening.
-
find the language bar in Thunderbird
After you download another language apart from English, I now need to change the layout of the keyboard. Have to do this in the language bar is not available when Right-click on the taskbar. Why is - this - how can I find the taskbar?