Maven4Champ
Technical User
- Jun 16, 2004
- 154
Greetings,
I have a question for all you Oracle 10g2 experts out there. I am trying to create a DBMS Scheduler Job to refresh a list of materialized views in our database. Because our DBAs want a more localized mechanism within Oracle to do the refresh (instead of a script used by operators or a .bat file to execute SQLPLUS and do the refreshes for us), I have opted for the DBMS SCHEDULER functionality in Oracle10g.
Below is my syntax. However I am receiving a permissions error - more than likely because my account doesn't have permissions to create the job which is fine (for now).
I have made this generic enough where it can be re-used. Is there someone out there with sys permissions that can fire this off for an MV of their own and verify that it works.
As well, not sure how it will handle multiple MVs and if it goes in order of how I list them - i.e. MV_NAME_1 and MV_NAME_2 won't be kicked off in paralell but rather one after the other? Also where to insert the delimeter when I want to add more MVs to the mv_refresh_job statement?
Any advice on if I am proceeding correctly with this would be greatly appreciated.
Thanks!
I have a question for all you Oracle 10g2 experts out there. I am trying to create a DBMS Scheduler Job to refresh a list of materialized views in our database. Because our DBAs want a more localized mechanism within Oracle to do the refresh (instead of a script used by operators or a .bat file to execute SQLPLUS and do the refreshes for us), I have opted for the DBMS SCHEDULER functionality in Oracle10g.
Below is my syntax. However I am receiving a permissions error - more than likely because my account doesn't have permissions to create the job which is fine (for now).
I have made this generic enough where it can be re-used. Is there someone out there with sys permissions that can fire this off for an MV of their own and verify that it works.
Code:
BEGIN
DBMS_SCHEDULER.CREATE_JOB (
JOB_NAME => 'MY_MV_REFRESH',
JOB_TYPE => 'PLSQL_BLOCK',
JOB_ACTION => 'BEGIN mv_refresh_job(''EXEC DBMS_MVIEW.REFRESH(''MV_NAME_HERE'', ''C'')''); END;',
START_DATE => SYSTIMESTAMP,
REPEAT_INTERVAL => 'freq=daily; byhour=0; byminute=0; bysecond=0;',
END_DATE => NULL,
ENABLED => TRUE,
COMMENTS => 'Refreshes Materialized Views on a Scheduled Basis (12:00AM each day).');
END;
/
As well, not sure how it will handle multiple MVs and if it goes in order of how I list them - i.e. MV_NAME_1 and MV_NAME_2 won't be kicked off in paralell but rather one after the other? Also where to insert the delimeter when I want to add more MVs to the mv_refresh_job statement?
Any advice on if I am proceeding correctly with this would be greatly appreciated.
Thanks!