Calling DBMS_METADATA.GET_DDL on scheduler jobs owned by SYS

Hi!
While I can generally retrieve the DDL for scheduler jobs using the PROCOBJ type, this doesn't seem to work for scheduler jobs owned by SYS.
Does anybody happen to have a workaround for this?
SELECT user FROM dual
USER
SYS
1 row selected
select * from v$version
BANNER                                                         
Oracle Database 10g Release 10.2.0.4.0 - 64bit Production
PL/SQL Release 10.2.0.4.0 - Production
CORE     10.2.0.4.0     Production
TNS for 64-bit Windows: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production        
5 rows selected
SELECT DBMS_METADATA.GET_DDL('PROCOBJ' ,'MGMT_CONFIG_JOB', 'ORACLE_OCM') DDL FROM dual
DDL
BEGIN dbms_scheduler.create_job( ...
1 row selected
SELECT DBMS_METADATA.GET_DDL('PROCOBJ' ,'AUTO_SPACE_ADVISOR_JOB', 'SYS') DDL FROM dual
ORA-31603: object "AUTO_SPACE_ADVISOR_JOB" of type PROCOBJ not found in schema "SYS"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.DBMS_METADATA", line 2806
ORA-06512: at "SYS.DBMS_METADATA", line 4333
ORA-06512: at line 1Cheers,
Marcus

I guess I need SELECT_CATALOG_ROLE role
http://www.orafaq.com/node/807
SYS and users with SELECT_CATALOG_ROLE can see all objects.

Similar Messages

  • Who should schedule jobs via DBMS_SCHEDULER; Sys or Apps user ?

    Oracle Version: 11.2.0.3 on RHEL 5.4
    We need to schedule running few Stored Procs in an Apps schema using DBMS_SCHEDULER.
    Should this be scheduled by Sys or Apps user ? If its Apps user I need to grant execute privilege on DBMS_SCHEDULER to the apps user and I want to know if this is a good practise ?

    Yes, you should use the apps account with execute on DBMS_SCHEDULER.
    SYS should not be used unless it is absolutely required -- e.g. makes use of SYS calls that are not available to other database accounts.
    Hemant K Chitale

  • DBMS_METADATA.GET_DDL doesn't include function parameters

    Sometimes, when I call DBMS_METADATA.GET_DDL to get the DDL statement for a function (which we always do to ensure we're starting from the source that's actually in production), the returned text doesn't include the parameters. Other times, it does, and I'm not able to see any pattern.
    I was going to just make a function and show the output, but that did show the parameters. Then I tried calling GET_DDL while logged in as SYS as SYSDBA on my development database, and I still did not get the parameters, so I don't think it's a permissions issue.
    Does anyone have any idea what's going on here?

    It's really difficult to show you exactly what I'm doing when I can't consistently reproduce the problem, as I described.
    But here, I'll try.
    declare
         the_ddl clob;
    begin
         the_ddl := dbms_metadata.get_ddl('FUNCTION', '*****', '*****');
         dbms_output.enable(null);
         dbms_output.put_line(the_ddl);
    end;
    /Sometimes, it produces output like this:
    CREATE OR REPLACE FUNCTION "*****"."*****" (
         ***** in varchar2,
         ***** in number,
    ) return *****
    ...And other times, it produces output like this:
    CREATE OR REPLACE FUNCTION "*****"."*****" return *****
    ...I am not able to determine any consistent reason for this. In our production database, I can log in as myself and get the parameters for a specific function, but another user (that our automated process uses) doesn't see the parameters. In my development database, I log in as myself and I do not see the parameters, but I still don't see them when I log in as SYS AS SYSDBA.
    For what it's worth, if I recreate the function on my development database, then subsequent calls do show the parameters.

  • DBMS_METADATA.GET_DDL- how does it format output

    I call "DBMS_METADATA.GET_DDL" to get package body source code, see example call below.
    Can i be always sure that it will always:
    1. Return schema name before package name as for example this: "MYSCHEMA"."COLLECTSTATS". Or may it return sometimes without schema/owner-name the package name as " CREATE OR REPLACE PACKAGE BODY "COLLECTSTATS" IS"
    2. Will it always be in capital letters the "owner.packagename" part?
    3. wil lthere always be Double quotes surrounding package name and owner name as "MYSCHEMA"."COLLECTSTATS"?
    select DBMS_METADATA.GET_DDL('PACKAGE_BODY','COLLECTSTATS','MYSCHEMA') from DUAL;
    Result:
    CREATE OR REPLACE PACKAGE BODY "MYSCHEMA"."COLLECTSTATS" IS
        PROCEDURE save_log(p_logrec IN LiveStatsLog%ROWTYPE) IS

    Can i be always sure that it will always:
    1. Return schema name before package name as for example this: "MYSCHEMA"."COLLECTSTATS". Or may it return sometimes without schema/owner-name the package name as " CREATE OR REPLACE PACKAGE BODY "COLLECTSTATS" IS"This is controlable through a parameter
    2. Will it always be in capital letters the "owner.packagename" part?If you have created object names with double quotes when you defined it like:
    Create package "p"then no, it will keep the case as it appears in the data dixtionary. If you never use double quotes when creating objects, then ot will always be upper case.
    3. wil lthere always be Double quotes surrounding package name and owner name as "MYSCHEMA"."COLLECTSTATS"?Yes, this is done so that case can be preserved if neccessary.
    John

  • Dbms_metadata.get_ddl and select_catalog_role

    Hi,
    We have been requested to give support staff the ability to see table triggers, stored procedures, etc only for specific schemas and they don't have access to the schema password. We can't give them SELECT_CATALOG_ROLE because they are not allowed to see all schemas. I wish there were a way to grant a version of SELECT_CATALOG_ROLE for only certain schemas......
    I've played around with dbms_metadata.get_ddl with no luck (as per the documentation, but just had to try it anyway). I've even considered the script below, but it requires creating a view under the SYS schema and I can't figure out how to add triggers to the view.
    Any ideas would be greatly appreciated!
    Thanks,
    Susan
    accept 1 prompt "Enter Owner:"
    create or replace view all_dev_source
    (OWNER, NAME, TYPE, LINE, TEXT)
    as
    select u.name, o.name,
    decode(o.type#, 7, 'PROCEDURE', 8, 'FUNCTION', 9, 'PACKAGE',
    11, 'PACKAGE BODY', 13, 'TYPE', 14, 'TYPE BODY',
    'UNDEFINED'),
    s.line, s.source
    from sys.obj$ o, sys.source$ s, sys.user$ u
    where
    u.name = upper('&&1') and
    o.obj# = s.obj#
    and o.owner# = u.user#
    and o.type# in (7, 8, 9, 11, 13, 14)
    and
    o.owner# in (userenv('SCHEMAID'), 1 /* PUBLIC */)
    or
    (o.type# = 7 or o.type# = 8 or o.type# = 9)
    and
    o.obj# in (select obj# from sys.objauth$
    where grantee# in (select kzsrorol from x$kzsro)
    and privilege# = 12 /* EXECUTE */)
    or
    exists
    select null from sys.sysauth$
    where grantee# in (select kzsrorol from x$kzsro)
    and
    /* procedure */
    (o.type# = 7 or o.type# = 8 or o.type# = 9)
    or
    privilege# = -144 /* EXECUTE ANY PROCEDURE */
    or
    privilege# = -141 /* CREATE ANY PROCEDURE */
         or
    /* package body */
    o.type# = 11 or
    privilege# = -141 /* CREATE ANY PROCEDURE */
    or
    /* type */
    o.type# = 13
    or
    privilege# = -184 /* EXECUTE ANY TYPE */
    or
    privilege# = -181 /* CREATE ANY TYPE */
         or
    /* type body */
    o.type# = 14 and
    privilege# = -181 /* CREATE ANY TYPE */
    union
    select u.name, o.name, 'JAVA SOURCE', s.joxftlno, s.joxftsrc
    from sys.obj$ o, x$joxfs s, sys.user$ u
    where
    u.name = upper('&&1') and
    o.obj# = s.joxftobn
    and o.owner# = u.user#
    and o.type# = 28
    and
    o.owner# in (userenv('SCHEMAID'), 1 /* PUBLIC */)
    or
    o.obj# in (select obj# from sys.objauth$
    where grantee# in (select kzsrorol from x$kzsro)
    and privilege# = 12 /* EXECUTE */)
    or
    exists
    select null from sys.sysauth$
    where grantee# in (select kzsrorol from x$kzsro)
    and
    /* procedure */
    privilege# = -144 /* EXECUTE ANY PROCEDURE */
    or
    privilege# = -141 /* CREATE ANY PROCEDURE */
    comment on table all_dev_source is
    'Current source on stored objects that user is allowed to create'
    comment on column all_dev_source.OWNER is
    'Owner of the object'
    comment on column all_dev_source.NAME is
    'Name of the object'
    comment on column all_dev_source.TYPE is
    'Type of the object: "TYPE", "TYPE BODY", "PROCEDURE", "FUNCTION",
    "PACKAGE", "PACKAGE BODY" or "JAVA SOURCE"'
    comment on column all_dev_source.LINE is
    'Line number of this line of source'
    comment on column all_dev_source.TEXT is
    'Source text'
    grant select on all_dev_source to <username>
    /

    user632322 wrote:
    I think I am misunderstanding your reply becauseI had to be more specific. By "privileged user" I meant SYS. SELECT_CATALOG_ROLE is a role itself, so it will be ignored by definer rights SP/SF. That is why it has to be owned by privileged user SYS:
    SQL> select * from v$version
      2  /
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
    PL/SQL Release 10.2.0.4.0 - Production
    CORE    10.2.0.4.0      Production
    TNS for 32-bit Windows: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    SQL> show user
    USER is "SYS"
    SQL> create user u1 identified by u1 default tablespace users quota unlimited on users
      2  /
    User created.
    SQL> grant create session to u1
      2  /
    Grant succeeded.
    SQL> create or replace
      2    function get_ddl(
      3                     p_type varchar2,
      4                     p_object varchar2,
      5                     p_owner varchar2
      6                    )
      7      return clob
      8      is
      9      begin
    10          return dbms_metadata.get_ddl(p_type,p_object,p_owner);
    11  end;
    12  /
    Function created.
    SQL> grant execute on get_ddl to u1
      2  /
    Grant succeeded.
    SQL> connect u1/u1
    Connected.
    SQL> set serveroutput on
    SQL> exec dbms_output.put_line(dbms_metadata.get_ddl('TABLE','EMP','SCOTT'));
    BEGIN dbms_output.put_line(dbms_metadata.get_ddl('TABLE','EMP','SCOTT')); END;
    ERROR at line 1:
    ORA-31603: object "EMP" of type TABLE not found in schema "SCOTT"
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
    ORA-06512: at "SYS.DBMS_METADATA", line 2806
    ORA-06512: at "SYS.DBMS_METADATA", line 4333
    ORA-06512: at line 1
    SQL> exec dbms_output.put_line(sys.get_ddl('TABLE','EMP','SCOTT'));
      CREATE TABLE "SCOTT"."EMP"
       (    "EMPNO" NUMBER(4,0),
            "ENAME" VARCHAR2(10),
            "JOB" VARCHAR2(9),
            "MGR" NUMBER(4,0),
            "HIREDATE" DATE,
            "SAL"
    NUMBER(7,2),
            "COMM" NUMBER(7,2),
            "DEPTNO" NUMBER(2,0),
             CONSTRAINT
    "PK_EMP" PRIMARY KEY ("EMPNO")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
    COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS
    2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "USERS"  ENABLE,
             CONSTRAINT "FK_DEPTNO" FOREIGN KEY ("DEPTNO")
    REFERENCES "SCOTT"."DEPT" ("DEPTNO") ENABLE
       ) PCTFREE 10 PCTUSED 40 INITRANS
    1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576
    MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
    BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"
    PL/SQL procedure successfully completed.
    SQL> Now one more correction to my previous reply. Driver table shoudl not be owned by SYS (that would be bad practice). Create it in some other schema. Just make sure your "support staff" has no access to it.
    SY.

  • DBMS_METADATA.GET_DDL Not working

    Hi All,
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    I am creating table as:
    create table XX as select * from fnd;
       select   DBMS_METADATA.GET_DDL('TABLE','xx') from dualI get the below given error:
    Error starting at line 1 in command:
    select DBMS_METADATA.GET_DDL('TABLE','xx') from dual
    Error report:
    SQL Error: ORA-31603: object "xx" of type TABLE not found in schema "A395513"
    ORA-06512: at "SYS.DBMS_METADATA", line 1548
    ORA-06512: at "SYS.DBMS_METADATA", line 1585
    ORA-06512: at "SYS.DBMS_METADATA", line 1902
    ORA-06512: at "SYS.DBMS_METADATA", line 2793
    ORA-06512: at "SYS.DBMS_METADATA", line 4333
    ORA-06512: at line 1
    31603. 00000 - "object \"%s\" of type %s not found in schema \"%s\""
    *Cause:    The specified object was not found in the database.
    *Action:   Correct the object specification and try the call again.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Oracle names are stored in dictionary in upper case (unless quoted name is used at create time). Use XX as table name:
    SQL> create table XX as select * from emp;
    Table created.
    SQL> set long 1000
    SQL> select   DBMS_METADATA.GET_DDL('TABLE','xx') from dual;
    ERROR:
    ORA-31603: object "xx" of type TABLE not found in schema "SCOTT"
    ORA-06512: at "SYS.DBMS_METADATA", line 1548
    ORA-06512: at "SYS.DBMS_METADATA", line 1585
    ORA-06512: at "SYS.DBMS_METADATA", line 1902
    ORA-06512: at "SYS.DBMS_METADATA", line 2793
    ORA-06512: at "SYS.DBMS_METADATA", line 4333
    ORA-06512: at line 1
    no rows selected
    SQL> select   DBMS_METADATA.GET_DDL('TABLE','XX') from dual;
    DBMS_METADATA.GET_DDL('TABLE','XX')
      CREATE TABLE "SCOTT"."XX"
       (    "EMPNO" NUMBER(4,0),
            "ENAME" VARCHAR2(10),
            "JOB" VARCHAR2(9),
            "MGR" NUMBER(4,0),
            "HIREDATE" DATE,
            "SAL" NUMBER(7,2),
            "COMM" NUMBER(7,2),
            "DEPTNO" NUMBER(2,0)
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    DBMS_METADATA.GET_DDL('TABLE','XX')
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"
    SQL> SY.

  • How to stop a scheduled job using OMB*Plus ?

    Hello everyone,
    I use a OMB*Plus script to deploy a project in various environments. This includes scheduled jobs.
    In this context, I need to stop the schedules of the previous versions to avoid a script crash.
    I found the OMBSTOP command thad could do, but I need to retrieve the job ID of the schedule I want to stop. And I don't know how to get the Job ID.
    I could get it from a previous launch and save it somewhere, but it wouldn't work if the schedule was manually stopped and restarted. Maybe is there a command that lists the running / scheduled jobs and their IDs? I didn't find it.
    Thanks in advance for your help.
    Cedric.

    Frankly, I cannot see where this is available via pure OMB+, however you could back-door it if if you can figure out how to get these values from the public views (I would guess from the "Scheduling Views" section at http://download-east.oracle.com/docs/cd/B31080_01/doc/owb.102/b28225/toc.htm).
    Then you could use my SQL library from OMB+ to get these values and stop the schedules before deploying. you can save this file as omb_sql_library.tcl and then just "source /path/to/omb_sql_library.tcl in your own script to make the functions available in your script.
    {code}
    package require java
    # PVCS Version Information
    #/* $Workfile: omb_sql_library.tcl $ $Revision: 1.0 $ */
    #/* $Author: $
    #/* $Date: 03 Apr 2008 13:43:34 $ */
    proc oracleConnect { serverName databaseName portNumber username password } {
    # import required classes
    java::import java.sql.Connection
    java::import java.sql.DriverManager
    java::import java.sql.ResultSet
    java::import java.sql.SQLWarning
    java::import java.sql.Statement
    java::import java.sql.CallableStatement
    java::import java.sql.ResultSetMetaData
    java::import java.sql.DatabaseMetaData
    java::import java.sql.Types
    java::import oracle.jdbc.OracleDatabaseMetaData
    # load database driver .
    java::call Class forName oracle.jdbc.OracleDriver
    # set the connection url.
    append url jdbc:oracle:thin
    append url :
    append url $username
    append url /
    append url $password
    append url "@"
    append url $serverName
    append url :
    append url $portNumber
    append url :
    append url $databaseName
    set oraConnection [ java::call DriverManager getConnection $url ]
    set oraDatabaseMetaData [ $oraConnection getMetaData ]
    set oraDatabaseVersion [ $oraDatabaseMetaData getDatabaseProductVersion ]
    puts "Connected to: $url"
    puts "$oraDatabaseVersion"
    return $oraConnection
    proc oracleDisconnect { oraConnect } {
    $oraConnect close
    proc oraJDBCType { oraType } {
    #translation of JDBC types as defined in XOPEN interface
    set rv "NUMBER"
    switch $oraType {
    "0" {set rv "NULL"}
    "1" {set rv "CHAR"}
    "2" {set rv "NUMBER"}
    "3" {set rv "DECIMAL"}
    "4" {set rv "INTEGER"}
    "5" {set rv "SMALLINT"}
    "6" {set rv "FLOAT"}
    "7" {set rv "REAL"}
    "8" {set rv "DOUBLE"}
    "12" {set rv "VARCHAR"}
    "16" {set rv "BOOLEAN"}
    "91" {set rv "DATE"}
    "92" {set rv "TIME"}
    "93" {set rv "TIMESTAMP"}
    default {set rv "OBJECT"}
    return $rv
    proc oracleQuery { oraConnect oraQuery } {
    set oraStatement [ $oraConnect createStatement ]
    set oraResults [ $oraStatement executeQuery $oraQuery ]
    # The following metadata dump is not required, but will be a helpfull sort of thing
    # if ever want to really build an abstraction layer
    set oraResultsMetaData [ $oraResults getMetaData ]
    set columnCount [ $oraResultsMetaData getColumnCount ]
    set i 1
    #puts "ResultSet Metadata:"
    while { $i <= $columnCount} {
    set fname [ $oraResultsMetaData getColumnName $i]
    set ftype [oraJDBCType [ $oraResultsMetaData getColumnType $i]]
    #puts "Output Field $i Name: $fname Type: $ftype"
    incr i
    # end of metadata dump
    return $oraResults
    # SAMPLE CODE to run a quick query and dump the results. #
    #set oraConn [ oracleConnect myserver orcl 1555 scott tiger ]
    #set oraRs [ oracleQuery $oraConn "select name, count(*) numlines from user_source group by name" ]
    #for each row in the result set
    #while {[$oraRs next]} {
    #grab the field values
    # set procName [$oraRs getString name]
    # set procCount [$oraRs getInt numlines]
    # puts "Program unit $procName comprises $procCount lines"
    #$oraRs close
    #oracleDisconnect $oraConn
    {code}
    So you would want to connect to the control center, query for scheduled jobs, stop them, and then continue on with your deployment. I assume that you also need to pause and check that an scheduled job in mid-run has time to exit before moving ahead. You could do a sleep loop querying against system tables looking for active sessions running mappings and waiting until they are all done or something if you really want to bulletproof the process.
    Hope this helps,
    Mike

  • Analytical snapshots and scheduled jobs

    Hello,
    for extended analytical reports we need to make the snapshots of our statistic datas every day.
    There is an option of doing snapshots of the Project in Project Management, but we need to have snapshots of our own BO's or data sources. Is there any possibility to do this?
    In case snapshots can't be done by the system we also would perform it in coding, by creating business objects with required datas and saving them. But we need to do the saving automatically (regularly).
    In Project Management it is also possible to run scheduled snapshots. How can we schedule jobs (it would be enough if we could execute an action which saves our datas at scheduled time)?
    We have found only "Mass Data Run Process" in this context but the MDR's can be done only for the special standard Floorplans, aren't they?
    Best regards,
    Leonid Granatstein.

    Hi,
    currently it is not possible to create snapshots for partner BO content by a standard process.
    Also defining a mass data run object, which you could schedule and where you could implement the snapshot by yourself, is not available for partners yet.  So we have no standard mechanism available to get your task done with the use of the current implementation possibilities.
    The only option I see is that you develop the snapshot activity on your own in ByD studio.
    To trigger the snapshot activity on a regular basis, I only see the option to trigger this from outside. An option would be to define a web service or an XML file upload.
    You could write for example a small program ( by using PHP or .NET) on a PC which runs on a regular basis and which uploads an XML file or calls a web service. This then triggers the snapshot activity you have programmed in ByD Studio.
    I hope this helps.
    Regards,
    Thomas

  • KM Scheduler job

    Hi
    I created several KM scheduler jobs.
    The problem is that they are running in the context of Guest user, and i could find any way to change this.
    Because of that when i try to call new InitialContext () for calling some remote ejbs i get caller not autorized.
    So does somebody know how i can change this?
    Florin

    hi,
    if you ejb connect to backend, you need to configure an service user who has authorized to call
    the rfc functions in R/3.
    Kind regards
    Ben.J.

  • Troubled to get scheduler job to run?

    Hi all friends:
    I'm having trouble getting any scheduler jobs (here, troubled job name is CUSTMASTER_CHANGES_01) to actually run.
    when
    sql>select job_name,state,enabled,retry_count,failure_count,run_count,restartable,start_date,repeat_interval,job_class
    from all_scheduler_jobs;
    JOB_NAME STATE ENABL RETRY_COUNT FAILURE_COUNT RUN_COUNT RESTA START_DATE REPEAT_INTERVAL JOB_CLASS
    CUSTMASTER_CHANGES_01 SCHEDULED TRUE 0 0 0 FALSE 14-JAN-08 09.46.14.6 FREQ=SECONDLY;I SCANNER_JO
    72965 AM AMERICA/NEW NTERVAL=5 B_CLASS
    _YORK
    for job 'CUSTMASTER_CHANGES_01'
    we can see RUN_COUNT 0 and restartable false.
    I upped slave processes to 5. dbms_scheduler.run_job('CUSTMASTER_CHANGES_01') works, but it's still not executing on the schedule
    when run as sysdba
    SQL> exec dbms_scheduler.run_job('CUSTMASTER_CHANGES_01');
    ERROR at line 1:
    ORA-27475: "SYS.CUSTMASTER_CHANGES_01" must be a job
    ORA-06512: at "SYS.DBMS_ISCHED", line 150
    ORA-06512: at "SYS.DBMS_SCHEDULER", line 441
    ORA-06512: at line 1
    to resolve that,
    we found
    When you create your job by using dbsm_scheduler, it has a parameter called ‘auto_drop’, is by default, =’true’, like, auto_drop => TRUE
    see below;
    dbms_scheduler.create_job(
    job_name IN VARCHAR2,
    job_type IN VARCHAR2,
    job_action IN VARCHAR2,
    number_of_arguments IN PLS_INTEGER DEFAULT 0,
    start_date IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
    repeat_interval IN VARCHAR2 DEFAULT NULL,
    end_date IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
    job_class IN VARCHAR2 DEFAULT 'DEFAULT_JOB_CLASS',
    enabled IN BOOLEAN DEFAULT FALSE,
    auto_drop IN BOOLEAN DEFAULT TRUE,
    comments IN VARCHAR2 DEFAULT NULL);
    The job you manually run once and then it drops itself when you test.
    so I am specifiying auto_drop to be false, but it is showing it has true as the attribute.
    DBMS_SCHEDULER.CREATE_JOB(
    job_name => scanner.scanner_name,
    job_type => 'PLSQL_BLOCK',
    job_action => 'BEGIN IF EEG_SCAN.GET_RUNNING_JOBS_COUNT('
    ||''''||UPPER(scanner.scanner_name)||''''
    ||') < 2 THEN '||scanner.scanner_proc_name||'; END IF; END;',
    repeat_interval => 'FREQ=SECONDLY;INTERVAL=5',
    job_class => c_job_class_name,
    auto_drop => FALSE,
    enabled => true
    scheduler job is still not working as expected.....?
    Can you help me for this??
    thanks a lot in advance.
    Message was edited by:
    jerrygreat
    Message was edited by:
    jerrygreat

    Hi,
    There are a few other limits you could check .
    Make sure that you have not exceeded the maximum number of sessions or the maximum number of processes or the maximum number of scheduler jobs
    select * from dba_scheduler_global_attribute;
    and
    select name,value from v$parameter where name like '%process%';
    select name,value from v$parameter where name like '%session%';
    Also check how many jobs are currently running
    select count(*) from dba_scheduler_running_jobs;
    select count(*) from dba_jobs_running ;
    select count(*) from v$session ;
    One of these limits may need to be increased.
    The run_job succeeds because it runs in the current session by default, if you use use_current_session=>false, does it still work ?
    Also auto_drop only drops the job when it has completed e.g. past its end_date or exceeded its max_runs.
    Finally note that there is a dedicated forum for dbms_scheduler located here
    Scheduler
    Hope this helps,
    Ravi.

  • How to schedule job?

    Hello All,
    i have a few questions about jobs (scheduling jobs)
    I want to run one procedure at 7:00 A.M and I want to stop this procedure at 12:30 PM on Daily basis.Is it possible with DBMS_JOB? I don't know how to stop running job at specified time.
    I m using Oracle 9i on Linux

    Hi,
    Your best bet is probably to schedule a second job to run at 12:30pm every day and execute the stop. To do the stop you will probably need to figure out the session and terminate the session (google for stopping dbms_job).
    In 10gR2 and up dbms_scheduler (the replacement for dbms_job) can handle this scenario in a much more striahgtforward way (generate an event if the job exceeds a max_run_duration and have the event trigger a second job to snipe the first using a stop_job call).
    -Ravi

  • How to schedule job under dbms_job??

    Hello,
    How would i go about scheduling a dbms job ?? All i have is the schema name and a procedure that i need to schedule. It need to run every night at midnight...i was said everything is ready in the procedure(some partitioning) of tables...i just need to put on dbms scheduler...how would i go about doing that?? schema name is syk2ws and the procedure name is maint....how can i put this on the dbms job ?? Do i need to tweak or do anything with the procedure ??

    Hi,
    You need to create a scheduler job which runs every night at midnight.
    You need to use the dbms_scheduler.create_job call.
    You can search online for examples or find Oracle's examples here
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28310/scheduse002.htm#i1006395
    There is a forum dedicated to dbms_scheduler here
    Scheduler
    -Ravi

  • Error while running schedule jobs in oim 11 gr2

    Hello,
             I have create the custom schedule job.for which i have create the java call and the plugin.xml file and i have successfully register it to oim
                 ,then i have create the metadata scheduler xml and import it to mds using wlst.
              then i have cretae the schedule job in oim advance tab.but when i run that task the console propmt the error
    <Jun 13, 2013 5:47:19 PM IST> <Warning> <oracle.iam.scheduler.impl> <BEA-000000> <XSD Validation Exception: org.xml.sax.SAXParseException: cvc-elt.1: Cannot f
    ind the declaration of element 'scheduledTasks'.>
    <Jun 13, 2013 5:48:51 PM IST> <Error> <oracle.iam.transUI.impl> <BEA-000000> <ADP ClassLoader failed to load: com.oracle.demo.oim.scheduled.NotificationDemoSc
    heduledTask>
    please help how to resolve this error
    regards,
    Tushar

    Check your scheduler xml. I hope XSD validation exception points to invalid scheduler xml file. It should look something like this sample
    <scheduledTasks xmlns="http://xmlns.oracle.com/oim/scheduler">
       <task>
          <name>Lookup Recon Scheduled Task</name>
    <class>oracle.iam.samples.schtasks.LookupReconScheduledTask</class>
          <description>Lookup recon Scheduled Task</description>
          <retry>5</retry>
          <parameters>
              <string-param required="true" helpText="Name of the Lookup code">Lookup Code Name</string-param>
    </parameters>
       </task>
    </scheduledTasks>

  • Error while using DBMS_METADATA.GET_DDL package.

    Hi all,
    I want script of DDL of all tables in Database not in particular schema,
    As I am using below query
    SELECT DBMS_METADATA.GET_DDL('TABLE',u.table_name)
    FROM ALL_TABLES u
    WHERE u.nested='NO'
    AND (u.iot_type is null or u.iot_type='IOT')
    but it gives error as below.
    ORA-31603: object "ICOL$" of type TABLE not found in schema "SCOTT"
    It should give DDL of all tables, also I am not having DBA Privs.
    Please help me.
    Thanks & Regards
    Rajiv.

    It could be helpful if you have a look into [url http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_metada.htm#i1016867]documentation.
    Security Model
    The object views of the Oracle metadata model implement security as follows:
    Nonprivileged users can see the metadata of only their own objects.
    SYS and users with SELECT_CATALOG_ROLE can see all objects.
    Nonprivileged users can also retrieve public synonyms, system privileges granted to them, and object privileges granted to them or by them to others. This also includes privileges granted to PUBLIC.
    If callers request objects they are not privileged to retrieve, no exception is raised; the object is simply not retrieved.
    If nonprivileged users are granted some form of access to an object in someone else's schema, they will be able to retrieve the grant specification through the Metadata API, but not the object's actual metadata.
    In stored procedures, functions, and definers-rights packages, roles (such as SELECT_CATALOG_ROLE) are disabled. Therefore, such a PL/SQL program can only fetch metadata for objects in its own schema. If you want to write a PL/SQL program that fetches metadata for objects in a different schema (based on the invoker's possession of SELECT_CATALOG_ROLE), you must make the program invokers-rights.
    Best regards
    Maxim

  • Material Document schedule job printing.

    Dear All ,
      I had configured all configuration to print the material document details in a smartofrm . All details are copied in the material document from output determination.
    if i set printing preference  4.send immediately (when saving the application) i am getting the output in the printer. Here the status is green .
    Here my user want to set the preference as 1.send with periodically scheduled job , so that all the material documents will be printed at the same time.
    How to schedule this in back ground job . I had tried in MB90 its not working there.
    Thanks in advance.
    Regards
    Srihari.P

    Hi,
    You can schedule the Job for the Despatch time  3. Send with application own transaction  also, for this you have to select the program to run for the Job, as you said you can schedule the JOB on the program of MB90
    for Using the Despatch time 1. 1. Send with periodically scheduled job, you have to run or setup job for the Program RSNAST00
    Manually you can also run the program RSNAST00 in SE38 to chcek whether the OUTPUT was processed or not
    Goto SE38 and with the RSNAST00 ,, execute and enter the Details of Application area ME and OUTPUT type and the Document number.
    Then  in the Menu click on Program--Exdcute in Back ground. It will run and in SM37 you can find the Processed outputs or Logs if any in case if they are not processed. you can then trace the error
    In the foreground you cant identify the eror or reason of why it was not processed.
    regards,
    santosh

Maybe you are looking for