Unit shell script with Oracle
Hi guys,
I want learn Unix shell script related with oracle .
Please give me the best help link
Thanks and Regards
Dear bharat,
I could find few for you.
http://orafaq.com/scripts/index.htm#UNIX
http://examples.oreilly.com/unixoracledbapr/
http://www.oracle.com/technology/oramag/oracle/06-linuxsupp/linux_shell.html
-aijaz
Similar Messages
-
Unix Shell Scripts with Oracle
Any body who can give me the link where I can find the Unix Shell Scripts to access the Oracle database and execute the stored procedures and cursors.
Your unix script will contain (at appropriate places):
sqlplus -s username/pasword@server @your_sql_Script_that_calls_the procedure.SQLor
sqlplus -s / @your_sql_Script_that_calls_the procedure.SQL -
Hi,
i havea requirement where in i should be able to call my shell script through oracle stored procedure.i tried the following way..but iam unable to get the result.please find the details below.
new.sh - my shell script - lctfile (LCTFILE) is the input pa
v_config_file=`find $FND_TOP -name LCTFILE
FNDLOAD apps/s0ccer@$dxbs1 0 Y DOWNLOAD $v_config_file /home/bir4163/RPT33/bin/menu.ldt MENU MENU_NAME='AR_NAVIGATE_GUI'
if [ $? != 0 ];then
echo "$DATE $0 FNDLOAD DOWNLOAD Failed!" | tee -a $LOG_FILE
else
echo "SUCCESS" | tee -a $LOG_FILE
fi
CREATE OR REPLACE PROCEDURE test_dbms_scheduler
AS
v_text VARCHAR2 (255) := 'AR_NAVIGATE_GUI';
BEGIN
DBMS_OUTPUT.put_line ('I am in Procedure');
DBMS_SCHEDULER.create_job (
job_name => 'test_dbms_scheduler',
job_action => '/home/bir4163/RPT33/bin/new.sh',
number_of_arguments => 1,
job_type => 'executable',
start_date => SYSDATE,
repeat_interval => 'FREQ=SECONDLY; INTERVAL=1',
enabled => FALSE,
auto_drop => FALSE,
comments => 'run shell script'
DBMS_SCHEDULER.set_job_argument_value (job_name => 'test_dbms_scheduler',
argument_position => 1,
argument_value => v_text);
DBMS_SCHEDULER.enable ('test_dbms_scheduler');
DBMS_OUTPUT.put_line ('I am back in Procedure');
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line (SQLCODE || SQLERRM);
END;
But iam unable to test it as i do not have permissions to access dbms_scheduler.can anybody tell me how to solve this using DBMS_PIPE with a sample code.
please do help its very urgent
thanks
ramyaHi,
Register your Shell Script as a concurrent program, Executable execution method "Host", then use fnd_request.submit_request to submit the program.
Regards,
Andries -
Shell scripting for oracle DBs
looking for good source for shell scripting for oracle DBs
Just buy 'Classic Shell Scripting' and 'the Unix Desktop Reference' both published by O'Reilly and you have it all.
But if you want a platform agnostic scripting language use Perl. Comes with Oracle.
However both bash and kornshell are a lot easier compared to Perl.
Sybrand Bakker
Senior Oracle DBA -
Executing a shell script with DBMS_SCHEDULER
Hi,
when I execute a shell script with DBMS_SCHEDULER this doesn't works correctly
BEGIN
DBMS_SCHEDULER.create_job
job_name => 'job_AR',
job_type => 'EXECUTABLE',
job_action => '/home/crm/crmdw/AR/start_execution.sh',
enabled => TRUE,
start_date => systimestamp,
repeat_interval => 'FREQ=MINUTELY;INTERVAL=15',
comments => 'Test Job AR'
END;Inside the shell script there is a code who call a Hierarchy of process,
if I executed it manually or with a cron, it works perfectly
but when I execute it with the job that I've described before it's executes
all process at same time and it doesn't work.
What can I do to fix the issue,
any Ideas?
Thanks in advanced...#!/usr/bin/ksh
#test_dbms_scheduler.ksh
echo $1
echo "I am in Unix"
exit 0
chmod 755 test_dbms_scheduler.ksh
Create or replace procedure test_dbms_scheduler
as
v_text varchar2(255) := 'Parameter passed from Oracle to Unix';
Begin
dbms_output.put_line("I am in Procedure");
dbms_scheduler.create_job
(job_name=>'test_dbms_scheduler',
job_action=>'/usr/bin/test_dbms_scheduler.ksh',
number_of_arguments=>1,
job_type=>'executable',
start_date => SYSDATE,
repeat_interval => 'FREQ=SECONDLY; INTERVAL=1',
enabled=>false,
auto_drop => TRUE,
comments=> 'Run shell-script test_dbms_scheduler.ksh');
dbms_scheduler.set_job_argument_value(job_name =>'test_dbms_scheduler', argument_position => 1, argument_value => v_text);
dbms_scheduler.enable('test_dbms_scheduler');
dbms_output.put_line("I am back in Procedure");
Exception
when others then
dbms_output.put_line(sqlcode||sqlerrm);
end;
set serveroutput on
exec test_dbms_scheduler; -
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;
/ -
From Where i can help or manual about writing shell script in oracle
can any one help me to write shell script in oracle.
not sure what you meant by shell script in oracle. If ou want to write a shellscript that interacts with an oracle database, you ma want to refer to an unix programming book and sqlplus manual.
Rgds
Arvind Balaraman -
How to execucte/calll a shell script from oracle
hi all
i want to execute a shell script from oracle...... how do i do that can any one send me a good link which i can refer and learn
or if any one has already implemented anything like this plz let me know the code
RegardsHere u goooooo
http://www.experts-exchange.com/Database/Oracle/Q_21908413.html
Regards,
http://www.oracleracexpert.com
Send email using UTL_MAIL in oracle.
http://www.oracleracexpert.com/2009/11/send-email-using-utlmail-in-oracle-10g.html
Migrate Non-ASM Database to ASM using RMAN
http://www.oracleracexpert.com/2009/10/migrate-database-to-asm-using-rman.html] -
Run Shell script from oracle plsql
OS--> Linux
Version--Oracle 10g
I want to run a shell script from oracle PL/sql. I know dbms_scheduler can be used to create job , enable job and run it .
But I have a requirement where I need to know if my script ran successfully or not. Something like a return code back to oracle.
So that I can run appropriate code depending on return code of executed Script.
Kindly help !!Online documentation was invented for a reason.
And this reason was not would look it, as a volunteer, on your behalf, and post it in this forum.
All procedures are documented. There are examples for most facitlities on Asktom, and there is Morgan's Library at [http://www.psoug.org]
Sybrand Bakker
Senior Oracle DBA -
How do you pass shell scripts with cocoa?
How do you pass shell scripts with cocoa?
You asked for more detail -- I don't know if this is what you were referring to or not, but here's a little more detail on how to use the system() function if that's what you wanted to know.
As etresoft mentioned, the system() function can be useful for the kind of thing you are talking about. You will need to write the following statement at the top of your code if you want to use it:
#include <stdlib.h>
To use the system() function, simply put the command as you would write it in the Terminal between double quotes between the parenthesis. For example, something as simple as:
system("ls");
I don't what the practical use of the above statement would be, but it will run, and that's the general format for the system() function. So just put between the quotes whatever command you want to send.
Hope there was something helpful here. -
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.
-
Can we call shell script from oracle 9i?
Hi experts,
I wanted to know can we call shell script from oracle 9i procedures? If yes,how
Thanks
ShaanNo. I can't think of a way to do this...
If you want you can use DBMS_SCHEDULER to call OS SHELL scripts within.
For e.g.
CREATE PROGRAM
begin
dbms_scheduler.create_program
program_name => 'CHECK_TIME',
program_type => 'EXECUTABLE',
program_action => '/opt/oracle/chk_date.sh',
enabled => TRUE,
comments => 'Check the Time'
end;
CREATE A SHELL SCRIPT
opt/oracle> cat chk_date.sh
#!/usr/bin/ksh
echo "The date is :`date`"
CREATE SCHEDULE
begin
dbms_scheduler.create_schedule
schedule_name => 'EVERY_30_MINS',
repeat_interval => 'FREQ=MINUTELY; INTERVAL=30',
comments => 'Every 30-mins'
end;
CREATE JOB
begin
dbms_scheduler.create_job
job_name => 'RUN_CHECK_TIME',
program_name => 'CHECK_TIME',
schedule_name => 'EVERY_30_MINS',
comments => 'Run the program CHECK_TIME every 30 minutes',
enabled => TRUE
end;
MANUALLY RUN A JOB
exec dbms_scheduler.run_job('RUN_CHECK_TIME'); -
Can anybody provide AIX shell script for Oracle Apps R12 instance backup
Hi
Can anybody provide AIX shell script for Oracle Apps R12 instance backup? Manually, i am able to backup but i donot have shell script to schedule through crontab.
Help me please.
ThanksRman can be used for Database, not for Application tier. Again, I assumed you are looking for a script to backup the database. For the application tier, you can simply do a filesystem backup.
I still do not understand your concern? Is it about using crontab? If so, then check here --> man crontab <-- -
Problems with executing shell script within oracle procedure
I have procedure that's owned by Semantic user. This procedure calls job scheduler (owned by USER1) which in turn executes a shell script load_semantic.sh (owned by USER1).
Now, there is a shell script(checkCount.sh)inside of this one (owned by this USER1) that has following contents:
checkCount.sh
#!/bin/bash
MODEL=$1
sqlplus -S user/pass << EOF
whenever sqlerror exit 1;
set echo on
set verify off
MERGE INTO SEMANTIC.COUNT_STATISTICS s
USING (SELECT '$MODEL' AS MODEL, 0 AS NEW_COUNT, SYSDATE AS NEW_DATE, 0 AS OLD_COUNT, SYSDATE AS OLD_DATE FROM dual) t
on (s.MODEL = t.MODEL)
when not matched then
INSERT (s.MODEL, s.NEW_COUNT, s.NEW_DATE, s.OLD_COUNT, s.OLD_DATE)
VALUES (t.MODEL, t.NEW_COUNT, t.NEW_DATE, t.OLD_COUNT, t.OLD_DATE);
COMMIT;
UPDATE SEMANTIC.COUNT_STATISTICS SET MODEL = '$MODEL', NEW_COUNT = (SELECT COUNT(*) FROM TABLE(SEM_MATCH('{?s ?p ?o}',SEM_Models('$MODEL'),NULL,SEM_ALIASES(SEM_ALIAS('','http://VISION/DataSource/SEMANTIC#')),NULL)) ),NEW_DATE = SYSDATE,
OLD_COUNT = NEW_COUNT, OLD_DATE = NEW_DATE WHERE MODEL = '$MODEL' AND NEW_DATE = (select max(NEW_DATE) from SEMANTIC.COUNT_STATISTICS where MODEL = '$MODEL');
COMMIT;
exit;
EOF
So when I execute SEMANTIC.PROCEDURE:
SEMANTIC.PROCEDURE => USER1.JOBSCHEDULER =>USER1.load_semantic.sh =>USER1.checkCount.sh
It never populates the table SEMANTIC.COUNT_STATISTICS.
I tried giving all of the permissions but I am probably missing something...
Maybe fresh eyes can see something that I can't.I can't believe I am going to say this but the reason it was not working was because I removed oracle environment path from my script by mistake.
. /etc/profile.d/oracle.sh
Ugh...
Now it is working perfectly.
Btw, sqlplus does know about shell environment variables.
THANK YOU GUYS!!! YOU ARE THE BEST!!!!!!!!!!!!!!!!!!
I ONLY HAVE YOU TO TALK TO WHEN I AM STUCK ON A PROBLEM. -
Sqlplus in Shell Script with startup pfile
I have the following entry in my Korn shell script:
${ORACLE_HOME}/bin/sqlplus -s /nolog << EOSQL >> ${PR_LOG}
connect / as sysdba
whenever sqlerror exit sql.sqlcode;
startup pfile "/u01/app/oracle/admin/${ORA_SID}/pfile/spfile${ORA_SID}.ora";
EOSQL
When I execute the script I get the following errors:
LRM-00123: invalid character 0 found in the input file
ORA-01078: failure in processing system parameters
I've isolated the problem to the 4th line. When I change it to simply "startup", everything works. I did try changing the quotes to ` and ', but those didn't work. I even explicitly listed the ORA_SID, and I'm still getting the same error messages.
Any ideas how I can resolve my problem with the 4th line? All help is appreciated.and yes I want to start the database with the spfile.
If I just use "startup", everything is fine; and I can start the database with the spfile, because I have a symbolic link under $ORACLE_HOME/dbs to point to my actual spfile location - /u01/app/oracle/admin/salsa/pfile/So... what's the problem ? Just use "startup", if I'm not wrong you'd use the same spfile.
To use that syntax you should create a file with a line like this
spfile=<path of spfile>
and start as
startup pfile='<path of that file>'
Maybe you are looking for
-
I am either receiving emails indicating that emails sent from my computer were "undeliverable" or I getting emails from contacts stating they are receiving emails from me. When they open these emails, they have a link to a Canadian drug company.
-
Safari crashing on main account. It works fine on guest account.
I have deleted cache, reinstalled OSX. Any other ideas? It also seems to work fine when we launch from Laucnhpad. Process: Safari [703] Path: /Users/USER/Desktop/Safari.app/Contents/MacOS/Safari Identifier: com.apple.Safari
-
Calling report with desformat prt file
Hello. First some background: According to forms and reports documentation, when you want to call a character mode report (MODE=Character) when DESTYPE=FILE and DESNAME=filename using a printer definition file (prt file) you set DESFORMAT=name_of_prt
-
HT201317 How come my photo stream no longer updates photos automotically?
My phone no longer updates photos which I take automotically and the settings have not changed. I've also deleted many photos in my photostream so there's definitely enough room. My phone and laptop are also connected to wifi and icloud is on.. Can't
-
Greetings! I am new to Arch, but not necessarily to Linux. I have recently moved back from the Windows world and would like to bring over all of my data files and documents from NTFS. The problem I am having with this involves creation timestamps.