Oralce scheduled execution of stored procedure task settings

Source: Internet
Author: User

Oralce:

[Function description]: the current system time is automatically inserted into the getSysDate table every minute.

[1. Create a test table]

Create table getSysDate (test date );

[2. Create a stored procedure for scheduled execution]

Create or replace procedure insertSysDate
Begin
Insert into getSysDate values (sysdate );
End;

3. Create a JOB, that is, the process of creating the scheduled task to be executed]

Variable job1 number;
Begin
Dbms_job.submit (: job1, 'insertsysdate; ', sysdate, 'sysdate + 100 ');
End;

4. Start a JOB, that is, the process of starting and running a scheduled task]

Begin
Dbms_job.run (: job1 );
End;

[5. View running results]

Select to_char (test, 'yyyy/mm/dd hh24: mi: ss') from getSysDate;

The result is as follows:

10:53:11
11:05:51

[Some important parameters are supplemented]:

DBMS_JOB.SUBMIT (: jobno, // job no.
'Your _ procedure; ', // process to be executed
Trunc (sysdate) + 1/24, // next execution time
'Trunc (sysdate) + 1/24 + 1' // Interval
);


Delete job: dbms_job.remove (jobno );
Modify the operation to be executed: job: dbms_job.what (jobno, what );
Modify the next execution time: dbms_job.next_date (job, next_date );
Interval of modification: dbms_job.interval (job, interval );

Stop job: dbms. broken (job, broken, nextdate );
Start job: dbms_job.run (jobno );

Modify the value of job_queue_processes: (Ensure that the value is not 0; otherwise, the JOB will not run automatically)
You can view the value of select * from v $ parameter;

You can also directly use show parameter job_queue_processes; to view the following information:

NAME TYPE VALUE
-----------------------------------------------------------------------------
Job_queue_processes integer 10


Method 1, startup pfile = 'C: \ Oracle \ ora90 \ database \ initorcl. ora ';


// This method modifies the job_queue_processes parameter of the initorcl. ora file, and then restarts the database.


Method 2: alter system set job_queue_processes = 10

// This method does not take effect after the database is restarted. The system automatically modifies the init. ora file.

Will take effect later

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.