DBMS_SCHEDULER.run_job problem
Hi friends.I have one problem. I use Oracle 10g(r2) in oracle enter.server. Also I can execute backupdb.sh script from terminal
success.But I created Job sheduler as
BEGIN
DBMS_SCHEDULER.CREATE_JOB
job_name => 'BACKUP_DB_JOB',
job_type => 'EXECUTABLE',
job_action => '/orahome/orastart/./backupdb.sh',
start_date => '13-jan-2010 6:32 PM',
repeat_interval => 'FREQ=DAILY'
END;
although i execute following
begin
DBMS_SCHEDULER.run_job (job_name=>'BACKUP_DB_JOB');
end;
then occur error [1]: (Error): ORA-27369: job of type EXECUTABLE failed with exit code: 274660 ORA-06512: at "SYS.DBMS_ISCHED", line 150 ORA-06512: at "SYS.DBMS_SCHEDULER", line 441 ORA-06512: at line 4
also i see detail information from dba_scheduler_job_run_details.ADDITIONAL_INFO described as
ORA-27369: job of type EXECUTABLE failed with exit code: 274660
STANDARD_ERROR="Oracle Scheduler error: Not running as extjob or extjobo."
there are for extjob following
ls -l $ORACLE_HOME/bin/extjob
-rwsr-x--- 1 root oinstall 64842 Oct 15 06:58 /orahome/oracle/product/10.2.0/db_1/bin/extjob
and
ls -l $ORACLE_HOME/rdbms/admin/externaljob.ora
-rw-rwxr-- 1 640 oinstall 1536 Jan 19 15:08 /orahome/oracle/product/10.2.0/db_1/rdbms/admin/externaljob.ora
why that error happen?
See the below forum for solution
Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch files
Hope this helps,
Regards
http://www.oracleracexpert.com
Click here for [Block Corruption and recovery|http://www.oracleracexpert.com/2009/08/block-corruption-and-recovery.html]
Click here for [Redo log corruption and recovery|http://www.oracleracexpert.com/2009/08/redo-log-corruption-and-recovery.html]
Similar Messages
-
Error While Running DBMS_SCHEDULER.RUN_JOB in Oacle 11g DB in LINUX ENvirnoment
Dear ALL,
I have two separate Server, One is App. Server which is on WINDOWS 2008 and the DB server on LINUX. I'm created a job for Daily logical Backup of Database through EXP command on DB Server.
I have created DBMS_SCHEDULER.CREATE_JOB with JOB_ACTION /home/oracle/wms_dbdmp/auto_backup.sh the Location of .sh file which contain the following code
#!/bin/bash
exp test/test@orcl file=/home/oracle/wms_dbdmp/test.dmp log=/home/oracle/wms_dbdmp/test.log compress=N rows=Y grants=Y owner=(test) statistics=NONE
ECHO "Export done successfully..."
Exit 0
Now i created job successfully, but when i'm invoking this .sh file through DBMS_SCHEDULER>RUN_JOB('backup_01');
I'm facing error which are given as-
ORA-27369: job of type EXECUTABLE failed with exit code: Permission denied
ORA-06512: at "SYS.DBMS_ISCHED", line 185
ORA-06512: at "SYS.DBMS_SCHEDULER", line 486
ORA-06512: at line 1
I did this on WINDOWS Environment Successfully. I'm naive user for LINUX Envirnoment SO Please Guide me to rid off to this problem.
I will be very thank full to all...I wrote the script as
#!/bin/bash
exp test/test@orcl file=/home/oracle/wms_dbdmp/test.dmp log=/home/oracle/wms_dbdmp/test.log compress=N rows=Y grants=Y owner=(test) statistics=NONE
exit 0
But it didn't work through procedure....how to invoke .sh file through db procedure...? -
Button process with DBMS_SCHEDULER.run_job
Hi,
I need to execute the DBMS_SCHEDULER.run_job on click of a button .
I tried creating a process (On submit) with DBMS_SCHEDULER.run_job('JOBNAME')
when i tried executing directly in db there is no problem, but when i create the process in apex i am running into the following error
ORA-06550: line 2, column 19: PLS-00222: no function with name 'RUN_JOB' exists in this scope ORA-06550: line 2, column 1: PL/SQL: Statement ignored
Anybody have tried this before?? is there a way around or am i getting this wrong?
Thanks,Resolved,
I had to specify the current session state while executing the scheduler job
In my case i made it false
BEGIN
-- Run job synchronously.
DBMS_SCHEDULER.run_job (job_name => 'JobName',
use_current_session => FALSE);
END;
Thanks -
Dbms_scheduler.run_job doesn't work
Hi,
We are currently using dbms_scheduler to execute linux system command. It works all fine before I update our database from 10.2.0.3 to 10.2.0.4. Now if we choose dbms_scheduler.run_job with parameter use_current_session => true, the following error occurs:
ORA-27370: job slave failed to launch a job of type EXECUTABLE ORA-27300: OS system dependent operation:getting external job pid failed with status: 2 ORA-27301: OS failure message: No such file or directory ORA-27302: failure occurred at: sjsec 6a
While we change use_current_session => false, everything works again.
As a result, we have to drop the job with force => true. Then the job details are not listed in view all_scheduler_job_run_details. wow, it seems like a bomb chain. Now everything need to be done in different way. Does anyone know why it will come and how to fix it?
Regards,
LikHi Lik and Ravi,
I'm in a similar situation but haven't managed to get it fixed.
Lik, what exactly did you do to the $ORACLE_HOME/bin dir to get it working again?
I've recently upgraded to 10.2.0.4 from 10.2.0.2 on Linux and I'm hitting problems running jobs.
Oracle is the os user executing the job.
My permissions on the three files you mention to check look ok:
-rwsr-x--- 1 root oinstall 64258 2008-06-17 10:45 /opt/app/oracle/product/10.2.0/db_1/bin/extjob
-rwxr-xr-x 1 oracle oinstall 64258 2008-06-17 10:45 /opt/app/oracle/product/10.2.0/db_1/bin/extjobo
-rw-r--r-- 1 root oinstall 1534 2005-12-22 13:39 /opt/app/oracle/product/10.2.0/db_1/rdbms/admin/externaljob.ora
THe Oracle bin dir has execute permissions also:
drwxr-xr-x 2 oracle oinstall 12288 2008-06-18 12:21 bin
I've looked through your guide also, but no luck with the suggestions mentioned there.
I still get this message when I execute the job (oracle is executing it):
ORA-27370: job slave failed to launch a job of type EXECUTABLE
ORA-27300: OS system dependent operation:getting external job pid failed with
status: 2
ORA-27301: OS failure message: No such file or directory
ORA-27302: failure occurred at: sjsec 6a
ORA-06512: at "SYS.DBMS_ISCHED", line 150
ORA-06512: at "SYS.DBMS_SCHEDULER", line 441
ORA-06512: at line 1
Also, if I create a test job, it does execute the script, as I can see that /tmp/testjob.out is created.
-rw-r--r-- 1 nobody nobody 15 2008-06-18 14:01 /tmp/testjob.out
however, I still get the error message from Oracle:
ERROR at line 1:
ORA-27370: job slave failed to launch a job of type EXECUTABLE
ORA-27300: OS system dependent operation:getting external job pid failed with
status: 2
ORA-27301: OS failure message: No such file or directory
ORA-27302: failure occurred at: sjsec 6a
ORA-06512: at "SYS.DBMS_ISCHED", line 150
ORA-06512: at "SYS.DBMS_SCHEDULER", line 441
ORA-06512: at line 1
This is the script:
#!/bin/ksh
echo "THIS IS A TEST" > /tmp/testjob.out
exit 0
Is there anything else I can try?
Thanks,
Owen.
Message was edited by:
owen00 -
Error In Running dbms_scheduler.run_job ORA-27369.
Dear Sir
I am trying to execute one batch file from one schedule which imports the data using imp command now my files look like this
*****************imp.bat ***************
imp treasury/tisnic@orcl FILE="C:\data\gis031164.dmp" LOG="C:\data\imp_gis031164.log" FULL=Y IGNORE=Y FEEDBACK=1000
*********************job created with bellow code *******************************
begin
DBMS_SCHEDULER.CREATE_JOB (
job_name=> 'myjob',
job_type=> 'EXECUTABLE',
job_action=> 'c:\windows\system32\cmd.exe /c c:\imp.bat',
enabled=> TRUE,
auto_drop=>false,
start_date => sysdate + 9999
commit;
end;
now when i run my job with bellow command
begin
dbms_scheduler.run_job('myjob');
end;
it gives me error as follow
ERROR at line 1:
ORA-27369: job of type EXECUTABLE failed with exit code: Incorrect function.
ORA-06512: at "SYS.DBMS_ISCHED", line 148
ORA-06512: at "SYS.DBMS_SCHEDULER", line 374
ORA-06512: at line 2
kindlly help as i have tried all your solutions in so many threads but same issue not finding any solution for my problem
Thanks & Regards
AashishDear sir
Actually my motive is to execute one shell script which imports all datafile (exported .dmp) files stored in specific folder and i need to run that job on my form 10g button click trigger but its not working ..
***********************************Job name : importjob*****************************************
begin
DBMS_SCHEDULER.CREATE_JOB (
job_name=> 'importjob',
job_type=> 'executable',
job_action=> '/u1/datafile/imp.sh',
enabled=> TRUE,
auto_drop=>false
commit;
end;
1. when i tried to run above job with bellow code it gives me error
begin
DBMS_scheduler.run_job('importjob');
end;
" ORA-27369: job of type EXECUTABLE failed with exit code: 255 "
2. but when i tried to excute that shell script directly from server like bellow
$ /u1/datafile/imp.sh
it works fine and do what i want
permission to my shell scrpit and complete datafile (folder) is set to
chmod 777 -R /u1/datafile
chmod 777 -R /u1/datafile/imp.sh
now seniors please kindly help me to get my problem resolved and bellow is me files which i used in complete procedure
***************************file name : imp.sh.env *************************************
source /u/upsegid/dbtreasury.env
for i in `ls *.dmp.gz`
do
echo $i
gunzip $i
done
for i in `ls *.dmp`
do
imp parfile=imp1.par file=$i
echo ' ' >>impall.log
echo $i >> impall.log
echo ' ' >>impall.log
cat imp1.log >> impall.log
mv $i ./u1/backup/
gzip ./u1/backup/$i
done
# Remeber to change dates in vdtfinal.sql and vdtdaily.sql file for Plan Data
# Remeber to change date in vdtfinal.sql and vdtdaily.sql file for deleting previous Month Data From Koshtb
# cd ../sqls/vdt1011
#sqlplus vdt1011/mn1346@treasury @vdtfinal
exit
***************************file name : dbtreasury.env *************************************
ORACLE_BASE=/u/apps; export ORACLE_BASE
ORACLE_HOME=/u/apps; export ORACLE_HOME
PATH=$PATH:$ORACLE_HOME/bin:/usr/bin:/bin:.;export PATH
ORACLE_SID=orcl; export ORACLE_SID
TERM=treasury; export TERM
ORACLE_TERM=xterm; export ORACLE_TERM
NLS_LANG=AMERICAN; export NLS_LANG
ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data; export ORA_NLS33
ORACLE_PATH=$PATH:$ORACLE_HOME/bin; export ORACLE_PATH
LD_LIBRARY_PATH=$PATH:$ORACLE_HOME/lib:/usr/lib:/lib:.;export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib
#DISPLAY=apps:0.0; export DISPLAY
TMPDIR=/tmp; export TMPDIR
TMP=/tmp; export TMP
TEMP=/tmp; export TEMP
TEMPDIR=/tmp; export TEMPDIR
Now sir kindly help me what and were i am doing wrong because i need to done this any how -
DBMS_SCHEDULER.RUN_JOB causes scheduled job not to run again
Environment: 10.2.0.2 Linux 64-bit
Hi,
I have some DBMS_SCHEDULER chain jobs scheduled to run every hour which has been running fine with no issues for a while now.
I needed to run a couple of jobs manually in-between scheduled times so I ran the job using DBMS_SCHEDULER.RUN_JOB, and that worked as expected as it has done in the past.
This issue is that the jobs I ran manually haven't run at their scheduled time since I did that. The only way around it was to recreate the job completely.
Any idea if this is normal functionality, or should I be raising this as a possible issue through Oracle Metalink?
Any help or ideas would be much appreciated.
Thanks
TimHi Tim,
This is a known bug which is tracked internally by bug #5705385. It will be fixed in the next patchsets for 10.2 and 11.1 (i.e. 10.2.0.5 and 11.1.0.7) . If you urgently need a fix, an official patch seems to be available for 10.2.0.3 .
There does seem to be a workaround - using run_job again after the first run_job has completed will not do anything but the chain job should again run on schedule.
Hope this helps,
Ravi. -
On the 11g db that I have access to, I'm seeing different systimestamp value while running plsql block using
dbms_scheduler.run_job with use_current_session = true and false.
My job looks like following.
dbms_scheduler.create_job(
job_name => 'tk2timestamp_test',
job_type => 'PLSQL_BLOCK',
job_action => 'begin insert into tktest values (systimestamp, to_char(sysdate, ''DD-MON-YYYY HH24:MI:SS''), current_timestamp, localtimestamp, dbtimezone, sessiontimezone); end;',
enabled => true,
auto_drop => false);
I see that UTC time was returned as systimestamp if it is called with true and PST if it is called with false.
In the same session, I get following result with select statement.
select systimestamp, current_timestamp, localtimestamp, dbtimezone, sessiontimezone from dual;
SYSTIMESTAMP CURRENT_TIMESTAMP LOCALTIMESTAMP DBTIMEZONE SESSIONTIM
27-MAR-13 04.05.59.914647 PM +00:00 27-MAR-13 09.05.59.914650 AM -07:00 27-MAR-13 09.05.59.914650 AM +00:00 -07:00
Can any one let me know why this is happening? Why systimestamp value is not PST if use_current_session = true?Thank you again for your response.
I've got following result.
SQL> SELECT SYSTIMESTAMP FROM dual;
SYSTIMESTAMP
28-MAR-13 07.13.08.556079 PM +00:00
SQL> SELECT SYSTIMESTAMP AT TIME ZONE 'PDB' FROM dual;
SELECT SYSTIMESTAMP AT TIME ZONE 'PDB' FROM dual
ERROR at line 1:
ORA-01882: timezone region not found
SQL> SELECT SESSIONTIMEZONE,CURRENT_TIMESTAMP, LOCALTIMESTAMP FROM dual;
SESSIONTIM CURRENT_TIMESTAMP LOCALTIMESTAMP
-07:00 28-MAR-13 12.13.41.196653 PM -07:00 28-MAR-13 12.13.41.196653 PM
BTW, I have two instances returns the result like this if this information helps.
I've created following table in order to help proving something is changing whether I pass true or false to use_current_session parameter when calling dbms_scheduler.run_job.
create table tktest (tksystimestamp timestamp(6), tktocharsysdate varchar2(100), tkcurrent_timestamp timestamp(6), tklocaltimestamp timestamp(6), tldbtimezone varchar2(100), tksessiontimezone varchar2(100));
Then I created job as following. This job inserts systimestamp,sysdate,current_timestamp,localtimestamp,dbtimezone, and sessiontimezone to above table.
begin
dbms_scheduler.create_job(
job_name => 'tk2timestamp_test',
job_type => 'PLSQL_BLOCK',
job_action => 'begin insert into tktest values (systimestamp, to_char(sysdate, ''DD-MON-YYYY HH24:MI:SS''), current_timestamp, localtimestamp, dbtimezone, sessiontimezone); end;',
enabled => true,
auto_drop => false);
exception
when others then
null;
end;
Run the job using run_job procedure.
exec dbms_scheduler.run_job(job_name => 'tk2timestamp_test',use_current_session => true);
Above inserts following record in tktest.
SYSTIMESTAMP SYSDATE CURRENT_TIMESTAMP LOCALTIMESTAMP DBTZ SESSIONTZ
28-MAR-13 07.04.58.227616 PM 28-MAR-2013 19:04:58 28-MAR-13 07.04.58.227617 PM 28-MAR-13 07.04.58.227617 PM +00:00 +00:00
Run the job using run_job procedure again but use 'use_current_session => false' this time.
Above inserts following record in tktest.
SYSTIMESTAMP SYSDATE CURRENT_TIMESTAMP LOCALTIMESTAMP DBTZ SESSIONTZ
28-MAR-13 12.05.24.150817 PM 28-MAR-2013 12:05:24 28-MAR-13 12.05.24.150819 PM 28-MAR-13 12.05.24.150819 PM +00:00 -07:00
I also run following from the same session.
SQL> select systimestamp, current_timestamp, localtimestamp, dbtimezone, sessiontimezone from dual;
SYSTIMESTAMP CURRENT_TIMESTAMP LOCALTIMESTAMP DBTZ SESSIONTZ
28-MAR-13 07.05.40.640499 PM +00:00 28-MAR-13 12.05.40.640503 PM -07:00 28-MAR-13 12.05.40.640503 PM +00:00 -07:00
So why executing dbms_scheduler.run_job with 'use_current_session => false' causes SEESSIONTIMEZONE to be PST8PDT?
I have an another instance pointing all the time based on UTC and my question is why only above instance is showing result like above and what causes it.
thx. -
Error In Running dbms_scheduler.run_job ORA-27369 with psexec.
I'm using dbms_scheduler in Oracle 10g on Windows 2008 (32-bit).
A recent application upgrade moved a portion of my work to a Windows 2008 R2 64-bit server.
Becuase of this I had to move some processing to this server.
When the internal processes within the batch files ran locally, everything functioned properly.
However, when I used 'psexec' to run them remotely on the other server, they crashed.
The batch processes work perfectly fine on the OS level. I believe the issue may have something to do with return code, but I'm not sure.
JOB:
BEGIN
DBMS_SCHEDULER.Create_Job(
Job_Name => 'SCENEXPORT',
Job_Action => 'C:\WINDOWS\SYSTEM32\CMD.EXE',
Number_of_Arguments=> 3,
Job_Type => 'EXECUTABLE',
Enabled => false);
DBMS_SCHEDULER.Set_Job_Argument_Value('SCENEXPORT',1,'/q');
DBMS_SCHEDULER.Set_Job_Argument_Value('SCENEXPORT',2,'/c');
DBMS_SCHEDULER.Set_Job_Argument_Value('SCENEXPORT',3,'E:\DBAAdmin\Hastus\PSoft\Test\Hastus\Extract\ScenariosR.bat');
END;
BATCH: (ScenariosR.bat)
psexec \\test236 -u <username> -p <pwd> e:\DBAAdmin\Hastus\PSoft\Test\Hastus\Extract\Scenarios1.bat
ERROR:
ERROR at line 1:
ORA-27369: job of type EXECUTABLE failed with exit code: Incorrect function.
ORA-06512: at "SYS.DBMS_ISCHED", line 150
ORA-06512: at "SYS.DBMS_SCHEDULER", line 441
ORA-06512: at line 2
Anyone else working with 'PSEXEC'?
Any ideas how to work through this issue?
Thanks.
BillI appreciate the attempt. However, it does not address a Windows environment.
In addition, ‘exertnaljob.ora’ does not exist in a Windows 10g install.
If the Windows similar is the Windows Service Oracle JobScheduler, it is already using an admin level account and should not be encountering permissions issues.
So, swing and a miss.
Thanks,
Bill
Additional testing revealed some strange behavior.
When I run it the first time, it fails.
When I run it immediately after the first failure, it fails.
However if I wait about ten minutes, it completes without issue.
SQL> BEGIN
2 DBMS_SCHEDULER.RUN_JOB ('SCENEXPORT');
3 END;
4 /
BEGIN
ERROR at line 1:
ORA-27369: job of type EXECUTABLE failed with exit code: Incorrect function.
ORA-06512: at "SYS.DBMS_ISCHED", line 150
ORA-06512: at "SYS.DBMS_SCHEDULER", line 441
ORA-06512: at line 2
SQL> /
BEGIN
ERROR at line 1:
ORA-27369: job of type EXECUTABLE failed with exit code: Incorrect function.
ORA-06512: at "SYS.DBMS_ISCHED", line 150
ORA-06512: at "SYS.DBMS_SCHEDULER", line 441
ORA-06512: at line 2
SQL> /
PL/SQL procedure successfully completed.
SQL> -
Dbms_scheduler.create_job problem
Hello.
I want to use dbms_scheduler.create_job in forms for progress_bar (http://fdegrelle.over-blog.com/article-10986844.html).
But i get Dbms_scheduler.create_job must be declared message.
If i connect to database as sys and check packages, dbms_scheduler is not among other packages.
How do i install it? Is there a script?
Thanks.DejanH,
The PL/SQL code included in the sample dialog use both DBMS_SCHEDULER for 10g database and DBMS_JOB for 9i database..
The DBMS_SCHEDULER is a 10g new feature. With a 9i version, you have to use the DBMS_JOB package:
-- Lancement de la procédure par le package dbms_job pour la version 9i --
If v_version = 9 Then
dbms_job.isubmit(v_jobid,'Progress_Bar;',sysdate,null);
forms_ddl('commit') ;
Else
-- Lancement de la procédure par le package dbms_scheduler pour la version 10g --
dbms_scheduler.create_job(
job_name => v_jobname
,job_type => 'stored_procedure'
,job_action => 'Progress_Bar'
,start_date => SYSDATE
,enabled => TRUE
...In case of a 9i version, you have to comment all lines relative to the DBMS_SCHEDULER package ;-)
Francois -
Problem with the run_job,shell script with sqlldr
Hi Gurus,
I Created a job which calls the shell script and i understood from the other posting this job is going to execute with nobody,
I had done the below testing
Test 1) Shell script calls the SQL file, this SQL file executes the procedure.
Test 2) Shell script calls the sqlldr command.
When i execute the Test cases with , dbms_scheduler Run_job procedure, Test1 is success but Test2 was failed
When i execute the Test cases with, logging into box with owner of the shell & both test cases are successful.
Parent folder & Shell files are given with 777 permissions. & the Oracle db is version 10.2.0.1.0.
Error:
STANDARD_ERROR="SQL*Loader-522: lfiopn failed for file (*.log)"
Please provide me your inputs its bit urgent Thanks a lot for your help.
Edited by: 926769 on May 23, 2012 2:27 PMFirst of all let's look at your environment ... a totally unpatched version of software that is so old it is in desupport mode. You should upgrade to a fully supported version but, if you can't, at least to 10.2.0.5.
That said without seeing any of your code, or a listing showing permissions on the directory and files, there is insufficient information from which to help you.
Please post ALL information required for us to understand what you are doing an your environment.
But before I decided that NOBODY was doing anything ... I'd shell out to the server from SQL*Plus using the HOST command and verify that permissions are as you believe them to be. There is every reason to believe SQL*Loader is having an issue with your file as identified. -
Getting error while trying to execute a external job using dbms_scheduler
Hello,
I create a job using alpha account.
begin
dbms_scheduler.create_job(
job_name => 'jps_test_executable',
job_type => 'EXECUTABLE',
job_action => '/usr/bin/ksh',
number_of_arguments => 2
dbms_scheduler.set_job_argument_value (
job_name => 'jps_test_executable',
argument_position => 1,
argument_value => '/tmp/abc.sh'
and when I execute the job in the schema using alpha account it works fine.
BEGIN
DBMS_SCHEDULER.run_job (job_name => 'jps_test_executable',
use_current_session => FALSE);
END;
Works fine.
But if I try to execute the same job using some other account say beta in the same schema , I am getting error
ORA-27476 :”SMS.RUN_SMS_JOBS Does not exist ORA-06512 at “SYS.DBMS_ISCHED” line 2793 ORA-06512 :at “SYS.DBMS_SCHEDULER”,line 1794
even I give the fill qualifier, still I am getting the error.
BEGIN
DBMS_SCHEDULER.run_job (job_name => 'alpha.jps_test_executable',
use_current_session => FALSE);
END;
Any help will be appreciated.
Thank you,
RajIt's the expected behavior:
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_sched.htm#CIHHBGGI
RUN_JOB requires that you be the owner of the job or have ALTER privileges on that job. You can also run a job if you have the CREATE ANY JOB privilege.So, you need to grant the required privilege:
aplha@orcl> grant alter on alpha.jps_test_executable to beta;HTH
Enrique
PS If your problem was solved consider marking the question as answered. -
Error with dbms_scheduler and shell script execution
Hi,guys.
I have an issue with a dbms_scheduler and a shell script execution. So, the shell script as it self works fine, when i'm executing ./test.sh all process is running, but when i'm executing the script from dbms_scheduler it just simply doesn't work. Actually it works, but some of executable information in sh doesn't work, seems it just jump over of the part of the script. Sendmail part is running, maybe there is problem with rman script as it self?
DB version: 10g
And my scripts:
Shell scripts (permisons 755):
#!/bin/ksh
export PATH=/home/oracle/product/asm_home/bin:/home/oracle/product/db_home/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/oracle/bin:/usr/bin/X11:/sbin:.
export ORACLE_BASE=/home/oracle/product
export ORACLE_SID=zabbix
export ORACLE_HOME=/home/oracle/product/db_home
${ORACLE_HOME}/bin/rman<<EOF
connect target /
run {backup recovery area delete all input;}
EOF
{ echo "From:[email protected]"
echo "To: [email protected]"
echo "Subject: Recovery area"
echo 'Content-Type: text/html'
echo
echo '<html><body><table border="1" cellspacing="1">'
echo '<tr><td><b>Process</b></td><td><b>Statuss</b></td></tr>'
echo "<tr><td>RMAN</td><td><b>Works</b></td></tr>"
echo "</table></body></html>"
} | sendmail -tIn the first part i'm exporting all of the important stuff for oracle, then I call RMAN with specific atributes. And then there is just simply sendmail functionality inside script to represent if script works (for now).
And below pl/sql script:
begin
DBMS_SCHEDULER.CREATE_JOB
job_name => 'FLASH_RECOVERY',
job_type => 'EXECUTABLE',
job_action => '/home/oracle/backup/test.sh',
start_date => sysdate,
job_class => 'DEFAULT_JOB_CLASS',
enabled => TRUE,
auto_drop => FALSE,
comments => 'FLASH RECOVERY USAGE AREA backup and delete'
END;
/And this job execution:
begin
DBMS_SCHEDULER.run_job (job_name =>'FLASH_RECOVERY',use_current_session => TRUE);
end;What can be wrong? For me, I think it's something with permisions.
I hope you got my idea and could help me.
Tom
Edited by: safazaurs on 2013.18.2 22:16There is no error, i just receive all the time e-mail, seems it jumps over rman. I tried almost everything and still couldn't get result as i want. And, if i'm running script from command line - it works. Rman calls, and starts to recover archivelogs.
-
Error ORA-01017 happened when dbms_scheduler run a job.
Hi All,
I got a problem when I use dbms_scheduler to run a job. I got Error code 1017 when the job is run by scheduler. Please find my steps below:
Oracle version is : Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
1. Created a job successfully by using the code below:
begin
dbms_scheduler.create_job(
job_name => 'monthly_refresh_elec_splits',
job_type => 'PLSQL_BLOCK',
job_action => 'BEGIN TRADINGANALYSIS.PKG_IM_REPORTING_ERM.REFRESH_ELEC_SPLITS_TEST; commit; END;',
start_date => SYSTIMESTAMP,
repeat_interval => 'freq=monthly;bymonthday=25;byhour=10;byminute=35;bysecond=0;',
end_date => NULL,
enabled => TRUE,
comments => 'monthly_refresh_elec_splits.',
auto_drop => FALSE
end;
2. Got the job run details from talbe user_scheduler_job_run_details after the job is finished:
select * from user_scheduler_job_run_details where job_name = 'MONTHLY_REFRESH_ELEC_SPLITS' order by log_id desc;
LOG_ID LOG_DATE OWNER JOB_NAME JOB_SUBNAME STATUS ERROR# REQ_START_DATE ACTUAL_START_DATE RUN_DURATION INSTANCE_ID SESSION_ID SLAVE_PID CPU_USED DESTINATION ADDITIONAL_INFO
2054804 25/06/2012 10:35:01.086000 AM +10:00 TRADINGANALYSIS MONTHLY_REFRESH_ELEC_SPLITS FAILED 1017 25/06/2012 10:35:00.300000 AM +10:00 25/06/2012 10:35:00.400000 AM +10:00 +00 00:00:01.000000 1 1025,37017 129396 +00 00:00:00.030000 ORA-01017: invalid username/password; logon denied
ORA-02063: preceding line from NETS
ORA-06512: at "TRADINGANALYSIS.PKG_IM_REPORTING_ERM", line 574
ORA-06512: at line 1
3. If I run the job directly the job will be finished successfully.
begin
dbms_scheduler.run_job('monthly_refresh_elec_splits',TRUE);
end;
LOG_ID LOG_DATE OWNER JOB_NAME JOB_SUBNAME STATUS ERROR# REQ_START_DATE ACTUAL_START_DATE RUN_DURATION INSTANCE_ID SESSION_ID SLAVE_PID CPU_USED DESTINATION ADDITIONAL_INFO
2054835 25/06/2012 11:05:38.515000 AM +10:00 TRADINGANALYSIS MONTHLY_REFRESH_ELEC_SPLITS SUCCEEDED 0 25/06/2012 11:04:35.787000 AM +10:00 25/06/2012 11:04:35.787000 AM +10:00 +00 00:01:03.000000 1 1047,700 +00 00:00:00.030000
Additional Info:
PL/SQL Code in procedure
PROCEDURE Refresh_Elec_Splits_Test IS
BEGIN
--Refresh im_fact_nets_genvol from v_im_facts_nets_genvol in NETS
DELETE FROM IM_FACT_NETS_GENVOL;
--the local NETS_GENVOL table has an additional column providing volume splits by generator and month.
--INSERT INTO IM_FACT_NETS_GENVOL values ('test',sysdate,'test',1,2,3,4,5,6,7);
INSERT INTO IM_FACT_NETS_GENVOL
select ngv.*,
ratio_to_report (net_mwh) OVER (PARTITION BY settlementmonth, state)
gen_percent
from [email protected] ngv;
commit;
END;
Does anyone can advice where should I check and how can I solve the problem?
Thanks in advance
Edited by: user13244529 on 24/06/2012 18:33
Edited by: user13244529 on 24/06/2012 18:43I apologize if you already solved this.. but see Metalink ID 790221.1
+*<Moderator Edit - deleted contents of MOS Doc - pl do NOT post such content - it is a violation of your Support agreement>*+ -
Dbms_scheduler - ORA-27301: system cannot find the file specified
Hi,
I'm having problems running an executable job via dbms_scheduler. The invoking code reads:
begin
dbms_scheduler.create_job(job_name => "fred",
job_type => "EXECUTABLE",
job_action => 'convert c:\wowtemp\test.jpg -thumbnail 155 c:\wowtemp\test.png',
enabled => TRUE
dbms_scheduler.run_job(job_name => "fred");
end;and running this in SQL*plus gives me:
ERROR at line 1:
ORA-27370: job slave failed to launch a job of type EXECUTABLE
ORA-27300: OS system dependent operation:accessing execution agent failed with status: 2
ORA-27301: OS failure message: The system cannot find the file specified.
ORA-27302: failure occurred at: sjsec 6a
ORA-27303: additional information: The system cannot find the file specified.
ORA-06512: at "SYS.DBMS_ISCHED", line 150
ORA-06512: at "SYS.DBMS_SCHEDULER", line 441
ORA-06512: at line 7This happens no matter what I put in the job_action, and despite the fact that if I paste the jpb_action into a command prompt window it executes successfully. The user has CREATE ANY JOB privilege.
Any ideas?
BTW, this is using XE on WinXP. (I'd post in the XP forum but it seems to have disappeared).
Thanks,
johnOK, problem #1 solved:
By default, XE on Windows sets up the scheduler service to disabled. Enable and start it, then we can move on to problem #2:
ORA-27369: job of type EXECUTABLE failed with exit code: Incorrect function.
See http://www.adp-gmbh.ch/blog/2005/may/27.html for a workaround using a .bat file which sadly doesn't help me. How do I pass runtime switches and parameters?
DBMS_SCHEDULER is wonderfully powerful, but NOWHERE in the copious documentation can I find help on how to do something really SIMPLE.
I just want to run an unscheduled, ad hoc executable job which runs an OS command with parameters, as in:
'c:\mydir\convert.exe c:\mydir\test.jpg -thumbnail 155 c:\mydir\test.png'
Can the job_action parameter include command-line switches and parameters or not?
In the documentation for CREATE_JOB, 'For an executable, the action is the name of the external executable, including the full path name and any command-line arguments.', but this doesn't work for me.
Elsewhere (Error running executable job I read:
If the job_type is executable then the scheduler expects only the executable name and path as job_action (no command line arguments) e.g. ("c:\win32\cmd.exe")
For commandline arguments you should be setting number_of_arguments to the required value and then doing set_job_argument_value for each argument. (e.g. 3, "/q", "/c", "script.bat").
What's the real story?
Any and all assistance much appreciated
Thanks -
SQLLDR Using DBMS_SCHEDULER
hi dear
i am using sqlldr from sql with dbms_scheduler.create_job but facing some problem elow is the code
this is the schedule for my job
BEGIN
DBMS_SCHEDULER.CREATE_SCHEDULE (
schedule_name => 'INSERT_SCHD'
,start_date => sysdate
,end_date => null
,repeat_interval => 'FREQ=MINUTELY; INTERVAL=10'
,comments => 'Check for Insert Minutly schedule'
END;
below is the job
BEGIN
DBMS_SCHEDULER.Create_Job(job_name => 'Host',
schedule_name => 'INSERT_SCHD',
job_type => 'PLSQL_BLOCK',
job_action => 'begin
HOST (SQLLDR CRUDEOIL/CRUDEOIL10G@KHIDEV CONTROL=c:\junaid\jobs\loads.ctl log=c:\load.log);
end;',
enabled => true);
END;
when i run this job
exec dbms_scheduler.run_job('host');
i am facing this error can some one help me out please
ERROR at line 1:
ORA-00600: internal error code, arguments: [17090], [], [], [], [], [], [], []
ORA-06512: at "SYS.DBMS_ISCHED", line 150
ORA-06512: at "SYS.DBMS_SCHEDULER", line 441
ORA-06512: at line 1
or any other way to load data from csv file into table using dbms_scheduler please tell me the code thanks
JunaidI have also tried with the following script , did changes as per ur suggestion. Still unable to run through scheduled job. Script is running successfully from command prompt of both "root" and "oracle" user. I have set highest Permissions of 777. Getting Error ORA -27369: job of type EXECUTABLE failed with exit code: No such file or directory
#! /bin/sh
export ORACLE_SID=orcl
export PATH=$PATH:$HOME/bin
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE=oracle
if [ $USER = "root" ]; then
su - "$ORACLE"<<EOO
export ORACLE_SID=orcl
export PATH=$PATH:$HOME/bin
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$PATH:$ORACLE_HOME/bin
cd /u01/app/oracle/product/11.2.0/db_1/bin/
sqlldr \'sys/sys as sysdba\' control=/u01/app/customer.ctl log=/u01/app/customer.log
EOO
else
sqlldr \'sys/sys as sysdba\' control=/u01/app/customer.ctl log=/u01/app/customer.log
fi
Maybe you are looking for
-
Merging large camera rolls in photo stream for iCloud merge/backup/share
I've got some pretty large camera rolls on my iPhone, never having realized I wasn't "synching" them to my iPad. Well, I looked at them and saw some large ones, as well as 1.000 photos in my iPhone my photo stream. I'd like iCloud to keep them sync
-
Itunes won't launch on windows xp...why?
Itunes is downloaded on my pc, but when i click on the desktop icon nothing happens. I realized that a lot of people are having the same problem, does anyone know how to correct this problem....my ipod nano is useless unless itunes opens. nano Window
-
Windows key inoperative dv7-4285 windows 7 - 64 bit. only key not working
Windows key inoperative dv7-4285 Windows 7 - 64 bit. The Windows key is the only key not working.
-
HT204053 Use two phones with one iCloud account?
Can you have two iphones with one iCloud account?
-
LEAD Codec for MotionJPEG-Premiere Elements Playback Issues
There are several reports online (here and elsewhere) recommending installing LEAD Codec for MotionJPEG-Premiere Elements Playback Issues. Most, if not all, of the feedback is that it works and is only $10 USA dollars. Today I went in search of that