Materialized Views or DBMS_JOBS?

Hellow
I have a situation where there are 2 database servers "db1" and
"db2". Both the servers have a common schema containing common tables.
Some tables in db1 is getting updated repeatedly in every 3sec. I need
to synchronise this tables with the corresponding replica tables in
db2 after every 4sec.
I cannot opt for trigger because in every 3 sec entire data in the
able is flushed out and new data is populated....so i need to wait for 3
sec and then do the same thing for the replica table in db2 by copying data
from db1 to db2...
what option will be better Materialized View or DBMS_JOB...I mean i
thought of writing a plsql script which will update the table in db2
after every 5sec..by associating this script with DBMS_JOB
performance wise which will be more better?
Regards
sam

Actually it is getting populated by new coordinates which depict the latest location of a moving object. this data is constantly getting updated (deleted and re-populated)
this is being done in db1 and we are asked to replicate the tables and populate the latest data from the tables in db1 to corresponding tables in db2.
we need to perform the same operation in db2 in every 5sec...thats the main issue
we will be accessing these coordinates and display them on a map, later...
performance wise which option will be good
1. Materialized Views
2. DBMS_JOBS (relating to a pl/sql code)
also is there any much difference in performance from a normal view when compared to materialized views?
please suggest
Regards
Sam

Similar Messages

  • ORA-01555 when performing refresh of materialized views via DBMS_JOB

    All,
    With this project needing to be finished soon and an issue occuring on the local database, I am hopefuly one of you will have the answer or resolution so that I may complete this project soon....
    Here is the setup..
    10g database (remote)
    9i database (local
    DB Link from local to remote database
    103 materialized views in local database that are refreshed by pulling data from dblink to remote database.
    A PL/SQL procedure has been created which sets the v_failures variable = 0 and then performs a check to see if the current job has a failure and if so, inserts that value into the v_failures variable. When that reaches "1", then the procedure does nothing and closes out. If the failures are equal to "0" then it performs a DBMS_MVIEW.REFRESH procedure for each materialized view.
    This worked the first time but its continually failing now with the ORA-01555 error (snapshot too old). From what I can tell, the dbms_job duration is 4 seconds and the Last_Exec is 2m 7s after it starts (8:30 PM). With that said, our DBAs working o nthe project have increased the Undo_Retention settings and assure us that shouldn't be the problem. Odd thing is, this never happened in the dev environment when we were developing/testing - only in the production environment once it got migrated.
    I am looking for possible causes and possible solutions to the ORA-01555 error. A sample of the code in my procedure is below:
    CREATE OR REPLACE PROCEDURE Ar_Mviews IS
    V_FAILURES NUMBER := 0;
    BEGIN
    BEGIN
              SELECT FAILURES INTO V_FAILURES FROM USER_JOBS WHERE SCHEMA_USER = 'CATEBS' AND WHAT LIKE '%DISCO_MVIEWS%';
              IF V_FAILURES = 1 THEN NULL;
              ELSE
    DBMS_MVIEW.REFRESH ('AR_BATCH_RECEIPTS_V', 'C');
              DBMS_OUTPUT.PUT_LINE(V_FAILURES); END IF;
    END;
    BEGIN
         SELECT FAILURES INTO V_FAILURES FROM USER_JOBS WHERE SCHEMA_USER = 'CATEBS' AND WHAT LIKE '%DISCO_MVIEWS%';
              IF V_FAILURES = 1 THEN NULL;
              ELSE
    DBMS_MVIEW.REFRESH ('AR_BATCHES_ALL_V', 'C');
              DBMS_OUTPUT.PUT_LINE(V_FAILURES); END IF;
    END;
    END Ar_Mviews;
    ---------------------------------------------------------------------------------------------------------------

    We are doing complete refreshes and doing it that way for consistency in the data presented. Because some materialized views are dependent upon data in other materialized views, we have them ordered in a procedure so that when one finishes, the next starts and they are also in a specific order as to ensure accurate data.
    The condition for v_failures is done so that the job doesn't get, lets say, 90% finished and hit an error and start over again. We do the IF statement which results in NULL (do nothing) so that the job doesn't repeat itself over and over again. If one MV fails, we have to consider the job a failure and do nothing else because the one MV that failed may have been a dependency of another MV down the line. (i.e. MV7 calls MV3 and MV3 fails, so the whole job fails because MV7 can't be accurate without the most current data from MV3).
    As well, this is being performed in off-business hours after backup to tape, etc. and prior to start of business so that no one is using the system when we run this job. That won't always be the case when we move to high availability with this system for varying time-zone end-users.
    I hope I have answered your question and look forward to continued feedback.
    Thanks!

  • How to get a materialized view get to refresh itself after the job is "broken"

    we created a materialized view sometime ago with the following statement:
    create materialized view SXV_PUB_EMPLOYEE_CERT_ALL_M
    refresh complete on demand
    start with to_date('30-08-2009 04:00:00', 'dd-mm-yyyy hh24:mi:ss') next trunc(sysdate) + (28/24)
    as
    select  sxv_emp_cert_all.*
    from    sxv_employee_certification_all sxv_emp_cert_all;
    this week we found out it had not been refresh for about a month
    In dba_jobs the column broken was 'Y', next_date time something like 01-01-4000 and failures 16
    when I ran it manually by executing
    BEGIN DBMS_MVIEW.REFRESH('SXV_PUB_EMPLOYEE_CERT_ALL_M', 'C'); END;
    I found that one of the columns was too small (probably a columns of one of the underlying tables had been extended since the creation of the materialized view)
    After fixing this I ussied yesterday (on 29-8-2013) the statement :
    alter materialized view SXV_PUB_EMPLOYEE_CERT_ALL_M
    refresh complete on demand
    start with to_date('30-08-2009 04:00:00', 'dd-mm-yyyy hh24:mi:ss') next trunc(sysdate) + (28/24)
    after this the table dba_jobs showed me 30-08-2013 04:00:00 as next date
    I was expecting it to run this night at 04:00, but it didn't
    the last_date column value was still from about a month ago, the column broken still shows 'Y'
    and the next date 30-08-2013 04:00:00 (while it should been set to 31-08-2013 01:00:00
    Rrunning
    BEGIN DBMS_MVIEW.REFRESH('SXV_PUB_EMPLOYEE_CERT_ALL_M', 'C'); END;
    gave no errors this time
    and in User_Mview_Analysis the last_refresh_date column showed the date/time I had executed it
    Any idea how to get the job "unbroken" again so that the view refreshes itself every night?
    the database is Oracle Database 10g Release 10.2.0.4.0
    regards,
    Remco

    thanx for all your helpful and correct answers . but eventually I found it myself
    exec dbms_job.broken(<jobnumber>, false);

  • Materialized View, ORA-12008: error in materialized view refresh path

    I want to refresh a materialized view, but I get an ORA-12008 error.
    Does anybody have an idea? I do not find any errors in my refresh statement.
    CREATE MATERIALIZED VIEW scott.dummy_mv
      TABLESPACE test
      BUILD IMMEDIATE
      USING INDEX TABLESPACE idx_test
      REFRESH
         START WITH sysdate
         NEXT ROUND(SYSDATE)+5/24          
         WITH PRIMARY KEY
      ENABLE QUERY REWRITE
      AS
      SELECT KM.ID ID
              ,KM.USERNAME USERNAME
           ,KM.ABTID ABTID     
      FROM my_table KM
    scott@orcl>desc dummy_mv
    Name                                      Null?    Typ
    ID                                        NOT NULL NUMBER(4)
    USERNAME                                  NOT NULL VARCHAR2(30)
    ABTID                                     NOT NULL NUMBER(4)
    scott@orcl>
    BEGIN
      SYS.DBMS_JOB.REMOVE(6579);
    COMMIT;
    END;
    DECLARE
      X NUMBER;
    BEGIN
      SYS.DBMS_JOB.SUBMIT
      ( job       => X
       ,what      => 'dbms_refresh.refresh(''"scott"."dummy_mv"'');'
       ,next_date => to_date('07.01.2009 05:00:00','dd/mm/yyyy hh24:mi:ss')
       ,interval  => 'ROUND(SYSDATE)+5/24              '
       ,no_parse  => FALSE
      SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' || to_char(x));
    COMMIT;
    END;
    scott@orcl>exec dbms_refresh.refresh('dummy_mv');
    BEGIN dbms_refresh.refresh('dummy_mv'); END;
    FEHLER in Zeile 1:
    ORA-12008: error in materialized view refresh path
    ORA-00947: not enough values
    ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 820
    ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 877
    ORA-06512: in "SYS.DBMS_IREFRESH", Zeile 683
    ORA-06512: in "SYS.DBMS_REFRESH", Zeile 195
    ORA-06512: in Zeile 1
    scott@orcl>

    crupper wrote:
    I get the same error:
    scott@orcl>exec dbms_mview.refresh('dummy_mv','c');
    BEGIN dbms_mview.refresh('dummy_mv','c'); END;
    FEHLER in Zeile 1:
    ORA-12008: error in materialized view refresh path
    ORA-00947: not enough values
    ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 820
    ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 877
    ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 858
    ORA-06512: in Zeile 1
    I would first check the "query" information of the DBA_SNAPSHOTS/DBA_MVIEWS dictionary views if it reveals anything obvious.
    But it looks more like an internal error while processing the refresh. You can get more information about the error by tracing the session. A "alter session set sql_trace = true;" before running the refresh should be sufficient. Disconnect afterwards and check the generated trace file for errors either using "tkprof" and checking the output or by manually searching for "err=" in the trace file.
    Which 4-digit version of Oracle are you using?
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • CONTAINS problem in materialized view

    SELECT SCORE(1) AS RELEVANCE, AST_OID, TOTAL
    FROM asset_materialized_vw
    WHERE CONTAINS(total, '%PRODUCT%', 1) > 0
    ORDER BY RELEVANCE DESC;
    The table in the FROM clause, asset_materialized_vw is a materialized view of a view called asset_vw with a complex query in it, it produces 2 columns, 1 ast_oid, which contains a unique id, and total which is a varchar2 column on which I put a CTXSYS.CONTEXT index, after putting the index on this column, I can execute the above query and it results many rows, but after about 5 - 10 minutes it doesn't return any rows at all anymore. Here is the script I used to create the index and materialized view:
    The view:
    SELECT * FROM asset_materialized_vw WHERE upper(total) LIKE '%N4S%'
    DROP MATERIALIZED VIEW mv_emp_pk
    CREATE MATERIALIZED VIEW asset_materialized_vw
         REFRESH COMPLETE
         NEXT SYSDATE + 1/96
         WITH PRIMARY KEY
         AS
         SELECT AST_OID,
              CONCAT(ASSET_REMARK, CONCAT(OBJECT_REFERENCE, CONCAT(PRJ_PROJECT_NAME, CONCAT(DV_REFERENCE_VALUE, CONCAT(LD_NAME_B, CONCAT(LD_NAME_A, CONCAT(DVL_DESCRIPTION, CONCAT(MDV_TEXT_VALUE, CONCAT(BUT_DVL_DESCRIPTION, CONCAT(MAG_DVL_DESCRIPTION, CONCAT(AGP_DVL_DESCRIPTION, CONCAT(BRC_DVL_DESCRIPTION, CONCAT(CAM_DVL_DESCRIPTION, CONCAT(PRS_NAME, PRD_PROPERTIES)))))))))))))) AS TOTAL
         FROM ASSET_VW
    The index:
    CREATE INDEX idx_asset_materialized_vw ON asset_materialized_vw(total)
    INDEXTYPE IS CTXSYS.CONTEXT

    Simple testcase to reproduce your issue:
    /* snapshot refreshes every 15 seconds */
    SQL> CREATE MATERIALIZED VIEW emp_mv
    REFRESH COMPLETE
    NEXT SYSDATE + 15/(24*60*60)
    AS
    SELECT * FROM emp
    Snapshot created.
    /* Context index */
    SQL> CREATE INDEX emp_txt_idx ON emp_mv
    (ename)
    INDEXTYPE IS ctxsys.CONTEXT
    Index created.
    SQL> SELECT ename,
           deptno
      FROM emp_mv
    WHERE contains (ename, 'scott') > 1
    ENAME          DEPTNO
    SCOTT              20
    /* wait 20 seconds*/
    SQL> EXEC dbms_lock.sleep(20)
    PL/SQL procedure successfully completed.
    SQL> SELECT *
      FROM emp_mv
    WHERE contains (ename, 'scott') > 1
    "no rows selected."
    /* sync the index */
    SQL> BEGIN
       ctx_ddl.sync_index ('emp_txt_idx');
    END;
    SQL> SELECT ename,
           deptno
      FROM emp_mv
    WHERE contains (ename, 'scott') > 1
    ENAME          DEPTNO
    SCOTT              20I would alter the generated job (from creation of materialized view) to append the sync of the index:
    BEGIN
      SYS.DBMS_JOB.CHANGE
          job        => 325634 /*  your job number */
         ,what       => 'dbms_refresh.refresh(''"EMP_MV"'');
                         ctx_ddl.sync_index (''emp_txt_idx'');'
         ,next_date  => sysdate
         ,interval   => 'SYSDATE + 15/(24*60*60) '
    END;

  • Materialized view with build deferred

    Hello,
    Do you have some idea why CREATE MATERIALIZED VIEW with BUILD DEFERRED option takes a lot of time? It's running 1 hour and not finish (Oracle 9.2).
    CREATE MATERIALIZED VIEW mv_users
    BUILD DEFERRED
    REFRESH COMPLETE
    NEXT SYSDATE+1
    WITH ROWID
    AS
    SELECT usr_id, usr_type, usr_active, usr_brn_id, usr_first_name,
    usr_last_name, usr_psl_rgn, usr_bp_id
    FROM users@db_link;
    Users table has 10 millions records.
    Edited by: user12111171 on 2011-09-16 13:28

    If the Job Queue is not enabled,  the CREATE cannot auto-schedule the refresh.  You need to have JOB_QUEUE_PROCESSES set to 1 or greater.
    It would seem that when you say "I have created job to refresh the materialized view everyday using dbms_refresh.refresh"  you haven't created a job using DBMS_JOB.SUBMIT   (which is what the CREATE MATERIALIZED VIEW would do "behind the scenes" --- you can then query DBA_JOBS or USER_JOBS to see the auto-submitted job).
    Hemant K Chitale

  • Materialized view refresh using connected user db links

    I have a general question. I have a materialized view that more or less joins tables from 2 databases.
    For example I have a table X in database A, and a table Y in database B. I create the materialized view in the schema owning table X in database A. Tables A & B from both database are in the same schema with a synchronized password. My materialized view is created to join tables A & B using connected user DB links, and everything works when I create the view, however, it appears that the refresh is failing. I suspect this is because of the connected user link and there is no "logged" in user when the refresh occurs.
    Does anyone know if it is possible to create a materialized view between 2 tables in different databases to refresh using a connected user DB link?
    Thanks.

    sybrandb
    Why does it not make sense to have materialized views accross databases?
    If a materialized view is essentially a remote copy, then wouldn't that imply accross databases? The only thing I did was to take it a step further and join it with a local table in the owning database.
    About not being right about not having a connected user., that may be right, but I have a thought/question..... I equated this as using connected user links in jobs scheduled via dbms_job or dbms_scheduler, as when this runs there is no user connected to the database to provide remote credentials for the link... Essentially this seems to be like a cron job that fires on some schedule (whether a user is connected or not), it would seem to me that it might need to have credentials defined in order to be able to connect to the remote database.
    Thanks

  • Error Creating Materialized View With a Job

    Oracle 9ir2
    I've created a job like this in a java class:
    ...Java Code ...
    cs = conn.prepareCall ("DECLARE v_job NUMBER; BEGIN DBMS_JOB.SUBMIT(v_job,'begin CTH_REGENERA_VM; end;', TRUNC(SYSDATE+1) + (3/24)); END;");
    ...Java Code ...
    The Procedure called in the Job:
    CREATE OR REPLACE PROCEDURE CTH_REGENERA_VM
         AUTHID CURRENT_USER IS
         existe NUMBER(1);
         cur BINARY_INTEGER := DBMS_SQL.OPEN_CURSOR;
         fdbk BINARY_INTEGER;
    BEGIN
         SELECT count(*) INTO existe FROM user_mviews WHERE mview_name = 'CTH_PRESENTA_A_VM';
         IF existe > 0 THEN
              DBMS_SQL.PARSE(cur, 'DROP MATERIALIZED VIEW CTH_PRESENTA_A_VM', DBMS_SQL.NATIVE);
         fdbk := DBMS_SQL.EXECUTE(cur);
              INSERT INTO CTH_HISTORIAL VALUES('ELIMINADA VM CTH_PRESENTA_A_VM', SYSDATE);
              COMMIT;
         END IF;
         DBMS_SQL.PARSE(cur, 'CREATE MATERIALIZED VIEW CTH_PRESENTA_A_VM
         TABLESPACE DAT1_CTH
         STORAGE(INITIAL 16M NEXT 8M MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 0)
                   XMLTYPE XML STORE AS CLOB (           TABLESPACE DAT1_CTH
                   STORAGE(INITIAL 16M NEXT 8M MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 0))
         AS select FICHA, XML,
         extractvalue(xml, ''/FICHE/Encab_de_nombre_geogr�fico_a'') as MUNICIPIO,
         extractvalue(xml, ''/FICHE/Encab_de_nombre_geogr�fico_c'') as CALIFICACION,
         extractvalue(xml, ''/FICHE/Encab_de_nombre_geogr�fico_b'') as PROVINCIA,
         extractvalue(xml, ''/FICHE/Encab_tem�tico_de_materia_a[1]'') as MATERIA,
         extractvalue(xml, ''/FICHE/Fecha_cronol�gica_b[1]'') as FECHA,
         extractvalue(xml, ''/FICHE/Datos_matem�ticos_a[1]'') as ESCALA
         from cth_xmltable', DBMS_SQL.NATIVE);
         INSERT INTO CTH_HISTORIAL VALUES('ASIGNO EL PARSE DE MATERIALIZED', SYSDATE);
         fdbk := DBMS_SQL.EXECUTE(cur);
         INSERT INTO CTH_HISTORIAL VALUES('EJECUTO EL PARSE DE MATERIALIZED', SYSDATE);
         INSERT INTO CTH_HISTORIAL VALUES('CREADA VM CTH_PRESENTA_A_VM', SYSDATE);
         DBMS_SQL.PARSE(cur, 'CREATE INDEX CTH_INDEX1
         ON CTH_PRESENTA_A_VM(XML)
         INDEXTYPE IS CTXSYS.CONTEXT
         PARAMETERS (''storage cth section group ctxsys.auto_section_group'')', DBMS_SQL.NATIVE);
         fdbk := DBMS_SQL.EXECUTE(cur);
         INSERT INTO CTH_HISTORIAL VALUES('CREADO INDICE ORACLE TEXT CTH_INDEX1', SYSDATE);
         DBMS_SQL.PARSE(cur, 'CREATE INDEX CTH_IDX_MUNICIPIO3
              ON CTH_PRESENTA_A_VM(UPPER(MUNICIPIO))
              TABLESPACE IDX1_CTH
              STORAGE (INITIAL 1M NEXT 512K MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 0)', DBMS_SQL.NATIVE);
         fdbk := DBMS_SQL.EXECUTE(cur);
         INSERT INTO CTH_HISTORIAL VALUES('CREADO INDICE CTH_IDX_MUNICIPIO2', SYSDATE);
         DBMS_SQL.PARSE(cur, 'CREATE INDEX CTH_IDX_FICHA2
         ON CTH_PRESENTA_A_VM
         (FICHA)
         TABLESPACE IDX1_CTH
         STORAGE(INITIAL 1M NEXT 512K MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 0)', DBMS_SQL.NATIVE);
         fdbk := DBMS_SQL.EXECUTE(cur);
         INSERT INTO CTH_HISTORIAL VALUES('CREADO INDICE CTH_IDX_FICHA2', SYSDATE);
         DBMS_SQL.CLOSE_CURSOR(cur);
    COMMIT;
    END;
    I got always an error in the created materialized view. If I call the procedure with SQL Plus, it run ok. The user
    has CTXAPP, DBA roles, so I supouse it is not a privileges problem. I also tried to create a simple materialized view or a table, and always got an error ora-12011
    Thanks in advance.

    If I call the procedure with SQL Plus, it run ok. Are you using the same user to run it in SQL*Plus as runs it from Java.
    The normal reason for procedures to fail like this is privileges. Particularly, we cannot run procedures using privileges we have been granted through roles.
    The user has CTXAPP, DBA roles, so I supouse it is not a privileges problem. Try granting the system privilege CREATE MATERIALIZED VIEW to the user and see what happens.
    I drop the materialized and create again, cause it's the fastest way I've found. With a DBMS_MVIEW.REFRESH is too slow.I find that surprising as drop & create has to do all the work that a refresh has to do plus some more - maybe it's something to do with XML. Did you try adding a snapshot log and going for FAST? I don't know whwther the XML procesing would render the view complex - have you explained it?
    Cheers, APC

  • Materialized view and RAC

    is there a way to make different materialized views run on different RAC nodes ?

    When you create materialized view with some periodic refresh Oracle creates job to refresh it. in user/all/dba jobs you can find out what instance will refresh it. I think by default it is 0, meaning any instance can run this job. If you want to change it (bind to specific instance), use DBMS_JOB.INSTANCE.
    Gints Plivna
    http://www.gplivna.eu

  • Job with materialized view not working anymore

    I'm on windows 2008 server with 10.2.0.4
    I have a job that was running at every hour in the database that was refreshing some materialized view (refresh group) the sql query on that MV goes by dblink to another database.
    Le atrget database had crashed last thursday since then the job on my first database do not execute.
    I tried to start the job in TOAD but it does nothing.... Le last refresh date still on thurday.
    Here are my script :
    DECLARE
    X NUMBER;
    BEGIN
    SYS.DBMS_JOB.SUBMIT
    ( job => X
    ,what => 'dbms_refresh.refresh(''"EREGROUPEMENT_TEMP"."VM_CANTOR_CREDENTIALS"'');'
    ,next_date => to_date('20-09-2010 13:17:21','dd/mm/yyyy hh24:mi:ss')
    ,interval => 'sysdate + 60/(60*24) '
    ,no_parse => FALSE
    SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' || to_char(x));
    COMMIT;
    END;
    DECLARE
    SnapArray SYS.DBMS_UTILITY.UNCL_ARRAY;
    JobNo Number;
    BEGIN
    SnapArray(1) := 'EREGROUPEMENT_TEMP.VM_CANTOR_CREDENTIALS';
    SnapArray(2) := 'EREGROUPEMENT_TEMP.VM_CANTOR_CV';
    SnapArray(3) := 'EREGROUPEMENT_TEMP.VM_CANTOR_DIS_CV';
    SnapArray(4) := 'EREGROUPEMENT_TEMP.VM_CANTOR_FINANCEMENT';
    SnapArray(5) := 'EREGROUPEMENT_TEMP.VM_CANTOR_FORM_ETUD_STAG';
    SnapArray(6) := 'EREGROUPEMENT_TEMP.VM_CANTOR_MOTS_CLES';
    SnapArray(7) := 'EREGROUPEMENT_TEMP.VM_CANTOR_OBR_CV';
    SnapArray(8) := 'EREGROUPEMENT_TEMP.VM_CANTOR_ORGANISME';
    SnapArray(9) := 'EREGROUPEMENT_TEMP.VM_CANTOR_SCHA_CV';
    SnapArray(10) := NULL;
    SYS.DBMS_REFRESH.MAKE (
    name => 'EREGROUPEMENT_TEMP.VM_CANTOR_CREDENTIALS'
    ,tab => SnapArray
    ,next_date => TO_DATE('01/01/4000 00:00:00', 'MM/DD/YYYY HH24:MI:SS')
    ,interval => 'SYSDATE + 60/(60*24)'
    ,implicit_destroy => TRUE
    ,lax => TRUE
    ,job => 0
    ,rollback_seg => NULL
    ,push_deferred_rpc => TRUE
    ,refresh_after_errors => FALSE
    ,purge_option => 1
    ,parallelism => 0
    ,heap_size => 0
    select job
    into JobNo
    from all_refresh
    where rowner = 'EREGROUPEMENT_TEMP'
    and rname = 'VM_CANTOR_CREDENTIALS';
    SYS.DBMS_JOB.BROKEN(JobNo,TRUE);
    Commit;
    END;
    Info on the MV :
    Last Refresh 2010-09-16 17:39:25
    Next Refresh SYSDATE + 60/(60*24)
    Refresh Type FORCE
    Refresh Mode Refresh Mode
    Start With 2010-09-16 18:39:25
    Do I have to refresh COMPLETE all the VIEWS MANUALLY and the recreate the refresh group or something wrong?

    RUN Procedure
    This procedure runs job JOB now. It runs it even if it is broken.
    Running the job recomputes next_date. See view user_jobs.
    Syntax
    DBMS_JOB.RUN (
    job IN BINARY_INTEGER,
    force IN BOOLEAN DEFAULT FALSE);
    Parameters
    It only change the next_date but it won't run.
    It tell me next date is in an hour but after an hour nothing has changed
    Edited by: Jpmill on 20 sept. 2010 11:32

  • Oracle Materialized view tables not getting refreshed automatically.

    At Destination:--
    CREATE MATERIALIZED VIEW PROG_MEDIA
    TABLESPACE ONA_TS1
    BUILD IMMEDIATE
    REFRESH FAST with rowid
    START WITH SYSDATE
    NEXT SYSDATE+1/96
    AS (select /*+ PARALLEL(a,6) */ * from PROG_MEDIA@onair a);
    exec dbms_mview.refresh('PROG_MEDIA','C');
    At Source:--
    CREATE MATERIALIZED VIEW LOG ON ONAIR.PROG_MEDIA
    TABLESPACE MVLOG
    WITH ROWID;
    Fired manually:--
    13:00:43 SQL> exec dbms_mview.refresh('PROG_MEDIA','C');
    PL/SQL procedure successfully completed.
    At source:--
    13:18:35 SQL> select PROG_MEDIA_ID,PROG_MEDIA_NAME from PROG_MEDIA where PROG_MEDIA_ID='102226';
    PROG_MEDIA_ID
    PROG_MEDIA_NAME
    102226
    test
    At Destination:--
    14:03:28 SQL> select PROG_MEDIA_ID,PROG_MEDIA_NAME from PROG_MEDIA where PROG_MEDIA_ID='102226';
    PROG_MEDIA_ID PROG_MEDIA_NAME
    102226 UTSAV-5-162077
    JOB LOG_USER THIS_DATE LAST_DATE_TIME NEXT_DATE_TIME INTERVAL FAILURES WHAT
    242 ONAIR 17-05-11 14:17:24 SYSDATE+1/96 7 dbms_refresh.refresh('"ONAIR"."PROG_MEDI
    A"');
    242 ONAIR 17-05-11 14:32:25 SYSDATE+1/96 8 dbms_refresh.refresh('"ONAIR"."PROG_MEDI
    A"');
    1> I have scheduled this refresh job for every 15mins, but its not getting executed. Also my job_queue_process is '20'. Whenever i execute it manually it get's refresh.
    2> I can schedule a cron for the same for every 15mins but i really dont want to do it.
    Kindly help me out.

    Hi,
    I have created MV_CAPABILITIES_TABLE & executed below commands:--
    17:56:54 SQL> EXECUTE DBMS_MVIEW.EXPLAIN_MVIEW ('"ONAIR"."PROG_MEDIA"');
    PL/SQL procedure successfully completed.
    17:57:26 SQL> SELECT capability_name, possible, SUBSTR(related_text,1,8)
    17:57:27 2 AS rel_text, SUBSTR(msgtxt,1,60) AS msgtxt
    17:57:27 3 FROM MV_CAPABILITIES_TABLE
    17:57:27 4 ORDER BY seq;
    CAPABILITY_NAME P REL_TEXT MSGTXT
    PCT N
    PCT N
    REFRESH_COMPLETE Y
    REFRESH_COMPLETE Y
    REFRESH_FAST Y
    REFRESH_FAST Y
    REWRITE N
    REWRITE N
    PCT_TABLE N PROG_MED relation is not a partitioned table
    PCT_TABLE N PROG_MED relation is not a partitioned table
    REFRESH_FAST_AFTER_INSERT Y
    REFRESH_FAST_AFTER_INSERT Y
    REFRESH_FAST_AFTER_ONETAB_DML Y
    REFRESH_FAST_AFTER_ONETAB_DML Y
    REFRESH_FAST_AFTER_ANY_DML Y
    REFRESH_FAST_AFTER_ANY_DML Y
    REFRESH_FAST_PCT N PCT is not possible on any of the detail tables in the mater
    REFRESH_FAST_PCT N PCT is not possible on any of the detail tables in the mater
    REWRITE_FULL_TEXT_MATCH N PROG_MED mv references a remote table or view in the FROM list
    REWRITE_FULL_TEXT_MATCH N PROG_MED mv references a remote table or view in the FROM list
    REWRITE_FULL_TEXT_MATCH N query rewrite is disabled on the materialized view
    REWRITE_FULL_TEXT_MATCH N query rewrite is disabled on the materialized view
    REWRITE_PARTIAL_TEXT_MATCH N materialized view cannot support any type of query rewrite
    REWRITE_PARTIAL_TEXT_MATCH N materialized view cannot support any type of query rewrite
    REWRITE_PARTIAL_TEXT_MATCH N query rewrite is disabled on the materialized view
    REWRITE_PARTIAL_TEXT_MATCH N query rewrite is disabled on the materialized view
    REWRITE_GENERAL N materialized view cannot support any type of query rewrite
    REWRITE_GENERAL N materialized view cannot support any type of query rewrite
    REWRITE_GENERAL N query rewrite is disabled on the materialized view
    REWRITE_GENERAL N query rewrite is disabled on the materialized view
    REWRITE_PCT N general rewrite is not possible or PCT is not possible on an
    REWRITE_PCT N general rewrite is not possible or PCT is not possible on an
    PCT_TABLE_REWRITE N PROG_MED relation is not a partitioned table
    PCT_TABLE_REWRITE N PROG_MED relation is not a partitioned table
    34 rows selected.
    Elapsed: 00:00:00.09
    What to be done next?
    Also i fired the job manually by:--
    17:38:02 SQL> set serveroutput on
    17:39:45 SQL> EXEC DBMS_JOB.RUN(242);
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.48

  • Refresh materialized view each second ?

    Hello all,
    I would like to refresh my materalized view each second. The creation is success with the following code, but when I monitor the table user_jobs, I see that the next scheduling is correctly planned (previous time + 1 second), but each time the view is refresh, it seems that the job is re-executed each 5 seconds.
    Do you know if this behaviour is possible ?
    Best Regards
    Sylvain
    CREATE MATERIALIZED VIEW test
    BUILD IMMEDIATE
    REFRESH FAST
    START WITH SYSDATE NEXT SYSDATE + 1/24/60/60
    AS SELECT ....

    Why would you want to refresh a materialized view every second? Why wouldn't you refresh on commit if you need the results to be immediately visible? Realistically, DBMS_JOB probably doesn't have the ability to reliably run a job with an interval that short-- it'll run it at close to the scheduled time, but it's not going to run it at exactly the second you had scheduled it.
    Justin

  • Updating Materialized Views

    Hi,
    I am running a database on 10.2g version. I am new to Oracle Databases/SQL, so I need to know the possibility of updating the materialized views through a scheduler? Can I find any link where all the steps are described in order to update/refresh the materialized views (probably on a daily basis or on a weekly basis)? Any help would be appreciated.
    Thanks,
    Vipul

    Short answer: MVs can be refreshed automatically as specified at creation time (in this case this is handled internally by a DBMS_JOB job) or on demand: in this case you can try to use DBMS_SCHEDULER to create and schedule a job to call DBMS_MVIEW.REFRESH.
    Long answer: http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/refresh.htm#sthref826

  • How to Refresh Materialized views

    Hi All,
    How ro refresh Mv views manualy.could you pls provide definiation for refreshing the MV's manually.
    Thanks for your help.

    When creating the materialized view, you have the option of specifying whether the refresh occurs manually (ON DEMAND) or automatically (ON COMMIT, DBMS_JOB).
    You can use something like:
    EXECUTE DBMS_MVIEW.REFRESH('emp_dept_sum','F'); -- 'F' for fast refresh, 'C' for complete refresh
    For automatic fast refresh:
    CREATE MATERIALIZED VIEW emp_mv
    ON PREBUILT TABLE
    REFRESH FAST ON COMMIT
    ENABLE QUERY REWRITE
      AS SELECT empno, ename, dname, loc,
             e.rowid emp_rowid,
             d.rowid dep_rowid
        FROM emp e, dept d
       WHERE e.deptno = d.deptno;

  • Problem in Materialized Views

    Hi,
    I have two servers one is remote database (it resides in public ip) and another one is local database.
    I have created Materialized view in Local System to replicate the data from remote system to Local System, Local system Internally creates Jobs , because of this replication Local System continuously ping the remote system, if any point of time network goes down, Local System unable to ping the remote system , at that time it gives Request timed out, due to this Reason jobs were going to fail. Is there any possibility to start these jobs automatically without manual intervention.
    Can you please suggest to go forward this.
    Regards,
    Paparao

    you may have another dbms_job or unix cron job to control and enable some of or all of broken jobs easily? A sample code may be like this one;
    DECLARE
      CURSOR C1 IS SELECT * from USER_JOBS
                              WHERE THIS_SEC IS NULL AND BROKEN='Y';
      ND DATE;
      stmt VARCHAR2(200);
    BEGIN
      FOR C1R IN C1 LOOP
        stmt :=  'SELECT '||C1R.INTERVAL||' FROM DUAL';
        EXECUTE IMMEDIATE stmt INTO ND;
        DBMS_OUTPUT.PUT_LINE(C1R.JOB||'-'||TO_CHAR(ND, 'DD/MM/YYYY HH24:MI:SS'));
        DBMS_JOB.BROKEN(C1R.JOB, FALSE, ND);
      END LOOP;
    END;
    /

Maybe you are looking for