Submit job in database
DB:11.2.0.1
OS:Linux
I have created a datapump export job like below
set serverout on
create or replace procedure do_exp
as
dp_handle NUMBER;
job_status VARCHAR2(30);
begin
dp_handle := dbms_datapump.open(operation => 'EXPORT',
job_mode => 'FULL');
dbms_datapump.add_file(handle => dp_handle,
filename => 'eioidq11.dmp',
directory => 'exp1_dir',
filetype => SYS.DBMS_DATAPUMP.KU$_FILE_TYPE_DUMP_FILE);
dbms_datapump.add_file(handle => dp_handle,
filename => 'eioidq11.log',
directory => 'exp1_dir',
filetype => SYS.DBMS_DATAPUMP.KU$_FILE_TYPE_LOG_FILE);
dbms_datapump.start_job(dp_handle);
dbms_datapump.detach(handle => dp_handle);
end;
I want to submit the job and excute it one time immediately. Can somebody help me on this. I fonud this syntax but , i want it to run one time immediately.
set serveroutput on
declare
v_jobnum number;
begin
DBMS_JOB.submit(v_jobnum, 'do_exp;',trunc(SYSDATE) + to_number(to_char(sysdate,'hh24'))/24 +
1/24,'trunc(SYSDATE) + to_number(to_char(sysdate,''hh24''))/24 + 1/24');
dbms_output.put_line(v_jobnum);
commit;
end;
/
user13549752 wrote:
DB:11.2.0.1
OS:Linux
I have created a datapump export job like below
set serverout on
create or replace procedure do_exp
as
dp_handle NUMBER;
job_status VARCHAR2(30);
begin
dp_handle := dbms_datapump.open(operation => 'EXPORT',
job_mode => 'FULL');
dbms_datapump.add_file(handle => dp_handle,
filename => 'eioidq11.dmp',
directory => 'exp1_dir',
filetype => SYS.DBMS_DATAPUMP.KU$_FILE_TYPE_DUMP_FILE);
dbms_datapump.add_file(handle => dp_handle,
filename => 'eioidq11.log',
directory => 'exp1_dir',
filetype => SYS.DBMS_DATAPUMP.KU$_FILE_TYPE_LOG_FILE);
dbms_datapump.start_job(dp_handle);
dbms_datapump.detach(handle => dp_handle);
end;
I want to submit the job and excute it one time immediately. Can somebody help me on this. I fonud this syntax but , i want it to run one time immediately.
Then just execute the expdp utility at the command line. Why use a job scheduler (*any* job scheduler) for a one-time task?
<snip>
Similar Messages
-
Please help me to run a submitted job in database
Hi, Guys:
I need your help for a problem:
I need to have a job runnning every day midnight to update a column in a table, so I wrote a procedure to do it, submit job as follows:
set serveroutput on;
declare
n_jobno BINARY_INTEGER;
begin
dbms_job.submit(job=>n_jobno, what=>'begin SOR_CHECKSUM_SERVICE.porpulate_Checksum; end;',next_date=>trunc(sysdate)+15/24+6/288,interval=>'trunc(sysdate+1/288,''MI'')');
commit;
dbms_output.put_line('Job Number:'||n_jobno);
end;But the job is never running. I checked dba_jobs
select job, last_date,last_sec, log_user, next_date, next_sec,schema_user, total_time, what,instance from dba_jobs;it shows the following result:
4001 27-AUG-12 11:36:51 SYS 27-AUG-12 19:36:51 APEX_030200 10.00000000000000000000000000000000000002 wwv_flow_cache.purge_sessions(p_purge_sess_older_then_hrs => 24);
4002 27-AUG-12 15:31:42 SYS 27-AUG-12 15:41:42 APEX_030200 468.999999999999999999999999999999999997 wwv_flow_mail.push_queue(wwv_flow_platform.get_preference('SMTP_HOST_ADDRESS'),wwv_flow_platform.get_preference('SMTP_HOST_PORT'));
69 SORS 27-AUG-12 15:30:00 SORS 313 begin SOR_CHECKSUM_SERVICE.porpulate_Checksum; end;the the dba_jobs shows with instance number as 0,
however, when I run the
select *
from v$instance;1 apexsb lsgapps.thruhere.net 11.2.0.1.0 01-AUG-12 OPEN NO 1
instance number shows 1.
Is thsi because I submit my job to a wrong database instance? or any other reason?
Thanks a lot for your time.
Samthe the dba_jobs shows with instance number as 0,Where? Not in your example....
(How do you do that, by the way? Posting unformatted code with {noformat}{noformat} tags?)
Check alert.log and trace files in your udump directory for additional clues. -
Please help me to run a submitted a job in database
Hi, Guys:
I need your help for a problem:
I need to have a job runnning every day midnight to update a column in a table, so I wrote a procedure to do it, submit job as follows:
set serveroutput on;
declare
n_jobno BINARY_INTEGER;
begin
dbms_job.submit(job=>n_jobno, what=>'begin SOR_CHECKSUM_SERVICE.porpulate_Checksum; end;',next_date=>trunc(sysdate)+15/24+6/288,interval=>'trunc(sysdate+1/288,''MI'')');
commit;
dbms_output.put_line('Job Number:'||n_jobno);
end;But the job is never running. I checked dba_jobs
select job, last_date,last_sec, log_user, next_date, next_sec,schema_user, total_time, what,instance from dba_jobs;it shows the following result:
4001 27-AUG-12 11:36:51 SYS 27-AUG-12 19:36:51 APEX_030200 10.00000000000000000000000000000000000002 wwv_flow_cache.purge_sessions(p_purge_sess_older_then_hrs => 24);
4002 27-AUG-12 15:31:42 SYS 27-AUG-12 15:41:42 APEX_030200 468.999999999999999999999999999999999997 wwv_flow_mail.push_queue(wwv_flow_platform.get_preference('SMTP_HOST_ADDRESS'),wwv_flow_platform.get_preference('SMTP_HOST_PORT'));
69 SORS 27-AUG-12 15:30:00 SORS 313 begin SOR_CHECKSUM_SERVICE.porpulate_Checksum; end;the the dba_jobs shows with instance number as 0,
however, when I run the
select *
from v$instance;1 apexsb lsgapps.thruhere.net 11.2.0.1.0 01-AUG-12 OPEN NO 1
instance number shows 1.
Is thsi because I submit my job to a wrong database instance? or any other reason?
Thanks a lot for your time.
Samlxiscas wrote:
Hi, I am sorry, I do no know which forum I should post my question, Really? Even after being a member for over 12 years?
Handle: lxiscas
Status Level: Newbie
Registered: Jun 5, 2000
Total Posts: 107
and I do not know I should post question only in one forum. Really? Not only have you been a member for over 12 years, you were called out on this very point just over a week ago:
Help me on a update statement
This problem has been solved by DBA. It looks job is running, but I could not see it from v$dba_job, but even I dropped the jobs, the sessions were still working. It took us a lot of time to recover database.
Thanks.
Sam -
Submit Job error... need help....
I got this error when I click on "Submit Job" button to submit a Backup job in 10g EM. Anyway to solve this ?
The job submission has failed for the following reason
ORA-20900: Could not find credential set DBHostCreds for target type oracle_database ORA-06512: at "SYSMAN.MGMT_CREDENTIAL", line 649 ORA-06512: at "SYSMAN.MGMT_CREDENTIAL", line 1309 ORA-06512: at "SYSMAN.MGMT_JOBS", line 263 ORA-06512: at "SYSMAN.MGMT_JOBS", line 48 ORA-06512: at line 1It look like you didn't set the credential for the node and database. check it out and try your operations.
SJH
OCP DBA -
Submit job to begin at 0230 hrs and run daily
Hi,
Oracle version - 10.2.0.4
Env- Windows 32 bit 2003 server R2
I scheduled a job with the below command to run on daily basis by exactly 02:30 am but the job is not running as per scheduled, it's running 30 minutes before the schedule.
Command used to schedule the job.
DECLARE
X NUMBER;
BEGIN
SYS.DBMS_JOB.SUBMIT
( job => X
,what => 'TESTJOB(20,20302);'
,next_date => to_date('10/08/2011 02:30:00','dd/mm/yyyy hh24:mi:ss')
,interval => 'TRUNC(SYSDATE+1)+2/24'
,no_parse => FALSE
SYS.DBMS_OUTPUT.PUT_LINE('Job Name is TEST JOB ' || to_char(x));
COMMIT;
END;
I came to know this when i queried the dba_jobs view last_date column,
JOB WHAT NEXT_DATE LAST_DATE
123 TESTJOB(20,20302) 08/17/2011 *02:00:00* 08/16/2011 *02:00:03*
Can you pls let me know where i am wrong !!
Thanks
Edited by: 879545 on Aug 16, 2011 2:22 AM879545 wrote:
,interval => 'TRUNC(SYSDATE+1)+2/24'Use 2.5 :
SQL> select trunc(sysdate+1)+2/24
2 from dual;
TRUNC(SYSDATE+1)+2/24
17-aug-2011 02:00:00
SQL> select trunc(sysdate+1)+2.5/24
2 from dual;
TRUNC(SYSDATE+1)+2.5/24
17-aug-2011 02:30:00Nicolas. -
How to Schedule Job using Database Control for SQLPLUS script?
Hi All,
I am using Database version 10.2. I would like to schedule a SQLPLUS script job using Database control (Not using Grid Control!). The following is the script.
========================================================
define OEM_FRIENDLY=1
define OWB_BACKGROUND=0
set serveroutput on
set verify off
whenever sqlerror exit failure;
define REPOS_OWNER='&1.'
define LOCATION_NAME='&2.'
define TASK_TYPE='&3.'
define TASK_NAME='&4.'
define SYSTEM_PARAMS='&5.'
define CUSTOM_PARAMS='&6.'
alter session set current_schema = &REPOS_OWNER.;
set role owb_d_&REPOS_OWNER., owb_o_&REPOS_OWNER.;
variable exec_return_code number;
begin
-- Initialize Return Code
:exec_return_code := wb_rt_api_exec.RESULT_FAILURE;
-- Run Task
:exec_return_code := wb_rt_api_exec.run_task('&LOCATION_NAME.',
'&TASK_TYPE.',
'&TASK_NAME.',
'&CUSTOM_PARAMS.',
'&SYSTEM_PARAMS.',
&OEM_FRIENDLY.,
&OWB_BACKGROUND.);
end;
exit :exec_return_code;
===========================================================
Is it possible to schedule SQLPLUS script with 6 different parameters? If yes then how can I schedule for monday to friday or only for Saturday and sundays.
Please provide brief steps.
Thanks for your help in advance.
- MehulLet me explain to you about scheduler.
You can schedule a pl/sql stored procedure TEST_S as follows...
Begin
dbms_scheduler.create_job(
job_name=>'MY_JOB',
Job_Type=>'STORED_PROCEDURE',
job_action=>'TEST_S',
start_date=>sysdate,
repeat_interval=>'freq=monthly;BYDAY=MON,TUE,WED,THU,FRI',
end_date=>null');
END;
You can also also execute o/s script like .bat or .sh. For this job type should be EXECUTABLE.
Example of converting a .sql script in .bat script...
insert.sql
insert into dept values(50,'IT','LONDON');
exit
insert.bat
sqlplus scott/tiger @insert.sql
Executing now...
C:\Documents and Settings>insert.bat
C:\Documents and Settings>sqlplus scott/tiger @insert.sql
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Mar 1 08:01:00 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
1 row created.
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - P
oduction
With the Partitioning, OLAP and Data Mining options
C:\Documents and Settings>
So first read about DBMS_SCHEDULER and do the work in prompt. Then you can go and schedule it even by database control.
Scheduling by database control...
http://www.oracle.com/technology/oramag/oracle/04-jul/o44tech_dba.html
Scheduler
http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_sched.htm#CIHEHDHA
PS: By default each job you created is disable state. Please enable it by enable procedure of DBMS_SCHEDULER package. -
Error saving job to database for standard jobs scheduling
Hi,
In IDES server when iam goto Tr.code -- SM36 -- Standard Jobs -- Default Scheduling iam getting below error.
Error saving job to database
Message no. BT117
Diagnosis
The SAP system was unable to save the current job in the database. This failure suggests that there is a problem with the database system or with the network connections between the SAP application servers and the database system.
System Response
Job not saved and not scheduled.
Procedure
To analyze this problem, start by checking the system log for messages about network or database problems. You can also use the computing center management system to check your system for problems.
Guide me for the same.
ThankuHI,
Sometimes this error will come.
Try to schedule jobs manually using SM36 instead of using standard job button.
Also you can check this thread
Re: Error saving job SAP_REORG_JOBS to database
Which seems to report same problem.
Its nothing to take with database conenctivity as SAP is up and running .
Try this and revert.
Regards, -
SQL Server Agent Job And Database Mail - Error formatting query, probably invalid paramters
We have a stored procedure that we are trying to call with a SQL Server Agent Job. The stored procedure calls Database Mail. This is SQL 2008. The execute task is simply:
USE [Production]
GO
EXEC [dbo].[JOB_EMAIL_SCHEDULED_REPORTS]
GO
When the job runs, it is erroring out immediately, with the error:
Execute as user: NT AUTHORITY\NETWORK SERVICE. Error formatting query, probably invalid paramters [SQLSTATE 42000] (Error 22050). The step failed.
When we go into SQL Server Manager and just execute the SQL query, it works though. Something within the SQL Server Agent job, and Database Mail is causing problems. Any ideas? Thanks.Justin,
If you use SSMS then the procedure is executed under a different user when compared to running using a SQL Server Agent Job.
Isolate the problem by running a SQL Server agent job that sends a mail. Also check if the NT Authority\Network Service account is
in good standing. Look at the below thread with a similar problem that had an expired account.
http://social.msdn.microsoft.com/Forums/en/sqltools/thread/bac7ecee-a156-4313-b532-ba15813a0700
http://SankarReddy.com/ -
Hi sap expert,
Please guide me for the abap coding. my requirement is when i create outbound delivery note, then press SAVE button, serial number will be automatic proposed.
Now , i process as below sequent.
1. using user exit MV50AFZ1 -> FORM USEREXIT_SAVE_DOCUMENT
in this user exit i submit background job to change oubound delivery
2. in the background job, i call BAPI BAPI_OUTB_DELIVERY_CHANGE to change serial number
Question.
1. This step right or wrong, if wrong, please suggest
2. How to coding --> submit job from the user exit
Thank you in advance
JeanHi,
Most of the guys around are with functional experience.
I think you should post this query in SAP-ABAP. U will get
an immediate reply.
Kind Regards
Chakradhar -
Could I use OEM to submit a job and call an EJB session bean? If answer is yes , could you point me to the right direction , steps should I perform in OEM.
Thanks
SuhailThis is the Basic code to Achieve that.
Call Function 'JOB_OPEN'
SUBMIT RSBDCBTC
via background Job <Job info>
With QIE = <QID Returned by BDC_OPEN_Group FM>
AND RETURN.
Call Function 'JOB_CLOSE'
2) Also go through this
DATA: lv_job_name LIKE tbtco-jobname,
lv_job_nr LIKE tbtco-jobcount,
lv_job_released TYPE c,
lv_job_start_sofort TYPE c,
lv_print_parameters TYPE pri_params.
lv_job_name = 'Z_BGPROGRAM'.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = lv_job_name
IMPORTING
jobcount = lv_job_nr
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF syst-subrc = 0.
" submit job with all the selection screen params...
SUBMIT (lv_job_name)
WITH applfile = applfile " these are the parameters of the background program
WITH p_lines = p_lines
USER syst-uname " you must use this
VIA JOB lv_job_name NUMBER lv_job_nr AND RETURN.
IF sy-subrc = 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = lv_job_nr
jobname = lv_job_name
strtimmed = 'X'
IMPORTING
job_was_released = lv_job_released
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.
IF syst-subrc <> 0.
MESSAGE i162(00) WITH
'An error occured while closing the background job.'.
STOP.
ENDIF.
ENDIF.
ENDIF.
SKIP 1.
WRITE: / 'Background process', lv_job_name , 'called successfully' NO-GAP.
WRITE: / 'You can check the job in transaction SM37'. -
Hi,
In IDES ECC6.0 Ehp 3 (Os: window 2003 64bit DB: oracle 10.2.0.2) server when iam goto T-Code -- SM36 -- Standard Jobs -- Default Scheduling iam getting below error.
<error saving job to database>
So I patched oracle 10.2.0.1 to 10.2.0.4, and kernel patch with latest one.
But, the same error occured.
I tried to execute r3trans -d at the OS level,the results is <The system cannot execute the specified program>.
In SM21, i am getting below error
<error saving job to database>
&CAUSE &
The SAP system was unable to save the current job in the database. This failure suggests that there is a problem with the database system or with the network connections between the SAP application servers and the database system.
&SYSTEM_RESPONSE&
Job not saved and not scheduled.
&What_TO_DO&
To analyze this problem, start by checking the <DS:TRAN.SM21>system log for message about network or database problems. you can also use the <DS:TRAN.SRZL>computing center management system to check your system for problems. >
I checked SM28 and SICK and it reports no error.
Please help how can I schedule the standard jobsMake sure you use the proper kernel, for 64bit there are two kernels:
- one for AMD64 and Intel64
- one for Itanium-2 64bit
The R3trans seems to be the wrong one - as I would suggest are the brtools.
Markus -
How to get spool number when using SUBMIT job
Hi All,
I am calling standard program using SUBMIT through JOB as below. Now I need spool number for this job to covert the output to PDF and send to mail. See the below code and guide me.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = name
IMPORTING
jobcount = number
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.
data: Zscreen type table of RSPARAMS with header line.
Zscreen-selname = 'PM_AENNR'.
Zscreen-kind = 'P'.
ZSCREEN-LOW = '500000000125'.
APPEND ZSCREEN.
SUBMIT RCC00130 WITH selection-table Zscreen TO SAP-SPOOL
SPOOL PARAMETERS print_parameters
WITHOUT SPOOL DYNPRO
VIA JOB name NUMBER number
AND RETURN.
IF sy-subrc = 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = number
jobname = name
strtimmed = 'X'
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5Hi,
Do this way, first get print parameters by using function module 'GET_PRINT_PARAMETERS'
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
destination = 'LP01'
list_name = 'TEST'
list_text = 'SUBMIT ... TO SAP-SPOOL'
immediately = ' '
line_size = '1023'
no_dialog = 'X'
IMPORTING
out_parameters = wa_pri_params
valid = w_valid.
If it returns success then
IF w_valid EQ 'X'.
CONCATENATE 'R'
w_tabix
sy-datum+4(4)
sy-uzeit INTO
wa_pri_params-plist.
ENDIF.
SUBMIT rprccc00
WITH firmennr = w_cid
WITH bel_clus = 'X'
WITH testlauf = ' '
WITH not_lokl = 'X'
WITH file_in = w_arc_out
TO SAP-SPOOL WITHOUT SPOOL DYNPRO
SPOOL PARAMETERS wa_pri_params AND RETURN.
COMMIT WORK AND WAIT.
SELECT rqident
FROM tsp01
INTO w_rqident
UP TO 1 ROWS
WHERE rq2name = wa_pri_params-plist.
ENDSELECT.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = w_rqident
no_dialog = 'X'
dst_device = 'LP01'
pdf_destination = 'X'
TABLES
pdf = t_pdf.
Hope it solves your problem
Regards
Krishna -
Hi All
I have a program with selection screen. The selection screen has Job name as one of the parameters. When I press F8 (Execute), this program should get scheduled in the background with the job name taken from selection screen. How to submit a program by itself in background.
Please suggest.
Thanks
ShakirHi,
Press F9 from the program itself after entering the selection parameters
Or
Create a selection variant and go to SM36 and give some valid name , program name with variant and save and schedule.
Regards,
Nandha -
How to pass an internal table to "submit job"
Dear Expert,
I use open_job & close_job to submit a background job.
A text file is to be uploaded from local drive.
Since we cant perform upload during the background,
I will have to upload the file from local drive in foreground, and then submit to the background job.
I tried to use Export [internal table] to memory and Import from the background job, it doesnt work.
How can I do this ??
Thank you.hi ,
you can do this using the open dataset...
i think it is the best one..
open dataset p_file for input in text mode encoding default .
loop at p_file.
output0(10) = p_file0(10).
output10(20) = p_file20(10).
output30(10). = p_file30(10).
output40(10). = p_file40(10).
endloop.
close p_file.
regards,
venkat. -
Using a form to submit data to database
I have a servlet and I am trying to implement a form in the page so that it will submit from a text box a string into the database. Here is my code.
java.util.Date d = new java.util.Date();
java.sql.Timestamp t = new java.sql.Timestamp(d.getTime());
String data = "";
out.println("<form method=get>");
out.println("Enter Data: ");
out.println("<input type=text name='data' >");
out.println("<input type=submit value=Submit>");
out.println("</form>");
// Insert Data
PreparedStatement pst = con.prepareStatement("INSERT INTO FOO (NAME,DATE_MODIFIED) VALUES(?,?)");
pst.setString(1, data);
pst.setTimestamp(2, t);
pst.executeUpdate();
I believe this is incorrect in the <form> code. I do not know how to INSERT the data that is submitted from the <form>.You need to separate the servlet code from the HTML code.
First you create an HTML page with the HTML form:
<form method="get" ACTION="myservletname">
Enter Data:
<input type=text name='data' >
<input type=submit value=Submit>
</form>
Then you create the servlet which will read the request object with the parameter called "data".
And then you input that value into a database.
Visit the servlet tutorials in the Sun site.
-AJD
Maybe you are looking for
-
TVTime doesn't works after upgrade to Xorg 1.7.1-1 [Solved]
Hi to everyone: My TVTime worked until the upgrade to Xorg 1.7.1-1 . Now, I'm launching the TVTime, and the console shows this : user@archerpc:~$ tvtime Running tvtime 1.0.2. Reading configuration from /etc/tvtime/tvtime.xml Reading configuration fro
-
SharePoint Workflow HTTP 404 Error
Hey guys, I'm testing the functionality of workflow manager 1.0 on my SP 2013 SP1 environment. Both installed at the same Windows Server 2012 Standard. I'm able to create and publish a WF using SP designer but when I tested it I got the following err
-
ESS- Code of Conduct Application Error
Dear sdn, Hi Whenever i click the code of conduct service i getting the following error msg A critical error has occured. Processing of the service had to be terminated. Unsaved data has been lost. Please contact your system adminis
-
hi, create one more module pool program with three > screen fields. > > A B > C > (Candidate) > ields. > > and put authorizations check if u required for above > fields. Hi Lashmi, Can you please elaborate more..Let me tell you that each of three mod
-
Classes used in BSP application 'HAP_DOCUMENT'
Hi, 'CL_BSP_HAP_DOCUMENT_UI' - this is a class used in BSP Application 'HAP_DOCUMENT'. do anyone have a document explaining the Attributes and method of this particular class ? or any website where i can go and find the use of each and every attribut