Can I schedule (Cron) execution of Materialized Views?

I need to run a bunch of materialized views nightly. Can I run the scripts (from an Unix file) directly or do I need to run them as part of a stored procedure?
Thanks

1. We want to run the MVs only during the night. The tables that we use are quite big and the users don't need dynamic refresh.I really don't see how this is relevant to your choice of scheduler.
2. It's going to be a series of MV refreshes and the users want to have e-mail notification if any of them fail and the company standard product for automated e-mail notification is CA's Unicenter.Not familiar with this, but I've setup simple little routines to email notification of db events ... it's not a problem.

Similar Messages

  • Query can't be rewritten by a Materialized View

    Hi All,
    The structure of Materialized view looks like:
    select
    T1483342.MEASR_AMT as c4,
    T1482315.MTH_NAME as c8
    from
    MMM T1483380,
    AN_VSBL_IND_LKP T1483226,
    AMM T1484452 ,
    ND_ASDN_DIM T1483850,
    _FDIM                                    T1482018,
    R_DIM T1482315,
    AN_FCT T1483342
    where (JOINS)
    And it has 'ENABLE QUERY REWRITE' clause.
    If I run the query like this, the query rewritten is used by CBO and seems fine to me.
    select
    T1483342.MEASR_AMT as c4,
    T1482315.MTH_NAME as c8
    from
    MMM T1483380,
    AN_VSBL_IND_LKP T1483226,
    AMM T1484452 ,
    ND_ASDN_DIM T1483850,
    _FDIM                                   T1482018,
    R_DIM T1482315,
    AN_FCT T1483342
    where (JOINS)
    But if I run the query like the following one, query rewritten can't happen with the following reason:
    QSM-01072: materialized view, LEON_SVP_NEW1, and query have different joins between tables.
    select
    sum(T1483342.MEASR_AMT) as c4,
    T1482315.MTH_NAME as c8
    from
    MMM T1483380,
    AN_VSBL_IND_LKP T1483226,
    AMM T1484452 ,
    ND_ASDN_DIM T1483850,
    _FDIM                                          T1482018,
    R_DIM T1482315,
    AN_FCT T1483342
    where (JOINS)
    group by T1482315.MTH_NAME
    order by c8
    The only difference between the 2 query is one has aggregation on one column but the other does not.
    Can someone give me some advice on why the latter query is not rewritten by CBO, please?
    Thank you very much,
    Leon
    Edited by: user12064076 on Feb 15, 2011 7:22 PM

    The error message is
    QSM-01072: materialized view, string, and query have different joins between tables, string
    Cause: Anchors, if any, in the MV and query match. But the joins between these anchors in the MV and query are different.
    Action: None
    That would mean that the JOINs are different.
    Edited by: Hemant K Chitale on Feb 16, 2011 11:34 AM
    Edited by: Hemant K Chitale on Feb 16, 2011 11:34 AM

  • Materialized views - schedule, indexes, query rewrite, etc.

    I'm trying to get the hang of materialized views and need some help . . .
    running Oracle 10gR2
    I created a materialized view as follows:
    CREATE MATERIALIZED VIEW "MY_SCHEMA"."USERS"
    AS
    SELECT * FROM "USERS"@PRODUCTION -- to copy the USERS table from my production database to this database
    Worked fine. So far so good. Then, I altered it to schedule the refresh:
    ALTER MATERIALIZED VIEW "MY_SCHEMA"."USERS" REFRESH FORCE START WITH SYSDATE NEXT TRUNC(SYSDATE + 1) + 4/24
    -- to schedule a refresh immediately (SYSDATE) and every morning thereafter at 4:00 am (I think)
    then, I wanted to enable query rewrite, so I issued the following command:
    ALTER MATERIALIZED VIEW "MY_SCHEMA"."USERS" ENABLE QUERY REWRITE;
    and I got the
    ALTER MATERIALIZED VIEW succeeded.
    message for both of those commands (I'm doing this in SQL Developer).
    Then, I edit the materialized view in SQL Developer, click on the 'SQL' tab, and get the following:
    CREATE MATERIALIZED VIEW "MY_SCHEMA"."USERS"
    ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "TBLSPC_PHIGH"
    BUILD IMMEDIATE
    USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "TBLSPC_PHIGH"
    REFRESH FORCE ON DEMAND START WITH sysdate+0 NEXT TRUNC(SYSDATE + 1) + 4/24
    WITH PRIMARY KEY USING DEFAULT LOCAL ROLLBACK SEGMENT
    DISABLE QUERY REWRITE
    AS SELECT "USERS"."User" "User","USERS"."Logon" "Logon","USERS"."Name" "Name","USERS"."Password"
    "Password","USERS"."Level" "Level","USERS"."Producer" "Producer","USERS"."Deleted" "Deleted","USERS"."ClaimDoctor"
    "ClaimDoctor","USERS"."UserType" "UserType","USERS"."Locked" "Locked","USERS"."Scheduler"
    "Scheduler","USERS"."RestrictDays" "RestrictDays","USERS"."First" "First","USERS"."DisableAutoChart"
    "DisableAutoChart","USERS"."MaxChartOut" "MaxChartOut","USERS"."MaxHoursOut" "MaxHoursOut","USERS"."EffDate"
    "EffDate","USERS"."ExpDate" "ExpDate","USERS"."SwipeLogon" "SwipeLogon","USERS"."SwipePassword"
    "SwipePassword","USERS"."PwdLastChanged" "PwdLastChanged","USERS"."Audit" "Audit","USERS"."IsInstructor"
    "IsInstructor" FROM "USERS"@PRODUCTION.REGRESS.RDBMS.DEV.US.ORACLE.COM "USERS";
    The problems I've encountered so far:
    1) I created this two days ago and changed the value of one column in one row in the 'source' USERS table
    (USERS@PRODUCTION) as a test case. So far, that change has not propagated over to my materialized view even though
    it has had two chances to do so (yesterday morning at 4:00 am and this morning at 4:00 am).
    2) I enabled QUERY REWRITE. Why does it still show DISABLE?
    3) The primary key of the table came over (as far as I can tell) because it shows in SQL Developer. However, the
    indexed columns are no longer indexed. Do I need to recreate those indexes manually and will they persist?
    4) As you have guessed, I have just taken the plunge into materialized views, and have not been able to find
    anything on the Web along the lines of 'Materialized Views for Dummies'. So, any and all advice/suggestions/help
    will be welcome.
    Thanks,
    Carl

    The Refresh would be executed by a job submitted in the background.
    Query USER_JOBS (or DBA_JOBS) to see if a job has been submitted and if it has been running (you'd be able to see LAST_DATE, LAST_SEC and NEXT_DATE and NEXT_SEC). \
    If the Refresh job has been failing the FAILURES count would be incremented. If there are 16 consecutive failures, the job is marked BROKEN. (if a job fails, Oracle retries it automatically and keeps retrying till it is BROKEN). If the job has been failing you would get messages in the database instance alert log file and trace files.
    If the Refresh job has not been running check the parameter value for JOB_QUEUE_PROCESSES -- a value of 0 would not run in jobs in the USER_JOBS/DBA_JOBS view. Ask the DBA to increase set this parameter to at least 1.
    Hemant K Chitale
    http://hemantoracledba.blogspot.com

  • Can Oracle materialized view be used as crystal report datasource

    Hi,
    Can we use materialized view created in Orace 10g database as the data source of crystal reports.
    I'm using Crystal reports Server 2008 V1 version. I'm unable to find the materialized view under my data connection. I can see only tables, static views and stored procedures.
    Is there a way by which I can run my reports against a materialized view created in Oracle.
    Thanks
    Thomas EL

    Hi Thomas,
    Rather than doing all of this work around to access multiple databases/servers why not create a stored procedure to do all of this for you? Search the notes area for samples on how/what CR requires to use a SP in Oracle.
    Advantages is this is done all server side and CR simply waits for the data to be returned. Even if you are using a BVM or connecting directly to the SP, both cases are server side. Database servers are much more efficient and optimized to run queries and filtering data. CR has to do the filtering on it's second pass and that causes performance delays.
    Thank you
    Don

  • Sdo_cs.transform procedure in a materialized view

    Hi all,
    Oracle version :10.2.0.4
    I am trying to do perform reprojection in a materialised view ( refresh on demand, complete mode).
    It seems everytime I refresh the MV ,this error pops up.
    SQL> exec dbms_mview.refresh('SUPER', 'C');
    BEGIN dbms_mview.refresh('SUPER', 'C'); END;
    ERROR at line 1:
    ORA-12008: error in materialized view refresh path
    ORA-06531: Reference to uninitialized collection
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2251
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2457
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2426
    ORA-06512: at line 1
    <code>
    CREATE MATERIALIZED VIEW "SUPER" ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "DATA_DATA" BUILD DEFERRED USING INDEX REFRESH COMPLETE ON DEMAND USING DEFAULT LOCAL ROLLBACK SEGMENT DISABLE QUERY REWRITE
    AS
    SELECT seq_nextval AS PID,
    SITE,
    STATE,
    reproject(geoloc)
    FROM BJON;
    <code>
    The procedure of reproject
    create or replace
    FUNCTION "REPROJECT" (p_coordinates in SDO_GEOMETRY)
         return SDO_GEOMETRY deterministic
         as v_coordinates SDO_GEOMETRY;
         BEGIN
              v_coordinates := sdo_cs.transform (p_coordinates, 4326);
              RETURN v_coordinates;
         end REPROJECT;
    Can anyone let me know hw I can put plug thereprojection in a materialized view.
    Edited by: CrackerJack on May 2, 2012 11:00 PM

    Hi all,
    Any clues?
    I have died of anymore ideas to make this work.
    All I need is a updated table with
    Primary key ,
    GEOMETRY 4326
    spatial index.
    metadata
    Teh materialized view is perfect except I can't do the reprojections.
    ORA-06531: Reference to uninitialized collection means have some null values in the array , but if you remove the Reproject function and just geometry itself , the materialised view works brilliant.
    I tried converting to 0,0 point in the function to tackle the nulls in array if any.. but doesn't work.
    sdo_cs.transform(nvl(geoloc, mdsys.sdo_geometry(2001, 8307, mdsys.sdo_point_type(0,0,NULL),NULL,NULL)),82027).get_wkt()
    Any ideas is much appreciated.
    Edited by: CrackerJack on May 6, 2012 10:27 PM

  • Error insert data over db link in table covered by materialized view

    Hello together,
    following problem:
    I got a table called LOCATION_INFO which is defined:
    create table LOCATION_INFO
    LOCATION_ID VARCHAR2(40) not null,
    PLANT VARCHAR2(4) not null,
    PRODUCT VARCHAR2(3),
    AREA VARCHAR2(1),
    LINE NUMBER(10),
    STATION NUMBER(10),
    STATINDEX NUMBER(10),
    FU NUMBER(10),
    WP NUMBER(10),
    TP NUMBER(10),
    LOCATION_LEVEL NUMBER(1) not null,
    LOCATION_PARENT_ID VARCHAR2(40),
    TIME_STAMP TIMESTAMP(6) WITH TIME ZONE not null
    I try to load data over PL/SQL procedure from another database using database link:
    INSERT INTO LOCATION_INFO
    (LOCATION_ID,
    PLANT,
    PRODUCT,
    AREA,
    LINE,
    STATION,
    STATINDEX,
    FU,
    WP,
    TP,
    LOCATION_LEVEL,
    LOCATION_PARENT_ID,
    TIME_STAMP)
    SELECT LOCATION_ID,
    PLANT,
    PRODUCT,
    AREA,
    LINE,
    STATION,
    STATINDEX,
    FU,
    WP,
    TP,
    LOCATION_LEVEL,
    LOCATION_PARENT_ID,
    GetUTCDateTime(TIME_STAMP) AS time_Stamp
    FROM LOCATION_INFO@SOURCE_MMPDDB
    WHERE ROWNUM < 100;
    This works fine (If i do select count(*) from location_info the data is present) but if set a commit
    ORA-00603 appears and the session is terminated.
    The point is i got a materialized view MVIEW_LOCATIONS in another schema in the database reading the data from my table location_info and a corresponding MVIEWLOG.
    create table MLOG$_LOCATION_INFO
    LOCATION_ID VARCHAR2(40),
    SNAPTIME$$ DATE,
    DMLTYPE$$ VARCHAR2(1),
    OLD_NEW$$ VARCHAR2(1),
    CHANGE_VECTOR$$ RAW(255)
    CREATE MATERIALIZED VIEW MVIEW_LOCATIONS
    REFRESH FAST ON COMMIT
    ENABLE QUERY REWRITE
    AS
    SELECT "LOCATION_INFO"."LOCATION_ID" "LOCATION_ID","LOCATION_INFO"."PLANT" "PLANT","LOCATION_INFO"."PRODUCT" "PRODUCT","LOCATION_INFO"."AREA" "AREA","LOCATION_INFO"."LINE" "LINE","LOCATION_INFO"."STATION" "STATION","LOCATION_INFO"."STATINDEX" "STATINDEX","LOCATION_INFO"."FU" "FU","LOCATION_INFO"."WP" "WP","LOCATION_INFO"."TP" "TP","LOCATION_INFO"."LOCATION_LEVEL" "LOCATION_LEVEL","LOCATION_INFO"."LOCATION_PARENT_ID" "LOCATION_PARENT_ID","LOCATION_INFO"."TIME_STAMP" "TIME_STAMP" FROM "CP4MMPDNEW"."LOCATION_INFO" "LOCATION_INFO";
    What do I need to do to make the insert working properly without deleting my mviews?
    Can anyone help me?
    Thanks, Matthias

    Helllo,
    Can you change this on your Materialized View DDL:
    REFRESH FAST ON COMMITTo:
    REFRESH FAST ON DEMANDThen, if your INSERT and COMMIT works OK then, can you try:
    exec DBMS_MVIEW.REFRESH('MVIEW_LOCATIONS')

  • UPDATING the query in materialized view

    Hi,
    i have a little doubt in Materialized view. i created a materialized view and log with the following query,
    create table test_mv (a number ,b number )
    alter table test_mv add constraint t_pk primary key ( a );
    insert into test_mv values (1,2);
    insert into test_mv values(2,2);
    insert into test_mv values(3,2);
    insert into test_mv values(4,2);
    insert into test_mv values(5,2);
    commit;
    CREATE MATERIALIZED VIEW LOG ON test_mv
    WITH SEQUENCE, ROWID
    *(a,b)*
    INCLUDING NEW VALUES;
    CREATE MATERIALIZED VIEW product_sales_mv
    ENABLE QUERY REWRITE
    AS SELECT  b  from test_mv;
    Now i want to update the query in the MV as 'Select a from test_mv' . for that i tried with
    *'ALTER MATERIALIZED VIEW product_sales_mv AS SELECT a from test_mv;'*
    But it throwing error,
    Error starting at line 5 in command:
    alter  MATERIALIZED VIEW product_sales_mv   AS SELECT  b  from test_mv
    Error report:
    SQL Error: ORA-00933: SQL command not properly ended
    +00933. 00000 - "SQL command not properly ended"+
    *Cause:+   
    *Action:+
    i guess i am doing wrong. kindly help me here. i want to update it without drop and recreate.
    thanks,
    Jeevanand.Ke

    Hi Jeeva,
    No. you cannot add or drop columns to the materialized view using the ALTER Statement.
    To Change the Structure of the view , drop and re-create the materialized view.
    To Alter a materialized view log, You can use the ALTER MATERIALIZED VIEW LOG. By this,
    You can add new columns to a materialized view log.
    ALTER MATERIALIZED VIEW LOG ON sggi_mrps.emp ADD(deptno);Thanks,
    Shankar
    Edited by: Shankar Viji on Aug 24, 2012 2:11 AM

  • Materialized view logs in cloned database

    Hi all!
    We have materlialized views and materlialized view logs in two separate databases which are connected with a database link. The MV logs are in DB1_PROD, which is the database being cloned. The database link goes from DB2_PROD (where the MVs are located) to DB1_PROD:
    DB2_PROD (materialized views) ----DB link---> DB1_PROD (materialized view logs)
    When cloning DB1_PROD to DB3_DEV, the MV logs still have a reference to DB2_PROD. However, there is no connection between DB3_DEV and DB2_PROD.
    In my opinion this is not harmful, but I would like to know if any of you can see any problems with this.
    In summary;
    DB1_PROD: Materialized view logs
    DB3_DEV: Materialized view logs. Clone of DB1_PROD
    DB2_PROD: Materialized views.
    DB1_PROD and DB3_DEV:
    select * from v$version;
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE     10.2.0.4.0     Production
    TNS for Linux: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    DB2_PROD:
    select * from v$version;
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE     11.2.0.3.0     Production
    TNS for Linux: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - ProductionPlease let me know if you need further information.

    Oracle automatically purges rows in the materialized view log when they are no longer needed. Because Oracle must wait for all dependent materialized views to refresh before purging rows from a materialized view log, unwanted situations can occur that cause a materialized view log to grow indefinitely when multiple materialized views are based on the same master table or master materialized view.
    For example, such situations can occur when more than one materialized view is based on a master table or master materialized view and one of the following conditions is true:
    Materialized view is not configured for automatic refreshes and has not been manually refreshed for a long time. OR
    Materialized view has an infrequent refresh interval, such as every year, etc
    You can also refresh the materialized views associated with the log so that Oracle can purge rows from the materialized view log.
    If a materialized view log needs to be purged manually for some reason a procedure called DBMS_MVEW.PURGE_LOG can be used.
    Edited by: user130038 on Sep 30, 2011 6:49 AM

  • Materialized view - parameter and refresh

    Hi,
    We are creating a Materialized view that has 2 rows for a CCID, one for this year and one for previous year with balances in 12 buckets.
    We have 2 questions:
    1. Can a materialized view be created with a parameter? or it can only take hard coded values?
    2. Can we refresh a part of materialized view, lets say we want to refresh the balances only for this year?
    Thanks

    user12182208 wrote:
    Hi,
    We are creating a Materialized view that has 2 rows for a CCID, one for this year and one for previous year with balances in 12 buckets.
    We have 2 questions:
    1. Can a materialized view be created with a parameter? or it can only take hard coded values? Typically, you want a materialized view to contain a complete set of aggregate data ... so, no, parameters don't really make sense (also, the results are pre-computed unlike a regular VIEW which is just a stored query. With a MV the data is actually computed on creation unless you defer it, and takes up physical storage).
    >
    2. Can we refresh a part of materialized view, lets say we want to refresh the balances only for this year?
    You can (depending on your Oracle Version and complexity of your materialized view) create a materialized view that does fast refreshes. If for some reason it was pertinent for you to achieve what you've asked, you could make 2 MV's and then a view that does a UNION ALL of them (the MV's would not contain overlaps), then you would just refresh the 1 MV, seems odd to me to want to do this though.
    Thanks

  • Import materialized view with rowid

    We are upgrading the Data Warehouse and Source Database from Oracle 9i to 10G.
    For replication we use materialized views. Since in our source database we don't have any primary keys, we maintain materialized view logs based on rowids in Source/Master Database.
    Similarly in the Staging schema of or data warehouse we have defined materialized views with rowid and fast refresh option.
    We are using imp/exp utility for migrating both the source database and the data warehouse.
    Since our replication is based on rowid, when we migrate to new environment, all the rowids of the source tables would be redifined making the materialized view tables rowid obsolete.
    One way is to do compete refresh to bring both source database and Staging database baack in sync, but that would be expensive and time consuming.
    Is there any way we can preserve rowid or keep the materialized views in staging in sync with source database ?
    Thanks.

    WITH ROWID is used with REFRESH clause. Try
    SQL> CREATE MATERIALIZED VIEW xxca_project_status_mv
    2 REFRESH WITH ROWID
    3 AS
    do I have to create a log.Only if you want a fast refresh.

  • Index On Materialized View

    I have created a materialized view that involves joining 4 tables for diferent where conditions. How can I create index on this materialized view.
    Thanks

    Yes, but it is done automatically:
    SQL> create materialized view emp_dept_mv
      2  as
      3  select e.empno
      4       , e.ename
      5       , e.sal
      6       , d.deptno
      7       , d.dname
      8    from emp e
      9       , dept d
    10   where e.deptno (+) = d.deptno
    11  /
    Gematerialiseerde view is aangemaakt.
    SQL> create index i1 on emp_dept_mv (deptno)
      2  /
    Index is aangemaakt.
    SQL> exec dbms_stats.gather_table_stats(user,'emp_dept_mv',cascade=>true)
    PL/SQL-procedure is geslaagd.
    SQL> set autotrace on explain
    SQL> select * from emp_dept_mv where deptno = 40
      2  /
         EMPNO ENAME             SAL     DEPTNO DNAME
                                             40 OPERATIONS
    1 rij is geselecteerd.
    Uitvoeringspan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=4 Bytes=96)
       1    0   TABLE ACCESS (BY INDEX ROWID) OF 'EMP_DEPT_MV' (Cost=2 Card=4 Bytes=96)
       2    1     INDEX (RANGE SCAN) OF 'I1' (NON-UNIQUE) (Cost=2 Card=4)
    SQL> set autotrace off
    SQL> insert into dept (deptno, dname) values (50, 'EXTRA DEPT')
      2  /
    1 rij is aangemaakt.
    SQL> exec dbms_mview.refresh('emp_dept_mv')
    PL/SQL-procedure is geslaagd.
    SQL> set autotrace on explain
    SQL> select * from emp_dept_mv where deptno = 50
      2  /
         EMPNO ENAME             SAL     DEPTNO DNAME
                                             50 EXTRA DEPT
    1 rij is geselecteerd.
    Uitvoeringspan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=4 Bytes=96)
       1    0   TABLE ACCESS (BY INDEX ROWID) OF 'EMP_DEPT_MV' (Cost=2 Card=4 Bytes=96)
       2    1     INDEX (RANGE SCAN) OF 'I1' (NON-UNIQUE) (Cost=2 Card=4)Regards,
    Rob.

  • Materialized view logs issue

    We are having issues with the size of materialized view logs in one od the database. The size of the log table is around 32G. Will appreciate if somebody will help in explaining why it is having such a huge size and is not getting purged.
    At the same time the master table is having comparatively smaller size of 18G(did not check table fragmentation).
    Also, please help me in understanding what is required to be done for fixing this issue.
    SQL> select LOG_OWNER,MASTER,LOG_TABLE,LOG_TRIGGER,PRIMARY_KEY from dba_mview_logs where log_owner='MARTDATA' and MASTER='POLICY_CONFIGURATION';
    LOG_OWNER MASTER LOG_TABLE LOG_TRIGGER PRI
    MARTDATA POLICY_CONFIGURATION MLOG$_POLICY_CONFIGURATION NO
    SQL> select owner, segment_name, sum(bytes)/1024/1024 "SIZE in MB" from dba_segments where segment_name='POLICY_CONFIGURATION' and owner ='MARTDATA' group by owner, segment_name;
    OWNER SEGMENT_NAME SIZE in MB
    MARTDATA POLICY_CONFIGURATION 18458
    SQL> select owner, segment_name, sum(bytes)/1024/1024 "SIZE in MB" from dba_segments where segment_name='MLOG$_POLICY_CONFIGURATION' and owner ='MARTDATA' group by owner, segment_name;
    OWNER SEGMENT_NAME SIZE in MB
    MARTDATA MLOG$_POLICY_CONFIGURATION 32298
    Thanks

    Oracle automatically purges rows in the materialized view log when they are no longer needed. Because Oracle must wait for all dependent materialized views to refresh before purging rows from a materialized view log, unwanted situations can occur that cause a materialized view log to grow indefinitely when multiple materialized views are based on the same master table or master materialized view.
    For example, such situations can occur when more than one materialized view is based on a master table or master materialized view and one of the following conditions is true:
    Materialized view is not configured for automatic refreshes and has not been manually refreshed for a long time. OR
    Materialized view has an infrequent refresh interval, such as every year, etc
    You can also refresh the materialized views associated with the log so that Oracle can purge rows from the materialized view log.
    If a materialized view log needs to be purged manually for some reason a procedure called DBMS_MVEW.PURGE_LOG can be used.
    Edited by: user130038 on Sep 30, 2011 6:49 AM

  • Questions on Materialized Views and MV Log tables

    Hello all,
    Have a few questions with regards to Materialized View.
    1) Once the Materialized View reads the records from the MLOG table the MLOG's records get purged. correct? or is it not the case? In some cases I still see (old) records in the MLOG table even after the MV refresh.
    2) How does the MLOG table distinguish between a read that comes from an MV and a read that comes from a user? If I manually execute
    "select * from <MLOG table>" would the MLOG table's record get purged just the same way as it does after an MV refresh?
    3) One of our MV refreshes hangs intermittently. Based on the wait events I noticed that it was doing a "db file sequential read" against the master table. Finally I had to terminate the refresh. I'm not sure why it was doing sequential read on the master table when it should be reading from the MLOG table. Any ideas?
    4) I've seen "db file scattered read" (full table scan) in general against tables but I was surprised to see "db file sequential read" against the table. I thought sequential read normally happens against indexes. Has anyone noticed this behaviour?
    Thanks for your time.

    1) Once all registered materialized views have read a particular row from a materialized view log, it is removed, yes. If there are multiple materialized views that depend on the same log, they would all need to refresh before it would be safe to remove the MV log entry. If one of the materialized views does a non-incremental refresh, there may be cases where the log doesn't get purged automatically.
    2) No, your query wouldn't cause anything to be purged (though you wouldn't see anything interesting unless you happen to implement lots of code to parse the change vectors stored in the log). I don't know that the exact mechanism that Oracle uses has been published, though you could go through and trace a session to get an idea of the moving pieces. From a practical standpoint, you just need to know that when you create a fast-refreshable materialized view, it's going to register itself as being interested in particular MV logs.
    3) It would depend on what is stored in the MV log. The refresh process may need to grab particular columns from the table if your log is just storing the fact that data for a particular key changed. You can specify when you create a materialized view log that you want to store particular columns or to include new values (with the INCLUDING NEW VALUES) clause. That may be beneficial (or necessary) to the fast refresh process but it would tend to increase the storage space for the materialized view log and to increase the cost of maintianing the materialized view log.
    4) Sequential reads against a table are perfectly normal-- it just implies that someone is looking at a particular block in the table (i.e. looking up a row in the table by ROWID based on the ROWID in an index or in a materialized view log).
    Justin

  • ORA-12899 when recreating materialized view

    Hi All,
    I have a PL/SQL procedure to load data in partitioned base tables and a refreh force meterilized view to compute data from base partition table. I just droped the materialized view and try to recreate it.
    I am facing an issue with Ora-12899 value too large for column "SYS".SNAP$".AUTO_FUN (actual: string 201, maximum: string 200).
    I google and search in Metalink & Oracle forum for couple days but i didnt find a valuable solution.
    Does you guy have some adivces for me to avoid this error.
    Note: Before I can drop and re-create this materialized view without an error. I just faced this issue a few day ago.
    TIA,
    Lux
    Edited by: lux2 on Mar 8, 2010 11:07 PM

    As below result from the query on both client and servier side.
    I see no different between the two.
    At server side:
    PARAMETER     VALUE
    NLS_CALENDAR     GREGORIAN
    NLS_COMP     BINARY
    NLS_CURRENCY     $
    NLS_DATE_FORMAT     DD-MON-RR
    NLS_DATE_LANGUAGE     AMERICAN
    NLS_DUAL_CURRENCY     $
    NLS_ISO_CURRENCY     AMERICA
    NLS_LANGUAGE     AMERICAN
    NLS_LENGTH_SEMANTICS     BYTE
    NLS_NCHAR_CONV_EXCP     FALSE
    NLS_NUMERIC_CHARACTERS     .,
    NLS_SORT     BINARY
    NLS_TERRITORY     AMERICA
    NLS_TIMESTAMP_FORMAT     DD-MON-RR HH.MI.SSXFF AM
    NLS_TIMESTAMP_TZ_FORMAT     DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_TIME_FORMAT     HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT     HH.MI.SSXFF AM TZR
    at Client side:
    PARAMETER     VALUE
    NLS_CALENDAR     GREGORIAN
    NLS_COMP     BINARY
    NLS_CURRENCY     $
    NLS_DATE_FORMAT     DD-MON-RR
    NLS_DATE_LANGUAGE     AMERICAN
    NLS_DUAL_CURRENCY     $
    NLS_ISO_CURRENCY     AMERICA
    NLS_LANGUAGE     AMERICAN
    NLS_LENGTH_SEMANTICS     BYTE
    NLS_NCHAR_CONV_EXCP     FALSE
    NLS_NUMERIC_CHARACTERS     .,
    NLS_SORT     BINARY
    NLS_TERRITORY     AMERICA
    NLS_TIMESTAMP_FORMAT     DD-MON-RR HH.MI.SSXFF AM
    NLS_TIMESTAMP_TZ_FORMAT     DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_TIME_FORMAT     HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT     HH.MI.SSXFF AM TZR

  • Mapping materialized views

    Is there some sort of setting I need to adjust to pull off creating Java objects from a materialized view? When I launch the Java Objects from Tables wizard in jDeveloper 11g I can't see any of the materialized views. The views are in a different schema but I have the grants to select from them.
    I can see synonyms to them in a different schema but importing synonyms seems to result in some odd mapping behavior.
    Any ideas?

    I done some more testing by creating a new schema and creating a materialized view inside of it. When I create a new Toplink project using that schemas login information I still cant see the materialized views in the "Create Java objects from Tables" wizard. This seems to happen in jDeveloper 10 and 11g, Windows and Mac.
    Has anyone here managed to successfully map a materialized view? Its looking impossible within jDeveloper at this point.

Maybe you are looking for