How to CREATE MATERIALIZED VIEW LOG (MV fast refresh) with some JOINS

Hi @ all,
i'm trying to create a MATERIALIZED VIEW LOG for a fast refresh of a MATERIALIZED VIEW.
It works fine with a simple Request in the MATERIALIZED VIEW:
CREATE MATERIALIZED VIEW MV_ZOTD43_P
TABLESPACE GDII
BUILD IMMEDIATE
REFRESH FORCE AS
SELECT * FROM ZOTD43_P;
COMMIT;
CREATE MATERIALIZED VIEW LOG ON ZOTD43_P
TABLESPACE "GDII"
WITH PRIMARY KEY, ROWID, SEQUENCE INCLUDING NEW VALUES;
call DBMS_MVIEW.REFRESH('MV_ZOTD43_P', 'f');
But when I use a complex SQL-Request with some JOINS (one of the Table with spatial Data) in the MATERIALIZED VIEW, I get an error:
CREATE MATERIALIZED VIEW MV_TEST
TABLESPACE GDII
BUILD IMMEDIATE
REFRESH FORCE AS
SELECT lptd04_p.sst_nr AS sst_nr,
lptd03_p.aaaa AS aaaa,
lptd04_geom.geom as geom
FROM lptd04_p lptd04_p
JOIN lptd01_p lptd01_p ON lptd01_p.cre_nr = lptd04_p.sst_nr
JOIN lptd04_geom ON lptd04_geom.sst_nr = lptd04_p.sst_nr
JOIN lptd03_p lptd03_p ON lptd03_p.lief_nr = lptd04_p.lief_nr;
COMMIT;
CREATE MATERIALIZED VIEW LOG ON LPTD04_P
TABLESPACE "GDII"
WITH PRIMARY KEY, ROWID, SEQUENCE INCLUDING NEW VALUES;
call DBMS_MVIEW.REFRESH('MV_TEST', 'f');
Error report:
SQL Error: ORA-12004: REFRESH FAST kann für Materialized View "GDI"."MV_GDI_SST_STAMM" nicht benutzt werden
ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 2255
ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 2461
ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 2430
ORA-06512: in Zeile 1
12004. 00000 - "REFRESH FAST cannot be used for materialized view \"%s\".\"%s\""
*Cause:    The materialized view log does not exist or cannot be used. PCT
refresh is also not enabled on the materialized view
*Action:   Use just REFRESH, which will reinstantiate the entire table.
If a materialized view log exists and the form of the materialized
view allows the use of a materialized view log or PCT refresh is
possible after a given set of changes, REFRESH FAST will
be available starting the next time the materialized view is
refreshed.
Am I doing something wrong or is it not possible CREATE MATERIALIZED VIEW LOG when the MATERIALIZED VIEW got some JOINS?
Regards,
Greq

Thanks for the link Alessandro ,
the error seems something to do with the Column-Type SDO_GEOMETRY, so
i create a new thread in the Spatial Discussion forum:
FAST REFRESHing of Oracle Materialized Views containing SDO_GEOMETRY column
Regards,
Greq

