ORA-12008:ERR OCCCURS WHEN MATERIALIZED VIEW IS REFRESHED FROM OTHER SCHEMA
Hi,
ORA-12008: Error occcurs when materialized view is refreshed from another schema, Following the output of the trace file when error occured.
/u01/app/oracle/admin/orcl92/bdump/orcl92_j000_23729.trc
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1
System name: Linux
Node name: newdbserver
Release: 2.6.9-5.ELsmp
Version: #1 SMP Wed Jan 5 19:30:39 EST 2005
Machine: i686
Instance name: orcl92
Redo thread mounted by this instance: 1
Oracle process number: 164
Unix process pid: 23729, image: oracle@newdbserver (J000)
*** SERVICE NAME:(SYS$USERS) 2008-05-23 10:30:51.848
*** SESSION ID:(462.21166) 2008-05-23 10:30:51.848
*** 2008-05-23 10:30:51.848
ORA-12012: error on auto execute of job 766
ORA-12008: error in materialized view refresh path
ORA-00942: table or view does not exist
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2255
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2461
ORA-06512: at "SYS.DBMS_IREFRESH", line 683
ORA-06512: at "SYS.DBMS_REFRESH", line 195
ORA-06512: at line 1
Regards,
Abhishek
Hi Damorgan,
As i said, when refresh materialized view from another schema, mentioned error occurs.
I have also granted accees explicitely still following error occurs.
ORA-12008: error in materialized view refresh path
ORA-00942: table or view does not exist
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2255
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2461
ORA-06512: at "SYS.DBMS_IREFRESH", line 683
ORA-06512: at "SYS.DBMS_REFRESH", line 195
ORA-06512: at line 1
Regards,
Abhishek
Message was edited by:
AbhishekRathod(user559364)
Similar Messages
-
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 -
ORA-00957 Duplicate Column Name Materialized View ( UPDATED: Not answered)
Hello all. I am getting this error when trying to create a Materialized View. I have many other MV I created without problem, but I cannot find the catch up here, can anyone help?. I cannot find any duplicates. The only duplicate I though was the Pipeline_Code column that was entered into the function and the one being being called out as a column. To check, I renamed the latter and still am getting this issue.
Any help would be greatly appreciated.
Thanks!
The query is below:
CREATE MATERIALIZED VIEW MV_TEST_STATION
REFRESH COMPLETE
START WITH TO_DATE('20-SEP-2013 00:00:00','dd-mon-yyyy hh24:mi:ss')
NEXT (SYSDATE +12/24)
AS
SELECT T.TEST_STATION_ID,
--(SELECT TEST_STATION_TYPE.DESCRIPTION
-- FROM TEST_STATION_TYPE
-- WHERE TEST_STATION.TEST_STATION_TYPE =
-- TEST_STATION_TYPE.TEST_STATION_TYPE)
--AS TEST_STATION_TYPE,
TST.DESCRIPTION AS TEST_STATION_TYPE,
T.SURVEY,
T.STATUS,
T.STATION,
F_TRUESTATION2 (
T.STATION,
T.PIPELINE_CODE,
F_REROUTE_CODE (T.STATION,
T.PIPELINE_CODE))
AS TRUE_STATION,
T.REQUIRED,
-- (SELECT PIPELINE_CODES.PIPELINE_CODE_DESCRIPTION
-- FROM PIPELINE_CODES
-- WHERE TEST_STATION.PIPELINE_CODE = PIPELINE_CODES.PIPELINE_CODE)
-- AS PIPELINE_CODE,
PC.PIPELINE_CODE_DESCRIPTION AS PC_PIPELINE_CODE,
T.INSTALL_DATE,
T.FUNCTIONAL COMMENTS,
TSR.TEST_STATION_READING_ID,
TSR.TEST_DATE,
TSR.SURVEYOR,
TSR.ON_VOLTS,
TSR.ON_BG,
TSR.ON_AG,
TSR.METER_UTC,
TSR.METER_ID,
TSR.IO_BG,
TSR.IO_AG,
TSR.INSTANT_OFF_VOLTS,
TSR.FUNCTIONAL_DAMAGE_OUT,
TSR.FUNCTIONAL_DAMAGE_IN,
TSR.COSEMETIC_DAMAGE_OUT,
TSR.COSEMETIC_DAMAGE_IN,
TSR.COMMENTS,
TSR.CASING_ON,
TSR.CASING_OFF,
TSR.CASING,
TSR.CALIBRATION_DUE_DATE,
TSR.ANODE_AMPS_ON,
TSR.ANODE_AMPS_OFF,
TSR.ANODE
FROM TEST_STATION T
INNER JOIN TEST_STATION_TYPE TST ON T.TEST_STATION_TYPE = TST.TEST_STATION_TYPE
INNER JOIN PIPELINE_CODES PC ON T.PIPELINE_CODE = PC.PIPELINE_CODE
INNER JOIN TEST_STATION_READING TSR ON T.TEST_STATION_ID = TSR.TEST_STATION_ID
WHERE T.TEST_STATION_ID = TSR.TEST_STATION_IDsince we don't have your tables or data, we can not run, test, fix or improve posted code
How do I ask a question on the forums?
https://forums.oracle.com/message/9362002#9362002 -
Materialized View fast refresh problems
I have two databases (A and B).
In database A, user NICK has a table called COLOUR_MASTER.
Also in that database, NICK issues the command create materialized view log on colour_master with primary key including new values (and yes, there is a primary key defined for this table)
In database B, there is a database link called A_LINK, connect to nick identified by password using 'dbA';
Also in database B, user IAN creates a materialized view CM_MV refresh fast as select * from colour_master@A_LINK
That statement completes successfully, and there are several million rows in CM_MV when it's done.
Immediately, IAN issues this command:
begin
dbms_mview.refresh('CM_MV');
end;
...and after a slight pause, he gets the error
ORA-12008: error in materialized view refresh path
ORA-02068: following sever error from A_LINK
ORA-03113: end-of-file on communication channel
Yet a +'select count(*) from colour_master@A_LINK'+ submitted immediately manages to return the correct number of records in database A -so that 3113 is a bit misleading, I think, in that instance A did not crash, the database remains accessible at all times, there are no networking issues (database A and B are both located in the same server room, so this isn't like I'm trying to connect half way round the globe).
The only thing I can think of is that there's a permissions problem causing this error. That because the MV creation is done via a link, there's no problem in IAN seeing the appropriate objects, but that once refreshes come into play, maybe there is.
Can anyone shed any light on why I can't do the fast refresh of the view I can happily create, please?I'm surprised that no-one has asked you to do the obvious: try doing a select * from colour_master@A_LINK, without that being wrapped up in a create materialized view statment. Just do a plain select * from...
My bet is that you'll get an ORA_22992 cannot use LOB locators selected from remote tables error. And if you can't do a simple select * from a remote table, I suspect that you can reasonably expect fireworks when you try to create or refresh a materialized view on such a thing!
Here's a quick test:
In Database 1:
=========
SQL> create table A (col1 varchar2(2), col2 clob);
Table created.
SQL> alter table A add constraint A1 primary key (col1);
Table altered.
SQL> insert into A values ('AA','This is an entry into a clob column');
1 row created.
SQL> commit;
Commit complete.
SQL> create materialized view log on A with primary key including new values;
Materialized view log created.In Database 2
=========
SQL> connect ims_global/v0yager1@ussd
Connected.
SQL> create materialized view B refresh fast as
2 select * from A@remotedb_link;
Materialized view created.
SQL> exec dbms_mview.refresh('B');
BEGIN dbms_mview.refresh('B'); END;
ERROR at line 1:
ORA-12008: error in materialized view refresh path
ORA-02068: following severe error from REMOTEDB_LINK
ORA-03113: end-of-file on communication channel
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2251
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2457
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2426
ORA-06512: at line 1
SQL> drop materialized view B;
Materialized view dropped.
SQL> create materialized view B refresh fast as
2 select col1 from A@ims_link;
Materialized view created.
SQL> exec dbms_mview.refresh('B');
PL/SQL procedure successfully completed.Which seems to replicate your problem rather well, I think.
I don't know if there are any workarounds for this. I mean, obviously you can miss out the CLOB column in your 'create MV' statement as I just did, but I don't know whether you are even allowed or supposed to be able to create an MV on lob columns and that patch such-and-such will let you do it. Maybe someone else can provide that information.
But at least you won't have to play Russian roulette with your init.ora parameters! -
Materialized view - fast refresh not working on joins
Hello,
Is it true that fast refresh for materialized view is not possible when I do a union of 2 tables, although both tables have materialized view logs ?there are a number of restrictions with fast refresh, read Materialized View Fast Refresh Restrictions and ORA-12052 [ID 222843.1]
edit: his royal kyteness has posted on this before
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:6506967884606
Edited by: deebee_eh on Apr 25, 2012 3:13 PM -
Materialized view with refresh frequency of once every day
DB Version:11g
If i want to create a Materialized view which should get refreshed once every day, the below code should be fine. Right
create materialized view mv_empname refresh complete
start with sysdate
next sysdate + 1
as select empname from emp Should i be using TRUNC
like
next trunc(sysdate) + 1 for any reason?If you dont use TRUNC i guess it will be refreshed every day at the time when it was first refreshed. That is If first time it was refreshed on 3pm then ever day it will be refreshed at 3pm.
But when you user TRUNC you are removing the time part and it will be set to 00:00:00 meaning 12AM. so the refresh will happen at 12AM ever day. -
Materialized View Fast Refresh encounters 2164 BUILD DEFERRED
I have a materialized view with REFRESH FAST ON DEMAND. The related tables have the required MV Logs and the FAST refresh usually works, but occasional it does not. When it does not there is NO error when DBMS_MVIEW.REFRESH with an F is executed, but the MV is no longer used for QUERY REWRITE. When I run DBMS_MVIEW.EXPLAIN_MVIEW for the MV, I get MSGNO 2164 with MSGTXT 'the materialized view is BUILD DEFERRED'. When I run DBMS_MVIEW.EXPLAIN_REWRITE for a query which used this MV for query rewrite, I get 'QSM-01219: no suitable materialized view found to rewrite this query'.
I have not been able to find any information on the 2164 message nor have I been able to understand why this happens sometimes and not other times.
Oracle 11.2.0.2
Any help in either resolving the error or a method to further research it would be greatly appreciated.
Thanks!I'd like to clarify that the issue I am seeing is NOT the the query will not rewrite. It rewrites perfectly when the MV is in a good state. The problem is that during certain refreshes of the MV a 2164 occurs and I get the message that the query is 'BUILD DEFERRED'. No error comes up during refresh, but when I run DBMS_MVIEW.EXPLAIN_MVIEW and query the MV_CAPABILITIES_TABLE I see the 2164.
Thanks for everyone's help in trying to get this solved. -
Materialized view - fast refresh logs
I understand that there will be a Change Data Capture(CDC) log maintained internally for materialized view fast refresh to happen.
My question is, will this log get purged once the changes are applied to corresponding materialized view or will it persist with further changes getting appended to it ?
What would be the size of change log for 150 million records covering 40 base tables ?MV log entries are deleted when all registered materialized views that depend on them have refreshed.
For example: Suppose you have a table T and materialized views A and B that are fast-refresh and depend on the MV log for T.
On Monday you refresh MV A. The log entries are nto purged because B has not yet incorporated them.
On Tuesday you refresh MV B. At this point the log entries are purged up to the time on Monday that A was refreshed, because all MVs have processed them.
On Wednesday you refresh MV A again. At this point the log entries are purged up to the time on Tuesday that A was refreshed. etc. -
Materialized view complete refresh fails with ora-02068
exec dbms_mview.refresh('WZ_PMS_INVOICE_DTLS','C');
BEGIN dbms_mview.refresh('WZ_PMS_INVOICE_DTLS','C'); END;
ERROR at line 1:
ORA-12008: error in materialized view refresh path
ORA-02068: following severe error from
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 820
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 877
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 858
ORA-06512: at line 1
Please help
RPi traced this CTAS
alter session set timed_statistics = true;
alter session set events '10046 trace name context forever, level 12';
create table pms_temp as select telephone_no from pms_invoice_dtls@cdrwest;
create table pms_temp as select telephone_no from pms_invoice_dtls@cdrwest
ERROR at line 1:
ORA-02068: following severe error from
and it generated a trace file in udump
the last few lines contain the following
=====================
PARSING IN CURSOR #11 len=283 dep=1 uid=0 oct=6 lid=0 tim=1277033874638425 hv=3948238198 ad='9f4a5a30'
update seg$ set type#=:4,blocks=:5,extents=:6,minexts=:7,maxexts=:8,extsize=:9,extpct=:10,user#=:11,iniexts=:12,lists=decode(:13, 65535, NULL, :13),groups=decode(:14, 65535, NULL, :14), cachehint=:15, hwmincr=:16, spare1=DECODE(:17,0,NULL,:17) where ts#=:1 and file#=:2 and block#=:3
END OF STMT
PARSE #11:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,tim=1277033874638420
BINDS #11:
bind 0: dty=2 mxl=22(22) mal=00 scl=00 pre=00 oacflg=08 oacfl2=1 size=24 offset=0
bfp=b781099c bln=24 avl=02 flg=05
value=3
bind 1: dty=2 mxl=22(22) mal=00 scl=00 pre=00 oacflg=08 oacfl2=1 size=24 offset=0
bfp=b7810978 bln=24 avl=03 flg=05
value=448
bind 2: dty=2 mxl=22(22) mal=00 scl=00 pre=00 oacflg=08 oacfl2=1 size=24 offset=0
bfp=b7810954 bln=24 avl=02 flg=05
value=22
bind 3: dty=2 mxl=22(22) mal=00 scl=00 pre=00 oacflg=08 oacfl2=1 size=24 offset=0
bfp=b7810930 bln=24 avl=02 flg=05
value=1
bind 4: dty=2 mxl=22(22) mal=00 scl=00 pre=00 oacflg=08 oacfl2=1 size=24 offset=0
bfp=b781090c bln=24 avl=06 flg=05
value=2147483645
bind 5: dty=2 mxl=22(22) mal=00 scl=00 pre=00 oacflg=08 oacfl2=1 size=24 offset=0
bfp=b78108e8 bln=24 avl=02 flg=05
value=64
bind 6: dty=2 mxl=22(22) mal=00 scl=00 pre=00 oacflg=08 oacfl2=1 size=24 offset=0
bfp=b78108c4 bln=24 avl=01 flg=05
value=0
bind 7: dty=2 mxl=22(22) mal=00 scl=00 pre=00 oacflg=08 oacfl2=1 size=24 offset=0
bfp=b78108a0 bln=24 avl=03 flg=05
value=2475
bind 8: dty=2 mxl=22(22) mal=00 scl=00 pre=00 oacflg=08 oacfl2=1 size=24 offset=0
bfp=b780fe9c bln=24 avl=02 flg=05
value=4
bind 9: dty=2 mxl=22(22) mal=00 scl=00 pre=00 oacflg=08 oacfl2=1 size=24 offset=0
bfp=b780fe78 bln=24 avl=01 flg=05
value=0
bind 10: (No oacdef for this bind)
bind 11: dty=2 mxl=22(22) mal=00 scl=00 pre=00 oacflg=08 oacfl2=1 size=24 offset=0
bfp=b780fe54 bln=24 avl=01 flg=05
value=0
bind 12: (No oacdef for this bind)
bind 13: dty=2 mxl=22(22) mal=00 scl=00 pre=00 oacflg=08 oacfl2=1 size=24 offset=0
bfp=b780fe30 bln=24 avl=01 flg=05
value=0
bind 14: dty=2 mxl=22(22) mal=00 scl=00 pre=00 oacflg=08 oacfl2=1 size=24 offset=0
bfp=b780fe0c bln=24 avl=05 flg=05
value=1642736
bind 15: dty=2 mxl=22(22) mal=00 scl=00 pre=00 oacflg=08 oacfl2=1 size=24 offset=0
bfp=b780fde8 bln=24 avl=04 flg=05
value=131073
bind 16: (No oacdef for this bind)
bind 17: dty=2 mxl=22(22) mal=00 scl=00 pre=00 oacflg=08 oacfl2=1 size=24 offset=0
bfp=b7810a08 bln=22 avl=03 flg=05
value=137
bind 18: dty=2 mxl=22(22) mal=00 scl=00 pre=00 oacflg=08 oacfl2=1 size=24 offset=0
bfp=b78109e4 bln=24 avl=02 flg=05
value=68
bind 19: dty=2 mxl=22(22) mal=00 scl=00 pre=00 oacflg=08 oacfl2=1 size=24 offset=0
bfp=b78109c0 bln=24 avl=04 flg=05
value=104537
EXEC #11:c=1000,e=1183,p=0,cr=5,cu=1,mis=0,r=1,dep=1,og=4,tim=1277033874639736
STAT #11 id=1 cnt=0 pid=0 pos=1 obj=0 op='UPDATE '
STAT #11 id=2 cnt=1 pid=1 pos=1 obj=14 op='TABLE ACCESS CLUSTER SEG$ '
STAT #11 id=3 cnt=1 pid=2 pos=1 obj=9 op='INDEX UNIQUE SCAN I_FILE#_BLOCK# '
EXEC #3:c=726889,e=217706310,p=7,cr=417,cu=409,mis=0,r=0,dep=0,og=4,tim=1277033875797114
ERROR #3:err=2068 tim=1919250001
*** 2011-06-10 13:16:24.262
XCTEND rlbk=0, rd_only=1
STAT #6 id=1 cnt=1 pid=0 pos=1 obj=475 op='TABLE ACCESS FULL CDC_SYSTEM$ ' -
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; -
Materialized view with tables in different schemas
Hello,
I want to create a materialized view with a table from a different schema in the SELECT statement. For materialized view I would like to apply the "REFRESH COMPLETE ON COMMIT" option.
Here the code:
CREATE MATERIALIZED VIEW S1.MV_EXAMPLE
TABLESPACE TS1
PCTFREE 0
BUILD IMMEDIATE
REFRESH COMPLETE ON COMMIT
AS
SELECT T.COLUMN1 COLUMN
FROM S2.TABLE1 T
I can't execute this SQL because I get an "insufficient privileges" error to this table:
FROM S2.TABLE1 T
FEHLER in Zeile 9:
ORA-01031: Insufficient privileges
User S1 has the following privileges:
CREATE SESSION
CREATE SNAPSHOT
CREATE TABLE
CREATE QUERY REWRITE
SELECT ANY TABLE
User S2 has the following privileges:
CREATE SESSION
CREATE SNAPSHOT
CREATE TABLE
CREATE QUERY REWRITE
ALTER ANY SNAPSHOT
Which privileges are missing?
Thanks, MathiasThanks Kamal for your answer!
S1 has the grant select directly. But I solveld the problem. The system privilege "ON COMMIT REFRESH" was missing for S1. This has to be set if any of the tables are outside the owner's schema of the materialized view (ORACLE documentation - Data Warehouse Guide).
But one thing is not clear to me yet and the ORACLE documentation doesn't give me an answer. I can set the refresh-attribute ON COMMIT on a materialized view containing only joins when a group by clause is set. If the group by clause is missing I can't! Why?
Regards, Mathias -
Regarding Error in Materialized view Fast Refresh
ORA-12015: cannot create a fast refresh materialized view from a complex query
CREATE MATERIALIZED VIEW MVCONTENTHISTORY_01
BUILD IMMEDIATE
REFRESH FAST
WITH PRIMARY KEY
ENABLE QUERY REWRITE
AS
SELECT a.DAY, a.contentname,
SUM
(CASE
WHEN (b.subscriptionstartdate) <= (a.DAY)
AND ((CASE
WHEN b.subscriptionenddate IS NOT NULL
THEN (a.DAY)
ELSE TO_DATE ('01/20/1990', 'MM/DD/YYYY')
END
) <=
(CASE
WHEN b.subscriptionenddate IS NOT NULL
THEN (b.subscriptionenddate)
ELSE TO_DATE ('01/20/1990', 'MM/DD/YYYY')
END
THEN 1
ELSE 0
END
) COUNT,
COUNT
(CASE
WHEN (b.subscriptionstartdate) <= (a.DAY)
AND ((CASE
WHEN b.subscriptionenddate IS NOT NULL
THEN (a.DAY)
ELSE TO_DATE ('01/20/1990', 'MM/DD/YYYY')
END
) <=
(CASE
WHEN b.subscriptionenddate IS NOT NULL
THEN (b.subscriptionenddate)
ELSE TO_DATE ('01/20/1990', 'MM/DD/YYYY')
END
THEN 1
ELSE 0
END
) cnt
FROM TBLTDATEWISECONTENT a,
(SELECT TRUNC (a.subscriptionstartdate) subscriptionstartdate,
TRUNC (a.subscriptionenddate) subscriptionenddate, b.NAME,
b.contentid
FROM syntbltcontentsubscrhistory a, syntblmcontent b
WHERE b.contentid = a.contentid(+)) b
WHERE a.contentid = b.contentid(+) AND a.DAY = b.subscriptionstartdate(+)
GROUP BY a.contentname, a.DAY;
I can't create Materialized view with fast Refresh .
Kindly provide solution .
Regards,
nayana chavda.Kindly provide full Oracle version since option vary by release.
There error message says it is impossible to fast refresh based on a complex query.
On 10g Oracle provides a package procedure that will tell you why the view cannot be fast refreshed: dbms_mview.explain_mview.
Otherwise see the Advanced Replication Manual for a list of restrictions.
10gR2 >>Restrictions for Materialized Views with Subqueries
The defining query of a materialized view with a subquery is subject to several restrictions to preserve the materialized view's fast refresh capability.
The following are restrictions for fast refresh materialized views with subqueries:
Materialized views must be primary key materialized views.
The master's materialized view log must include certain columns referenced in the subquery. For information about which columns must be included, see "Logging Columns in the Materialized View Log".
If the subquery is many to many or one to many, join columns that are not part of a primary key must be included in the materialized view log of the master. This restriction does not apply to many to one subqueries.
The subquery must be a positive subquery. For example, you can use the EXISTS condition, but not the NOT EXISTS condition.
The subquery must use EXISTS to connect each nested level (IN is not allowed).
Each table can be in only one EXISTS expression.
The join expression must use exact match or equality comparisons (that is, equi-joins).
Each table can be joined only once within the subquery.
A primary key must exist for each table at each nested level.
Each nested level can only reference the table in the level above it.
Subqueries can include AND conditions, but each OR condition can only reference columns contained within one row. Multiple OR conditions within a subquery can be connected with an AND condition.
All tables referenced in a subquery must reside in the same master site or master materialized view site.
<<
HTH -- Mark D Powell --
Message was edited by: added list of restrictions left off initial post
mpowel01 -
Materialized view fast refresh
I would like to create a fast refresh materialized view. The query is below.
create materialized view dw_v_bal_txn_fast
BUILD IMMEDIATE
refresh fast
as
SELECT b.machine_id,nvl(p.promotion_code_id,0)promotion_code_id,p.promotion_code_name
,min(bal_transaction_id) bal_transaction_id
,offered_promotion_id
,operator_session_id
,decode((case when count(*)>1 then 1 else 0 end),1,max(transaction_type),0,max(transaction_type))transaction_type
,sum(balance_change) balance_change
,min(transaction_time) transaction_time
,min(dtransaction_time) dtransaction_time
,count(*)cnt
,count(balance_change)cnt_balance_change
FROM balance_transaction b,promotion_code p
WHERE
b.machine_id=p.machine_id(+) and
b.promo_code_id=p.promotion_code_id(+)
and b.transaction_type in (3,5)
GROUP BY b.machine_id
,p.promotion_code_id,p.promotion_code_name
,offered_promotion_id
,operator_session_id
The materialized view logs are as follows:
create materialized view log on pims_repo.balance_transaction WITH SEQUENCE, ROWID
(machine_id,bal_transaction_id,MONEY_DEVICE_ID,offered_promotion_id,operator_session_id,transaction_type,
balance_change,transaction_time,dtransaction_time,EXT_KEY,PROMO_CODE_ID,IMP_FILE_HISTORY_ID,PROMOTION_CODE,ACCOUNT_MASTER_ID,EZCODE_VALUE,
PRIZECODE,PROMO_CODE_VALUE_ID
INCLUDING NEW VALUES
create materialized view log on pims_repo.promotion_code WITH SEQUENCE, ROWID
(machine_id,promotion_code_id,CONFIGURATION_ID,PROMOTION_CODE_TYPE_ID,PROMOTION_CODE_NAME,PRICE,credit,PROMOTION_ID,
ACTIVE_START_TIME,DACTIVE_START_TIME,ACTIVE_END_TIME,DACTIVE_END_TIME,AVAILABILITY,CREDIT_TYPE,TIME_MODIFIER,
DAYS,START_TIME,DURATION,TRAFFIC_WATERMARK,TRAFFIC_PERIODS,TRAFFIC_PERIOD_LEN,TRAFFIC_MIN_TIME,TRAFFIC_MAX_TIME,DERIVED
,EXPIRED,uses,USES_ON_PURCHASE,SORT_KEY,FILTER_KEY,EXT_KEY,IMP_FILE_HISTORY_ID,LINKED_PROMOTION_CODE,MARGIN_CRITERIA,
SELECTION_ODDS,AD_ONLY,REFILL_AMOUNT,FILLS
INCLUDING NEW VALUES
and the join columns (machine_id,promotion_code_id) of promotion_code has unique constraint in it.But it still says
ORA-12015: cannot create a fast refresh materialized view from a complex query
Can anyone please let me know what else needto be done.
Thanks in advance.There are certain restriction on create meterialize view with Fast Refresh
For example in your case,
Restrictions on Fast Refresh on Materialized Views with Joins Only
-They cannot have GROUP BY clauses or aggregates.
-Rowids of all the tables in the FROM list must appear in the SELECT list of the query.
-Materialized view logs must exist with rowids for all the base tables in the FROM list of the query.
Full list of restrictions here
http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14223/basicmv.htm#i1006803 -
Materialized view fast refresh error
hi,
I have a materialized view created with fast refresh on demand option. Now when i try to refresh it manually the next day, it gives me an error . I have both count(*) and count(1) inside the materialized view. There is update and delete transactions done on most of the tables. The refresh is set to be at 4 am though a refresh group . But it fails with the error shown below . Please help. thanks
here is the script from toad
DROP MATERIALIZED VIEW MYPORTAL.ACCOUNT_COST_CATEGORY_MV;
CREATE MATERIALIZED VIEW MYPORTAL.ACCOUNT_COST_CATEGORY_MV
TABLESPACE USERS
PCTUSED 0
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOCACHE
LOGGING
NOCOMPRESS
NOPARALLEL
BUILD IMMEDIATE
USING INDEX
TABLESPACE USERS
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
REFRESH FAST ON DEMAND
WITH PRIMARY KEY
AS
/* Formatted on 2011/01/07 10:04 (Formatter Plus v4.8.8) */
SELECT ac.account_id,
ac.account_manager mgr_id,
ac.account_number,
ac.account_name,
bc.burden_center_name burden_center,
p.surname_isi || ', ' || p.first_name account_manager,
p.division_id,
item.code_id,
item.code_name cost_category_item,
TO_NUMBER (TO_CHAR (ap.first_day, 'YYYY')) period_year,
ap.first_day period,
ap.fiscal_system_period_cal_yr_eq || ', ' || ap.fiscal_year period_asr,
COUNT (*) total_row_count,
COUNT (1) total_one_count,
SUM (NVL (ad.current_expense, 0)) expense,
SUM (NVL (ad.total_budget, 0)) budget,
SUM (NVL (ad.cumltv_expense, 0)) cumltv_expense,
SUM (NVL (ad.commitments, 0)) commitments,
SUM (NVL (ad.budget_balance, 0)) budget_balance
FROM accounts ac,
burden_centers bc,
personnel p,
asr_headers ah,
asr_details ad,
codes item,
codes costcat,
all_periods ap,
codes cost_element,
accounting_base_group abg
WHERE ac.account_manager = p.personnel_id
AND ac.burden_center_id = bc.burden_center_id
AND ac.account_id = ah.account_id
AND ah.asr_header_id = ad.asr_header_id
AND ah.period_asr =
ap.fiscal_system_period_cal_yr_eq || ', ' || ap.fiscal_year
AND abg.cost_element_cat_item_id = item.code_id
AND cost_element.code_id = abg.cost_element_id
AND ad.object_code = cost_element.code_value
AND item.code_parent_id = costcat.code_id
AND ( costcat.code_name = 'Report 1'
OR (costcat.code_name = 'Base' AND item.code_name = 'MTDC')
GROUP BY ac.account_id,
ac.account_manager,
ac.account_number,
ac.account_name,
bc.burden_center_name,
p.surname_isi || ', ' || p.first_name,
p.division_id,
item.code_id,
item.code_name,
TO_NUMBER (TO_CHAR (ap.first_day, 'YYYY')),
ap.first_day,
ap.fiscal_system_period_cal_yr_eq || ', ' || ap.fiscal_year;
COMMENT ON MATERIALIZED VIEW MYPORTAL.ACCOUNT_COST_CATEGORY_MV IS 'snapshot table for snapshot MYPORTAL.ACCOUNT_COST_CATEGORY_MV';
CREATE INDEX MYPORTAL.ACCOUNT_COST_CAT_MV_IDX ON MYPORTAL.ACCOUNT_COST_CATEGORY_MV
(ACCOUNT_ID, CODE_ID, PERIOD)
LOGGING
TABLESPACE USERS
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
-- Note: Index I_SNAP$_ACCOUNT_COST_CATEG will be created automatically
-- by Oracle with the associated materialized view.
here is the error :
10:10:04 SQL> exec dbms_mview.refresh('account_cost_category_mv');
BEGIN dbms_mview.refresh('account_cost_category_mv'); END;
ERROR at line 1:
ORA-32314: REFRESH FAST of "MYPORTAL"."ACCOUNT_COST_CATEGORY_MV" unsupported after deletes/updates
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2254
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2460
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2429
ORA-06512: at line 1
10:10:14 SQL>alright, i did a explain_mview, and then query the table , here is the result.
exec DBMS_MVIEW.EXPLAIN_MVIEW('account_cost_category_mv');
select MVOWNER, MVNAME, CAPABILITY_NAME, POSSIBLE
from MV_CAPABILITIES_TABLE
where CAPABILITY_NAME = 'REFRESH_FAST' ;
MVOWNER MVNAME CAPABILITY_NAME POSSIBLE
MYPORTAL ACCOUNT_COST_CATEGORY_MV REFRESH_FAST Y So why is it still giving the error ? -
Materialized view fast refresh with date field
I have a situation where I need to create a materialized view worth of 6 months of data with fast refresh option from the master table. Somehow whenever I have the where clause added with the date field then it craps out with "ORA-12015: cannot create a fast refresh materialized view from a complex query".
Here is what I am trying to do. Please let me know if there is any other way to accomplish this.
create table test (id number, date_time DATE);
CREATE MATERIALIZED VIEW LOG ON test WITH ROWID;
CREATE MATERIALIZED VIEW cms.scoreboard_statistics_mv
BUILD IMMEDIATE
REFRESH FAST
WITH ROWID
AS
SELECT * from test
WHERE date_time >= sysdate - 180;
ORA-12015: cannot create a fast refresh materialized view from a complex query
Thanks,
RajIt's crazy but a new time Metalink help us into the Note:179466.1
The restrictions that prevent snapshots from being fast refreshed depend on
the version of Oracle being used, a full list of these by version is included
in section 3. In all cases the snapshot defining query should:
- refer to fully qualified table names rather than to partial table names.
- refer to remote tables only, not to remote master views or synonyms.
- not generate context sensitive data. For example, do not create a simple
snapshot with a query that uses the SQL functions :SYSDATE, UID or USER.
Maybe you are looking for
-
Is there a way to create a contact box on photoshop and save as PDF?
Can someone explain how or where to find a tutorial to create a contact box on photoshop then save as a pdf? Thank you!
-
HDMI or RGB: Which is better via MacBook Pro?
Hello. I want to connect my MacBook Pro (with a Mini-Display Port) to my HD flat-screen monitor in my living room. The HD flat-screen monitor does both RGB and HDMI connections. I can do a Mini-Display Port to RGB adapter to connect them. -Or I can c
-
Can anyone verify that iTunes version 7.0.1 is working properly? I don't wanna download it and have all that crap again...
-
Weblogic Server throwing Out of Memmory Exception
Hi , I am deploying my application on the Weblogic Appserver . In the logs i can see the server starting however , when i try debugging the application i get a error saying <Dec 23, 2011 10:21:30 AM IST> <Error> <HTTP> <BEA-101017> <[weblogic.servlet
-
Hello everyone! I'm just learning JSP right now so I hope I can explain my problem correctly. If i'm not making sense please let me know. I have a table (FormFields) in my database that stores which fields should be displayed on my web form. The tabl