Materialized view (creating and complete refresh)
Good day.
I have a huge query that is used to create a materialized view. The query consist of 9 joins, a lot of aggregations, some subqueries, so we can say it is rather huge. The query itself executes for about 30 seconds and returns about 200 rows. The materialized view creates and refreshes for more than 30 minutes. Can someone please explain me the mechanism of materialized view creation which causes such bad performance.
We use Oracle Database 9.2.0.4.
Thank you in advance.
I've fount the solution. May be it will be useful for someone not regarding that 9.2 database is less used today than 10.2.
I studied carefully the plan of the query and the plan of insert statement that is used when creating materialized view and found the cause of trouble. Insert statements generates VIEW PUSHED PREDICATE and BITMAP CONVERSION FROM ROWIDS when parsing. Bitmap conversion can be removed by setting environment parameter btree_bitmap_plans to false (a well-known issue), but I decided not ot change the production environment. The pushed predicate can be removed by using hint NO_PUSH_PRED to each subquery used in a materialized view. This step reduced the time of materialized view creation and execution to about a minute.
Thank everyone who tried to help.
Similar Messages
-
Materialized view - parameter and refresh
Hi,
We are creating a Materialized view that has 2 rows for a CCID, one for this year and one for previous year with balances in 12 buckets.
We have 2 questions:
1. Can a materialized view be created with a parameter? or it can only take hard coded values?
2. Can we refresh a part of materialized view, lets say we want to refresh the balances only for this year?
Thanksuser12182208 wrote:
Hi,
We are creating a Materialized view that has 2 rows for a CCID, one for this year and one for previous year with balances in 12 buckets.
We have 2 questions:
1. Can a materialized view be created with a parameter? or it can only take hard coded values? Typically, you want a materialized view to contain a complete set of aggregate data ... so, no, parameters don't really make sense (also, the results are pre-computed unlike a regular VIEW which is just a stored query. With a MV the data is actually computed on creation unless you defer it, and takes up physical storage).
>
2. Can we refresh a part of materialized view, lets say we want to refresh the balances only for this year?
You can (depending on your Oracle Version and complexity of your materialized view) create a materialized view that does fast refreshes. If for some reason it was pertinent for you to achieve what you've asked, you could make 2 MV's and then a view that does a UNION ALL of them (the MV's would not contain overlaps), then you would just refresh the 1 MV, seems odd to me to want to do this though.
Thanks -
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 -
How do I use Primary Key and RowID in Materialized View Logs and MVs
How do I use Primary Key and RowID in Materialized View Logs and Materialized Views????
I donât understand in the Materalized View Logs the diference between Primary Key and RowID. Besides, I could choose both Primary Key and RowID.
When I have to use RowID?? Why?? And Primary Key??? And both, Primary Key and RowID????
Thank you very much!Yes, I have already read it...
But for example I donât Understand:
This is the example 8-1
CREATE MATERIALIZED VIEW LOG ON products
WITH SEQUENCE, ROWID
(prod_id, prod_name, prod_desc, prod_subcategory, prod_subcat_desc, prod_
category, prod_cat_desc, prod_weight_class, prod_unit_of_measure, prod_pack_
size, supplier_id, prod_status, prod_list_price, prod_min_price)
INCLUDING NEW VALUES;
But if I create a Materialized View with TOAD if I choose a KEY field I receive the error:
ORA-12026: invalid filter column detected
Then I have to take out the Key (in the above example prod_id)
And then the script is
CREATE MATERIALIZED VIEW LOG ON products
WITH ROWID, SEQUENCE, PRIMARY KEY!!!!!!!!!!!!!!!!!!!!
(prod_id, prod_name, prod_desc, prod_subcategory, prod_subcat_desc, prod_
category, prod_cat_desc, prod_weight_class, prod_unit_of_measure, prod_pack_
size, supplier_id, prod_status, prod_list_price, prod_min_price)
INCLUDING NEW VALUES;
I have PRIMARY KEY in the definition (I donât choose it) and I donât have the prod_id field
Why is it????
Note: If I execute the script to create the MV Log manually the PRIMARY KEY option NO IS in the script and the prod_id field either is in the script.
And on the other hand,
What is this:
CREATE MATERIALIZED VIEW LOG ON sales
WITH ROWID;
CREATE MATERIALIZED VIEW LOG ON times
WITH ROWID;
CREATE MATERIALIZED VIEW LOG ON customers
WITH ROWID;
These MATERIALIZED VIEW LOG contain any fields????
Or it contain the primary key fields of this tables (sales, times and customers)??? Then, Why is it ROWID instead of PRIMARY KEY????
Thanks! -
Hi,
What is significance of Cache Refresh (SXI_CACHE)?
And what is difference between Delta Refresh and Complete Refresh?
Thanks and Regards,
Vijay RahejaHi Vijay,
You can view all cached objects by running transaction SXI_CACHE. You can see whether the cache is up-to-date or not. You can view all cached data and start a manual cache refresh.
If you suspect that a change in a Integration Directory has not been replicated to the runtime cache, you can refresh the cache manually. To refresh the cache in SXI_CACHE, from the menu choose XI runtime Cache.
In a Delta cache all the data are not replicated. Only the data that is changed from the last cache is updated.
Hope this clarifies.
Regards.
Praveen -
Hi,
We have installed Oracle 12c Oracle Developer Tools for Visual Studio (Visual Studio is 2010 edition). With this tool we can manage tables, views, etc... but we also need to manage more database objects such as materialized views, materialized view logs and db links.
Is there any option to manage this object from Server Explorer and to add the script in the Database Project? At the same time, the schema compare tools does not include this object types. Is there any option to compare them?
Thanks.As you noticed, not all database objects are available in Server Explorer, and because of this they can't have scripts generated for them, nor can they be compared with Schema Compare.
In a pinch, you should be able to use SQL Developer to do this. -
Materialized View big and empty after full refresh
Background:
Database 10.2.0.4 running on Windows 2003 Server R2 SP2.
Materialized view MV_A, selects from 3 base tables, 2 of which are partitioned, fast refresh on demand, approx 33 million rows. Initially populated with a complete refresh of 31 million rows about 2 months ago, and fast refreshed every 10 seconds since then.
Problem: Performed a partition split on one of the base tables and received this error on the next fast refresh:
ORA-32313: REFRESH FAST of "CUR"."MV_A" unsupported after PMOPs
Docs say a complete refresh is required.
So, created a new copy of the materialized view "MV_B", same storage params, same mview SELECT, same schema.
Did a complete refresh, the extents grew to the expected 10GB combined size. The DBMS_MVIEW.REFRESH reported 'PL/SQL procedure successfully completed' but the MVIEW is empty.
23:01:26 SQL> exec DBMS_MVIEW.REFRESH('MV_B','C','',FALSE,FALSE,0,0,0,TRUE) /* Complete */;
PL/SQL procedure successfully completed.
07:56:46 SQL> commit;
Commit complete.
08:17:51 SQL> select count(*) from mv_b;
COUNT(*)
0
08:19:39 SQL>
Since the MVIEW table MV_B added 10 GB worth of extents during the refresh, it appears that the rows were inserted but then for some reason were rolled back. Nothing unusual in the alert.log. If I execute the MVIEW select statement by itself in SQLPlus, yes, I do get rows back.
The tablespaces housing the MVIEW table as well as the temporary and undo tablespaces are set to autoextend/unlimited to make sure they are not an issue.
Next I dropped and recreated the materialized view MV_B, identical except an added condition to the WHERE clause so that the number of rows returned is only 7 million instead of 33 million and that works fine - a complete refresh populates it and subsequent fast refreshes work correctly.
I'm stumped. Any ideas? Could we be running out of some memory resource that when exhausted, is not trapped properly by Oracle as an error?
- TomIs the MV and the source tables on the same database? If this is a remote MV, then check the source site if there are any issues (TEMP, UNDO space issues).
-
Materialized View - creation and schedule (To automate Refresh)
Hi All,
I have one table based on SQL Query (multiple tables) and loading data every day through procedure.
When I execute the procedure is taking lot of time to load data. That’s why I am planning to create Materialized view to refresh the data in a table every day at some point of time (ex:-9.00 am).
Exclude procedure and materialized view are there any ways to refresh the data?
Can you and all please help me to create materialized view and schedule (Automate refresh).
begin
insert into CLAIMS_PRODUCT_TAB
select
substr(at.ATN_VOUCHER_NUMBER,1,6) as BRANCH,
t.MONTH_NAME as MONTH,t.FISCAL_YEAR as YEAR,
bb.ACC_ACCOUNT_TYPE as TYPE,
aa.ACC_DEPARTMENT_CODE as DEPT,
pr.PRODUCT_NAME as PRODUCT,
case bb.ACC_ACCOUNT_TYPE when '1301' then 'Claims Paid' when '5383' then 'Claims OS' end as HEAD,
case aa.ACC_DEPARTMENT_CODE when '31' then 'OD' when '32' then 'TP' when '39' then 'TP Pool' end as DEPT_NAME,
count(distinct at.CLAIM_ID) as CLAIMS,
--count( distinct at.POLICY_ID) as POLICIES,
sum(atd.ATD_CREDIT_AMOUNT - atd.ATD_DEBIT_AMOUNT) as totals
from
ACCOUNTING_TRN_DETAIL atd,time t,
ACCOUNT bb,
ACCOUNT aa,claim c, policy p,product pr,
accounting_transaction at
where bb.ACC_ACCOUNT_ID = aa.ACC_ACC_ACCOUNT_ID
and at.CLAIM_ID = c.CLAIM_ID
and c.POLICY_ID = p.POLICY_ID
and p.PRODUCT_ID = pr.PRODUCT_ID
and aa.ACC_ACCOUNT_ID = atd.ACC_ACCOUNT_ID
and atd.ATN_ACCOUNTING_TRANSACTION_ID = at.ATN_ACCOUNTING_TRANSACTION_ID
and trunc(at.ATN_TRANSACTION_DATE) = t.CAL_DATE
and (bb.ACC_ACCOUNT_TYPE in ('1301','5383'))
group by substr(at.ATN_VOUCHER_NUMBER,1,6)
,t.MONTH_NAME
,t.FISCAL_YEAR,bb.ACC_ACCOUNT_TYPE
,aa.ACC_DEPARTMENT_CODE
,pr.PRODUCT_NAME
, case bb.ACC_ACCOUNT_TYPE when '1301' then 'Claims Paid' when '5383' then 'Claims OS' end
,case aa.ACC_DEPARTMENT_CODE when '31' then 'OD' when '32' then 'TP' when '39' then 'TP Pool' end );
end;
Thanks and Regards
VenkatIs the MV and the source tables on the same database? If this is a remote MV, then check the source site if there are any issues (TEMP, UNDO space issues).
-
Create materialized view as part of refresh group
Hello,
When I create a materialized view in 11g it automatically creates its own refresh group. How can I create the materialized group as part of an existing refresh group? (I know I can drop the individual refresh group and add the mview to the main refresh group but that is a pain).
Thank you,>
How can I create the materialized group as part of an existing refresh group?
>
You can't - you need to add the MV to the existing refresh group.
See the Add Procedure of the DBMS_REFRESH package
http://docs.oracle.com/cd/B28359_01/server.111/b28327/rarrefreshpac.htm -
Create materialized view is failing when refresh fast is used
version 10.2.0.4 on solaris
This statement is working fine
CREATE MATERIALIZED VIEW MVIEW1
TABLESPACE MIS_CURD01
BUILD IMMEDIATE
as
SELECT ACTIVITY_ID "ACTIVITY_ID",
ASSOC_ID "ASSOC_ID",
PIT_ROLE_CODE "PIT_ROLE_CODE",
PIT_BANK_CODE "PIT_BANK_CODE",
PIT_COST_CENTER "PIT_COST_CENTER",
RESP_ASSOC_IND "RESP_ASSOC_IND"
FROM TABLE1@DBLINK;
The statement with fast refresh is failing with this error message
ERROR at line 18:
ORA-12018: following error encountered during code generation for
"TABLE1"
ORA-00942: table or view does not exist
Here is the statement
CREATE MATERIALIZED VIEW MVIEW1
TABLESPACE MIS_CURD01
NOCACHE
LOGGING
NOCOMPRESS
NOPARALLEL
BUILD IMMEDIATE
USING INDEX TABLESPACE MIS_CURI01
REFRESH FAST ON DEMAND
WITH PRIMARY KEY
AS
SELECT ACTIVITY_ID "ACTIVITY_ID",
ASSOC_ID "ASSOC_ID",
PIT_ROLE_CODE "PIT_ROLE_CODE",
PIT_BANK_CODE "PIT_BANK_CODE",
PIT_COST_CENTER "PIT_COST_CENTER",
RESP_ASSOC_IND "RESP_ASSOC_IND"
FROM TABLE1@DBLINK;
Any idea what's going wrong here. Thanks for your help in advance.
Edited by: user11319873 on Jun 30, 2010 4:17 PMRefresh FAST requires that
a. An MV Log (Snapshot Log) be created on the source table
b. The user doing the refresh (i.e. the account that the DBLink uses) has SELECT privilege on the MV Log.
Hemant K Chitale -
Materialized view takes long to refresh
On Oracle 11g2, I created a materialized view fast refresh on commit CREATE MATERIALIZED VIEW mv_case
PARALLEL BUILD IMMEDIATE REFRESH FAST ON COMMIT ENABLE QUERY REWRITE AS
SELECT p.jperson_id,offense_id,CASE_SENTENCE_DATE,court_ref,CASE_COURT_ORI,
c.CASE_VERDICT_DATE,CASE_DOCKET,c.CASE_EXPUNGED,c.jcase_id,cc.CYCLEID_ID,
p.rowid p_rowid,xc.rowid xc_rowid,c.rowid c_rowid,cxo.rowid cxo_rowid,cc.rowid cc_row_id
FROM jperson p,jperson_x_jcase xc,jcase c,jcase_x_offense cxo,jcase_x_cycleid cc
where p.jperson_id = xc.jperson_id(+) and xc.jcase_id = c.jcase_id(+)
and c.jcase_id = cxo.jcase_id(+) and c.jcase_id=cc.jcase_id;
create index idx_mv_case_pid on mv_case(jperson_id);
ALTER TABLE mv_case ADD (CONSTRAINT PK_MV_CASE PRIMARY KEY(jcase_id,offense_id)) ;
create index idx_mv_case_p_rowid on mv_case(p_rowid);
create index idx_mv_case_xc_rowid on mv_case(xc_rowid);
create index idx_mv_case_c_rowid on mv_case(c_rowid);
create index idx_mv_case_cxo_rowid on mv_case(cxo_rowid);
create index idx_mv_case_cc_rowid on mv_case(cc_row_id); I inserted one single row into one of the master table
insert into jcase_x_offense (offense_id,jcase_id) values ('test_row3','test_row3');
commit; The commit tooks a quite long. I looked into the trace file and the actual insert took 0.01 seconds but one of the internel DML took most of time. I copy the relevant TKPROF output for the internal DML belowINSERT INTO QAPF.MV_CASE SELECT /*+ NO_MERGE(JV$) */
MAS$4.JPERSON_ID,JV$.OFFENSE_ID,MAS$2.CASE_SENTENCE_DATE,
MAS$2.COURT_REF,MAS$2.CASE_COURT_ORI,MAS$2.CASE_VERDICT_DATE,
MAS$2.CASE_DOCKET,MAS$2.CASE_EXPUNGED,MAS$2.JCASE_ID,
MAS$0.CYCLEID_ID,MAS$4.ROWID,MAS$3.ROWID,MAS$2.ROWID,JV$.RID$,
MAS$0.ROWID
FROM ( SELECT MAS$.ROWID RID$ , MAS$.* FROM QAPF.JCASE_X_OFFENSE MAS$ WHERE ROWID IN
(SELECT /*+ HASH_SJ */ CHARTOROWID(MAS$.M_ROW$$) RID$
FROM QAPF.MLOG$_JCASE_X_OFFENSE MAS$ WHERE MAS$.XID$$ = :1 )) JV$,
JCASE_X_CYCLEID AS OF SNAPSHOT(:B_SCN) MAS$0, JCASE AS OF SNAPSHOT(:B_SCN) MAS$2,
JPERSON_X_JCASE AS OF SNAPSHOT(:B_SCN) MAS$3, JPERSON AS OF SNAPSHOT(:B_SCN) MAS$4
WHERE (MAS$4.JPERSON_ID=MAS$3.JPERSON_ID(+)
AND MAS$3.JCASE_ID=MAS$2.JCASE_ID(+)
AND MAS$2.JCASE_ID=JV$.JCASE_ID(+)
AND MAS$2.JCASE_ID=MAS$0.JCASE_ID)
AND NOT EXISTS (
SELECT 1 FROM QAPF.MV_CASE SNA2$
WHERE (SNA2$.P_ROWID = MAS$4.ROWID)
AND (SNA2$.XC_ROWID = MAS$3.ROWID OR MAS$3.ROWID IS NULL )
AND (SNA2$.C_ROWID = MAS$2.ROWID OR MAS$2.ROWID IS NULL )
AND (SNA2$.CC_ROW_ID = MAS$0.ROWID OR MAS$0.ROWID IS NULL )
AND JV$.RID$ IS NULL)
AND NOT EXISTS (
SELECT 1 FROM JCASE_X_OFFENSE MAS_INNER$, JCASE AS OF SNAPSHOT(:B_SCN) MAS_OUTER$
WHERE MAS$2.ROWID = MAS_OUTER$.ROWID AND JV$.RID$ IS NULL
AND MAS_OUTER$.JCASE_ID=MAS_INNER$.JCASE_ID)
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 99.51 364.87 377012 17412972 1 0
Fetch 0 0.00 0.00 0 0 0 0
total 2 99.51 364.87 377012 17412972 1 0
Rows Row Source Operation
0 LOAD TABLE CONVENTIONAL (cr=17412968 pr=377012 pw=120527 time=0 us)
0 FILTER (cr=17412968 pr=377012 pw=120527 time=0 us)
3363837 HASH JOIN RIGHT OUTER (cr=264914 pr=280254 pw=120527 time=35845080 us cost=299444 size=1029332286 card=3363831)
1 VIEW (cr=112490 pr=180864 pw=119722 time=0 us cost=30743 size=78 card=1)
1 HASH JOIN SEMI (cr=112490 pr=180864 pw=119722 time=0 us cost=72627 size=208 card=1)
11354346 TABLE ACCESS FULL JCASE_X_OFFENSE (cr=112488 pr=112447 pw=0 time=4814838 us cost=30703 size=749386770 card=11354345)
1 TABLE ACCESS BY INDEX ROWID MLOG$_JCASE_X_OFFENSE (cr=2 pr=0 pw=0 time=0 us cost=1 size=142 card=1)
1 INDEX RANGE SCAN IDX_MLOG$_XID_JCASE_X_OFFENSE (cr=1 pr=0 pw=0 time=0 us cost=1 size=0 card=1)(object id 98375)
3363837 HASH JOIN (cr=152424 pr=99390 pw=805 time=29973970 us cost=268690 size=766953468 card=3363831)
2994042 INDEX FAST FULL SCAN JPERSON_I0 (cr=18134 pr=0 pw=0 time=772990 us cost=17450 size=134731845 card=2994041)(object id 83738)
3363837 HASH JOIN (cr=134290 pr=99390 pw=805 time=25292580 us cost=212128 size=615581073 card=3363831)
3363837 HASH JOIN (cr=69008 pr=34127 pw=805 time=4750330 us cost=101637 size=393568929 card=3363837)
3363837 TABLE ACCESS FULL JCASE_X_CYCLEID (cr=33337 pr=33322 pw=0 time=2942460 us cost=33569 size=222013242 card=3363837)
6586646 TABLE ACCESS FULL JCASE (cr=35671 pr=0 pw=0 time=1584102 us cost=35988 size=335918895 card=6586645)
6586635 TABLE ACCESS FULL JPERSON_X_JCASE (cr=65282 pr=65263 pw=0 time=5446686 us cost=65632 size=434717844 card=6586634)
3363837 FILTER (cr=17148054 pr=96758 pw=0 time=0 us)
3363837 MAT_VIEW ACCESS BY INDEX ROWID MV_CASE (cr=17148054 pr=96758 pw=0 time=0 us cost=7 size=40 card=1)
32464070 INDEX RANGE SCAN IDX_MV_CASE_P_ROWID (cr=4489770 pr=15250 pw=0 time=19576798 us cost=3 size=0 card=7)(object id 98467)
0 FILTER (cr=0 pr=0 pw=0 time=0 us)
0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us cost=4 size=78 card=1)
0 TABLE ACCESS BY USER ROWID JCASE (cr=0 pr=0 pw=0 time=0 us cost=1 size=45 card=1)
0 INDEX RANGE SCAN JCASE_X_OFFENSE_I0 (cr=0 pr=0 pw=0 time=0 us cost=3 size=33 card=1)(object id 83623)Questions:
1) what are the objects like JCASE AS OF SNAPSHOT(:B_SCN) ? Can I index them? I tried access it but got error
select * from JCASE AS OF SNAPSHOT(:B_SCN) ;
ORA-08187: snapshot expression not allowed here
08187. 00000 - "snapshot expression not allowed here"
*Cause: A snapshot expression using AS OF was specified when not allowed.
*Action: Do not use the AS OF clause
2) In the inline view following the firs FROM, it used ROWID in where clause. I tried create an index on ROWID, and error
create index idx_jcase_offense_rid on JCASE_X_OFFENSE(rowid)
ERROR at line 1:
ORA-00904: : invalid identifier
Note: I checked that I have indexes all fields in all where clauses in the DML except rowid.
Thanks for help.sybrand_b wrote:
1 Apparently Oracle is using Flashback technology when no materialized view logs have been set up
As your MV is a complex MV it is not a candidate for FAST REFRESH ON COMMIT.
I haven't looked closely at how 11.2 has changed the "fast refresh on commit" - but I would have expected it to raise an Oracle error when the OP tried to create the materialized view with that option if it were not possible.
I think your first comment is probably the more important one - if the user sets up suitable materialized view logs on all the tables in the outer join then it's possible that the fast refresh could work properly.
This is pure speculation, of course, based on the absence of an error message.
Regards
Jonathan Lewis
http://jonathanlewis.wordpress.com
http://www.jlcomp.demon.co.uk
To post code, statspack/AWR report, execution plans or trace files, start and end the section with the tag {noformat}{noformat} (lowercase, curly brackets, no spaces) so that the text appears in fixed format.
There is a +"Preview"+ tab at the top of the text entry panel. Use this to check what your message will look like before you post the message. If it looks a complete mess you're unlikely to get a response. (Click on the +"Plain text"+ tab if you want to edit the text to tidy it up.)
+"Science is more than a body of knowledge; it is a way of thinking"+
+Carl Sagan+ -
Materialized Views created using ROLLUP
Not sure if this one is best posted to a general Oracle forum, or even to the Discoverer Forum, but it's more to do with Data Warehousing so here goes...
1. If I create a materialized view, either with or without OWB, do I also need to separately create indexes on the materialized view?
2. If I create them using GROUP BY and ROLLUP (to create summaries that calculate all the subtotals along all hierarchies and dimensions), would any subsequent query have to use GROUP BY and ROLLUP to qualify for query rewrite?
3. If I create them using GROUP BY and ROLLUP, would the queries generated by Discoverer ever get rewritten, as I assume they would not use GROUP BY and ROLLUP as these were not features found in earlier versions of Oracle?
Any advice gratefully received.
MarkThanks for replying, Igor.
Just to clarify:
1. Do MV's created without fash refresh capabilities still get indexes created automatically? If not, should you manually create them in this instance?
2. Can you confirm that, if a MV gets created using GROUP BY and ROLLUP (to potentially calculate all dimension intersections in one go), users queries to the base fact table do not have to use ROLLUP in their GROUP BY clause - they will still get rewritten ok?
3. You mentioned that Discoverer generates queries using GROUP BY - does it ever use GROUP BY ROLLUP if it knows it's working on an Oracle 9i platform?
I guess where i'm coming from, is that we're considering using the OLAP Summary Manager within OEM to create materialized views, rather than the normal summary adviser, as this creates MV's designed to hold (R)OLAP cubes (as detailed at http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96520/mv.htm#574241). I wouldn't however want to use these if user's queries had to specify ROLLUP in their GROUP by clause to qualify for query rewrite.
Getting back to OWB, are there any plans to improve the support for importing, designing and refreshing materialized views in the Paris release of OWB? Summary management is perhaps a bit of a weak spot in OWB, and it'd be good if Hierarchical Cube Materialized Views - which are an excellent new feature in 9i - were supported in future releases.
best regards
Mark Rittman -
Query on Materialized View created on Prebuilt Table
Hi,
I am trying to explain the scenario below on Materialized View which I want to setup for our database.
I have created a materialized view on prebuilt table on target side on primary key. Now for purging history data from target side which are more than 5 years old I have executed the following steps:
1. Dropped the materialized view which was created previously on prebuilt table in target side.
2. Deleted the data from that target table which are more than 5 years old.
3. Now created the materialized view again on the prebuilt table.
Now, the problem which I am facing is that - if any changes happens in the source side during the above 3 steps on the target side those changed records were not captured even after successfully building materialized view again in the target side (i.e. after completing step-3 of above the intermediate changed records were not captured).
Can you please let me know exactly what I am doing wrong here and how can I achieve my intended result.
Regards,
KoushikSee matelink for doc id *252246.1*. The document id says: A materialized view was defined on a Table A. This table had a referential constraint defined against another table, Table B. This constraint was defined as 'ON DELETE CASCADE'. An 'ON DELETE CASCADE' constraint is not allowed on views but as the constraint was created on the table underlying the materialized view, Table A, it could be created although it would behave as a constraint on the view. The constraint existed for performance reasons, which is permitted, and was disabled when created but a general script had been run to enable all constraints. When a delete was performed on Table B the error above was reported although there was no view created on Table B.
-
Materialized view logs for Fast refreshes
Hi,
I created MV and MV logs on the base table/main table. I set the base table in NOLOGGING MODE. so ofcourse redo is not gonna generate during DML but i wanted to know that:
Will NOLOGGING effect the MV logs for fast refreshes?
I came up on conclusion that MV logs are nothing to do with Redo Logs and would have no impact on MV logs for fast refresh since i have set my all base table in NOLOGGING MODE.
Looking forward for expert opinion.
REGARDS,Though I'm not an expert...
SQL> alter table emp nologging;
Table altered.
SQL> create materialized view log on emp;
Materialized view log created.
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
EMP TABLE
BONUS TABLE
SALGRADE TABLE
RUPD$_EMP TABLE
MLOG$_EMP TABLE
SQL> insert into emp values(1000,'Matt','Test',100,sysdate,1000,1000,10,11,11);
1 row created.
SQL> select *From mlog$_emp;
EMPNO SNAPTIME$ D O
CHANGE_VECTOR$$
1000 01-JAN-00 I N
FEFF -
Oracle Materialized view tables not getting refreshed automatically.
At Destination:--
CREATE MATERIALIZED VIEW PROG_MEDIA
TABLESPACE ONA_TS1
BUILD IMMEDIATE
REFRESH FAST with rowid
START WITH SYSDATE
NEXT SYSDATE+1/96
AS (select /*+ PARALLEL(a,6) */ * from PROG_MEDIA@onair a);
exec dbms_mview.refresh('PROG_MEDIA','C');
At Source:--
CREATE MATERIALIZED VIEW LOG ON ONAIR.PROG_MEDIA
TABLESPACE MVLOG
WITH ROWID;
Fired manually:--
13:00:43 SQL> exec dbms_mview.refresh('PROG_MEDIA','C');
PL/SQL procedure successfully completed.
At source:--
13:18:35 SQL> select PROG_MEDIA_ID,PROG_MEDIA_NAME from PROG_MEDIA where PROG_MEDIA_ID='102226';
PROG_MEDIA_ID
PROG_MEDIA_NAME
102226
test
At Destination:--
14:03:28 SQL> select PROG_MEDIA_ID,PROG_MEDIA_NAME from PROG_MEDIA where PROG_MEDIA_ID='102226';
PROG_MEDIA_ID PROG_MEDIA_NAME
102226 UTSAV-5-162077
JOB LOG_USER THIS_DATE LAST_DATE_TIME NEXT_DATE_TIME INTERVAL FAILURES WHAT
242 ONAIR 17-05-11 14:17:24 SYSDATE+1/96 7 dbms_refresh.refresh('"ONAIR"."PROG_MEDI
A"');
242 ONAIR 17-05-11 14:32:25 SYSDATE+1/96 8 dbms_refresh.refresh('"ONAIR"."PROG_MEDI
A"');
1> I have scheduled this refresh job for every 15mins, but its not getting executed. Also my job_queue_process is '20'. Whenever i execute it manually it get's refresh.
2> I can schedule a cron for the same for every 15mins but i really dont want to do it.
Kindly help me out.Hi,
I have created MV_CAPABILITIES_TABLE & executed below commands:--
17:56:54 SQL> EXECUTE DBMS_MVIEW.EXPLAIN_MVIEW ('"ONAIR"."PROG_MEDIA"');
PL/SQL procedure successfully completed.
17:57:26 SQL> SELECT capability_name, possible, SUBSTR(related_text,1,8)
17:57:27 2 AS rel_text, SUBSTR(msgtxt,1,60) AS msgtxt
17:57:27 3 FROM MV_CAPABILITIES_TABLE
17:57:27 4 ORDER BY seq;
CAPABILITY_NAME P REL_TEXT MSGTXT
PCT N
PCT N
REFRESH_COMPLETE Y
REFRESH_COMPLETE Y
REFRESH_FAST Y
REFRESH_FAST Y
REWRITE N
REWRITE N
PCT_TABLE N PROG_MED relation is not a partitioned table
PCT_TABLE N PROG_MED relation is not a partitioned table
REFRESH_FAST_AFTER_INSERT Y
REFRESH_FAST_AFTER_INSERT Y
REFRESH_FAST_AFTER_ONETAB_DML Y
REFRESH_FAST_AFTER_ONETAB_DML Y
REFRESH_FAST_AFTER_ANY_DML Y
REFRESH_FAST_AFTER_ANY_DML Y
REFRESH_FAST_PCT N PCT is not possible on any of the detail tables in the mater
REFRESH_FAST_PCT N PCT is not possible on any of the detail tables in the mater
REWRITE_FULL_TEXT_MATCH N PROG_MED mv references a remote table or view in the FROM list
REWRITE_FULL_TEXT_MATCH N PROG_MED mv references a remote table or view in the FROM list
REWRITE_FULL_TEXT_MATCH N query rewrite is disabled on the materialized view
REWRITE_FULL_TEXT_MATCH N query rewrite is disabled on the materialized view
REWRITE_PARTIAL_TEXT_MATCH N materialized view cannot support any type of query rewrite
REWRITE_PARTIAL_TEXT_MATCH N materialized view cannot support any type of query rewrite
REWRITE_PARTIAL_TEXT_MATCH N query rewrite is disabled on the materialized view
REWRITE_PARTIAL_TEXT_MATCH N query rewrite is disabled on the materialized view
REWRITE_GENERAL N materialized view cannot support any type of query rewrite
REWRITE_GENERAL N materialized view cannot support any type of query rewrite
REWRITE_GENERAL N query rewrite is disabled on the materialized view
REWRITE_GENERAL N query rewrite is disabled on the materialized view
REWRITE_PCT N general rewrite is not possible or PCT is not possible on an
REWRITE_PCT N general rewrite is not possible or PCT is not possible on an
PCT_TABLE_REWRITE N PROG_MED relation is not a partitioned table
PCT_TABLE_REWRITE N PROG_MED relation is not a partitioned table
34 rows selected.
Elapsed: 00:00:00.09
What to be done next?
Also i fired the job manually by:--
17:38:02 SQL> set serveroutput on
17:39:45 SQL> EXEC DBMS_JOB.RUN(242);
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.48
Maybe you are looking for
-
Indesign CS5 application crash
Problem details below. Problem signature: Problem Event Name: APPCRASH Application Name: InDesign.exe Application Version: 7.0.0.355 Application Timestamp:
-
Hello, I was trying the upgrade from today and here is my error log: :: Synchronizing package databases... core is up to date extra is up to date community is up to date archlinuxfr is up to date :: Starting full system upgrade... resolving dependenc
-
Create delivery with sales order reference.
Dear all, I created a sales order with sales area (1000,10,00) and order type(or). when i am creating a delivery with sales order reference , error is occurring. error:(Order cannot be delivered (see long text)). plz solve the pr
-
I have a Mac Pro (early 2009) System Version: Mac OS X 10.6.8 (10K549) I have XP installed on Bootcamp. The keyboard control keys don't seem to work properly. I would like to upgrade the OS and Bootcamp version. Which is the best OS to upgrade to?
-
Hi All, I've searched through the forums and have found some similar issues but nothing exactly like this. I am editing a music concert that was shot in PAL. The audio was also recorded separately and has been edited and mixed in ProTools. When I tak