{"id":4596,"date":"2014-03-02T20:06:12","date_gmt":"2014-03-02T20:06:12","guid":{"rendered":"http:\/\/erpschools.com\/?p=4596"},"modified":"2014-12-05T10:06:01","modified_gmt":"2014-12-05T10:06:01","slug":"dbms_job-api-example","status":"publish","type":"post","link":"https:\/\/erpschools.com\/erps\/api\/sysadmin-api\/dbms_job-api-example","title":{"rendered":"DBMS_JOB API Example"},"content":{"rendered":"<p>DBMS_JOB API example to kill DB session of a concurrent request:<br \/>\nThe DBMS_JOB package schedules and manages jobs in the job queue.<\/p>\n<p><span style=\"text-decoration: underline;\">Main Procedures that will be used:<\/span><br \/>\n<span style=\"text-decoration: underline;\">DBMS_JOB.SUBMIT<\/span> submits the job to the job queue. You must issue a COMMIT statement immediately after the statement.<br \/>\n<span style=\"text-decoration: underline;\">Parameters:<\/span><br \/>\njob: Number of the job being run.<br \/>\nwhat: PL\/SQL procedure to run.<br \/>\nnext_date: Next date when the job will be run.<br \/>\ninterval: Date function that calculates the next time to run the job. The default is NULL. This must evaluate to a either a future point in time or NULL.<br \/>\nno_parse: A flag. The default is FALSE. If this is set to FALSE, then Oracle parses the procedure associated with the job. If this is set to TRUE, then Oracle parses the procedure associated with the job the first time that the job is run.<br \/>\nFor example, if you want to submit a job before you have created the tables associated with the job, then set this to TRUE.<br \/>\ninstance: When a job is submitted, specifies which instance can run the job.<br \/>\nforce: If this is TRUE, then any positive integer is acceptable as the job instance. If this is FALSE (the default), then the specified instance must be running; otherwise the routine raises an exception.<\/p>\n<p><span style=\"text-decoration: underline;\">DBMS_JOB.RUN<\/span> runs the job specified.<br \/>\n<span style=\"text-decoration: underline;\">Parameters:<\/span><br \/>\njob: Number of the job being run.<br \/>\nforce: If this is TRUE, then instance affinity is irrelevant for running jobs in the foreground process. If this is FALSE, then the job can be run in the foreground only in the specified instance.<\/p>\n<p>Here\u2019s an example on how to use this package to kill the session of a concurrent request from a PL\/SQL procedure.<br \/>\n<code><br \/>\nDECLARE<br \/>\nl_mon_req_id NUMBER := fnd_global.conc_request_id;<br \/>\nl_jobnum NUMBER;<br \/>\nBEGIN<br \/>\n--Get session details of the concurrent request you want kill<br \/>\nSELECT d.sid,<br \/>\nd.inst_id,<br \/>\nd.serial#<br \/>\nFROM apps.fnd_concurrent_requests a,<br \/>\napps.fnd_concurrent_processes b,<br \/>\ngv$process c,<br \/>\ngv$session d<br \/>\nWHERE a.controlling_manager =<br \/>\nb.concurrent_process_id<br \/>\nAND c.pid = b.oracle_process_id<br \/>\nAND d.paddr = c.addr<br \/>\nAND a.request_id = l_mon_req_id;<br \/>\n--Submit the job to kill the session to the job queue<br \/>\nDBMS_JOB.submit (<br \/>\njob => l_jobnum,<br \/>\nwhat => 'begin execute immediate ''alter system kill session '''''<br \/>\n|| s.sid<br \/>\n|| ','<br \/>\n|| s.serial#<br \/>\n|| '''''''; end;',<br \/>\ninstance => s.inst_id);<br \/>\nCOMMIT;<br \/>\n--Run the job<br \/>\nDBMS_JOB.run (l_jobnum);<br \/>\nEND;<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>DBMS_JOB API example to kill DB session of a concurrent request: The DBMS_JOB package schedules and manages jobs in the job queue. Main Procedures that will be used: DBMS_JOB.SUBMIT submits the job to the job queue. You must issue a COMMIT statement immediately after the statement. Parameters: job: Number of the job being run. what: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[500],"tags":[199,200,201],"class_list":["post-4596","post","type-post","status-publish","format-standard","hentry","category-sysadmin-api","tag-dbms_job-run","tag-dbms_job-submit","tag-kill-session-from-plsql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>DBMS_JOB API Example - erpSchools<\/title>\n<meta name=\"description\" content=\"DBMS_JOB API Example\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/erpschools.com\/erps\/api\/sysadmin-api\/dbms_job-api-example\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prudhvi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/erpschools.com\/erps\/api\/sysadmin-api\/dbms_job-api-example#article\",\"isPartOf\":{\"@id\":\"https:\/\/erpschools.com\/erps\/api\/sysadmin-api\/dbms_job-api-example\"},\"author\":{\"name\":\"Prudhvi\",\"@id\":\"https:\/\/erpschools.com\/erps\/#\/schema\/person\/dbed9bb7fb66aa7a700fc565da024512\"},\"headline\":\"DBMS_JOB API Example\",\"datePublished\":\"2014-03-02T20:06:12+00:00\",\"dateModified\":\"2014-12-05T10:06:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/erpschools.com\/erps\/api\/sysadmin-api\/dbms_job-api-example\"},\"wordCount\":297,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/erpschools.com\/erps\/#organization\"},\"keywords\":[\"DBMS_JOB.RUN\",\"DBMS_JOB.SUBMIT\",\"Kill session from PL\/SQL\"],\"articleSection\":[\"Sysadmin API\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/erpschools.com\/erps\/api\/sysadmin-api\/dbms_job-api-example#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/erpschools.com\/erps\/api\/sysadmin-api\/dbms_job-api-example\",\"url\":\"https:\/\/erpschools.com\/erps\/api\/sysadmin-api\/dbms_job-api-example\",\"name\":\"DBMS_JOB API Example - erpSchools\",\"isPartOf\":{\"@id\":\"https:\/\/erpschools.com\/erps\/#website\"},\"datePublished\":\"2014-03-02T20:06:12+00:00\",\"dateModified\":\"2014-12-05T10:06:01+00:00\",\"description\":\"DBMS_JOB API Example\",\"breadcrumb\":{\"@id\":\"https:\/\/erpschools.com\/erps\/api\/sysadmin-api\/dbms_job-api-example#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/erpschools.com\/erps\/api\/sysadmin-api\/dbms_job-api-example\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/erpschools.com\/erps\/api\/sysadmin-api\/dbms_job-api-example#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/erpschools.com\/erps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DBMS_JOB API Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/erpschools.com\/erps\/#website\",\"url\":\"https:\/\/erpschools.com\/erps\/\",\"name\":\"erpSchools\",\"description\":\"Oracle Apps\",\"publisher\":{\"@id\":\"https:\/\/erpschools.com\/erps\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/erpschools.com\/erps\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/erpschools.com\/erps\/#organization\",\"name\":\"erpSchools\",\"url\":\"https:\/\/erpschools.com\/erps\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/erpschools.com\/erps\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/erpschools.com\/erps\/wp-content\/uploads\/img\/erps_logo7.png\",\"contentUrl\":\"https:\/\/erpschools.com\/erps\/wp-content\/uploads\/img\/erps_logo7.png\",\"width\":250,\"height\":60,\"caption\":\"erpSchools\"},\"image\":{\"@id\":\"https:\/\/erpschools.com\/erps\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"http:\/\/facebook.com\/erpschools\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/erpschools.com\/erps\/#\/schema\/person\/dbed9bb7fb66aa7a700fc565da024512\",\"name\":\"Prudhvi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/erpschools.com\/erps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/488cec3605845b95cb20e60c67a8f5c7e74b65a305525c8006315d524f120db9?s=96&d=blank&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/488cec3605845b95cb20e60c67a8f5c7e74b65a305525c8006315d524f120db9?s=96&d=blank&r=g\",\"caption\":\"Prudhvi\"},\"sameAs\":[\"http:\/\/www.erpschools.com\"],\"url\":\"https:\/\/erpschools.com\/erps\/author\/prudhvi\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"DBMS_JOB API Example - erpSchools","description":"DBMS_JOB API Example","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/erpschools.com\/erps\/api\/sysadmin-api\/dbms_job-api-example","twitter_misc":{"Written by":"Prudhvi","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/erpschools.com\/erps\/api\/sysadmin-api\/dbms_job-api-example#article","isPartOf":{"@id":"https:\/\/erpschools.com\/erps\/api\/sysadmin-api\/dbms_job-api-example"},"author":{"name":"Prudhvi","@id":"https:\/\/erpschools.com\/erps\/#\/schema\/person\/dbed9bb7fb66aa7a700fc565da024512"},"headline":"DBMS_JOB API Example","datePublished":"2014-03-02T20:06:12+00:00","dateModified":"2014-12-05T10:06:01+00:00","mainEntityOfPage":{"@id":"https:\/\/erpschools.com\/erps\/api\/sysadmin-api\/dbms_job-api-example"},"wordCount":297,"commentCount":0,"publisher":{"@id":"https:\/\/erpschools.com\/erps\/#organization"},"keywords":["DBMS_JOB.RUN","DBMS_JOB.SUBMIT","Kill session from PL\/SQL"],"articleSection":["Sysadmin API"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/erpschools.com\/erps\/api\/sysadmin-api\/dbms_job-api-example#respond"]}]},{"@type":"WebPage","@id":"https:\/\/erpschools.com\/erps\/api\/sysadmin-api\/dbms_job-api-example","url":"https:\/\/erpschools.com\/erps\/api\/sysadmin-api\/dbms_job-api-example","name":"DBMS_JOB API Example - erpSchools","isPartOf":{"@id":"https:\/\/erpschools.com\/erps\/#website"},"datePublished":"2014-03-02T20:06:12+00:00","dateModified":"2014-12-05T10:06:01+00:00","description":"DBMS_JOB API Example","breadcrumb":{"@id":"https:\/\/erpschools.com\/erps\/api\/sysadmin-api\/dbms_job-api-example#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/erpschools.com\/erps\/api\/sysadmin-api\/dbms_job-api-example"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/erpschools.com\/erps\/api\/sysadmin-api\/dbms_job-api-example#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/erpschools.com\/erps"},{"@type":"ListItem","position":2,"name":"DBMS_JOB API Example"}]},{"@type":"WebSite","@id":"https:\/\/erpschools.com\/erps\/#website","url":"https:\/\/erpschools.com\/erps\/","name":"erpSchools","description":"Oracle Apps","publisher":{"@id":"https:\/\/erpschools.com\/erps\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/erpschools.com\/erps\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/erpschools.com\/erps\/#organization","name":"erpSchools","url":"https:\/\/erpschools.com\/erps\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/erpschools.com\/erps\/#\/schema\/logo\/image\/","url":"https:\/\/erpschools.com\/erps\/wp-content\/uploads\/img\/erps_logo7.png","contentUrl":"https:\/\/erpschools.com\/erps\/wp-content\/uploads\/img\/erps_logo7.png","width":250,"height":60,"caption":"erpSchools"},"image":{"@id":"https:\/\/erpschools.com\/erps\/#\/schema\/logo\/image\/"},"sameAs":["http:\/\/facebook.com\/erpschools"]},{"@type":"Person","@id":"https:\/\/erpschools.com\/erps\/#\/schema\/person\/dbed9bb7fb66aa7a700fc565da024512","name":"Prudhvi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/erpschools.com\/erps\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/488cec3605845b95cb20e60c67a8f5c7e74b65a305525c8006315d524f120db9?s=96&d=blank&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/488cec3605845b95cb20e60c67a8f5c7e74b65a305525c8006315d524f120db9?s=96&d=blank&r=g","caption":"Prudhvi"},"sameAs":["http:\/\/www.erpschools.com"],"url":"https:\/\/erpschools.com\/erps\/author\/prudhvi"}]}},"_links":{"self":[{"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/posts\/4596","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/comments?post=4596"}],"version-history":[{"count":0,"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/posts\/4596\/revisions"}],"wp:attachment":[{"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/media?parent=4596"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/categories?post=4596"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/tags?post=4596"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}