DBA_AUTOTASK_WINDOW_CLIENTS 每晚10点数据库繁忙

for SID    in `ps -ef | grep pmon | grep -v grep | grep -v ASM |   cut -d"_" -f3,4 `
for SID    in     PDB PDB1 PDB2 
do
sqlplus  -s  ' / as sysdba' < alter session set container=$SID;
select * from DBA_AUTOTASK_WINDOW_CLIENTS;
/


begin
dbms_scheduler.disable(name => 'MONDAY_WINDOW');
dbms_scheduler.set_attribute(
name => 'MONDAY_WINDOW',
attribute => 'REPEAT_INTERVAL',
value => 'freq=daily;byday=MON;  byhour=22;byminute=40; bysecond=0');
dbms_scheduler.enable(name => 'MONDAY_WINDOW');
end;
/

begin
dbms_scheduler.disable(name => 'TUESDAY_WINDOW');
dbms_scheduler.set_attribute(
name => 'TUESDAY_WINDOW',
attribute => 'REPEAT_INTERVAL',
value => 'freq=daily;byday=TUE;  byhour=22;byminute=40; bysecond=0');
dbms_scheduler.enable(name => 'TUESDAY_WINDOW');
end;
/


begin
dbms_scheduler.disable(name => 'WEDNESDAY_WINDOW');
dbms_scheduler.set_attribute(
name => 'WEDNESDAY_WINDOW',
attribute => 'REPEAT_INTERVAL',
value => 'freq=daily;byday=WED;  byhour=22;byminute=40; bysecond=0');
dbms_scheduler.enable(name => 'WEDNESDAY_WINDOW');
end;
/

begin
dbms_scheduler.disable(name => 'THURSDAY_WINDOW');
dbms_scheduler.set_attribute(
name => 'THURSDAY_WINDOW',
attribute => 'REPEAT_INTERVAL',
value => 'freq=daily;byday=THU;  byhour=22;byminute=40; bysecond=0');
dbms_scheduler.enable(name => 'THURSDAY_WINDOW');
end;
/


begin
dbms_scheduler.disable(name => 'FRIDAY_WINDOW');
dbms_scheduler.set_attribute(
name => 'FRIDAY_WINDOW',
attribute => 'REPEAT_INTERVAL',
value => 'freq=daily;byday=FRI;  byhour=22;byminute=40; bysecond=0');
dbms_scheduler.enable(name => 'FRIDAY_WINDOW');
end;
/


select * from DBA_AUTOTASK_WINDOW_CLIENTS;
/
EOF
done
 
 

你可能感兴趣的:(oracle)