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 :-) .
Similar Messages
-
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 -
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. -
Create a fast refresh materialized view with partitioned primary index
Hi,
I have a materialized view that is based on a table with primary key.
I want to create a materialized view with a partitioned primary index . do you have any way of doing it?
I tried to create a materialized view with rowid and then I created a partitioned primary index on it.
It did not work as what I expected. I could not perform a fast refresh on it. the materialized view can only complete refresh
thank youHi,
Here is some info from the Oracle Documentation.
http://download.oracle.com/docs/cd/E11882_01/server.112/e10706/repmview.htm
http://download.oracle.com/docs/cd/E11882_01/server.112/e10810/basicmv.htm
Determining the Fast Refresh Capabilities of a Materialized View
http://download.oracle.com/docs/cd/E11882_01/server.112/e10706/repmview.htm#BABEDIAH
Regards, -
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 -
Fast Refresh Materialized view on a 'View'
Hi,
I am trying to create a materialized view with Refresh FAST option. This is based on a view. I am getting an error that there is no materialized view log on the table. But we cannot create a materialized view log on a view. Can you please let me know how to create a FAST REFRESH materialized view on a view.
Thanks!Thanks Justin! Actually, I have a remote database on which I want the copy of one of our tables. We have a view on this table on the source database with meaningful names. I have created materialized view logs on the underlying table. If I am able to create a MV on the view, then I need not write that extra step to code for meaningful names. I wanted to know if a fast refresh is possible on a view (There are materialized view logs on the underlying table)?
Thanks! -
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> -
Alternative for OUTER Join for use in fast refresh materialized view
Hi ,
I have two tables as :
CREATE TABLE TEST_SANDY1
COL1 NUMBER
CREATE TABLE TEST_SANDY2
COL1 NUMBER,
COL2 VARCHAR2(10 BYTE)
Data for the tables are :
INSERT INTO TEST_SANDY1 ( COL1 ) VALUES (
1);
INSERT INTO TEST_SANDY1 ( COL1 ) VALUES (
2);
INSERT INTO TEST_SANDY1 ( COL1 ) VALUES (
3);
COMMIT;
INSERT INTO TEST_SANDY2 ( COL1, COL2 ) VALUES (
1, 'a');
INSERT INTO TEST_SANDY2 ( COL1, COL2 ) VALUES (
2, 'b');
INSERT INTO TEST_SANDY2 ( COL1, COL2 ) VALUES (
4, 'd');
COMMIT;
Now when I run the following select statement :
select
b.col1
from
test_sandy1 a,
test_sandy2 b
where
b.COL1 = a.COL1(+)
I get :
COL1
1
2
4
I want to build a materialized view to generate the same values but it has to be fast refresh. But since I am using outer join I am unable to create a fast refresh one.
Can someone suggest an alternate select to create fast refresh materialized view.
Thanks,
SandipanThe select statement was not fitting my problem , so I'll change it as :
select
a.col1, nvl(b.col2, 'DEFAULT')
from
test_sandy1 a,
test_sandy2 b
where
b.COL1(+) = a.COL1
I get :
COL1 VAL
1 a
2 b
3 DEFAULT
How do I this ? -
A table with two fast refresh materialized views
Hi,
In the current env of ours, there are three database servers.
Data is to refreshed on demand from the master site to other two materialized view sites using fast refresh.
Means if we have a table name ABC on Site 1. Then site2 and site3 needs to have fast refresh materialzied views from ABC.
Can we use same materialzied view logs of ABC to refresh site2 and site3 (on demand)?
Thanks,
RamneekYes. Assuming materialized views on both site2 and site3, the MV logs on site1 won't be cleared until the data has been pushed to both site2 and site3.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
On commit fast refreshable materialized view does not update
... but instead it deletes and inserts. And I would like it to perform an update, so we can add a database trigger to call a webservice. But it's crucial that we call the "update webservice" when it updates.
This is an Oracle 10.2.0.4 database.
Output of my problem-reproducing-case:
First creation of a small instrumentation setup:
SQL> create table logtable
2 ( id number
3 , time timestamp
4 , text varchar2(100)
5 )
6 /
Tabel is aangemaakt.
SQL> create sequence log_seq cache 100
2 /
Reeks is aangemaakt.
SQL> create procedure add_log_message (p_text in varchar2)
2 is
3 pragma autonomous_transaction;
4 begin
5 insert into logtable
6 values (log_seq.nextval,systimestamp,p_text);
7 commit;
8 end;
9 /
Procedure is aangemaakt.Two tables with full blown materialized view logs defined on them:
SQL> create table t1 (id,ean)
2 as
3 select level
4 , to_char(trunc(dbms_random.value(0,999999999999999999)))
5 from dual
6 connect by level <= 10
7 /
Tabel is aangemaakt.
SQL> alter table t1 add primary key (id)
2 /
Tabel is gewijzigd.
SQL> create materialized view log on t1 with sequence, rowid (id,ean) including new values
2 /
Gematerialiseerde viewlog is aangemaakt.
SQL> create table t2 (id,t1_id,value)
2 as
3 select level
4 , level * 2
5 , trunc(dbms_random.value(1,100))
6 from dual
7 connect by level <= 5
8 /
Tabel is aangemaakt.
SQL> alter table t2 add primary key (id)
2 /
Tabel is gewijzigd.
SQL> alter table t2 add foreign key (t1_id) references t1(id)
2 /
Tabel is gewijzigd.
SQL> create materialized view log on t2 with sequence, rowid (id,t1_id,value) including new values
2 /
Gematerialiseerde viewlog is aangemaakt.And the materialized view itself, containing an outer join. And on that materialized view there is a trigger that logs the action performed (I, U or D):
SQL> create materialized view mv refresh fast on commit
2 as
3 select t1.rowid t1_rowid
4 , t2.rowid t2_rowid
5 , t1.id t1_id
6 , t1.ean ean
7 , t2.id t2_id
8 , t2.value value
9 from t1
10 , t2
11 where t1.id = t2.t1_id (+)
12 and t1.ean is not null
13 /
Gematerialiseerde view is aangemaakt.
SQL> create trigger mv_trg_ariud
2 after insert or update or delete on mv
3 for each row
4 begin
5 add_log_message
6 ( case
7 when inserting then 'I'
8 when updating then 'U'
9 when deleting then 'D'
10 end
11 );
12 end;
13 /
Trigger is aangemaakt.
SQL> select * from mv
2 /
T1_ROWID T2_ROWID T1_ID EAN T2_ID VALUE
AAFwMeAChAABamIAAA 1 360432237186591962
AAFwMeAChAABamIAAB AAFwMhAChAABamaAAA 2 706465424496730795 1 77
AAFwMeAChAABamIAAC 3 678961199378791568
AAFwMeAChAABamIAAD AAFwMhAChAABamaAAB 4 351418443524585979 2 35
AAFwMeAChAABamIAAE 5 610374519804201714
AAFwMeAChAABamIAAF AAFwMhAChAABamaAAC 6 798782716740397566 3 33
AAFwMeAChAABamIAAG 7 909989471290455410
AAFwMeAChAABamIAAH AAFwMhAChAABamaAAD 8 670698835550268126 4 69
AAFwMeAChAABamIAAI 9 746290195605805530
AAFwMeAChAABamIAAJ AAFwMhAChAABamaAAE 10 157491298211132413 5 82
10 rijen zijn geselecteerd.Now we add a new t1 row, which leads to an extra row in the mv on commit time:
SQL> insert into t1 values (11, '999999999999999999')
2 /
1 rij is aangemaakt.
SQL> commit
2 /
Commit is voltooid.
SQL> select rpad(text,10) || to_char(time,'hh24:mi:ss.ff6') log
2 from logtable
3 order by id
4 /
LOG
I 11:39:47.817225
1 rij is geselecteerd.
SQL> select * from mv where ean = '999999999999999999'
2 /
T1_ROWID T2_ROWID T1_ID EAN T2_ID VALUE
AAFwMeAChAABamJAAA 11 999999999999999999
1 rij is geselecteerd.As expected. Now insert a record in t2, which should lead to an update of the materialized view:
SQL> insert into t2 values (11,11,1)
2 /
1 rij is aangemaakt.
SQL> commit
2 /
Commit is voltooid.
SQL> select * from mv where ean = '999999999999999999'
2 /
T1_ROWID T2_ROWID T1_ID EAN T2_ID VALUE
AAFwMeAChAABamJAAA AAFwMhAChAABambAAA 11 999999999999999999 11 1
1 rij is geselecteerd.
SQL> select rpad(text,10) || to_char(time,'hh24:mi:ss.ff6') log
2 from logtable
3 order by id
4 /
LOG
I 11:39:47.817225
D 11:39:47.992824
I 11:39:48.015072
3 rijen zijn geselecteerd.But it doesn't: apparently it has inserted a row and deleted a row. Let's do a normal update:
SQL> update t2 set value = 2 where id = 11
2 /
1 rij is bijgewerkt.
SQL> commit
2 /
Commit is voltooid.
SQL> select * from mv where ean = '999999999999999999'
2 /
T1_ROWID T2_ROWID T1_ID EAN T2_ID VALUE
AAFwMeAChAABamJAAA AAFwMhAChAABambAAA 11 999999999999999999 11 2
1 rij is geselecteerd.
SQL> select rpad(text,10) || to_char(time,'hh24:mi:ss.ff6') log
2 from logtable
3 order by id
4 /
LOG
I 11:39:47.817225
D 11:39:47.992824
I 11:39:48.015072
D 11:39:48.142621
I 11:39:48.168553
5 rijen zijn geselecteerd.And again: a delete and an insert.
Does anybody know if I can change this behaviour and let the mv perform an update?
In another materialized view (not shown here) containing aggregates, I've seen that it performs an update. But using this "join" mv, it does not.
Here is the script, if you want to try it on your own database:
create table logtable
( id number
, time timestamp
, text varchar2(100)
create sequence log_seq cache 100
create procedure add_log_message (p_text in varchar2)
is
pragma autonomous_transaction;
begin
insert into logtable
values (log_seq.nextval,systimestamp,p_text);
commit;
end;
create table t1 (id,ean)
as
select level
, to_char(trunc(dbms_random.value(0,999999999999999999)))
from dual
connect by level <= 10
alter table t1 add primary key (id)
create materialized view log on t1 with sequence, rowid (id,ean) including new values
create table t2 (id,t1_id,value)
as
select level
, level * 2
, trunc(dbms_random.value(1,100))
from dual
connect by level <= 5
alter table t2 add primary key (id)
alter table t2 add foreign key (t1_id) references t1(id)
create materialized view log on t2 with sequence, rowid (id,t1_id,value) including new values
create materialized view mv refresh fast on commit
as
select t1.rowid t1_rowid
, t2.rowid t2_rowid
, t1.id t1_id
, t1.ean ean
, t2.id t2_id
, t2.value value
from t1
, t2
where t1.id = t2.t1_id (+)
and t1.ean is not null
create trigger mv_trg_ariud
after insert or update or delete on mv
for each row
begin
add_log_message
( case
when inserting then 'I'
when updating then 'U'
when deleting then 'D'
end
end;
select * from mv
insert into t1 values (11, '999999999999999999')
commit
select rpad(text,10) || to_char(time,'hh24:mi:ss.ff6') log
from logtable
order by id
select * from mv where ean = '999999999999999999'
insert into t2 values (11,11,1)
commit
select * from mv where ean = '999999999999999999'
select rpad(text,10) || to_char(time,'hh24:mi:ss.ff6') log
from logtable
order by id
update t2 set value = 2 where id = 11
commit
select * from mv where ean = '999999999999999999'
select rpad(text,10) || to_char(time,'hh24:mi:ss.ff6') log
from logtable
order by id
set echo off
drop materialized view mv
drop table t2 purge
drop table t1 purge
drop procedure add_log_message
drop sequence log_seq
drop table logtable purge
/Regards,
Rob.
Edited by: Rob van Wijk on 7-mrt-2009 9:49
bumpRob,
here's what Tom says about this:
seems dangerous as there is nothing stopping Oracle from performing an "update" of a materialized
view as a DELETE+INSERT. For you see, the internals of how materialized views are maintained are
"internal" and subject to change (so even if documented - so what, you cannot control the "how" of
materialized view refreshes)
...It is from 2006 though ...things might have changed ;) -
Fast refresh materialized view on demand but not working
Hi all,
I've created a simple table called xx using the following statements:
1.) create table xx(x1 varchar2(10),x2 varchar2(10),x3 varchar2(10);
2.) alter table xx add primary key (x1,x2);
I've also created a materialized log on xx using:
3.) create materialized view log on xx;
Finally, I've create a very simple materialized view based on the table xx using:
4.) create materialized view mv_xx refresh fast on demand as select * from xx;
The version of Oracle I'm currently using is:
Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
PL/SQL Release 9.2.0.6.0 - Production
CORE 9.2.0.6.0 Production
TNS for 32-bit Windows: Version 9.2.0.6.0 - Production
NLSRTL Version 9.2.0.6.0 - Production
Everything seems to be ok. However when I execute the dbms_mview.refresh('mv_xx','f') after performing any DMLs like INSERT, DELETE or UPDATE statements to the xx table. The data never gets refreshed to mv_xx and it only works on the complete refresh. Could anyone help me please as I must have missed or misunderstood some of the points about materialized view. By the way, do I need to set any flags or alter any system or session parameters prior to creating the materialized view or any other related components. Thank you.
Regards,
JohnYes, mv_xx is created in the same schema as xx. Do you have any ideas.
-
Fast-Refresh Materialized Views
hi
How to auto Refresh Materialized Views. Mean when ever a new row inserted into a table ; It must show automatically..
Or Tells is that , Is it a good decision use Materialized Views for reporting purpose.
Thanks
ManiSmall example for you:
[email protected]> create table dept2 as select * from scott.dept;
Table created.
[email protected]> alter table dept2 add constraint dept2_pk primary key(deptno);
Table altered.
[email protected]> create materialized view log on dept2;
Materialized view log created.
[email protected]> create materialized view dept2_mv
2 refresh fast on commit as
3 select * from dept2 ;
Materialized view created.
[email protected]> select * from dept2_mv;
DEPTNO DNAME LOC
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
[email protected]> insert into dept2 values(50,'HR','WARSAW');
1 row created.
[email protected]> commit;
Commit complete.
[email protected]> select * from dept2_mv;
DEPTNO DNAME LOC
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
50 HR WARSAW
Best Regards
Krystian Zieja / mob -
Need to refresh materialized view from procedure and pl/sql block
Hi,
I need to refresh materialized view (complete refresh)from procedure and pl/sql block .can some one help.
MV name:MV_DGN_TEST_SESSION
Thanks,
Rajasekhardbms_mview.REFRESH ('MV_DGN_TEST_SESSION', 'C');Regards,
Mahesh Kaila
Edited by: user4211491 on Dec 1, 2009 10:41 PM -
Fast Refresh Materialized View - failure
Okay, this issue currently has me stumped. I searched the world wide web and still cannot seem to identify the cause of this issue.
Here is the scenario:
I created a materialized view log for the source table (let's say table1) found at DB1.
I then create a materialized view (fast refresh, with logging) at a remote database (let's say DB2). The query for the MV is basic: select * from schema1.table1@db1_link;
I set the materialized view to refresh every 30 seconds (for testing purposes).
This creates a dbms job that executes every 30 seconds. The materialized view gets created successfully. I purposely enter new data into table1. The materialized view log for table1 successfully captures these changes. However, the materialized view found at DB2 does not get refreshed (updated) successfully.
In fact, the dbms job errors-out. It keeps failing and failing. After 16 times, it gets marked as 'broken.'
The error message is as such:
RDBA WARNING: ORA-12012: error on auto execute of job 1472
RDBA WARNING: ORA-00604: error occurred at recursive SQL level 3
RDBA WARNING: ORA-01017: invalid username/password; logon denied
RDBA WARNING: ORA-02063: preceding line from db1
RDBA WARNING: ORA-06512: at "SYS.DBMS_SNAPSHOT", line 820
RDBA WARNING: ORA-06512: at "SYS.DBMS_SNAPSHOT", line 877
RDBA WARNING: ORA-06512: at "SYS.DBMS_IREFRESH", line 683
RDBA WARNING: ORA-06512: at "SYS.DBMS_REFRESH", line 195
RDBA WARNING: ORA-06512: at line 1
The strange thing is, that the error supposedly claims invalid username/password. But I've used the db links successfully before & the username/password is not invalid. Has anyone encountered this issue before?Justin,
From reading earlier posts about issues with materialized views, I remember reading something about materialized views (fast refreshable) not working with sysdate. What did you mean by such a statement? (I would copy & paste it here, but I am unable to find it at the moment).
The reason I am curious, is the fact that I am setting my MV to refresh every 30 seconds let's say (for testing). At this moment - it starts failing & failing & failing. -
MLOGS not purge after a fast refresh (Materialized view) ...
Hi,
I have a database on my own site (Quebec) that has 36 materialized views refresh by a master table site that is physically at Montreal. The MVIEWs are refreshed every day of the week (monday to friday) at 7h00 until 19h00. We use the "fast refresh" technic to refresh the materialized views.
Last weekend, I transfered this database on a new server. So, I created a new SID (I rename the old SID "ORCL" by "ATQP") and I created this instance with a DB_BLOCK_SIZE of 16k rather than 8k. It's the only difference between the two instances (the old one and the new one). I also created the owner schema "ATQP" and I made an Export on the old server followed by an Import of the schema that owned the Materialized views (not a Full import) on the new server. The export was made many hours (saturday morning) after the last refresh of the week (friday, at 19h00) on the old server.
After the successul import on my new server, I'm looking for the information about the creation of the MVIEW. Everything seems OK. I can see that the last refresh date indicated "2008-02-22 19:00" (date / time of the last refresh of the week). I made a quick test on a small MVIEW (a fast refresh) and it worked, no error.
Yesterday morning, the DBA of the master table site mentionned us that the DELETE on the MLOGS didn't work on the master site. The refresh was made successfully but the MLOGS continue to grow up, again and again ... On my database, I'm looking in the SYS.SNAP$ table and I saw that the SNAPTIME date is '1950-01-01 12:00' rather than '2008-02-25 19:00'. In the SYS.SNAP_REFTIME, the SNAPTIME is OK but the LOADERTIME column contains the same strange date '1950-01-01 12:00'.
I made a quick check on my old server and the SYS.SNAP$ table is empty !!! I think it's normal because the last refresh on this node was made last friday night and I made the transfert last saturday (I shutdown the old database after).
I know how to solve the problem, by recreate the MVIEW, but it causes a big problem for us. We are in PRODUCTION and we don't want to refresh many millions of records. I think it will take a couple of days to refresh all the materialized views of my schema. And it doesn't sound good by the master table site management team ...
The master table site "rush" us to solve the problem before the weekend. They don't want that we overcharge the network link between them and us by refreshing those MVIEWS.
So, is it possible to make something simple to resynchronized the SNAPTIME date without refreshing completely all the materialized views ?
If the master site table recreate the MLOG (purge manually), is it possible that it will solve our problem ?
Is it also possible to recreate the MVIEW without refreshing the data (specify to Oracle to recreate the MVIEW but indicate that the table associated already exist) ?
All of my materialized view are up to date concerning the data. I don't want to refresh all of it.
Thank's in advance ...Hi Justin,
The DBA of the master table site sent me a email about the fact he unregistered the MVIEW. He told me that the script for the unregistered worked well. He tried to purge the MLOG and he got the error ORA-23424 but I think it's normal (It's what you said yesterday about the fact that the UNREGISTER command also purge the MLOGS).
So, it seems that the MLOGS are still not purged (that's what the DBA of the master table site said). I ran the following query:
SQL> select * from [email protected];
LOG_OWNER MASTER LOG_TABLE LOG_TRIGGER ROW PRI OBJ FIL SEQ INC
ATQ ALIAS_ANILOTS MLOG$_ALIAS_ANILOTS NO YES NO YES NO YES
ATQ ALIAS_INTERVENANTS MLOG$_ALIAS_INTERVENANTS NO YES NO YES NO YES
ATQ ANILOTS MLOG$_ANILOTS NO YES NO YES NO YES
ATQ CATEGORIES MLOG$_CATEGORIES NO YES NO YES NO YES
ATQ CODES_POSTAUX MLOG$_CODES_POSTAUX NO YES NO YES NO YES
ATQ COMMANDES MLOG$_COMMANDES NO YES NO YES NO YES
ATQ COMMUNICATIONS MLOG$_COMMUNICATIONS NO YES NO YES NO YES
ATQ DEPLACEMENTS MLOG$_DEPLACEMENTS NO YES NO YES NO YES
ATQ DETAILS_STATUTS_COMMANDES MLOG$_DETAILS_STATUTS_COMM NO YES NO YES NO YES
ATQ DOMAINES MLOG$_DOMAINES NO YES NO YES NO YES
ATQ ENREGISTREMENT_LOGS MLOG$_ENREGISTREMENT_LOGS NO YES NO YES NO YES
ATQ ENREGISTREMENT_NOTES MLOG$_ENREGISTREMENT_NOTES NO YES NO YES NO YES
ATQ ESPECES MLOG$_ESPECES NO YES NO YES NO YES
ATQ EVENEMENTS MLOG$_EVENEMENTS NO YES NO YES NO YES
ATQ EVENE_DIFFERES MLOG$_EVENE_DIFFERES NO YES NO YES NO YES
ATQ IDENTIFIANTS MLOG$_IDENTIFIANTS NO YES NO YES NO YES
ATQ INTERVENANTS MLOG$_INTERVENANTS NO YES NO YES NO YES
ATQ INTERVENANTS_CLIENTS MLOG$_INTERVENANTS_CLIENTS NO YES NO YES NO YES
ATQ INTERVENANTS_SITES MLOG$_INTERVENANTS_SITES NO YES NO YES NO YES
ATQ MAX_EVENE_DIFFERES MLOG$_MAX_EVENE_DIFFERES NO YES NO YES NO YES
ATQ MESSAGES MLOG$_MESSAGES NO YES NO YES NO YES
ATQ MUNICIPALITES MLOG$_MUNICIPALITES NO YES NO YES NO YES
ATQ NEW_ANILOTS MLOG$_NEW_ANILOTS NO YES NO YES NO YES
ATQ NEW_EVENEMENTS MLOG$_NEW_EVENEMENTS NO YES NO YES NO YES
ATQ NEW_IDENTIFIANTS MLOG$_NEW_IDENTIFIANTS NO YES NO YES NO YES
ATQ NEW_SITES MLOG$_NEW_SITES NO YES NO YES NO YES
ATQ PAYS MLOG$_PAYS NO YES NO YES NO YES
ATQ PRODUCTIONS MLOG$_PRODUCTIONS NO YES NO YES NO YES
ATQ PROPRIETES_ANILOTS MLOG$_PROPRIETES_ANILOTS NO YES NO YES NO YES
ATQ PROVINCES MLOG$_PROVINCES NO YES NO YES NO YES
ATQ SITES_EXPLOITATIONS MLOG$_SITES_EXPLOITATIONS NO YES NO YES NO YES
ATQ TYPES_IDENTIFIANTS MLOG$_TYPES_IDENTIFIANTS NO YES NO YES NO YES
ATQ UTILISATEURS MLOG$_UTILISATEURS NO YES NO YES NO YES
ATQ VALEURS MLOG$_VALEURS NO YES NO YES NO YES
ATQ VALEURS_DETAILS MLOG$_VALEURS_DETAILS NO YES NO YES NO YES
ATQ VEHICULES MLOG$_VEHICULES NO YES NO YES NO YES
36 ligne(s) sélectionnée(s).
SQL>
I supposed that is the result of the MLOG of the MVIEW associated with my new server. How can I be sure that the MLOG associated with the old one are really deleted ?
Thank you
Maybe you are looking for
-
Is it possible to encrypt a single mail account?
Hi, apologies to regulars if this topic has been addressed. I looked for posts about encrypting mail, and mostly found stuff about encrypting messages as they were sent/received (PGP type problems). I have a very specific question that doesn't seem t
-
How to retrieve detached @ManyToOne entities with relationship
Hi All, I am having difficulty retrieving all the Zipcode, Zipname records which have successfully been deployed on Glassfish v2r2, JDK1.6.0_06, MySQL 5.0, Netbeans 6.1 on Windows XP platform. Below are the relevant EJBs snippets: package domain; @En
-
*Exit/BAdI for Invoice Verification*
Hi Experts, I'm looking for some exits/BAdi in the transaction MIRO. I've a list of relevant enhancement/BAdI but not sure which one will l serve my purpose specifically. So I request, please let me now the specific one which will meet my requirement
-
Can I have 2 My Photo Stream Album on my iCloud Account?
Hi! We have 3 Apple TV's set-up in our space in different locations and using 1 icloud account, just want to know if it's possible to have 3 different My Photo Stream Album so we have 3 different sets of photos on each apple tv. If YES, how? If no, i
-
Java Stored Procedure in one database connecting to muntiple databases.
Hello, I created a Java Stored Procedure in one database(Oracle10g) and successfully open a connection to another database(Oracle10g) using Thin JDBC Driver. I want to actually transfer CLOB data from one DB to another DB. I am concern that by openin