ICode9

精准搜索请尝试: 精确搜索
首页 > 数据库> 文章详细

oracle 19c 升级job 没有同步的解决办法

2022-07-12 14:36:01  阅读:241  来源: 互联网

标签:DBMS JOB sample job Version 19c oracle procedure


 


########sample 2

APPLIES TO:
Oracle Database - Standard Edition - Version 12.2.0.1 and later
Information in this document applies to any platform.
SYMPTOMS
Statspack schema import in 19C failing with following error:
IMP-00017: following statement failed with ORACLE error 27486
"BEGIN DBMS_JOB.ISUBMIT(JOB=>1,WHAT=>'statspack.snap;',NEXT_DATE=>TO_DATE("
"'2020-07-26:07:10:00','YYYY-MM-DD:HH24:MI:SS'),INTERVAL=>'TRUNC(SYSDATE+30/"
"1440,''MI'')',NO_PARSE=>TRUE); END;"
IMP-00003: ORACLE error 27486 encountered
ORA-27486: insufficient privileges
ORA-06512: at "SYS.DBMS_ISCHED", line 9396

CHANGES
No changes

CAUSE
Missing privilege on DBMS_JOB.

SOLUTION
In 19c Privilege on DBMS_JOB need to be explicitly granted to the importing user:

Grant Create Job To "<IMPORTING SCHEMA>

 

 

#####sample 1
IF: An Example to Convert from DBMS_JOB Jobs to DBMS_SCHEDULER Jobs (Doc ID 2117140.1) To BottomTo Bottom

In this Document
Goal
Solution
References
APPLIES TO:
Oracle Database - Enterprise Edition - Version 10.2.0.1 and later
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Database Exadata Express Cloud Service - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Information in this document applies to any platform.
GOAL
This document summarizes the steps to convert a job created using DBMS_JOB to a DBMS_SCHEDULER job with the help of an example.

SOLUTION
1. Obtain the DDL for DBMS_JOB job.

The definition of a job submitted via DBMS_JOB can be obtained by using the dbms_job.user_export procedure.

set serveroutput on
DECLARE
callstr VARCHAR2(500);
BEGIN
dbms_job.user_export(23, callstr);
dbms_output.put_line(callstr);
END;
/

dbms_job.isubmit(job=>23,what=>'sample_procedure;',next_date=>to_date('2016-03-1
6:17:00:00','YYYY-MM-DD:HH24:MI:SS'),interval=>'SYSDATE + 1',no_parse=>TRUE);

Looking at the DDL, this job executes the stored procedure sample_procedure at 5 PM every day. This can be confirmed from the output of dba_jobs as well.

SQL> select log_user, schema_user, job,next_date,what,interval from dba_jobs where log_user='TEST';
LOG_USER SCHEMA_USE JOB NEXT_DATE WHAT INTERVAL
---------- ---------- ---------- -------------------- ------------------------------ ------------------------------
TEST TEST 23 16-MAR-16 sample_procedure; SYSDATE + 1

 

2. Create a DBMS_SCHEDULER job similar to above DBMS_JOB

A scheduler job has to be created such that it satisfies all the conditions of the DBMS_JOB job. In this example the job should execute the stored procedure sample_procedure at 5 PM every day.

BEGIN
DBMS_SCHEDULER.create_job (
job_name => 'sample_procedure_job', -- provide a name for the job
job_type => 'STORED_PROCEDURE', -- job executes a stored procedure
job_action => 'sample_procedure',
start_date => TRUNC(SYSDATE) + 17/24, -- start today at 5 PM
repeat_interval => 'freq=daily; byhour=17; byminute=0', -- repeat at 5 PM everyday
end_date => NULL,
enabled => TRUE, -- job is enabled
comments => 'Job created using the CREATE JOB procedure.');
End;
/

3. Ensure that the scheduler job is created as per the requirements

select JOB_NAME,JOB_TYPE,JOB_ACTION,STATE,NEXT_RUN_DATE, REPEAT_INTERVAL from dba_scheduler_jobs where job_name='SAMPLE_PROCEDURE_JOB';
JOB_NAME JOB_TYPE JOB_ACTION ENABL STATE NEXT_RUN_DATE REPEAT_INTERVAL
-------------------- ---------------- -------------------- ----- ------------ ---------------------------------------- ----------------------------------------
SAMPLE_PROCEDURE_JOB STORED_PROCEDURE sample_procedure TRUE SCHEDULED 16-MAR-16 05.00.00.000000 PM +00:00 freq=daily; byhour=17; byminute=0

 

4. Drop the DBMS_JOB job

exec dbms_job.remove(23);

REFERENCES
NOTE:270256.1 - How to Create a Job Using DBMS_SCHEDULER - 10g Job Scheduling Feature
NOTE:2109399.1 - How to Schedule a Job using DBMS_JOB

 

标签:DBMS,JOB,sample,job,Version,19c,oracle,procedure
来源: https://www.cnblogs.com/feiyun8616/p/16469932.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有