Question

Change user on scheduled task

  • 3 November 2020
  • 5 replies
  • 339 views

Userlevel 6
Badge +14

If a user is deactivated, then scheduled tasks created by this user is also deactivated when the task hits execution time.

Can the ‘scheduled by’ user be changed?

 


5 replies

Userlevel 7

If a user is deactivated, then scheduled tasks created by this user is also deactivated when the task hits execution time.

Can the ‘scheduled by’ user be changed?

 

I believe the only two options you have is to either create the schedule again with another user (preferably one that isn’t a real person that might leave) or update the db.

UPDATE batch_schedule_tab
SET username = 'IFSAPP’
WHERE schedule_id = <schedule_id>

You may need to deactivate and reactivate the jobs after update.

 

 

Userlevel 6
Badge +14

I just copied the tasks. The copy changed the user to the active one and nothing else I believe.

Not a big deal after all.

Userlevel 7
Badge +28

@Hans Andersen 

Ahhh, you found the answer I was just going to mention, we had to do this quite a bit at the last upgrade, it really isn’t a ton of time.

Userlevel 4
Badge +8

It is interesting that there is a procedure batch_schedule_api.modify_username, but seemingly not possible to invoke from the client.

The following would loop all scheduled tasks for a given user and use the procedure to update Scheduled By to IFSAPP.

begin
for r in (select *
from ifsapp.batch_schedule
where username = '*FROM_USER*'and BATCH_SCHEDULE_TYPE_DB = 'TASK') loop

ifsapp.batch_schedule_api.Modify_Username(schedule_id_ => r.schedule_id,
username_ => 'IFSAPP');
end loop;
end;

 

Userlevel 5
Badge +10

It is interesting that there is a procedure batch_schedule_api.modify_username, but seemingly not possible to invoke from the client.

The following would loop all scheduled tasks for a given user and use the procedure to update Scheduled By to IFSAPP.

begin
for r in (select *
from ifsapp.batch_schedule
where username = '*FROM_USER*'and BATCH_SCHEDULE_TYPE_DB = 'TASK') loop

ifsapp.batch_schedule_api.Modify_Username(schedule_id_ => r.schedule_id,
username_ => 'IFSAPP');
end loop;
end;

 

Ran this in SQl Developer and purred like a kitten.

 

As I’m leaving for pastures new - I’ve had to change over a number of tasks that I lazily created in my name.

 

I could have just left them - but that would have been cruel.

 

Reply