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

Similar Messages

  • Error when Create Materialized View

    Hi
    When I tried to create MV show me error :
    SQL> @CRIA_MV_ARC_BW.SQL
    AND INDUSTRIAL.CD_FABRICA = SUBSTR(ARC.DS_ARC, 1, 3)
    ERROR at line 88:
    ORA-01031: insufficient privilegesI am using Oracle 9.02 and there are Grant for all Tablles , my query of creation is:
    CREATE MATERIALIZED VIEW CLIBGF.MV_ARC_BW
    NOCACHE
    LOGGING
    NOPARALLEL
    BUILD IMMEDIATE
    REFRESH FORCE
    START WITH TO_DATE('26-nov-2009 02:00:00','dd-mon-yyyy hh24:mi:ss')
    NEXT trunc(sysdate) + 1/12
    ENABLE QUERY REWRITE
    AS
    SELECT     MAX(NVL((SELECT  DECODE(A.T$CDNG$O,'F',DECODE(TRIM(B.T$CALC$O),'S','C',A.T$CDNG$O),A.T$CDNG$O)
                     FROM TRITON.TTDFAT995501 A, TRITON.TTDFAT996501 B
                    WHERE A.T$OCOM$O + 0 = ARC.CD_UNIDADE_EXPEDIDORA
                      AND A.T$NDOC$O = NOTAS.CD_NOTA
                      AND (A.T$OCOM$O = B.T$OCOM$O AND A.T$NREF$O = B.T$NREF$O)
                                        AND ROWNUM =1),
                   0)) NEGOCIO,
           ARC.CD_CLIENTE CD_CLIENTE,
           CLIENTE.T$NAMA DS_CLIENTE,
           ARC.CD_ARC,
           ARC.CD_STATUS,
           ARC.CD_STATUS || ' - ' || STATUS.DS_STATUS STATUS,
           TO_CHAR(ARC.DT_EMISSAO, 'DD/MM/YYYY') DT_EMISSAO,
           TO_CHAR(ACAO_INV.DT_REALIZADO, 'DD/MM/YYYY') DT_REALIZADO_INVESTIGACAO,
           ARC.CD_MARCA || ' - ' || MARCA.T$DSMA$O MARCA,
           ARC.CD_PRODUTO CD_PRODUTO,
           EMBALAGEM.T$CDAC$O || ' - ' || EMBALAGEM.T$DESC$O DS_EMBALAGEM,
           SUBSTR(ARC.DS_ARC, 1, 3) CD_COMPANHIA_PRODUTORA,
            ARC.CD_MOTIVO_RECLAMACAO CD_MOTIVO_RECLAMACAO,
            MOTIVO.DS_ITEM DS_MOTIVO_RECLAMACAO,
           DECODE(ARC.FL_PROCEDENCIA, 0, 'PROCEDENTE', 1, 'IMPROCEDENTE', ' ') PROCEDENCIA,
           SUM(NVL((SELECT SUM(NVL(T$IQUA$O, 0))
                     FROM TRITON.TTDFAT995501 A, TRITON.TTDFAT996501 B
                    WHERE A.T$OCOM$O + 0 = ARC.CD_UNIDADE_EXPEDIDORA
                      AND A.T$NDOC$O = NOTAS.CD_NOTA
                      AND (A.T$OCOM$O = B.T$OCOM$O AND A.T$NREF$O = B.T$NREF$O)),
                   0)) NR_QUANTIDADE_VENDIDA,
               ARC.NR_QUANTIDADE_AFETADA NR_QUANTIDADE_AFETADA,     
           ARC.NR_QUANTIDADE_AFETADA_REAL NR_QUANTIDADE_AFETADA_REAL,
           DS_JUSTIFICATIVA DSJUST
      FROM ARCTB_ARC                 ARC,
           ARCTB_NOTAS               NOTAS,
           ARCTB_TABELA_MOTIVO       MOTIVO,
           ARCTB_ACAO_IMEDIATA       ACAO_INV,
           ARCTB_ACAO_IMEDIATA       ACAO_IME,
           ARCTB_STATUS              STATUS,
           TRITON.TTCCOM010501       CLIENTE,
           TRITON.TTCCOM936501       CIDADE,
           TRITON.TTIITM001810       D,
           TRITON.TTIITM983501       PRODUTO,
           TRITON.TTFGLD010806       CC,
           TRITON.TTCCOM983501       MARCA,
           TRITON.TTCCOM000501       CIA,
           TRITON.TTIITM982501       NAT,
           SEI.SIBTB_MULTIMARCA      MULTIMARCA,
           SEI.SIBTB_DIRETORIA_DEPTO DIRETORIA,
           TRITON.TTCCOM994501       USUARIO,
           ARCTB_GERENCIA_INDUSTRIAL INDUSTRIAL,
           TRITON.TTIITM984501       EMBALAGEM
    WHERE ARC.CD_ARC = NOTAS.CD_ARC(+)
       AND ARC.CD_ARC = ACAO_INV.CD_ARC(+)
       AND ACAO_INV.CD_TIPO_ACAO(+) = 0
       AND ACAO_INV.CD_ACAO_IMEDIATA(+) = 999
       AND ARC.CD_ARC = ACAO_IME.CD_ARC(+)
       AND ACAO_IME.CD_TIPO_ACAO(+) = 1
       AND ACAO_IME.CD_ACAO_IMEDIATA(+) = 999
       AND ARC.CD_CLIENTE = CLIENTE.T$CUNO(+)
       AND CLIENTE.T$ESTA$L = CIDADE.T$ESTA$L(+)
       AND CLIENTE.T$CDMU$L = CIDADE.T$MUNI$L(+)
       AND TRIM(REPLACE(ARC.CD_PRODUTO, '-', '')) =
           TRIM(REPLACE(D.T$ITEM(+), '-', ''))
       AND TRIM(REPLACE(ARC.CD_PRODUTO, '-', '')) =
           TRIM(REPLACE(PRODUTO.T$ITEM$O(+), '-', ''))
       AND PRODUTO.T$PROC$O = NAT.T$PROC$O(+)
       AND EMBALAGEM.T$CDAC$O(+) = PRODUTO.T$CDAC$O
       AND ARC.CD_MOTIVO_RECLAMACAO = MOTIVO.CD_ITEM(+)
       AND ARC.CD_MARCA = MARCA.T$CDMA$O(+)
       AND SUBSTR(ARC.DS_ARC, 1, 3) = CIA.T$NCMP(+)
       AND ARC.CD_STATUS = STATUS.CD_STATUS(+)
       AND TRIM(ARC.CD_CENTRO_CUSTO) = TRIM(CC.T$DIMX(+))
       AND CC.T$DTYP(+) = 2
       AND CC.T$SUBL(+) = 0
       AND ARC.CD_DEPTO_MULTIMARCA = MULTIMARCA.CD_MULTIMARCA(+)
       AND ARC.CD_DEPTO = DIRETORIA.CD_DEPTO(+)
       AND ARC.CD_USUARIO = TRIM(USUARIO.T$CDUS$O(+))
       AND ARC.CD_STATUS IS NOT NULL
       AND ARC.CD_MOTIVO_RECLAMACAO = MOTIVO.CD_ITEM(+)
       AND INDUSTRIAL.CD_FABRICA = SUBSTR(ARC.DS_ARC, 1, 3)
       GROUP BY TO_CHAR(ARC.DT_EMISSAO, 'YYYY'),
              TO_CHAR(ARC.DT_EMISSAO, 'MM'),
              ARC.CD_ARC,
              ARC.DS_ARC,
              ARC.DS_SUPERVISOR,
              ARC.CD_STATUS,
              STATUS.DS_STATUS,
              TO_CHAR(ARC.DT_EMISSAO, 'DD/MM/YYYY'),
              TO_CHAR(ACAO_INV.DT_ORIGINAL, 'DD/MM/YYYY'),
              TO_CHAR(ACAO_INV.DT_REALIZADO, 'DD/MM/YYYY'),
              TO_CHAR(ACAO_IME.DT_ORIGINAL, 'DD/MM/YYYY'),
              TO_CHAR(ACAO_IME.DT_REALIZADO, 'DD/MM/YYYY'),
              TO_CHAR(ARC.DT_PROCEDENCIA, 'DD/MM/YYYY'),
              TO_CHAR(ARC.DT_RECEBIMENTO, 'DD/MM/YYYY'),
              TO_CHAR(NVL(ARC.DT_APROVACAO_INDUSTRIAL,
                          ARC.DT_APROVACAO_COMERCIAL),
                      'DD/MM/YYYY'),
              ARC.CD_CLIENTE,
              CLIENTE.T$NAMA,
              CIDADE.T$DSCA$L,
              ARC.CD_MARCA,
              MARCA.T$DSMA$O,
              ARC.CD_PRODUTO,
              D.T$SEAK,
              EMBALAGEM.T$CDAC$O || ' - ' || EMBALAGEM.T$DESC$O,
              NAT.T$DESC$O,
              ARC.NR_LOTE,
              ARC.DT_FABRICACAO,
              SUBSTR(ARC.DS_ARC, 1, 3),
              CIA.T$CITY,
              ARC.CD_MOTIVO_RECLAMACAO,
              MOTIVO.DS_ITEM,
              DECODE(ARC.FL_PROCEDENCIA,
                     0,
                     'PROCEDENTE',
                     1,
                     'IMPROCEDENTE',
              ARC.DS_DISPOSICAO,
              ARC.CD_CENTRO_CUSTO,
              CC.T$DESC,
              ARC.NR_QUANTIDADE_AFETADA,
              DS_JUSTIFICATIVA,
              DS_DISPOSICAO,
              CD_RESPONSAVEL_CAUSA,
              ARC.NR_QUANTIDADE_AFETADA_REAL,
              ARC.DT_ATENDIMENTO,
              MOTIVO.CLASSIFICACAO,
              ARC.DS_COORDENADOR,
              ARC.FL_ATENDIMENTO,
              TO_CHAR(ARC.DT_ATENDIMENTO, 'DD/MM/YYYY'),
              ARC.DS_COORDENADOR_INVESTIGACAO,
              INDUSTRIAL.REGIAO
    ORDER BY ARC.CD_ARC DESC;
    Edited by: muttleychess on Nov 25, 2009 10:25 AM

    Please see my privilege
    GRANTEE PRIVILEGE ADM
    CLIBGF CREATE TABLE NO
    CLIBGF CREATE ANY VIEW NO
    CLIBGF CREATE SNAPSHOT NO
    CLIBGF SELECT ANY TABLE NO
    CLIBGF CREATE ANY TRIGGER NO
    CLIBGF CREATE ANY SNAPSHOT NO

  • 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

  • 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 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

  • 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

  • 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

  • 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

  • Create Materialized View question

    Hi all,
    I have a question about MV.
    Toad creation wizard of a new snapshots (materialized view) on "Refresh Info" tab I set
    Refresh mode: complete On demand
    With: ROWID (I can't use primary key because on my table there isn't PK)
    Writing teh query, next the Materialized View is successfully created and this is a toad script:
    CREATE MATERIALIZED VIEW ASDF
    TABLESPACE USERS
    NOCACHE
    LOGGING
    NOCOMPRESS
    NOPARALLEL
    BUILD IMMEDIATE
    REFRESH COMPLETE ON DEMAND
    WITH PRIMARY KEY
    AS
    select CDA_PART, DES_PART, DES_MAT, CDA_APPART, CDA_PROVEN
    from ldanapr01
    where dat_end>(sysdate-1);Why is specified WITH PRIMARY KEY if I created the view with ROWID option?
    Indeed if a drop a MV and directly run the create VM script above obtain error ORA-14012 table 'LDANAPR01' does not contain a primary key constraint.
    So, if I modify the script in this way
    CREATE MATERIALIZED VIEW ASDF
    TABLESPACE USERS
    NOCACHE
    LOGGING
    NOCOMPRESS
    NOPARALLEL
    BUILD IMMEDIATE
    REFRESH COMPLETE ON DEMAND
    WITH ROWID
    AS
    select CDA_PART, DES_PART, DES_MAT, CDA_APPART, CDA_PROVEN
    from ldanapr01
    where dat_end>(sysdate-1);the MV is successfully created!!
    What is difference between WITH PRIMARY KEY and WITH ROW ID... and why Toad show always the created MV script as WITH PRIMARY KEY ?

    >
    WITH PRIMARY KEY is used to create a primary key materialized view i.e. the materialized view is based on the primary key of the master table instead of ROWID (for ROWID clause). PRIMARY KEY is the default option. To use the PRIMARY KEY clause you should have defined PRIMARY KEY on the master table or else you should use ROWID based materialized views.
    Primary key materialized views allow materialized view master tables to be reorganized without affecting the eligibility of the materialized view for fast refresh.
    Rowid materialized views should have a single master table and cannot contain any of the following:
    * Distinct or aggregate functions
    * GROUP BY Subqueries , Joins & Set operations
    source : http://www.dbasupport.com/oracle/ora9i/mat_views2.shtml

  • 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

  • Creating Materialized View in Toad

    As with every new endeavor - come new questions.
    I am trying to create a materialized view via toad (first time doing this). Now - toad is great, since it provides a kind-of wizard interface. Hence, one doesn't have to completely code in the create statement, with all of the options, etc.
    Instead, in toad, one can (via the schema browser), go into the Materialized Views tab and click on create new. This opens a window with 6 tabs: Basic Info, Refresh Info, Physical Attributes, Query, Partitions & Subpartition Template.
    In the Basic Info, one can put a check mark next to some of the following options:
    -Build Deffered
    -Parallel
    -Cache
    -Logging
    -Using index
    -Allow updates
    etc.
    I have read that build deferred refers to whether or not you would like the view to be created automatically or to be deferred.
    Anyways, I tried to find Toad documentation to explain each of the options in-detail. No success. Hence, am researching each part piece by piece.
    But - here is my question:
    In the Query tab, we are asked to specify a query. I am assuming that the query does not have to be a full query, beginning with CREATE MATERIALIZED VIEW mv_table1 REFRESH FAST etc...
    Since in this 'wizard', we are providing the MV name at the top of the dialog box, we are checking the 'options' in the other tabs, etc.
    And so, I assumed that the query should merely be a select query in the window mentioned above.
    So I entered the following:
    select * from table1@remote_db;
    When I go to verify the syntax, I get the error message: ORA_00911: invalid character. It seems to be pointing to my db_link (remote_db). I have been using this link throughout many places, w/o any problems.
    Has anyone created a MV in toad before? Any links to good toad documentation would be helpful as well.
    Thanks.

    (This is fun... ;))
    For anyone endeavoring this in the future, below I have attached the prerequisites required in order to create a materialized view (can also be found @ http://download-uk.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_6002.htm):
    Prerequisites
    The privileges required to create a materialized view should be granted directly rather than through a role.
    To create a materialized view in your own schema:
    You must have been granted the CREATE MATERIALIZED VIEW system privilege and either the CREATE TABLE or CREATE ANY TABLE system privilege.
    You must also have access to any master tables of the materialized view that you do not own, either through a SELECT object privilege on each of the tables or through the SELECT ANY TABLE system privilege.
    To create a materialized view in another user's schema:
    You must have the CREATE ANY MATERIALIZED VIEW system privilege.
    The owner of the materialized view must have the CREATE TABLE system privilege. The owner must also have access to any master tables of the materialized view that the schema owner does not own (for example, if the master tables are on a remote database) and to any materialized view logs defined on those master tables, either through a SELECT object privilege on each of the tables or through the SELECT ANY TABLE system privilege.
    To create a refresh-on-commit materialized view (ON COMMIT REFRESH clause), in addition to the preceding privileges, you must have the ON COMMIT REFRESH object privilege on any master tables that you do not own or you must have the ON COMMIT REFRESH system privilege.
    To create the materialized view with query rewrite enabled, in addition to the preceding privileges:
    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.
    If you are defining the materialized view on a prebuilt container (ON PREBUILT TABLE clause), then you must have the SELECT privilege WITH GRANT OPTION on the container table.
    The user whose schema contains the materialized view must have sufficient quota in the target tablespace to store the master table and index of the materialized view or must have the UNLIMITED TABLESPACE system privilege.
    When you create a materialized view, Oracle Database creates one internal table and at least one index, and may create one view, all in the schema of the materialized view. Oracle Database uses these objects to maintain the materialized view data. You must have the privileges necessary to create these objects.

  • Error while creating materialized view which using database link

    Helo!
    I'm getting error "ORA-00942: table or view does not exist" when I want to create materialized view.
    Details:
    1. On destination database I create a database link:
    CREATE DATABASE LINK SDATABASE
    CONNECT TO MYUSER
    IDENTIFIED BY MYUSERPASS
    USING 'ORCL';
    => Command "SELECT * FROM TABLE1@SDATABASE" returns data normally!
    2. On source database I create MATERIALIZED VIEW LOG:
    CREATE MATERIALIZED VIEW LOG
    ON TABLE1
    WITH PRIMARY KEY
    INCLUDING NEW VALUES;
    3. Now, when I want to create MATERIALIZED VIEW on destination database:
    CREATE MATERIALIZED VIEW TABLE1
    REFRESH FAST
    START WITH SYSDATE
    NEXT SYSDATE + 1/1440
    WITH PRIMARY KEY
    AS SELECT * FROM TABLE1@SDATABASE;
    ...I get error "ORA-00942: table or view does not exist"!
    How is that possible if command "SELECT * FROM TABLE1@SDATABASE" returns data normally?
    Thanks,
    Voranc

    And, I'm using Oracle 10g.
    Voranc

  • Error occured while creating MATERIALIZED VIEW

    I created as below:
    CREATE MATERIALIZED VIEW LOG ON FIN.F_CV_HDR
    WITH ROWID, SEQUENCE, PRIMARY KEY;
    CREATE MATERIALIZED VIEW LOG ON FIN.F_CV_DTL
    WITH ROWID, SEQUENCE;
    REATE MATERIALIZED VIEW F_GL_SMRY_MVW
    PARALLEL
    BUILD IMMEDIATE
    REFRESH FAST ON COMMIT AS
    SELECT * FROM
    SELECT
    F_CV_HDR.ROWID "HDR_ID",
    CAST(NULL AS ROWID) "DTL_ID",
    cah_dsm_trm_tr_code gsv_dsm_trm_tr_code,
    cah_dsm_dcmnt_type gsv_dsm_dcmnt_type,
    cah_cv_nmbr gsv_dcmnt_nmbr,
    cah_lcm_lctn_code dsv_lcm_lctn_code,
    cah_dsm_dcmnt_srs gsv_dsm_dcmnt_srs,
    cah_cv_date gsv_dcmnt_date,
    'G' gsv_sub_code_type,
    DECODE(cah_dsm_dcmnt_type,'CPV',0,'CRV',cah_net_amnt) gsv_amnt_dbtd,
    DECODE(cah_dsm_dcmnt_type,'CPV','C','CRV','D') gsv_dr_cr_indctr,
    cah_net_amnt gsv_amnt,
    DECODE(cah_dsm_dcmnt_type,'CPV',cah_net_amnt,'CRV',0) gsv_amnt_crdtd,
    cah_asm_sbldgr_code gsv_sub_code,
    CAH_RMRKS GSV_RMRKS,
    CAST(NULL AS VARCHAR2(3)) GSV_CRS_RFRNCE_TYPE,
    CAST(NULL AS VARCHAR2(3)) GSV_CRS_RFRNCE_TR_CODE,
    CAST(NULL AS NUMBER(10)) GSV_CRS_RFRNCE_NMBR,
    CAST(NULL AS VARCHAR2(6)) GSV_FCM_CRNCY_CODE,
    CAST(NULL AS NUMBER(6,3)) GSV_EXCHNGE_RATE,
    CAST(NULL AS NUMBER(13,2)) GSV_FRGN_CRNCY_AMNT,
    CAST(NULL AS DATE) GSV_DATE_FROM,
    CAST(NULL AS DATE) GSV_DATE_TO,
    CAST(NULL AS NUMBER(7)) GSV_RJH_NMBR,
    CAST(NULL AS VARCHAR2(3)) GSV_PJC_SRS,
    CAST(NULL AS NUMBER(7)) GSV_PJC_NMBR,
    CAST(NULL AS NUMBER(3)) GSV_PJC_EQPTMNT_SRL,
    CAST(NULL AS VARCHAR2(5))GSV_PJC_EXPNSE_HEAD_CODE,
    CAST(NULL AS VARCHAR2(3)) gsv_dpm_dprtmnt_code,
    cah_asm_amm_main_code gsv_amm_main_code,
    CAH_LCM_LCTN_CODE_BOOK GSV_LCM_LCTN_CODE_BOOK,
    CAST(NULL AS NUMBER) gsv_dr_cr_advce_srl,
    0 gsv_dcmnt_srl_nmbr,
    cah_trnsctn_with_indctr gsv_trnsctn_with_indctr,
    cah_trnsctnr_code gsv_trnsctnr_code,
    0 gsv_net_tds_amnt,
    to_number(TO_CHAR(cah_cv_date ,'YYYY')) gsv_year,
    to_number(TO_CHAR(cah_cv_date ,'MM')) gsv_mnth,
    cah_cv_tmpry_nmbr gsv_tmpry_nmbr,
    CAH_SRCE_INDCTR GSV_SRCE_INDCTR,
    CAST(NULL AS VARCHAR2(50)) GSV_BILL_NMBR,
    CAST(NULL AS DATE) gsv_bill_date,
    cah_pay_rcve_name gsv_pay_rcve_name
    FROM f_cv_hdr
    WHERE CAH_FNCL_CLSRE_INDCTR = 'N'
    AND cah_avlble_indctr = 'Y'
    UNION ALL
    SELECT
    F_CV_HDR.ROWID "HDR_ID",
    f_cv_dtl.ROWID "DTL_ID",
    cah_dsm_trm_tr_code gsv_dsm_trm_tr_code,
    cah_dsm_dcmnt_type gsv_dsm_dcmnt_type,
    cah_cv_nmbr gsv_dcmnt_nmbr,
    cah_lcm_lctn_code dsv_lcm_lctn_code,
    cah_dsm_dcmnt_srs gsv_dsm_dcmnt_srs,
    cah_cv_date gsv_dcmnt_date,
    cad_sub_code_type gsv_sub_code_type,
    DECODE(cad_dr_cr_indctr, 'C',0,'D',cad_amnt) gsv_amnt_dbtd,
    cad_dr_cr_indctr gsv_dr_cr_indctr,
    cad_amnt gsv_amnt,
    DECODE(cad_dr_cr_indctr, 'D',0,'C',cad_amnt) gsv_amnt_crdtd,
    cad_sub_code gsv_sub_code,
    cad_rmrks gsv_rmrks,
    cad_crs_rfrnce_type gsv_crs_rfrnce_type,
    cad_crs_rfrnce_tr_code gsv_crs_rfrnce_tr_code,
    CAD_CRS_RFRNCE_NMBR GSV_CRS_RFRNCE_NMBR,
    CAST(NULL AS VARCHAR2(6)) GSV_FCM_CRNCY_CODE,
    CAST(NULL AS NUMBER(6,3)) GSV_EXCHNGE_RATE,
    CAST(NULL AS NUMBER(13,2)) gsv_frgn_crncy_amnt,
    cad_date_from gsv_date_from,
    cad_date_to gsv_date_to,
    cad_rjh_nmbr gsv_rjh_nmbr,
    cad_pjc_srs gsv_pjc_srs,
    cad_pjc_nmbr gsv_pjc_nmbr,
    cad_pjc_eqpmnt_srl gsv_pjc_eqptmnt_srl,
    cad_pjc_expnse_head_code gsv_pjc_expnse_head_code,
    cad_dpm_dprtmnt_code gsv_dpm_dprtmnt_code,
    cad_amm_main_code gsv_amm_main_code,
    cah_lcm_lctn_code_book gsv_lcm_lctn_code_book,
    cad_dr_cr_advce_srl gsv_dr_cr_advce_srl,
    cad_cv_srl_nmbr gsv_dcmnt_srl_nmbr,
    cah_trnsctn_with_indctr gsv_trnsctn_with_indctr,
    cah_trnsctnr_code gsv_trnsctnr_code,
    0 gsv_net_tds_amnt,
    to_number(TO_CHAR(cah_cv_date ,'YYYY')) gsv_year,
    to_number(TO_CHAR(cah_cv_date ,'MM')) gsv_mnth,
    cah_cv_tmpry_nmbr gsv_tmpry_nmbr,
    cah_srce_indctr gsv_srce_indctr,
    CAST(NULL AS VARCHAR2(50)) GSV_BILL_NMBR,
    CAST(NULL AS DATE) GSV_BILL_DATE,
    cah_pay_rcve_name gsv_pay_rcve_name
    FROM f_cv_hdr,
    F_CV_DTL
    WHERE CAH_FNCL_CLSRE_INDCTR = 'N'
    AND cah_avlble_indctr = 'Y'
    AND cah_lcm_lctn_code = cad_cah_lcm_lctn_code
    AND CAH_DSM_DCMNT_TYPE = CAD_CAH_DSM_DCMNT_TYPE
    AND cah_cv_tmpry_nmbr = cad_cah_cv_tmpry_nmbr);
    Giving below error:
    ==================================================
    ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view
    12054. 00000 - "cannot set the ON COMMIT refresh attribute for the materialized view"
    *Cause:    The materialized view did not satisfy conditions for refresh at
    commit time.
    *Action:   Specify only valid options.
    ==================================================

    *Action: Specify only valid options.                                                                                                                                                                                                                           

Maybe you are looking for

  • Cost Estimates - system collects planed price for some raw materials only

    Hello I have a question regarding price determination for raw materials when creating cost estimates. My costing variant uses material future price (Accounting 1 view) in raw materials as a primary source for price collecting of raw materials and I w

  • Problems with Application Builder and NI-DAQmx drivers in Labview 8.2 Professional

    Hello everyone, I am trying to use the application builder to create an executable so that someone without labview is capable of a remote panel connection to connect to our test laboratory.  our test laboratory uses the USB Compact DAQ  9172.  I did

  • PHP form/Captcha alternative

    I have a php form that works fine. In part: <form method="post" action="sendmail.php"> Now, to add some security to it I created a required field: What is 6 plus 6? A bot can't fill in 12, right? So then the form doesn't go to the sendmail.php file.

  • Release Strategy for contracts.

    Hi gurus, Good day,. Please help on this. We have a release strat for Contract. It is working fine when a contract is created, but when several changes were made on the Quantity, release srtat are not being triggered. Example. Contact created with qt

  • Host credential

    hi I need some tips about host credentials. I installed 11g on linux as5. When I run oem and do setting for backup. It asks to set host credentials. When I go at preferences - preffered credentials and after filling proper username and password it ge