Similar Messages

  • How to create materialized view log on remote database

    How do you create materialized view logs on a remote database.
    I tried
    create materialized view log on global_express_views.vccs438_project_work_request@h92edwp with sequence, rowid ( columns...)
    ERROR at line 1:
    ora-00949 illegal reference to remote database

    Hi,
    I am not getting the error exactly. But have some suggestion:
    If the schema owner does not own the master tables, then the schema owner must have the GLOBAL QUERY REWRITE privilege or the QUERY REWRITE object privilege on each table outside the schema.
    Hope, this may help you?
    Thanx.. Ratan

  • Materialized view logs for Fast refreshes

    Hi,
    I created MV and MV logs on the base table/main table. I set the base table in NOLOGGING MODE. so ofcourse redo is not gonna generate during DML but i wanted to know that:
    Will NOLOGGING effect the MV logs for fast refreshes?
    I came up on conclusion that MV logs are nothing to do with Redo Logs and would have no impact on MV logs for fast refresh since i have set my all base table in NOLOGGING MODE.
    Looking forward for expert opinion.
    REGARDS,

    Though I'm not an expert...
    SQL> alter table emp nologging;
    Table altered.
    SQL> create materialized view log on emp;
    Materialized view log created.
    SQL> select * from tab;
    TNAME TABTYPE CLUSTERID
    EMP TABLE
    BONUS TABLE
    SALGRADE TABLE
    RUPD$_EMP TABLE
    MLOG$_EMP TABLE
    SQL> insert into emp values(1000,'Matt','Test',100,sysdate,1000,1000,10,11,11);
    1 row created.
    SQL> select *From mlog$_emp;
    EMPNO SNAPTIME$ D O
    CHANGE_VECTOR$$
    1000 01-JAN-00 I N
    FEFF

  • Is it possible to create materialized view log file for force refresh

    Is it possible to create materialized view log file for force refresh with join condition.
    Say for example:
    CREATE MATERIALIZED VIEW VU1
    REFRESH FORCE
    ON DEMAND
    AS
    SELECT e.employee_id, d.department_id from emp e and departments d
    where e.department_id = d.department_id;
    how can we create log file using 2 tables?
    Also am copying M.View result to new table. Is it possible to have the same values into the new table once the m.view get refreshed?

    You cannot create a record as a materialized view within the Application Designer.
    But there is workaround.
    Create the record as a table within the Application Designer. Don't build it.
    Inside your database, create the materialized with same name and columns as the record created previously.
    After that, you'll be able to work on that record as for all other within the Peoplesoft tools.
    But keep in mind do never build that object, that'll drop your materialized view and create a table instead.
    Same problem exists for partitioned tables, for function based-indexes and some other objects database vendor dependant. Same workaround is used.
    Nicolas.

  • Error creating materialized view log using DBlink

    Hi guys,
    I have 2 databases in diferent machines . (machine A and B)
    Machine A is my production database and I have a database link in machine B accessing Machine A
    CREATE MATERIALIZED VIEW vm_test
    BUILD IMMEDIATE
    REFRESH FAST ON commit as
    select * from test@A
    -- no problem in this first operation the materialized view was created sucessfully
    Now I need to create the LOG
    SQL> CREATE MATERIALIZED VIEW LOG ON test
    2 PCTFREE 5
    3 TABLESPACE prodemge_2006
    4 STORAGE (INITIAL 10K NEXT 10K);
    CREATE MATERIALIZED VIEW LOG ON test
    ERROR at line 1:
    ORA-02050: transaction 5.21.8771 rolled back, some remote DBs may be in-doubt
    ORA-02068: following severe error from A
    ORA-03113: end-of-file on communication channel
    What could be causing this error ?
    Thank you,
    Felipe

    ORA-02050 transaction string rolled back, some remote DBs may be in-doubt
    Cause: Network or remote failure during a two-phase commit.
    Action: Notify operations; remote databases will automatically re-sync when the failure is repaired.
    ORA-02068 following severe error from stringstring
    Cause: A severe error (disconnect, fatal Oracle error) was received from the indicated database link. See following error text.
    Action: Contact the remote system administrator.
    M.S.Taj

  • CREATE MATERIALIZED VIEW LOG ON / SNAPSHOT LOG ON

    HI,
    Is there any difference between create materialized view log on and creat snapshot on.
    Did some googling, found out that: A snapshot log is a table associated with
    the master table of a snapshot and Is used for refresh the master table\'s snapshots.
    Materialized view log is a table associated with the master table of a materialized view. Seem like the same.
    By the way, are these tables important? Will my database function as normal without these view log.
    regards,
    becks

    Where did you pick up this syntax from ?
    The MV Log that will be created on DOCUMENT will be called MLOG$_DOCUMENT.
    So, the correct syntax is :
    create materialized view log on DOCUMENT with primary key;this will create a "table" called MLOG$_DOCUMENT which serves as the Materialized View Log on the real table called DOCUMENT. This will allow you to create one or more Materialized Views based on DOCUMENT, which can be fast refreshed because of the presence of the MV Log. For example :
    create materialized view MV_DOCUMENT refresh fast on demand as select DOC_ID, DOC_DATE from DOCUMENT;(i.e. assuming you want an MV that has only two columns from the table DOCUMENT.
    Hemant K Chitale
    http://hemantoracledba.blogspot.com

  • CREATE MATERIALIZED VIEW LOG ERROR

    Quick question:
    This doesn't work:
    CREATE MATERIALIZED VIEW LOG ON STOCKMOVES
    NOCACHE
    LOGGING
    NOPARALLEL
    WITH PRIMARY KEY, (ITEMKEY,WAREHOUSE,AGENT,DOCUMENTID,STATUS,RATE,PRICE,DISCOUNTPRC,SUPPLYQUANTITY)
    INCLUDING NEW VALUES
    Fails with "ORA-00922: missing or invalid option" and points to "(ITEMKEY"
    Can't find what's wrong.

    Comma after PRIMARY KEY is not required.
    Regards,
    Archana
    "While one person hesitates because he feels inferior, the other is busy making mistakes and becoming superior."
    http://justoracle.blogspot.com/
    -----------------------

  • Create materialized view log with rowid hangs indefinitely..

    Hi
    create materialized view log on advice_note with rowid;
    This stmt hangs indefinitely...
    Help needed in resolving this issue
    Rp

    i have resolved the issue myself.
    Found out the sessions that are locking the object , killed all those sessions & pids.
    Rp

  • Bug: Can not create materialized view log on 11G XE

    Hi,
    I log in as HR user and try create materialized view log
    CREATE MATERIALIZED VIEW LOG ON HR.EMPLOYEES;I get error
    >
    Error starting at line 1 in command:
    CREATE MATERIALIZED VIEW LOG ON HR.EMPLOYEES
    Error at Command Line:1 Column:0
    Error report:
    SQL Error: ORA-00439: feature not enabled: Advanced replication
    00439. 00000 - "feature not enabled: %s"
    *Cause:    The specified feature is not enabled.
    *Action:   Do not attempt to use this feature.
    >
    You can create materialized view log on 10G XE without any problem.
    Regards,
    Jari
    http://dbswh.webhop.net/dbswh/f?p=BLOG:HOME:0

    Is it a bug in 11g or 10g?
    It was reported earlier in now archived beta forum. {thread:id=2214092}
    The current doc lists MV sites only (and "No" for Advanced Replication feature):
    http://download.oracle.com/docs/cd/E17781_01/license.112/e18068/toc.htm#BABDFDAI

  • Create materialized view is failing when refresh fast is used

    version 10.2.0.4 on solaris
    This statement is working fine
    CREATE MATERIALIZED VIEW MVIEW1
    TABLESPACE MIS_CURD01
    BUILD IMMEDIATE
    as
    SELECT ACTIVITY_ID "ACTIVITY_ID",
    ASSOC_ID "ASSOC_ID",
    PIT_ROLE_CODE "PIT_ROLE_CODE",
    PIT_BANK_CODE "PIT_BANK_CODE",
    PIT_COST_CENTER "PIT_COST_CENTER",
    RESP_ASSOC_IND "RESP_ASSOC_IND"
    FROM TABLE1@DBLINK;
    The statement with fast refresh is failing with this error message
    ERROR at line 18:
    ORA-12018: following error encountered during code generation for
    "TABLE1"
    ORA-00942: table or view does not exist
    Here is the statement
    CREATE MATERIALIZED VIEW MVIEW1
    TABLESPACE MIS_CURD01
    NOCACHE
    LOGGING
    NOCOMPRESS
    NOPARALLEL
    BUILD IMMEDIATE
    USING INDEX TABLESPACE MIS_CURI01
    REFRESH FAST ON DEMAND
    WITH PRIMARY KEY
    AS
    SELECT ACTIVITY_ID "ACTIVITY_ID",
    ASSOC_ID "ASSOC_ID",
    PIT_ROLE_CODE "PIT_ROLE_CODE",
    PIT_BANK_CODE "PIT_BANK_CODE",
    PIT_COST_CENTER "PIT_COST_CENTER",
    RESP_ASSOC_IND "RESP_ASSOC_IND"
    FROM TABLE1@DBLINK;
    Any idea what's going wrong here. Thanks for your help in advance.
    Edited by: user11319873 on Jun 30, 2010 4:17 PM

    Refresh FAST requires that
    a. An MV Log (Snapshot Log) be created on the source table
    b. The user doing the refresh (i.e. the account that the DBLink uses) has SELECT privilege on the MV Log.
    Hemant K Chitale

  • How to create materialized view based on a view?

    Hi,
    I hope this is not very far fetched idea.
    I have a very complex view and I would like to replicate it 'in place' that is I would like to make a materialized view that is based on this view complex view. I would like to use this materialized view (i.e table) to query data instead of using the original view, since it takes Oracle some 10-15 seconds to execute my query on the original view and I am not allowed to create indexes on most of the tables that are included in the original view.
    Can this be done?
    Best regards,
    Tamas Szecsy

    The best way to do this is to create a materialzed view based on the underlying code of the original view. If you don't have this handy, issue the following in sqlplus:
    select text
    from user_views
    where view_name = 'NAME_OF_VIEW'
    You can then cut and paste the sql statement into your create materialized view statement.
    Please note, you will probable have to set the long parameter to a higher value to reveal the complete statement for example:
    SQL> set long 2048

  • How to create materialized view based on a synonym

    Hi all,
    I am trying to create simple materialized view based on a synonym and that synonym is pointing a view in other database (using dblink). I am getting table or view not found error . I am able to select synonym if i use select but not in materialized view. Please help me.
    Thanks,

    The best way to do this is to create a materialzed view based on the underlying code of the original view. If you don't have this handy, issue the following in sqlplus:
    select text
    from user_views
    where view_name = 'NAME_OF_VIEW'
    You can then cut and paste the sql statement into your create materialized view statement.
    Please note, you will probable have to set the long parameter to a higher value to reveal the complete statement for example:
    SQL> set long 2048

  • How to create materialized  view with parameter and index ?

    Hi all,
    i am using oracle 11g.
    i want to create  parameter materialized view  with two parameter (STORED_VALUE, LOV_NAME) with  an index .
    i have below view
    CREATE OR REPLACE FORCE VIEW SR_MY_TEST(DISPLAYED_VALUE, STORED_VALUE, LOV_NAME) AS
      SELECT  DISPLAYED_VALUE , LOVVALUE.STORED_VALUE , lovname.lov_name
               FROM (SELECT T.LOV_VALUE_ID,
          T.LOV_ID,
          T.ORG_ENTITY_ID,
          T.STORED_VALUE,
          T.DISPLAYED_VALUE,
          T.ENTERPRISE_ID
         FROM MS_QS_LIST_OF_VALUES_T T) lovvalue, ms_qs_lov_names lovname
              WHERE lovvalue.lov_id = lovname.lov_id
                AND lovvalue.org_entity_id = 1
                and LOVVALUE.ENTERPRISE_ID = 100000
                AND LOVNAME.ENTERPRISE_ID = 100000;
    i want to create index on   STORED_VALUE, LOV_NAME
    Thanks
    Damby

    No.AFAIK, there's nothing called as "parameterized MV".
    Materialized View store data like tables (and not like Views). So, does it make sense when you say - "table with parameters" ?
    Could you please explain your business requirement?
    What is the purpose behind those 2 parameters?

  • Create materialized view as part of refresh group

    Hello,
    When I create a materialized view in 11g it automatically creates its own refresh group. How can I create the materialized group as part of an existing refresh group? (I know I can drop the individual refresh group and add the mview to the main refresh group but that is a pain).
    Thank you,

    >
    How can I create the materialized group as part of an existing refresh group?
    >
    You can't - you need to add the MV to the existing refresh group.
    See the Add Procedure of the DBMS_REFRESH package
    http://docs.oracle.com/cd/B28359_01/server.111/b28327/rarrefreshpac.htm

  • Query on Materialized view and materialized view log

    I am creating a materialized view something like this.but getting following error:
    ERROR at line 1:
    ORA-12032: cannot use rowid column from materialized view log on "SCOTT"."EMP"
    SQL> create snapshot log on scott.emp;
    Materialized view log created.
    SQL> create materialized view scott_emp refresh fast on demand as select deptno,sum(sal) sum_sal from scott.emp group by deptno;
    ERROR at line 1:
    ORA-12032: cannot use rowid column from materialized view log on "SCOTT"."EMP"
    Note when i have my query in materialized view as "select * from emp;" in place of
    "select deptno,sum(sal) sum_sal from scott.emp group by deptno;" This code works fine.
    How do i have a materialized with with a group by clause.
    Thanks in Advance

    Got the answer myself.
    I wasnt adding all the required columns.
    CREATE MATERIALIZED VIEW LOG ON scott.emp
    WITH SEQUENCE, ROWID (<all the required columns>)
    INCLUDING NEW VALUES;
    Anyways,
    Thanks guys...

Maybe you are looking for