Materialized View Initial Creation vs Complete Refresh - MAJOR differences
Hi All,
I am currently in the process of setting up MV's for replication via a DBLink and have noticed something that I find quite odd. Basically If I create an MV I get v. large differences than when I do a complete refresh on the same MV after the initial "load". Actual stats are shown below :
Action TimeTaken Undo Reqd (Bytes)
Initial Load 00:01:07 37254998
Complete Refresh 00:02:41 463919012
Question is why does a complete refresh require 12x the amount of Undo than the creation of the MV? I though tit would be roughly the same or at most twice as much?
The Instance is only being used by myself so no other processes are causing this difference and this can be reproduced. Undo calculated from V$ROLLSTAT.
Thanks
MH
Hi tekicora,
Thanks for your help and suggestions. I have tried this method of evaluating UNDO with the following results:
STATISTIC# NAME SID VALUE
176 undo change vector size 115 132
CREATE MATERIALIZED VIEW mytest1
TABLESPACE TABSPACEA NOLOGGING BUILD IMMEDIATE
USING INDEX TABLESPACE TABSPACEB REFRESH FORCE WITH ROWID ON DEMAND AS
select * from ptable@remdb;
STATISTIC# NAME SID VALUE
176 undo change vector size 115 332860
exec DBMS_MVIEW.REFRESH('MYTEST1', 'C',ATOMIC_REFRESH=>TRUE);
STATISTIC# NAME SID VALUE
176 undo change vector size 115 261460092
exec DBMS_MVIEW.REFRESH('MYTEST1', 'C',ATOMIC_REFRESH=>FALSE);
STATISTIC# NAME SID VALUE
176 undo change vector size 115 272282756
This is still creating masses of undo (particulalry atomic refresh). Could this be because mv table source is on a remote db?
Thanks
Mark H
Message was edited by:
markyb0y
Similar Messages
-
Is it possible to create materialized view log file for force refresh
Is it possible to create materialized view log file for force refresh with join condition.
Say for example:
CREATE MATERIALIZED VIEW VU1
REFRESH FORCE
ON DEMAND
AS
SELECT e.employee_id, d.department_id from emp e and departments d
where e.department_id = d.department_id;
how can we create log file using 2 tables?
Also am copying M.View result to new table. Is it possible to have the same values into the new table once the m.view get refreshed?You cannot create a record as a materialized view within the Application Designer.
But there is workaround.
Create the record as a table within the Application Designer. Don't build it.
Inside your database, create the materialized with same name and columns as the record created previously.
After that, you'll be able to work on that record as for all other within the Peoplesoft tools.
But keep in mind do never build that object, that'll drop your materialized view and create a table instead.
Same problem exists for partitioned tables, for function based-indexes and some other objects database vendor dependant. Same workaround is used.
Nicolas. -
Materialized view does not exist upon refresh
Hi all,
I got the following stack trace upon executing 'DBMS_MVIEW.REFRESH('Layout_tab','C')' to refresh an materialized view upon an object table:
ORA-23401: materialized view "MINIMOL"."LAYOUT_TAB" does not exist
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 794
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 851
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 832
The view create statement is following:
CREATE MATERIALIZED VIEW PlateLayout_tab
OF PlateLayout
CACHE
REFRESH ON DEMAND
AS
SELECT
PlateLayout(l.id,VALUE(pos),l.ComputeCheckerboardPosition(VALUE(pos)))
FROM
Layout_tab l
, TABLE(mcu_enumerate.LoopFor(1,l.wells_across * l.wells_down)) pos;
now what is going wrong? I can't even create the view with the 'REFRESH ON COMMIT' option.
Thanks,
HenrikJohn,
it is only a typo in the posted message, but the executed SQL-smt of course was:
EXECUTE DBMS_MVIEW.REFRESH('PlateLayout_tab','C');
After browsing through metalink I even tried this:
EXECUTE DBMS_MVIEW.REFRES('PlateLayout_tab','C','',TRUE,FALSE,0,0,0,TRUE);
with the same stack trace.
By the way the MVIEW is accessible via:
SELECT * FROM PlateLayout_tab
Thanks,
Henrik -
Materialized view taking long time to refresh
I want to understand why materialized view refresh takes more time than running the sql for the materialized view.
For example say I have a materialized view test_mv which is created as below; When I run just the select statement i get the result within 34 secs whereas if I try to refresh it using
BEGIN
DBMS_MVIEW.refresh ('wi_mv7_monthly','C',ATOMIC_REFRESH=>false);
end;
/This takes around 74 secs
MV creation
Oracle version : Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
create materialized view TEST_MV
COLUMN_NAME_1,
OBJECT_NAME,
COLUMN_ID,
"SUM(C.DATA_LENGTH)"
) organization heap
partition by list (COLUMN_ID) (
PARTITION "first_10_col" VALUES
1, 2, 3, 4, 5, 6, 7, 8, 9, 10
PARTITION "After_10_col" VALUES
11,12, 13, 14, 15, 16, 17, 18, 19, 20
PARTITION "NONE" VALUES (DEFAULT)
BUILD IMMEDIATE USING INDEX REFRESH COMPLETE ON DEMAND USING DEFAULT LOCAL ROLLBACK SEGMENT USING ENFORCED CONSTRAINTS
as
select /*+ parallel(o,8) parallel(c,2) */
C.COLUMN_NAME as COLUMN_NAME_1,O.OBJECT_NAME,C.COLUMN_ID,SUM(C.DATA_LENGTH) from ALL_OBJECTS O
join ALL_tab_columns c on c.table_name=o.object_name
group by
C.COLUMN_NAME,O.OBJECT_NAME,C.COLUMN_IDEdited by: user627047 on Sep 6, 2012 6:56 AMI want to understand why materialized view refresh takes more time than running the sql for the materialized view.Mview has to save the data as well .
-
Materialized View with Join for FAST Refresh
Hi Gurus,
Facing issues in MV with a simple join for FAST Refresh.
2 sample Tables:
1. employee
empid integer PK
empname varchar(50)
deptid integer FK
2. delta_employee
empid integer PK
empname varchar(50)
deptid integer FK
dmlflag varchar(2)
watermark integer
Code is as given below -
CREATE MATERIALIZED VIEW LOG ON work.employee
WITH SEQUENCE,rowid(empid)
INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW LOG ON work.delta_employee
WITH SEQUENCE,rowid(empid)
INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW work.MVEmployee REFRESH force on
demand with rowid AS
select e.empid,e.empname,e.deptid,d.empid t1
from work.employee e, work.delta_employee d
where e.empid = d.empid;
Able to perform Complete Refresh. Not able to use Fast Refresh for
incremental refresh.
Please help.
Thanks,
J KumarFound a solution,
As per oracle documentation rowid fileds should be included in the Select statement. Even though I included the rowid fields, empid in this case it still didnt work.
The implementation of the rowid column should be included with tablename.rowid instead of the tablename.columnname !
Modified script is as given below.
CREATE MATERIALIZED VIEW WORK.MVEMPLOYEE
REFRESH FORCE ON DEMAND
WITH PRIMARY KEY
AS
select e.rowid "empid",d.rowid "t1" ,e.empname,e.deptid
from work.employee e, work.delta_employee d
where e.empid = d.empid;
And It really WORKS -
Materialized View with OLAP table function
Hi,
I am trying to materialize OLAP cubes into relational materialized views which works quite fine. After a few loadings in background in parallel with Database Jobs and DBMS_MVIEW package the peformance is getting poor. Steps I am performing:
1. Generate materialized view as DEFERRED and COMPLETE refresh
2. Generate database Jobs for refreshing views with DBMS_MVIEW.REFRESH function
3. Running Jobs in background
I have loading times the first time 10min after then over 4 hours. I also tried with ATOMIC_REFRESH=FALSE but the same result. Database is running in ARCHIVE LOGGING. Can this degrade the performance?
Any ideas?
Thanks,
ChristianHi,
yes thats correct. I am creating MVs in 10.2.0.3
Here is an example:
CREATE MATERIALIZED VIEW "FCRSGX"."MV_F_ICCC_C11"
ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 COMPRESS NOLOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "FCRSGX_CONSO_RELATIONAL"
BUILD DEFERRED
USING INDEX
REFRESH COMPLETE ON DEMAND
USING DEFAULT LOCAL ROLLBACK SEGMENT
DISABLE QUERY REWRITE
AS SELECT ENTITY, REVE_ICC, RP_ICC, MV_ICC, PERIOD, MEASURE, AMOUNT, R2C
FROM TABLE(OLAP_TABLE('FCRSGX.CONSODATA DURATION SESSION',
DIMENSION ENTITY as varchar2(8) FROM ENTITY
DIMENSION REVE_ICC as varchar2(8) FROM REVE_ICC
DIMENSION RP_ICC as varchar2(8) FROM RP_ICC
DIMENSION MV_ICC as varchar2(8) FROM MV_ICC
DIMENSION PERIOD as varchar2(8) FROM GMONTH
DIMENSION MEASURE as varchar2(30) FROM EXPR
MEASURE AMOUNT as number FROM ICCC.C11
LOOP CMPE.ICCC.C11
ROW2CELL R2C '))
WHERE OLAP_CONDITION(r2c, 'lmt entity to CMPE.ICCC.C11')=1
AND OLAP_CONDITION(r2c, 'lmt reve_icc to CMPE.ICCC.C11')=1
AND OLAP_CONDITION(r2c, 'lmt mmonth to sapload.per eq y')=1
AND OLAP_CONDITION(r2c, 'lmt gmonth to charl(mmonth) ')=1
AND OLAP_CONDITION(r2c, 'lmt rp_icc to CMP.ICCC.C11 ')=1
AND OLAP_CONDITION(r2c, 'lmt mv_icc to CMP.ICCC.C11 ')=1
AND OLAP_CONDITION(r2c, 'lmt expr to ''F.ICCC.C11'' ')=1
MODEL
DIMENSION BY(ENTITY,REVE_ICC,RP_ICC,MV_ICC,PERIOD,MEASURE)
MEASURES(AMOUNT,R2C)
RULES UPDATE SEQUENTIAL ORDER()
; -
Hi,
Could any of you please confirm that we always require a Materialized View Log on the table(s) at the Master site for FAST REFRESH to work on the Materialized View.
If we do not have a Materialized View Log on, the Materialized View always do a COMPLETE REFRESH.
Thanks,
Chanjalhttp://download.oracle.com/docs/cd/E11882_01/server.112/e10713/schemaob.htm#CNCPT411
-
Need help on tuning materialized view refresh
Hi All,
I am working on materialized view refresh tuning.Initially it was complete refresh and used to take more than 90 mins to complete.
I changed it to fast refresh now it is completing fast. Now i have partitioned the base tables gl_balances and gl_code_combinations of column code_combination_id and created a local index on column code_combination_id then i am trying to partition the materialized on the same column to take advantage of partition change tracking.
Size of gl_balances base tables is 40Gb and all others tables sizes are small. In where clause there all the 4 tables are mapped. If i will create the partition only on code_combination_id will i the materialized will become the candidate for partition change tracking. As i know it will be applicable for PCT. I need expert advice on this.
While doing a fast refresh. the refresh takes less time. when there is a change in gl_balances , gl_code_combinations or gl_periods it completes in 20-30 mins. When there is a change in gl_set_of_books tables. It creates a problem here.DEL query takes more than 48 hours to complete.
CREATE MATERIALIZED VIEW apps.BAL_PART
REFRESH FAST ON DEMAND
ENABLE QUERY REWRITE as
SELECT GL.GL_CODE_COMBINATIONS21.ROWID C1,GL.GL_BALANCES21.ROWID C2, GL.GL_SETS_OF_BOOKS.ROWID C3,
GL.GL_PERIOD.ROWID C4,
"GL"."GL_BALANCES21"."ACTUAL_FLAG" ,
"GL"."GL_BALANCES21"."CURRENCY_CODE" ,
"GL"."GL_BALANCES21"."PERIOD_NUM" ,
"GL"."GL_BALANCES21"."PERIOD_YEAR" ,
"GL"."GL_BALANCES21"."SET_OF_BOOKS_ID" "SOB_ID",
"GL"."GL_CODE_COMBINATIONS21"."CODE_COMBINATION_ID" "CCID",
"GL"."GL_CODE_COMBINATIONS21"."SEGMENT1" ,
"GL"."GL_CODE_COMBINATIONS21"."SEGMENT10" ,
"GL"."GL_CODE_COMBINATIONS21"."SEGMENT11" ,
"GL"."GL_CODE_COMBINATIONS21"."SEGMENT12" ,
"GL"."GL_CODE_COMBINATIONS21"."SEGMENT13" ,
"GL"."GL_CODE_COMBINATIONS21"."SEGMENT14" ,
"GL"."GL_CODE_COMBINATIONS21"."SEGMENT2" ,
"GL"."GL_CODE_COMBINATIONS21"."SEGMENT3" ,
"GL"."GL_CODE_COMBINATIONS21"."SEGMENT4" ,
"GL"."GL_CODE_COMBINATIONS21"."SEGMENT5" ,
"GL"."GL_CODE_COMBINATIONS21"."SEGMENT6" ,
"GL"."GL_CODE_COMBINATIONS21"."SEGMENT7" ,
"GL"."GL_CODE_COMBINATIONS21"."SEGMENT8" ,
"GL"."GL_CODE_COMBINATIONS21"."SEGMENT9" ,
"GL"."GL_PERIODS"."PERIOD_NAME" ,
NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_CR", 0) Open_Bal_Cr,
NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_CR", 0) +
NVL("GL"."GL_BALANCES21"."PERIOD_NET_CR", 0) Close_Bal_Cr,
NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_DR", 0) Open_Bal_Dr,
NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_DR", 0) +
NVL("GL"."GL_BALANCES21"."PERIOD_NET_DR", 0) Close_Bal_Dr,
NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_DR", 0) -
NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_CR", 0) Open_Bal,
NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_DR", 0) -
NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_CR", 0) +
NVL("GL"."GL_BALANCES21"."PERIOD_NET_DR", 0) -
NVL("GL"."GL_BALANCES21"."PERIOD_NET_CR", 0) Close_Bal,
NVL("GL"."GL_BALANCES21"."PERIOD_NET_CR", 0) Period_Cr,
NVL("GL"."GL_BALANCES21"."PERIOD_NET_DR", 0) Period_Dr
FROM GL.GL_CODE_COMBINATIONS21,
GL.GL_BALANCES21,
GL.GL_SETS_OF_BOOKS,
GL.GL_PERIODS
WHERE GL.GL_BALANCES21.CODE_COMBINATION_ID =GL.GL_CODE_COMBINATIONS21.CODE_COMBINATION_ID
AND GL.GL_SETS_OF_BOOKS.SET_OF_BOOKS_ID = GL.GL_BALANCES21.SET_OF_BOOKS_ID
AND GL.GL_PERIODS.PERIOD_NUM = GL.GL_BALANCES21.PERIOD_NUM
AND GL.GL_PERIODS.PERIOD_YEAR = GL.GL_BALANCES21.PERIOD_YEAR
AND GL.GL_PERIODS.PERIOD_TYPE = GL.GL_BALANCES21.PERIOD_TYPE
AND GL.GL_PERIODS.PERIOD_NAME = GL.GL_BALANCES21.PERIOD_NAME
AND GL.GL_PERIODS.PERIOD_SET_NAME = GL.GL_SETS_OF_BOOKS.PERIOD_SET_NAME
and gl.GL_CODE_COMBINATIONS21.summary_flag != 'Y'TRACE 1046 del statement
DELETE FROM "APPS"."apps.BAL_PART" SNA$
WHERE "C3" IN (SELECT /*+ NO_MERGE */ * FROM (SELECT
CHARTOROWID("MAS$"."M_ROW$$") RID$ FROM "GL"."MLOG$_GL_SETS_OF_BOOKS"
"MAS$" WHERE "MAS$".SNAPTIME$$ > :B_ST1 ) AS OF SNAPSHOT(:B_SCN) MAS$)
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 17759.00 171782.99 159422121 1267371 2564144739 0
Fetch 0 0.00 0.00 0 0 0 0
total 2 17759.00 171782.99 159422121 1267371 2564144739 0
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 175 (APPS) (recursive depth: 1)
Rows Row Source Operation
0 DELETE apps.BAL_PART (cr=0 pr=0 pw=0 time=0 us)
193128740 NESTED LOOPS (cr=592437 pr=592422 pw=0 time=945244160 us cost=339302 size=168 card=1)
3 SORT UNIQUE (cr=7 pr=0 pw=0 time=15832 us cost=2 size=138 card=1)
24 TABLE ACCESS FULL MLOG$_GL_SETS_OF_BOOKS (cr=7 pr=0 pw=0 time=19 us cost=2 size=138 card=1)
193128740 INDEX RANGE SCAN C3BOOKS (cr=592430 pr=592422 pw=0 time=789499200 us cost=339299 size=3318314250 card=110610475)(object id 2114736)
error during execute of EXPLAIN PLAN statement
ORA-08187: snapshot expression not allowed here
parse error offset: 314
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
db file sequential read 159520897 2.12 144415.96
latch: cache buffers chains 134 0.06 0.68
latch: undo global data 33 0.02 0.15
latch: object queue header operation 521 0.02 0.53
log file switch (private strand flush incomplete)
532 0.31 28.26
resmgr:cpu quantum 155 1.40 13.49
resmgr:internal state change 25 0.11 2.21
latch free 10 0.00 0.00
latch: cache buffers lru chain 4 0.00 0.00
rdbms ipc reply 489 0.02 0.54
reliable message 587 0.00 0.56
latch: row cache objects 3 0.00 0.00
********************************************************************************GL_SETS_OF_BOOKS has only 6 rows. I know there is complete refresh as a option which will again take more than 90 mins.
I want to do the fast refresh. Tables rows details below.
SQL> select count(*) from gl.gl_code_combinations21;
COUNT(*)
3075255
SQL> select count(*) from gl.GL_PERIODS;
COUNT(*)
1160
SQL> select count(*) from gl.gl_balances21;
COUNT(*)
477613527
SQL> select count(*) from gl.gl_sets_of_books;
COUNT(*)
6gl_sets_of_books has less rows. Whenever there is a change then it mapped to huge rows hence during materialized view has delete huge number of rows.
select count(*) from apps.BAL_PART group by C3;
C3 is the rowid which is present in create materialized statement.
COUNT(*)
292927011
210215
69330
184406971
Is there any way to improve the plan. As i created a partition on code_combination_id and local index on code_combination_id which will not help in set_of_books_id case. I dont PCT will help here or not. Is it possible to use PCT refresh by equipartitioning only one column in where clause.
Please assist me in improving refresh of materialized view using fast refresh.
Thanks and Regards,
Edited by: user646034 on Feb 23, 2013 11:13 PM
Edited by: user646034 on Feb 23, 2013 11:19 PM
Edited by: user646034 on Feb 23, 2013 11:46 PM
Edited by: user646034 on Feb 25, 2013 11:46 AMHi
The below explain without index and with index.
/* MV_REFRESH (DEL) */ DELETE FROM "APPS"."BAL_PART
" SNA$ WHERE "C3" IN (SELECT /*+ NO_MERGE */ * FROM (SELECT
CHARTOROWID("MAS$"."M_ROW$$") RID$ FROM
"GL"."MLOG$_GL_SETS_OF_BOOKS" "MAS$" WHERE "MAS$".SNAPTIME$$ > :B_ST1
) AS OF SNAPSHOT(:B_SCN) MAS$)
Plan hash value: 2704021294
| Id | Operation | Name | E-Rows |E-Bytes| Cost (%CPU)| E-Time |
| 0 | DELETE STATEMENT | | | | 339K(100)| |
| 1 | DELETE | BAL_PART | | | | |
| 2 | NESTED LOOPS | | 1 | 168 | 339K (1)|999:59:59 |
| 3 | SORT UNIQUE | | 1 | 138 | 2 (0)| 00:02:31 |
| 4 | TABLE ACCESS FULL| MLOG$_GL_SETS_OF_BOOKS | 1 | 138 | 2 (0)| 00:02:31 |
| 5 | INDEX RANGE SCAN | C3BOOKS | 110M| 3164M| 339K (0)|999:59:59 |
If i will not use the C3 index then the query will use the belolw plan, I guess this will also take same time or more time.
| 0 | DELETE STATEMENT | | | | 9743K(100)| |
| 1 | DELETE | BAL_PART | | | |   -
Refresh time for Materialized View
Hi,
I have created a materialized view and set it to refresh everyday at 4 am . When I check the status of the job , it shows the refresh timing between 20 mins to 4 hours . That means , some times it takes 20 mins to refresh , some times 40 , some time 2 hours and some times up to 4 hours. Any reason for the wide range ? Here is the query for the view.
CREATE MATERIALIZED VIEW BDS_COST_CATEGORY_MV
ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS"
BUILD IMMEDIATE
USING INDEX
REFRESH COMPLETE ON DEMAND START WITH sysdate+0 NEXT ROUND(SYSDATE + 1) + 4/24
USING DEFAULT LOCAL ROLLBACK SEGMENT
DISABLE QUERY REWRITE
AS SELECT AC.ACCOUNT_MANAGER, AC.ACCOUNT_NUMBER,
AC.ACCOUNT_NAME, DIV.DIVISION_NUMBER, ITEM.CODE_ID,
ITEM.CODE_NAME COST_CATEGORY_ITEM,
TO_NUMBER(TO_CHAR(AP.FIRST_DAY,'YYYY')) PERIOD_YEAR,
AP.FIRST_DAY PERIOD,
SUM(NVL(AD.CURRENT_EXPENSE,0)) EXPENSE
FROM ACCOUNTS AC, PERSONNEL AC_MGR, DIVISIONS DIV, ASR_HEADERS AH , ASR_DETAILS AD, CODES ITEM, CODES COSTCAT, ALL_PERIODS AP,
CODES COST_ELEMENT, ACCOUNTING_BASE_GROUP ABG
WHERE AC.ACCOUNT_MANAGER = AC_MGR.PERSONNEL_ID
AND AC_MGR.DIVISION_ID = DIV.DIVISION_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 = 'BDS' OR ( COSTCAT.CODE_NAME = 'Base' AND ITEM.CODE_NAME = 'MTDC'))
GROUP BY AC.ACCOUNT_MANAGER,AC.ACCOUNT_NUMBER, AC.ACCOUNT_NAME,
DIV.DIVISION_NUMBER, ITEM.CODE_ID, ITEM.CODE_NAME,
TO_NUMBER(TO_CHAR(AP.FIRST_DAY,'YYYY')), AP.FIRST_DAYThis appears to be a duplicate of Refreshing Materilized view. I replied on the other thread.
Justin -
How do I monitor the actual refresh of materialized view.
Hi See below,
I am creating the materialized view.
It took a while to see the actual data in the table. Do you any reason.
How do I, investigate, if there is any issue, how do I monitor the actual refresh.
I am worried since, it look long time to see the actual data, after creating the materialized view.
SQL> @"ee_grant_details_mview.sql.bkp"
Snapshot dropped.
Snapshot created.
SQL>
select count(*) from grant_details_mview;SQL>
COUNT(*)
0
SQL> select count(*) from grant_details_mview;
COUNT(*)
0
SQL> commit;
Commit complete.
SQL> select count(*) from grant_details_mview;
COUNT(*)
0
SQL> select count(*) from grant_details_mview;
COUNT(*)
0
SQL> select count(*) from grant_details_mview;
COUNT(*)
0
SQL> select count(*) from grant_details_mview;
COUNT(*)
0
SQL> select count(*) from grant_details_mview;
COUNT(*)
344466
SQL>During the initial building of the materialized view, the data is not available to users until the refresh completes.
If you are talking about subsequent refreshes, you have a few options
- Can the materialized view be made fast refreshable?
- If not, can you put the materialized view be put into a refresh group? This will increase the time required to refresh, since Oracle would be deleting and inserting rather than truncating and inserting, but the old data will remain available for users until the refresh completes.
Note that the Replication or Database - General forums might be more appropriate for this sort of question. You may want to move further discussion to one of those forums.
Justin -
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 -
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 :-) . -
Regd FAST refresh option in a Materialized view
Hi All,
I am using a pipeline function in which I am creating a table of records and a few cursors to fetch data from various tables.
Now this PL/SQL table is being used to construct a Materialized view.
Creation of Materialized view is happening fine but not with FAST refresh option. It gives an error " Cannot create a FAST refresh Materialized view from a complex query."
The query which I have used for the view creation is
CREATE MATERIALIZED VIEW CUSTOM.ABC
PCTFREE 0
BUILD IMMEDIATE
REFRESH FAST ON DEMAND
AS
SELECT A.Number,
A.Guarantors_Number,
A.Guarantors_Name,
A.Personal_Garantee_PCNT,
A.Company, LG.Source_System,
A.Type_of_Info,
A.File_Gen_Date,
A.Periodicity
FROM
TABLE(CUSTOM.CDM_LG_PACK_PF.CDM_LG_FUNC) A;
where CDM_LG_PACK_PF is the package and CDM_LG_FUNC is the pipeline function I have written to fetch all the records.
Please help me on how can I do a FAST refresh on this materialized view.
Thanks in advance,
GauravWelcome to the forum!
FAST refresh doesn't mean that the operation is fast (time wise), it means it's an incremental refresh.
If you have a complex query, you can't use a FAST refresh - that's what the exception tells you. -
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+ -
Erro perforing Fast Refresh of Materialized View.
Hi Experts,
We are facing serious problem while refreshing materialized views using fast refresh option in ORACLE..
For the very first time we are performing Complete refresh of data from DB1 to DB2 for few tables.Ongoing we are performing Fast Refresh.
Sometimes the fast refresh works fine without any error and sometimes it fails with the below error.
ERROR at line 1:
ORA-32320: REFRESH FAST of "CIR"."C_BO_COMM" unsupported after cointainer table
PMOPs
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 803
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 860
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 841
ORA-06512: at line 1we came to know the folowing.
// *Cause:
A Partition Maintenance Operation (PMOP) has been performed on the materialized view,
and no materialized view supportsfast refersh after container table PMOPs.
// *Action:
Use REFRESH COMPLETE.
Note:
you can determine why your materialized view does not support fast refresh after PMOPs using
the DBMS_MVIEW.EXPLAIN_MVIEW() API.Please let u know what action to be taken to avoid this.
Please note that this error is not repeated always. Some times REFRESH FAST is happening and some times it is throwing error.
Appreicate your earliest reply.
Thank you.
Edited by: User71408 on Sep 4, 2008 11:40 PM
Edited by: User71408 on Sep 4, 2008 11:43 PM
Edited by: User71408 on Sep 5, 2008 12:38 AM9i doesn't support fast refresh after truncate. Read the metalink note 275325.1
You should be sure no truncate has been executed, or use complete refresh.
Nicolas.
Maybe you are looking for
-
Adobe acrobat pro 9 install failed
I installed adobe acrobat pro 9 right at the end it gives me a installed failed. then it complete and says your installed is complete. but it crashes all the time I tried to repair it from the help menu same thing happens install failed. then instal
-
PS : Revenue on a statistical WBS
I would like to be able to show revenue from a SD order shown against a statistical WBS element. Can somebody guide me through how I would need to set this up? Thanks, Mark
-
[SOLVED] Cannot start X session from login
I don't know what exactly is going on. I'm using the nvidia package from the repo and kernel 2.6.32.6-1. I'm having trouble starting a second X session using: startx -- :1 but this works fine su - startx -- :1 This is my xorg.conf # nvidia-settings
-
lp9 is crashing on start up. i have checked and repaired disk permissions and re installed. heres the error log. Process: Logic Pro [420] Path: /Applications/Logic Pro.app/Contents/MacOS/Logic Pro Identifier: com.apple.logic.pro Version: 9.0.0 (1660.
-
Dear All, I am very new to EP, we are planning to implement EP. Would anybody give a rough project plan for EP, Atleast any links. this is for 700 users. Thanks in advance chandrasekhar Message was edited by: chandrasekhar yadlapalli