Oracle scheduled task and oracle task

Source: Internet
Author: User

Oracle scheduled task and oracle task

# Su-oracle
Oracle> sqlplus "/as sysdba"
SQL> exec dbms_scheduler.disable ('Monday _ window ');
SQL> exec dbms_scheduler.disable ('tuesday _ window ');
SQL> exec dbms_scheduler.disable ('wednesday _ window ');
SQL> exec dbms_scheduler.disable ('Thursday _ window ');
SQL> exec dbms_scheduler.disable ('Friday _ window ');
SQL> exec dbms_scheduler.disable ('Saturday _ window ');
SQL> exec dbms_scheduler.disable ('Sunday _ window ');
SQL> exec dbms_scheduler.disable ('weekend _ window ');

# Su-oracle
Oracle> sqlplus "/as sysdba"
SQL> exec dbms_scheduler.enable ('Monday _ window ');
SQL> exec dbms_scheduler.enable ('tuesday _ window ');
SQL> exec dbms_scheduler.enable ('wednesday _ window ');
SQL> exec dbms_scheduler.enable ('Thursday _ window ');
SQL> exec dbms_scheduler.enable ('Friday _ window ');
SQL> exec dbms_scheduler.enable ('Saturday _ window ');
SQL> exec dbms_scheduler.enable ('Sunday _ window ');

Disable oracle scheduled tasks
1 Set the current resource manager plan to null (or another plan that is not restrictive ):
Alter system set resource_manager_plan = ''scope = both;

2 Change the active windows to use the null resource manager plan (or other nonrestrictive plan) using:
Execute dbms_scheduler.set_attribute ('weeknight _ Window', 'Resource _ plan ','');
Execute dbms_scheduler.set_attribute ('weekend _ Window', 'Resource _ plan ','');
 
3 Then, for each window_name (WINDOW_NAME from DBA_SCHEDULER_WINDOWS), run:
Execute dbms_scheduler.set_attribute ('<window name>', 'Resource _ plan ','');
SQL> select * from DBA_SCHEDULER_WINDOWS;

4 open resources plan
Check the resource status (Maybe need to set NULL or Change the running time. Please contact with the product engineers to confirm)
SQL> select a. name, a. value from v $ parameter a where a. name = 'Resource _ manager_plan ';
SQL> select window_name, resource_plan from dba_scheduler_windows where resource_plan is not null;
If not NULL, please think about Change the running time by the following:
Begin
Dbms_scheduler.set_attribute (name => 'Monday _ Window', attribute => 'Repeat _ INTERVAL ', value => 'freq = daily; byday = MON; byhour = 3; byminute = 0; bysecond = 0 ');
Dbms_scheduler.set_attribute (name => 'tuesday _ Window', attribute => 'Repeat _ INTERVAL ', value => 'freq = daily; byday = TUE; byhour = 3; byminute = 0; bysecond = 0 ');
Dbms_scheduler.set_attribute (name => 'wednesday _ Window', attribute => 'Repeat _ INTERVAL ', value => 'freq = daily; byday = WED; byhour = 3; byminute = 0; bysecond = 0 ');
Dbms_scheduler.set_attribute (name => 'Thursday _ Window', attribute => 'Repeat _ INTERVAL ', value => 'freq = daily; byday = THU; byhour = 3; byminute = 0; bysecond = 0 ');
Dbms_scheduler.set_attribute (name => 'Friday _ Window', attribute => 'Repeat _ INTERVAL ', value => 'freq = daily; byday = FRI; byhour = 3; byminute = 0; bysecond = 0 ');
End;
/
 
Begin
Dbms_scheduler.set_attribute (name => 'Saturday _ Window', attribute => 'Repeat _ INTERVAL ', value => 'freq = daily; byday = SAT; byhour = 3; byminute = 0; bysecond = 0 ');
Dbms_scheduler.set_attribute (name => 'Saturday _ Window', attribute => 'duration', value => '+ 000 04:00:00 ');
Dbms_scheduler.set_attribute (name => 'Sunday _ Window', attribute => 'Repeat _ INTERVAL ', value => 'freq = daily; byday = SUN; byhour = 3; byminute = 0; bysecond = 0 ');
Dbms_scheduler.set_attribute (name => 'Sunday _ Window', attribute => 'duration', value => '+ 000 04:00:00 ');
End;
/

Exec DBMS_SCHEDULER.SET_SCHEDULER_ATTRIBUTE ('default _ timezone ', 'Asia/TASHKENT ');


High-score and urgent oracle scheduled tasks

1. When a job is running, if there are update and delete operations, when there is no commit or rollback, only the update and delete operations will be locked, affecting the data.
2. If no one updates or deletes the data processed by the job at this time, no locks will occur.
3. If the preceding statement does not exist, the insert operation of the new data is not affected.
4. I think a little more about it, and it is unnecessary to worry about it.

High-score and urgent oracle scheduled tasks

1. When a job is running, if there are update and delete operations, when there is no commit or rollback, only the update and delete operations will be locked, affecting the data.
2. If no one updates or deletes the data processed by the job at this time, no locks will occur.
3. If the preceding statement does not exist, the insert operation of the new data is not affected.
4. I think a little more about it, and it is unnecessary to worry about it.

Related Article

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.