Home » SQL & PL/SQL » SQL & PL/SQL » Cannot refresh Materialized View with Join in Oracle 12c 12.1.0.1.0 after Create (Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production, Windows Server 2012)
Cannot refresh Materialized View with Join in Oracle 12c 12.1.0.1.0 after Create [message #612784] |
Thu, 24 April 2014 14:14 |
|
appsystems
Messages: 6 Registered: April 2014
|
Junior Member |
|
|
Hello,
last week i migrated from Oracle 10g to 12c, but i had problems with Refreshing Materialized views, which contain joins.
Then i tried an example on 12c and i got still the same mistake.
i have installed a clean Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production, i created 2 testtables like this:
CREATE TABLE Y_FIRST ( ID NUMBER NOT NULL PRIMARY KEY, TEXT VARCHAR2(10 BYTE), ID_FOREIGN NUMBER NOT NULL );
CREATE TABLE Y_SECOND ( ID NUMBER NOT NULL PRIMARY KEY, TEXT2 VARCHAR2(10 BYTE));
Then i inserted some Sample Statements into it, like this:
Insert into Y_FIRST (ID, TEXT, ID_FOREIGN) Values (1, 'erst1', 1);
Insert into Y_FIRST (ID, TEXT, ID_FOREIGN) Values (2, 'erst2', 1);
Insert into Y_FIRST (ID, TEXT, ID_FOREIGN) Values (3, 'erst3', 2);
Insert into Y_FIRST (ID, TEXT, ID_FOREIGN) Values (4, 'erst4', 2);
COMMIT;
Insert into Y_SECOND (ID, TEXT2) Values (1, 'yes');
Insert into Y_SECOND (ID, TEXT2) Values (2, 'no');
COMMIT;
Afterwards i created a Materialised View like this:
CREATE MATERIALIZED VIEW MV (RON,ID1,NAME1,ID2,NAME2) REFRESH COMPLETE ON DEMAND WITH PRIMARY KEY AS
SELECT ROWNUM AS RON, ab.ID AS ID1, ab.text AS NAME1,b.ID AS ID2, b.text2 AS NAME2 FROM y_first ab, y_second b WHERE ab.id_foreign = b.id;
COMMIT;
this worked so far, but when i tried to refresh the Materialized View with the command
EXEC DBMS_MVIEW.REFRESH('mv','?');
or
EXEC DBMS_MVIEW.REFRESH('mv','F');
i get the following exception
ORA-12008: error in materialized view refresh path
ORA-01732: data manipulation operation not legal on this view materialized view
ORA-06512: in "SYS.DBMS_SNAPSHOT", line 2802
ORA-06512: in "SYS.DBMS_SNAPSHOT", line 3039
ORA-06512: in "SYS.DBMS_SNAPSHOT", line 2998
ORA-06512: in line 1
The same code works in Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production, but for 12c i had no success.
I also tried to set some materialized view Logs on 12c with:
CREATE MATERIALIZED VIEW LOG ON Y_FIRST with primary key, rowid, sequence including new values;
CREATE MATERIALIZED VIEW LOG ON Y_SECOND with primary key, rowid, sequence including new values;
but i still had no success with it.
Do you have any idea, what the solution to this problem could be?
Thank you for your help!
Kind regards,
Edvin
[Updated on: Thu, 24 April 2014 14:16] Report message to a moderator
|
|
|
Re: Cannot refresh Materialized View with Join in Oracle 12c 12.1.0.1.0 after Create [message #612786 is a reply to message #612784] |
Thu, 24 April 2014 14:28 |
Solomon Yakobson
Messages: 3273 Registered: January 2010 Location: Connecticut, USA
|
Senior Member |
|
|
Is it PDB or non-CDB? I have no issues with non-CDB:
SCOTT@sol12 > select banner from v$version
2 /
BANNER
--------------------------------------------------------------------------------
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
PL/SQL Release 12.1.0.1.0 - Production
CORE 12.1.0.1.0 Production
TNS for 64-bit Windows: Version 12.1.0.1.0 - Production
NLSRTL Version 12.1.0.1.0 - Production
SCOTT@sol12 > EXEC DBMS_MVIEW.REFRESH('mv','C');
PL/SQL procedure successfully completed.
SCOTT@sol12 > EXEC DBMS_MVIEW.REFRESH('mv','F');
BEGIN DBMS_MVIEW.REFRESH('mv','F'); END;
*
ERROR at line 1:
ORA-12004: REFRESH FAST cannot be used for materialized view "SCOTT"."MV"
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2802
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 3039
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2998
ORA-06512: at line 1
SCOTT@sol12 > EXEC DBMS_MVIEW.REFRESH('mv','?');
PL/SQL procedure successfully completed.
SCOTT@sol12 >
Have no time now to test it on PDB.
SY.
|
|
|
Re: Cannot refresh Materialized View with Join in Oracle 12c 12.1.0.1.0 after Create [message #612787 is a reply to message #612786] |
Thu, 24 April 2014 14:48 |
|
appsystems
Messages: 6 Registered: April 2014
|
Junior Member |
|
|
Hey, thank you for your fast reply!
This is my version:
select banner from v$version;
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
PL/SQL Release 12.1.0.1.0 - Production
CORE 12.1.0.1.0 Production
TNS for 64-bit Windows: Version 12.1.0.1.0 - Production
NLSRTL Version 12.1.0.1.0 - Production
I didn't choose any Container at the Installation (i deactivated it), so i guess it's a non-cdb?
is there any Select-Statement to check this, so we can go sure that this isn't that problem?
i only got this select-statement:
select * from v$parameter where name like 'noncdb%';
NUM,NAME,TYPE,VALUE,DISPLAY_VALUE,ISDEFAULT,ISSES_MODIFIABLE,ISSYS_MODIFIABLE,ISPDB_MODIFIABLE,ISINSTANCE_MODIFIABLE,ISMODIFIED,ISADJUSTED,ISDEPRECATED,ISBASIC,DESCRIPTION,UPDATE_COMMENT,HASH,CON_ID
3317,noncdb_compatible,1,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,Non-CDB Compatible,null,2594626030,0
i hope that it's readable, maybe let's do a smaller select:
select NAME, DISPLAY_VALUE,ISDEFAULT, ISSES_MODIFIABLE, ISMODIFIED, ISADJUSTED,ISBASIC, DESCRIPTION from v$parameter where name like 'noncdb%'
NAME,DISPLAY_VALUE,ISDEFAULT,ISSES_MODIFIABLE,ISMODIFIED,ISADJUSTED,ISBASIC,DESCRIPTION
noncdb_compatible,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,Non-CDB Compatible
Thank you for your Help!
Any ideas?
Kind regards,
Edvin
|
|
|
|
|
Re: Cannot refresh Materialized View with Join in Oracle 12c 12.1.0.1.0 after Create [message #612791 is a reply to message #612789] |
Thu, 24 April 2014 15:26 |
|
appsystems
Messages: 6 Registered: April 2014
|
Junior Member |
|
|
Solomon Yakobson wrote on Thu, 24 April 2014 15:08You issue
select cdb from v$database;
to check if it is container database (CDB) or non-CDB.
SY.
Thank you for your reply!
This is the Result:
select cdb from v$database;
CDB
NO
@Michel Cadot: yeah, i guess so, but i wanted to try if i could set some kind of primary key on it, i was just playing around.
But a complete refresh would be already very nice
Thanks for your feedback,
Do you have any idea how to fix this? I would appreciate that really much.
Kind regards,
Edvin
[Updated on: Thu, 24 April 2014 15:27] Report message to a moderator
|
|
|
|
Re: Cannot refresh Materialized View with Join in Oracle 12c 12.1.0.1.0 after Create [message #612794 is a reply to message #612792] |
Thu, 24 April 2014 16:04 |
|
appsystems
Messages: 6 Registered: April 2014
|
Junior Member |
|
|
Solomon Yakobson wrote on Thu, 24 April 2014 15:39I already showed you - complete refresh works fine on my 12C. In any case check what dbms_mview.explain_mview says.
SY.
Thank you for your reply - i appreciate that very much!
The problem is, that in my Database the same exact constelltion does not work, so i don't have a working solution
I tried the mv_capabilites_table, i uploaded the results as an attachment (The comments are on German, but i hope this shouldn't be a problem - otherwise i will upload later on i translated version of that file)
Thank you for your help.
Can you tell me, what the File means?
Kind regards,
Edvin
[Updated on: Thu, 24 April 2014 16:07] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
Re: Cannot refresh Materialized View with Join in Oracle 12c 12.1.0.1.0 after Create [message #612886 is a reply to message #612856] |
Sat, 26 April 2014 16:40 |
|
appsystems
Messages: 6 Registered: April 2014
|
Junior Member |
|
|
Solomon Yakobson wrote on Sat, 26 April 2014 08:51Sorry, I can't reproduce it in PDB either. What happens when you remove ROWNUM from MV?
SY.
Thank you for your feedback!
I get still the same error after removing the rownum.
i added the screenshot of sqlplus again:
Do i have to insert some kind of Materialized View log or index to make this work?
because i tried this with one simple table and i get the same mistake, here is the code:
CREATE TABLE Y_TEST2 (
ID NUMBER NOT NULL PRIMARY KEY,
TEXT VARCHAR2(255)
);
insert into y_test2 values(1,'yep');
insert into y_test2 values(2,'no');
CREATE MATERIALIZED VIEW RATSCHINGS.MV_Y_TEST2 (ID,TEXT) REFRESH COMPLETE ON DEMAND WITH PRIMARY KEY AS
SELECT ID, text FROM Y_TEST2;
exec dbms_mview.refresh('mv_y_test2', 'C');
ORA-12008: error in materialized view refresh path
ORA-01732: data manipulation operation not legal on this view materialized view
ORA-06512: in "SYS.DBMS_SNAPSHOT", line 2802
ORA-06512: in "SYS.DBMS_SNAPSHOT", line 3039
ORA-06512: in "SYS.DBMS_SNAPSHOT", line 2998
ORA-06512: in line 1
and this also didn't work, so i have absolutely no clue, because this should work.
Thank you for your help!
Do you have any clue why this happens with my installation of oracle or any other ideas?
Kind regards,
edvin
[Updated on: Sat, 26 April 2014 17:01] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Fri Apr 26 15:06:54 CDT 2024
|