ORA-12013 on Fast Refreshable view
Hi,
I'am trying to create an update mview but encoutering ORA-12013.
The problem is , if i comment for update clause in the create statment, the mview is correctly created :
create materialized view AGREGAT_MVNO_RC
build deferred
refresh
fast
on demand
with primary key
for update
enable query rewrite
as
SELECT
LIBELLE_MVNO,
PTA_ID,
TYPE_USAGE,
CODE_CHARGE,
TRUNC( DATE_DEBUT_PERIODE, 'MM') AS MOIS_DATE_DEBUT,
TRUNC( DATE_VALORISATION, 'MM') AS MOIS_VALORISATION,
SUM( MONTANT) AS MONTANT, COUNT( MONTANT) AS NB_MONTANT,
COUNT( *) AS NB_ENR
FROM
CHARGE_VALORISEE_RC
GROUP BY
LIBELLE_MVNO,
PTA_ID,
TYPE_USAGE,
CODE_CHARGE,
TRUNC( DATE_DEBUT_PERIODE, 'MM'),
TRUNC( DATE_VALORISATION, 'MM');
=>produce ORA-12013
create materialized view AGREGAT_MVNO_RC
build deferred
refresh
fast
on demand
with primary key
--for update
enable query rewrite
as
SELECT
LIBELLE_MVNO,
PTA_ID,
TYPE_USAGE,
CODE_CHARGE,
TRUNC( DATE_DEBUT_PERIODE, 'MM') AS MOIS_DATE_DEBUT,
TRUNC( DATE_VALORISATION, 'MM') AS MOIS_VALORISATION,
SUM( MONTANT) AS MONTANT, COUNT( MONTANT) AS NB_MONTANT,
COUNT( *) AS NB_ENR
FROM
CHARGE_VALORISEE_RC
GROUP BY
LIBELLE_MVNO,
PTA_ID,
TYPE_USAGE,
CODE_CHARGE,
TRUNC( DATE_DEBUT_PERIODE, 'MM'),
TRUNC( DATE_VALORISATION, 'MM');
=> No errors
i don't understand why ?
Evironment: 10.2.0.3 enterprise on hp-ux
Thanks for help
The error message description seems clear enough :
ORA-12013 : updatable materialized views must be simple enough to do fast refresh
Cause: The updatable materialized view query contained a join, subquery, union, connect by, order by, or group by caluse.
Action: Make the materialized view simpler. If a join is really needed, make multiple simple materialized views then put a view on top of them.
Nicolas.
Similar Messages
-
Fast Refresh on Materialized View With Join
Hi All,
i have created following Materialized View Logs and MV
on EMP and DEPT
CREATE MATERIALIZED VIEW LOG ON DEPT
WITH PRIMARY KEY,SEQUENCE
INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW LOG ON EMP
WITH PRIMARY KEY,SEQUENCE
INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW EMP_MVW
TABLESPACE OSMIS_REPORT_DATA
REFRESH FAST ON COMMIT
AS
SELECT A.EMPNO,A.ENAME,A.DEPTNO,A.JOB,A.MGR,A.HIREDATE,A.SAL,A.COMM,B.DNAME,B.LOC
FROM EMP A,DEPT B
WHERE A.DEPTNO=B.DEPTNO
The Create MV Stmnt raised following error.
ERROR at line 6:
ORA-12052: cannot fast refresh materialized view SCOTT.EMP_MVW
I have tried the same with ROWID also,but same error
while creating MV.
Pls anyone give idea to Fast Refersh on MV with Joins
Thnks
Raj.G.
mail : [email protected]Actually you can get Oracle to tell you why the view does not have the capabilities you want using the DBMS_MVIEW package. For example you could have done something like this...
Personal Oracle Database 10g Release 10.1.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> CREATE MATERIALIZED VIEW LOG ON dept
2 WITH PRIMARY KEY, SEQUENCE
3 INCLUDING NEW VALUES;
Materialized view log created.
SQL> CREATE MATERIALIZED VIEW LOG ON emp
2 WITH PRIMARY KEY,SEQUENCE
3 INCLUDING NEW VALUES;
Materialized view log created.
SQL> CREATE MATERIALIZED VIEW emp_mvw
2 REFRESH FAST ON COMMIT
3 AS
4 SELECT a.empno, a.ename, a.deptno,
5 a.job, a.mgr, a.hiredate,
6 a.sal, a.comm, b.dname, b.loc
7 FROM emp a,dept b
8 WHERE a.deptno = b.deptno;
FROM emp a,dept b
ERROR at line 7:
ORA-12052: cannot fast refresh materialized view SCOTT.EMP_MVW
SQL> CREATE MATERIALIZED VIEW emp_mvw
2 REFRESH ON COMMIT -- remove the FAST to allow view to compile
3 AS
4 SELECT a.empno, a.ename, a.deptno,
5 a.job, a.mgr, a.hiredate,
6 a.sal, a.comm, b.dname, b.loc
7 FROM emp a,dept b
8 WHERE a.deptno = b.deptno;
Materialized view created.
SQL> @\oracle\product\10.1.0\Db_1\RDBMS\ADMIN\utlxmv.sql -- create mv_capabilities_table
Table created.
SQL> EXEC DBMS_MVIEW.EXPLAIN_MVIEW ('EMP_MVW');
PL/SQL procedure successfully completed.
SQL> SELECT capability_name, possible, msgtxt
2 FROM mv_capabilities_table
3 WHERE capability_name LIKE '%REFRESH_FAST_AFTER%';
CAPABILITY_NAME P MSGTXT
REFRESH_FAST_AFTER_INSERT N the SELECT list does not have the rowids of all the detail tables
REFRESH_FAST_AFTER_INSERT N mv log must have ROWID
REFRESH_FAST_AFTER_INSERT N mv log must have ROWID
REFRESH_FAST_AFTER_ONETAB_DML N see the reason why REFRESH_FAST_AFTER_INSERT is disabled
REFRESH_FAST_AFTER_ANY_DML N see the reason why REFRESH_FAST_AFTER_ONETAB_DML is disabled
SQL> DROP MATERIALIZED VIEW LOG ON dept;
Materialized view log dropped.
SQL> DROP MATERIALIZED VIEW LOG ON emp;
Materialized view log dropped.
SQL> DROP MATERIALIZED VIEW emp_mvw;
Materialized view dropped.
SQL> CREATE MATERIALIZED VIEW LOG ON dept
2 WITH ROWID, SEQUENCE
3 INCLUDING NEW VALUES;
Materialized view log created.
SQL> CREATE MATERIALIZED VIEW LOG ON emp
2 WITH ROWID,SEQUENCE
3 INCLUDING NEW VALUES;
Materialized view log created.
SQL> CREATE MATERIALIZED VIEW emp_mvw
2 REFRESH FAST ON COMMIT
3 AS
4 SELECT a.ROWID emp_rowid, b.ROWID dept_rowid,
5 a.empno, a.ename, a.deptno,
6 a.job, a.mgr, a.hiredate,
7 a.sal, a.comm, b.dname, b.loc
8 FROM emp a,dept b
9 WHERE a.deptno = b.deptno;
Materialized view created.
SQL> DELETE mv_capabilities_table;
18 rows deleted.
SQL> EXEC DBMS_MVIEW.EXPLAIN_MVIEW ('EMP_MVW');
PL/SQL procedure successfully completed.
SQL> SELECT capability_name, possible, msgtxt
2 FROM mv_capabilities_table
3 WHERE capability_name LIKE '%REFRESH_FAST_AFTER%';
CAPABILITY_NAME P MSGTXT
REFRESH_FAST_AFTER_INSERT Y
REFRESH_FAST_AFTER_ONETAB_DML Y
REFRESH_FAST_AFTER_ANY_DML Y
SQL> -
Error While Creating Fast Refresh Materialized view.
Table Scripts:
CREATE TABLE CONTRACT_MASTER
CONTRACT_SEQ NUMBER(10) NOT NULL,
PDN CHAR(5) NOT NULL,
APPID NUMBER(10) NOT NULL,
CONTRACT_LOB_DESC VARCHAR2(20) NOT NULL,
CUSTOMER_NAME VARCHAR2(57) NOT NULL,
CONTRACT_DT DATE NOT NULL,
CONTRACT_RECD_DT DATE NOT NULL,
HELD_OFFERING_DT DATE NOT NULL,
DRAFT_AMT NUMBER(15,2) NOT NULL,
STATUS_DESC VARCHAR2(20) NOT NULL,
GIF_UPLOAD_TM TIMESTAMP NOT NULL
CREATE table CONTRACT_COMMENTS
CONTRACT_COMMENTS_SEQ NUMBER(10) NOT NULL,
APPID NUMBER(10) NOT NULL,
COMMENTS VARCHAR2(1000) NOT NULL,
GIF_UPLOAD_TM TIMESTAMP NOT NULL
Constraints on tables
ALTER TABLE CONTRACT_MASTER ADD
CONSTRAINT XPKCONTRACT_MASTER PRIMARY KEY (CONTRACT_SEQ) USING INDEX ;
ALTER TABLE CONTRACT_COMMENTS ADD
CONSTRAINT XPKCONTRACT_COMMENTS PRIMARY KEY (CONTRACT_COMMENTS_SEQ) USING INDEX ;
alter table CONTRACT_MASTER add CONSTRAINT XUIAPPCONTRACT_MASTER UNIQUE (APPID) USING INDEX;
CREATE INDEX XUIAPPCONTRACT_COMMENTS ON
CONTRACT_COMMENTS(APPID) ;
Materialized View Creation:
CREATE MATERIALIZED VIEW LOG ON CONTRACT_MASTER WITH PRIMARY KEY,ROWID;
CREATE MATERIALIZED VIEW LOG ON CONTRACT_COMMENTS WITH PRIMARY KEY, ROWID;
CREATE MATERIALIZED VIEW MV_CONTRACT_COMMENTS_HELDOFFERING
REFRESH FAST
ENABLE QUERY REWRITE AS
SELECT APPID,COMMENTS FROM CONTRACT_COMMENTS WHERE APPID IN (
SELECT APPID FROM CONTRACT_MASTER WHERE STATUS_DESC = 'Held Offering' )
Errors generated:
ERROR at line 4:
ORA-12015: cannot create a fast refresh materialized view from a complex query
_*Afer That I have changed the query but still it was not created like:*_
CREATE MATERIALIZED VIEW MV_CONT_COMMNTS_HELDOFFERNG
REFRESH FAST
ENABLE QUERY REWRITE AS
SELECT CONTRACT_COMMENTS_SEQ,c.APPID,COMMENTS
FROM CONTRACT_COMMENTS c,CONTRACT_MASTER m
WHERE m.APPID = c.APPID and m.STATUS_DESC = 'Held Offering'
*even though error displayed:
SQL> CREATE MATERIALIZED VIEW MV_CONT_COMMNTS_HELDOFFERNG*
2 REFRESH FAST
3 ENABLE QUERY REWRITE AS
4 SELECT CONTRACT_COMMENTS_SEQ,c.APPID,COMMENTS
5 FROM CONTRACT_COMMENTS c,CONTRACT_MASTER m
6 WHERE m.APPID = c.APPID and m.STATUS_DESC = 'Held Offering';
FROM CONTRACT_COMMENTS c,CONTRACT_MASTER m
ERROR at line 5:
ORA-12052: cannot fast refresh materialized view GSSIO.MV_CONT_COMMNTS_HELDOFFERNG
*Again I have done "Analyzing Materialized Views for Fast Refresh" as follows:*
1: exec dbms_mview.explain_mview('MV_CONT_COMMNTS_HELDOFFERNG');
2: SELECT capability_name, possible, SUBSTR(msgtxt,1,60) AS msgtxt
FROM mv_capabilities_table
WHERE capability_name like '%FAST%';
Output is :
CAPABILITY_NAME P MSGTXT
REFRESH_FAST N
REFRESH_FAST_AFTER_INSERT N the SELECT list does not have the rowids of all the detail t
REFRESH_FAST_AFTER_ONETAB_DML N see the reason why REFRESH_FAST_AFTER_INSERT is disabled
REFRESH_FAST_AFTER_ANY_DML N see the reason why REFRESH_FAST_AFTER_ONETAB_DML is disabled
REFRESH_FAST_PCT N PCT is not possible on any of the detail tables in the mater
Please suggest what to do to implement fast refresh materialized view for same.Edited by: dba on Sep 20, 2010 12:00 AMIf the two MVs have to be consistent with each other as of a specific time, put them into a Refresh Group and refresh them with DBMS_MVIEW.REFRESH
If an MV is dependent on another, use DBMS_MVIEW.REFRESH_DEPENDENT
See the "Oracle® Database PL/SQL Packages and Types Reference" documentation pages for DBMS_MVIEW.
Hemant K Chitale
http://hemantoracledba.blogspot.com --- this is NOT a documentation site.
Edited by: Hemant K Chitale on Sep 20, 2010 5:19 PM -
Creation of fast refresh materialized view
Hi,
I am creating fast refreshable materialized view.At that time i am getting error message
ORA-12052: cannot fast refresh materialized view OPS$QDW.EMP_DEPT_MV
I created log's also on that tables(emp,dept)
Please Help me any body.
I am using oracle 8.1.7.4.0
below the scripts i created
CREATE MATERIALIZED VIEW LOG ON emp
tablesspace vijay_test
WITH ROWID
INCLUDING NEW VALUES
CREATE MATERIALIZED VIEW LOG ON DEPT
tablesspace vijay_test
WITH ROWID
INCLUDING NEW VALUES
CREATE MATERIALIZED VIEW emp_dept_mv
TABLESPACE vijay_test
BUILD IMMEDIATE
REFRESH FAST
ENABLE QUERY REWRITE
as
select e.ename,e.empno,e.deptno,d.loc from emp e, dept d
where e.deptno=d.deptnoIt will be possible to create a Materialised view with up to 20 tables, but you have to understand the restrictions on complex Materialised views with regards to fast refresh.
To help your understanding, refer to Materialized View Concepts and Architecture
<br>
Oracle Database FAQs
</br> -
hi
plz tell me why am not able to create a Fast refresh materialized View
SQL> CONNECT SCHEMA1/SCHEMA@HOST;
Connected.
SQL> CREATE MATERIALIZED VIEW LOG ON COMPANY WITH PRIMARY KEY;
Materialized view log created.
SQL> CREATE MATERIALIZED VIEW LOG ON EMPLOYEE WITH PRIMARY KEY;
Materialized view log created.
SQL> GRANT SELECT ON MLOG$_COMPANY TO SCHEMAREP;
Grant succeeded.
SQL> GRANT SELECT ON MLOG$_EMPLOYEE TO SCHEMAREP;
Grant succeeded.
SQL> CONNECT SCHEMAREP/REPORTS@HOST;
Connected.
SQL>
SQL> CREATE MATERIALIZED VIEW mview_1
2 REFRESH fast on DEMAND
3 AS
4 SELECT EMPLOYEE.EMPLOYEE_num
5 FROM schema1.COMPANY company,schema1.EMPLOYEE EMPLOYEE
6 WHERE COMPANY.COMPANY_ID=EMPLOYEE.COMPANY_ID;
FROM schema1.COMPANY company,schema1.EMPLOYEE EMPLOYEE
ERROR at line 5:
ORA-12052: cannot fast refresh materialized view SCHEMAREP.MVIEW_1
SQL>You would be able to answer yourself your question, if you
a) read the restrictions for fast refresheable materialized view at
http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/basicmv.htm#sthref537
b) make you familiar with the packaged procedure dbms_mview.explain_mview
Best regards
Maxim -
ORA-12052 when create materialized view
I following the sample in Oracle document to create materialized viewCREATE MATERIALIZED VIEW LOG ON sales
WITH ROWID, SEQUENCE(amount_sold, time_id, prod_id) INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW LOG ON times
WITH ROWID, SEQUENCE (time_id, calendar_year) INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW LOG ON products
WITH ROWID, SEQUENCE (prod_id,prod_name) INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW sales_mv
BUILD IMMEDIATE REFRESH FAST ON COMMIT
AS SELECT t.calendar_year, p.prod_id, p.prod_name,
SUM(s.amount_sold) AS sum_sales
FROM times t, products p, sales s
WHERE t.time_id = s.time_id AND p.prod_id = s.prod_id
GROUP BY t.calendar_year, p.prod_id, p.prod_name; This works. BUt I actually does not want do aggregation. Thus I changed the MV creation statement toCREATE MATERIALIZED VIEW sales_mv
BUILD IMMEDIATE REFRESH FAST ON COMMIT
AS SELECT t.calendar_year, p.prod_id, p.prod_name,s.amount_sold
FROM times t, products p, sales s
WHERE t.time_id = s.time_id AND p.prod_id = s.prod_id;I got errorSQL Error: ORA-12052: cannot fast refresh materialized view GLU.SALES_MV
*Cause: Either ROWIDs of certain tables were missing in the definition or
the inner table of an outer join did not have UNIQUE constraints on
join columns.
*Action: Specify the FORCE or COMPLETE option. If this error is got
during creation, the materialized view definition may have be
changed. Refer to the documentation on materialized views.Please help or point me to the relevant document.
Thanksdamorgan, Thank you for you reply.
the inner table of an outer join did not have UNIQUE constraints on join columns.
I am not sure how much clearer and explanation can be written.If you look at the query, you will find that there is no outer join in the query.
sales table does not have unique constraints on prod_id and time_id. If this is the cause of the problem, I cannot change the data but is there a work around. That is way I ask for specific doc. In 11g documents, I only find some info on CREATE MV. That is mainly on syntax but not on requirement. -
ORA-12015: cannot create a fast refresh materialized view from a complex q
Hi,
I'm facing very strange problem. Please help me why this error is coming
I'm creating a simple materialized view, but it is giving below error since this is simple select * from.
CREATE MATERIALIZED VIEW EFMS.MS_TASK
BUILD IMMEDIATE
REFRESH FAST
START WITH SYSDATE
NEXT (SYSDATE + 1/24)
WITH ROWID
AS
SELECT * FROM MS_TASK@efms_link;
SELECT * FROM MS_TASK@efms_link
ERROR at line 8:
ORA-12015: cannot create a fast refresh materialized view from a complex query
CREATE MATERIALIZED VIEW LOG ON MSDBO.MS_TASK
TABLESPACE DBOR_MVLOG
PCTUSED 0
PCTFREE 60
INITRANS 20
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOCACHE
NOLOGGING
PARALLEL ( DEGREE 2 INSTANCES 1 )
WITH ROWID, PRIMARY KEY
EXCLUDING NEW VALUES;1º
Not is a best practice to use 'select *'
2º
ORA-12015: cannot create a fast refresh materialized view from a complex query
Cause: Neither ROWIDs and nor primary key constraints are supported for complex queries.
Action: Reissue the command with the REFRESH FORCE or REFRESH COMPLETE option or create a simple materialized view.
Then you have to change REFRESH FAST or create a primary key in MS_TASK@efms_link to avility fast refresh.
. :-) any help with my english is wellcome :-) . -
ORA-12015: cannot create a fast refresh materialized view from a complex
Hi All,
I am trying to create materialized view but i got a error ORA-12015: cannot create a fast refresh materialized view from a complex query.
Regards,
narayanaHi,
Please see if (Note: 179466.1 - Diagnosing ORA-12015 fast refresh materialized view / complex queries) helps.
Regards,
Hussein -
Materialized view fast refresh ...getting ORA-22992: error
Hi All,
Oracle version 11.1.0.7
While creating a materialized view(Fast refresh) on remote tables ... i am getting the ORA-22992: cannot use LOB locators selected from remote tables ... error.
but the actual scenario is... i am not selecting any of the BLOB/LOB columns from the remote tables. I did n't include them in my materialized query.
I am able to refresh it complete but couldn't refresh it fast. Here i want to mention other thing... when ever i have records in Mat view log(Base table has a blob cloumns in it)
i am getting the above error. when no record in the Mat view log(i.e on BLOB base table) .. i can able to refresh it as FAST.
MV_CAPABILITIES table tells that ...My Mat view is able to refresh it FAST.I don't know howw to approach to solve this issue.could some one tell me the approach..to solve it?
Here is the sample code ....this is what i have done so fat
session 1 (REMOTE_ONE)
I have created synonyms for the remote tables on current schema. That's why i didn't include @DBLINK.
create table RT_A ( col1_A varchar2(20), col2_A BLOB,COL3_A NUMBER);
create a table RT_B (COl1_B varchar2(20), col2_B BLOB, COL3_B NUMBER);
create a table RT_C (COL1_C varchar2(20), col2_C VARCHAR2,COL3_C NUMBER);
create MATERIALIZED VIEW LOG ON RT_A
WITH ROWID EXCLUDING NEW VALUES;
create MATERIALIZED VIEW LOG ON RT_B
WITH ROWID EXCLUDING NEW VALUES;
create MATERIALIZED VIEW LOG ON RT_C
WITH ROWID EXCLUDING NEW VALUES;
grant select on RT_A to CUURRENT_ONE with grant option;
grant select on RT_B to CUURRENT_ONE with grant option;
grant select on RT_C to CUURRENT_ONE with grant option;
grant select on MLOG$_RT_A to CUURRENT_ONE with grant option;
grant select on MLOG$_RT_B to CUURRENT_ONE with grant option;
grant select on MLOG$_RT_C to CUURRENT_ONE with grant option;Session 2 (CUURRENT_ONE)
create materialized view ABC_MV
BUILD IMMEDIATE REFRESH FORCE ON DEMAND START WITH SYSDATE NEXT SYSDATE+1
AS
select A.ROWID AS A_ROWID,
B.ROWID as B_ROWID,
C.ROWID AS C_ROWID,
A.COL1_A,
B.col1_B,
c.col1_c
from RT_A, RT_B,RT_C
where COL3_A = COL3_B(+)
and COL3_B = COL3_C(+)Appreciate your help.
Thanks,
MikeThanks for the reply
In that he/she is selecting the LOB column from the remote database(master site).
I am just referencing the table which has BLOB column in it.I am not referencing any LOB column in my select(Mat view) query...
is there anything i need to check..?
Regards,
Mike -
Materialized view fast refresh raising error ORA-12031
Hi All,
I have a table named TblA on A database. I have created mview name mviewTblA on database B.
When I tried to Complete refresh on mviewTblA it is getting refresh but with fast refresh it is raising an error i.e ORA-12031: cannot use primary key columns from materialized view log on "NIMS"."PIPER_ENABLED_EXCHANGES" ORA-06512: at "SYS.DBMS_SNAPSHOT", line 794 ORA-06512: at "SYS.DBMS_SNAPSHOT", line 851 ORA-06512: at "SYS.DBMS_SNAPSHOT", line 832 ORA-06512: at line 2
BEGIN
DBMS_MVIEW.REFRESH('MVIEWTBLA','F');
END;
I checked with database "A", there is an materialized view log. Tell me how i can view/update that materialized view log i.e. want to see and confirm that materialized view log is created with primary key or not.
Please suggest me on this.
Message was edited by:
user593684.. I use following code (from asktom.oracle.com) to check any limitations on mview
variable x refcursor
declare
l_data EXPLAINMVARRAYTYPE;
begin
dbms_mview.explain_mview( '&MV_NAME', l_data );
open :x for
select capability_name, possible,
msgno, msgtxt
from table( cast( l_data as EXPLAINMVARRAYTYPE ) )
order by seq;
end;
column msgtxt format a30 word_wrapped
print x; -
ORA-12015: cannot create a fast refresh materialized view from a complex qu
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - ProductionI'm trying to create a fast refresh materialized view that uses a column of xmltype. The problem is I cannot create an MV log that accounts for the xmltype column. I tried excluding it and got the above error. Is there another way I can incrementally update a materialized view where I don't have to do a COMPLETE refresh or use FAST refresh?
CREATE TABLE "DAS_DESC"."AUTHORITY_TEST"
"NAID" NUMBER(20,0) NOT NULL ENABLE,
"AUTH_TYPE" VARCHAR2(40 BYTE),
"XML_DATA" "SYS"."XMLTYPE" ,
"TERM_NAME" VARCHAR2(4000 BYTE)
CREATE TABLE "DAS_DESC"."AUTH_ASSC_TEST"
"NAID" NUMBER(20,0),
"P_NAID" NUMBER(20,0),
"REL_TYPE" VARCHAR2(25 BYTE),
"XML_DATA" "SYS"."XMLTYPE"
CREATE
MATERIALIZED VIEW person_mv
AS
SELECT p.naid
, p.auth_type
, INSERTCHILDXML
p.xml_data -- Parent XML Column
, '//*[contains(local-name(), ''person'')]' --XPATH to Person
, 'nonPreferredHeadingArray' -- Value for new child element
( -- Sub query for injecting new variant person array
SELECT XMLELEMENT
"nonPreferredHeadingArray"
, XMLAGG -- Aggregator for Variant Persons Array
XMLELEMENT
"variantPersonName" -- Wrapper for each entry in array
, extract(a.xml_data,'*/*')
FROM auth_assc_table -- Link table
WHERE a.p_naid = p.naid
) AS XML_DATA
FROM authority p -- Parent table
WHERE p.auth_type = 'Person';The views are created fine and they work perfectly for what we need. The problem is the refresh when we edit the base tables. Ideally, it should take a couple seconds. Right now, it takes a couple minutes. XMLTYPE is one problem and the Complex Query exception is the other. If there is a work-around for fast refresh, please let me know. Greatly appreciated.jjmdb wrote:
I'm trying to create a fast refresh materialized view that uses a column of xmltype. The problem is I cannot create an MV log that accounts for the xmltype column. I tried excluding it and got the above error. Is there another way I can incrementally update a materialized view where I don't have to do a COMPLETE refresh or use FAST refresh? Besides XMLTYPE column, your MV definition has a subquery which prevents it from being fast refreshable.
I could not find any specific reference in documentation about restriction on XMLTYPE (or CLOB) columns but it seems logical that oracle will not be able to keep track of changes to binary data. What does DBMS_MVIEW.EXPLAIN_MVIEW generate for your MV definition? That should tell you which all conditions (for FAST REFRESH) your MV violates. Since you can not create a MV LOG to include XMLTYPE column, it will not be possible to create a FAST REFRESHABLE MV that includes the XMLTYPE column.
I am afraid there is not much you can do here unless you are prepared to change the way data is stored in your base tables. If you can store data in base tables using standard data types instead of binary/XML storage, you might be able to create a FAST REFRESHABLE MV. -
Fast refresh of materialized view
Hi All,
This is my first posting on this forum, so I hope I don't step on anyone's toes as I wade into a problem that I am experiencing.
I have a number of either join-only or single table aggregate materialized views that I have experienced problems with. All the views are setup for FAST REFRESH ON DEMAND but I'm hitting an error if I execute a COMPLETE refresh of the view when I've done an ALTER SESSION ENABLE PARALLEL DML. The error I get is:
ERROR at line 1:
ORA-30439: refresh of 'DTKTGT.CTNS_PER_HR_VOL_AGG_MV' failed because of ORA-32320: REFRESH FAST of "DTKTGT"."CTNS_PER_HR_VOL_AGG_MV" unsupported after cointainer table PMOPs
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 814
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 872
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 852
ORA-06512: at "DTKTGT.MV_REFRESH", line 21
ORA-06512: at line 2
Any help anyone could provide would be greatly appreciated as every now and then, a COMPLETE refresh is unavoidable and using the ENABLE PARALLEL DML makes the refresh run a lot faster than without the ALTER SESSION.
GaryThis forum only is for questions relating to the use of OLAP Option. I would post your question on the database forum.
Keith Laker
Oracle Data Warehouse Product Management
OLAP Blog: http://oracleOLAP.blogspot.com/
OLAP Wiki: http://wiki.oracle.com/page/Oracle+OLAP+Option
DM Blog: http://oracledmt.blogspot.com/
OWB Blog : http://blogs.oracle.com/warehousebuilder/
OWB Wiki : http://wiki.oracle.com/page/Oracle+Warehouse+Builder
DW on OTN : http://www.oracle.com/technology/products/bi/db/11g/index.html -
Fast Refresh Nested Materialized View problem in ORACLE 9i 9.2.0.7
Hello
My problem is in creating fast refresh nested materialized view in oracle 9i
In below is an example of my problem
( I need to say when I run this example in Oracle 11g all things is OK )
create table ali.alitest1(id number primary key,n1 number,n2 number);
create table ali.alitest2(id number primary key,n3 number);
CREATE MATERIALIZED VIEW LOG ON ali.alitest1 WITH ROWID,PRIMARY KEY ,SEQUENCE
(n1,n2)
INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW LOG ON ali.alitest2 WITH ROWID,PRIMARY KEY ,SEQUENCE
(n3)
INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW ali.alitest1_mv
REFRESH WITH PRIMARY KEY FAST
AS
select id,n1 from ali.alitest1;
CREATE MATERIALIZED VIEW LOG ON ali.alitest1_mv WITH ROWID,PRIMARY KEY ,SEQUENCE
(n1)
INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW ali.alitest2_mv
REFRESH WITH PRIMARY KEY FAST
AS
select t1.id,t1.n1,t2.n3,t1.rowid "t1_rowid",t2.rowid "t2_rowid" from ali.alitest1_mv t1,ali.alitest2 t2 where t1.id=t2.id;
SQL Error: ORA-12053: this is not a valid nested materialized view
12053. 00000 - "this is not a valid nested materialized view"
*Cause: The list of objects in the FROM clause of the definition of this
materialized view had some dependencies upon each other.
*Action: Refer to the documentation to see which types of nesting are valid.
do you know what is problem ?
thanksTake look for this link :
http://rwijk.blogspot.com/2009/08/fast-refreshable-materialized-view.html -
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,
GreqThanks 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 -
MATERIALIZED view on two tables with Fast Refresh
i Wanted to create MV on two tables with Fast refresh on commit.
I followed below steps
create materialized view log on t1 WITH PRIMARY KEY, rowid;
create materialized view log on t2 WITH PRIMARY KEY, rowid;
CREATE MATERIALIZED VIEW ETL_ENTITY_DIVISION_ASSO_MV
REFRESH fast ON commit
ENABLE QUERY REWRITE
AS
select A.ROWID B.ROWID,a.c1, DECODE(a.c1,'aaa','xxx','aaa') c2
from t1 A
join t2 b
on AB.c1= CD.c2;
i am getting below error.
Error report:
SQL 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.
Basically i want to take record in MV by joinig two tables and if both of the base tables will updated then record should reflect in materialised view.
Please do the needfull.does the table support PCT? the other restrictions on joins look to be ok in your statement.
maybe try creating first with on demand instead of commit to see does it create.
http://docs.oracle.com/cd/B19306_01/server.102/b14223/basicmv.htm
>
Materialized Views Containing Only Joins
Some materialized views contain only joins and no aggregates, such as in Example 8-4, where a materialized view is created that joins the sales table to the times and customers tables. The advantage of creating this type of materialized view is that expensive joins will be precalculated.
Fast refresh for a materialized view containing only joins is possible after any type of DML to the base tables (direct-path or conventional INSERT, UPDATE, or DELETE).
A materialized view containing only joins can be defined to be refreshed ON COMMIT or ON DEMAND. If it is ON COMMIT, the refresh is performed at commit time of the transaction that does DML on the materialized view's detail table.
If you specify REFRESH FAST, Oracle performs further verification of the query definition to ensure that fast refresh can be performed if any of the detail tables change. These additional checks are:
A materialized view log must be present for each detail table unless the table supports PCT. Also, when a materialized view log is required, the ROWID column must be present in each materialized view log.
The rowids of all the detail tables must appear in the SELECT list of the materialized view query definition.
If some of these restrictions are not met, you can create the materialized view as REFRESH FORCE to take advantage of fast refresh when it is possible. If one of the tables did not meet all of the criteria, but the other tables did, the materialized view would still be fast refreshable with respect to the other tables for which all the criteria are met.
Maybe you are looking for
-
Premiere Elements 12 does not start after error message: display driver is incompatible
After successful installation and starting Premiere Elements the following error message appears: "Uncompatible display driver identified. Update the display driver for a better and faster playback performance!" Hopefully my translation from German i
-
Error while converting Ship-to-party to Sold-to-party
Hi, I need to covert a Ship-to-party to Sold-to-party using transaction XD07. While converting the above i m getting the following error The planned change is not allowed as the following field groups would be masked by the new account group Group
-
Design top row of user entered information to repeat at top of each page
I am trying to design a form that will allow the top row (or top few text fields) to repeat at the top of any additional pages that are generated as a result of flowed content.
-
Compressor 3.5.3 Quickcluster still only uses 20%CPU. What gives?
I'm using Final Cut Studio 7. Compressor 3.5.3. First i couldn't get clusters to work at all. So i uninstalled and reinstalled FCS7 and the Clusters seem to -set up- just fine. But when i submit a batch, Compressor STILL only uses about 20% of the CP
-
Help: Trying to get Apple Mail to be my client program with GMail
I've used Apple Mail (OS 10.4.10) as my email program for Comcast Mail. I am dropping our Comcast service soon and picking up GMail as my primary email program. I want to use the Apple Mail program to pick up my mail from the GMail server. According