Refresh groups to administer several materialized views?
Hi,
I had three materialized views in my database. They are used for decision support and access local data. Each one is completely refreshed at a distinct time during the night.
Now, application developers asked for more 3 materialized views. Although there is no need to guarantee referential integrity between the materialized views, it seems to me that the more efficient way to administer their refresh is by using a refresh group. Therefore, I am planning to create a refresh group with the 6 materialized views.
Is there another good way to administer refresh options of several materialized views?
Regards.
If the existing three materialized views are refreshed at distinct times during the night, I'm not sure what benefit there would be to putting the three into a single refresh group (and I'm ignoring what happens when you add the three new ones). You put multiple materialized views into a refresh group so that you can do a single refresh and so that the data is internally consistent. If you don't need the data to be consistent and you want the materialized views to be refreshed at different points in time, I'm not sure what benefit you'd derive from putting them in a refresh group.
Justin
Similar Messages
-
Refresh/Update data in a materialized view
Hi,
I have question about the data in a materialized view and how it is refreshed. My mat view has all my dimension-ids and my (for my specialize needs) aggregated measures from my fact table. I used the mat view wizard to create my view - which works perfectly. But now I wonder if I have to create some sort of mapping(?) or some sort of trigger to refresh the data in the mat view. Or is the data automatically refreshed when I start my fact table mappings. I use OWB 11gR2
thxMVs have properties for refresh - you an refresh based on schedules or when dependent data is committed or manually.
Cheers
David -
Several Materialized Views reading same log
We have a production system that refreshes it's materialized view remotely from a materialized view log on a different instance. We have created a new upgraded instance that we want to run in parallel to verify everything will work. My question is, if we have the materialized views from both system being update from the one set of logs, will we get incomplete data in each system? Are the logs maintained in the source system, or are they cleaned out once one of the destination systems refreshes from them?
The existing production database is V9i, the new one is 10g. I don't know what the version the source database is.
ThanksYou shouldn't have a problem with incomplete data.
You should see that there are two rows in DBA_REGISTERED_MVIEWS in the source system, one for each target's materialized view (you may, of course, have other rows for other materialized views). Assuming that is what you see, and assuming both show a YES for the CAN_USE_LOG, the materialized view log will ensure that both sites have processed each change before that change is purged from the log.
Justin -
Is it possible to refresh the table from a Materialized view
Hi,
Is it possible to update the underlying table on which a Materialized view is created when some changes in a Materialized view is done.Is this reverse compatibility possible in Materialized View?
Thanks in Advance,
V.DennisIf you created the materialized view as UPDATEABLE then changes to it should automatically be relected in the underlying table. If this is not occurring I suggest you check the replication jobs. You probably have a stack of errors in DEFERROR.
Cheers, APC -
Material View Refresh Slow under 10.2.0.4?
I have several material views that refreshed in minutes under 9.2.0.6, but are now taking hours under 10.2.0.4. I'm thinking it's in my initialization parameters. I remember the upgrade process making at least one of the HASH parameters obsolete.
Can anyone point me in a direction quickly?
A little more info... If I drop and recreate the materialized view from scratch it take just a few minutes to build.
Thank you.
Edited by: golflover1 on Jan 3, 2009 7:32 AM
Edited by: golflover1 on Jan 3, 2009 7:33 AMWhat type of refresh you use to refresh the Materialized Views? (COMPLETE, FAST, FORCE)
Since you migrated to 10g there is a slight difference in how Oracle does the refresh.
Prior to 10g, when a materialized view is completely refreshed the base table was truncated and then populated with a data.
Starting from 10g, the default behavior is changed and truncate is replaced with delete which results in longer refresh times.
This is expected behavior, even though there was a bug associated with it Bug#4132133 which was closed as NOT A BUG.
However, if you still want to do a truncate instead of delete, you should set atomic_refresh=>FALSE in your DBMS_MVIEW.REFRESH command. This will do a truncate and refresh will complete faster.
You should be careful about this since there will be a time when the MV will contain no data.
golflover1 wrote:
A little more info... If I drop and recreate the materialized view from scratch it take just a few minutes to build.
This just confirms what I have written above. When you drop and recreate the MV, it doesn't do the DELETE so it completes faster.
I would say, go ahead and try to refresh the view with atomic_refresh=>FALSE and compare the execution times.
begin
dbms_mview.refresh(list=>'your mv name',method=>'C',atomic_refresh=>FALSE);
end;For more about DBMS_MVIEW.REFRESH check the reference docs on this link</link>.
Cheers, -
Materialized view refresh is very slow in production
Hi,
I am using Oracle 10.2.0.4.0 version and facing problem in Materialized view refresh in production.
There is a set of Materialized views (15 Mviews) are refreshed through refresh group in production every week or adhoc basis. And for refreshing it is taking 5hrs. I have refreshed the same set of Materialized views multiple times in development environment through refresh group but it got refreshed within 3min. The structure of materialized base tables, type of materialized view refresh, materialized definition and volume of base tables are same between development and production. The production disk space also larger than development. But I am not sure why in production the refresh is very slow compare to development. As this is very critical can some one help on this?
Thanks is advance.
- Gopinath.Is it fast refresh Mviews? If yes, then check size of materialized view logs. Also check is any other mviews registered on those tables and not refreshing.
select log_owner, master, log_table, REFRESH_method, version,
owner, name as ragistered_snapshot, snapshot_site, current_snapshots last_refresh_time, sl.snapshot_id
from dba_snapshot_logs sl,
dba_registered_snapshots rs
where sl.snapshot_id = rs.snapshot_id (+)
order by 1,2,3
; -
Materialized Views Not Refreshing
I have created several materialized views and I am having a problem with them never refreshing even though their refresh times are specified in the create statement. Here is the SQL statement for one of them.
create MATERIALIZED view autonomy_mvw
nocache
logging
noparallel
build immediate
refresh complete
start with to_date(sysdate,'dd-mon-yyyy hh24:mi:ss')
next sysdate + 18/24
as
select c.contract_seq,
c.contract_number contract,
cast('' as VARCHAR2(1)) contract_mod,
cast('' as VARCHAR2(1)) do,
cast('' as VARCHAR2(1)) do_seq,
cast('' as VARCHAR2(1)) do_mod_number,
c.contract_number co_do,
c.contract_name title,
c.contract_remarks description,
c.contract_effective_date award_date,
to_char(c.contract_performance_end_date) originalpop,
to_char(cont_perform_end_date(c.contract_seq)) currentpop,
c.control_group controlgroup,
c.fiscal_year_execution fy,
c.quarter,
nvl(CON_PENDING_ROLLUP_AMOUNT(c.contract_seq),0) pendingamt,
nvl(CON_OBLIGATED_ROLLUP_AMOUNT(c.contract_seq),0) originalamt,
cont_majcoms_comma(c.contract_seq) majcom,
cont_installations_desc_comma(c.contract_seq) installation,
case pocPM.last_name || ', ' || pocPM.first_name || nvl2(pocPM.mi,' '||pocPM.mi,'') when ', ' then 'Not Assigned'
else pocPM.last_name || ', ' || pocPM.first_name || nvl2(pocPM.mi,' '||pocPM.mi,'') end pm,
case pocCM.last_name || ', ' || pocCM.first_name || nvl2(pocCM.mi,' '||pocCM.mi,'') when ', ' then 'Not Assigned'
else pocCM.last_name || ', ' || pocCM.first_name || nvl2(pocCM.mi,' '||pocCM.mi,'') end cm,
case pocBCO.last_name || ', ' || pocBCO.first_name || nvl2(pocBCO.mi,' '||pocBCO.mi,'') when ', ' then 'Not Assigned'
else pocBCO.last_name || ', ' || pocBCO.first_name || nvl2(pocBCO.mi,' '||pocBCO.mi,'') end BCO,
con.contractor_name contractor,
c.contract_status status,
cast('' as VARCHAR2(1)) active_status,
nvl(c.prg_name,'Non Program') prg_name,
c.funds_type fund_type,
c.contract_instr_num
from contract c,
contractor con,
cg_level cgl,
poc_user_info pocPM,
poc_user_info pocCM,
poc_user_info pocBCO
where c.contractor_number = con.contractor_number
and c.control_group = cgl.control_group(+)
and c.pm_seq = pocPM.poc_user_seq(+)
and c.cm_seq = pocCM.poc_user_seq(+)
and c.bco_seq = pocBCO.poc_user_seq(+)
and c.contract_instr_num <> 'D'
and c.contract_status in ('AC', 'NEW')
union
select c.contract_seq,
c.contract_number contract,
cmod.contract_mod_num contract_mod,
cast('' as VARCHAR2(1)) do,
cast('' as VARCHAR2(1)) do_seq,
cast('' as VARCHAR2(1)) do_mod_number,
c.contract_number||'/'||cmod.contract_mod_num co_do,
c.contract_name title,
c.contract_remarks description,
c.contract_effective_date award_date,
to_char(c.contract_performance_end_date) originalpop,
to_char(cont_perform_end_date(c.contract_seq)) currentpop,
c.control_group controlgroup,
cmod.fiscal_year_execution fy,
cmod.quarter,
nvl(cmod.contract_mod_committed_amt,0) pendingamt,
nvl(cmod.afcee_oblig_contract_mod_amt, 0) originalamt,
cont_majcoms_comma(c.contract_seq) majcom,
cont_installations_desc_comma(c.contract_seq) installation,
case pocPM.last_name || ', ' || pocPM.first_name || nvl2(pocPM.mi,' '||pocPM.mi,'') when ', ' then 'Not Assigned'
else pocPM.last_name || ', ' || pocPM.first_name || nvl2(pocPM.mi,' '||pocPM.mi,'') end pm,
case pocCM.last_name || ', ' || pocCM.first_name || nvl2(pocCM.mi,' '||pocCM.mi,'') when ', ' then 'Not Assigned'
else pocCM.last_name || ', ' || pocCM.first_name || nvl2(pocCM.mi,' '||pocCM.mi,'') end cm,
case pocBCO.last_name || ', ' || pocBCO.first_name || nvl2(pocBCO.mi,' '||pocBCO.mi,'') when ', ' then 'Not Assigned'
else pocBCO.last_name || ', ' || pocBCO.first_name || nvl2(pocBCO.mi,' '||pocBCO.mi,'') end BCO,
con.contractor_name contractor,
c.contract_status status,
cast('' as VARCHAR2(1)) active_status,
nvl(c.prg_name,'Non Program') prg_name,
c.funds_type fund_type,
c.contract_instr_num
from contract c,
contract_modification cmod,
contractor con,
cg_level cgl,
poc_user_info pocPM,
poc_user_info pocCM,
poc_user_info pocBCO
where c.contract_seq = cmod.contract_seq
and c.contractor_number = con.contractor_number
and c.control_group = cgl.control_group(+)
and c.pm_seq = pocPM.poc_user_seq(+)
and c.cm_seq = pocCM.poc_user_seq(+)
and c.bco_seq = pocBCO.poc_user_seq(+)
and c.contract_instr_num <> 'D'
and c.contract_status in ('AC', 'NEW')
union
select c.contract_seq,
c.contract_number contract,
cast('' as VARCHAR2(1)) contract_mod,
do.do_number do,
to_char(do.do_seq) do_seq,
cast('' as VARCHAR2(1)) do_mod,
c.contract_number||'-'||do.do_number co_do,
do.do_title title,
do.do_description description,
do.afcee_obligated_do_date award_date,
to_char(do.do_end_date) originalpop,
to_char(do_mod_end_date(do.do_seq)) currentpop,
do.control_group controlgroup,
do.fiscal_year_execution fy,
do.quarter,
nvl(DO_PENDING_ROLLUP_AMOUNT(do.do_seq),0) pendingamt,
nvl(DO_OBLIGATED_ROLLUP_AMOUNT(do.do_seq),0) originalamt,
do_majcoms_comma(do.do_seq, null) majcom,
do_installations_desc_comma(do.do_seq, null) installation,
case pocPM.last_name || ', ' || pocPM.first_name || nvl2(pocPM.mi,' '||pocPM.mi,'') when ', ' then 'Not Assigned'
else pocPM.last_name || ', ' || pocPM.first_name || nvl2(pocPM.mi,' '||pocPM.mi,'') end pm,
case pocCM.last_name || ', ' || pocCM.first_name || nvl2(pocCM.mi,' '||pocCM.mi,'') when ', ' then 'Not Assigned'
else pocCM.last_name || ', ' || pocCM.first_name || nvl2(pocCM.mi,' '||pocCM.mi,'') end cm,
case pocBCO.last_name || ', ' || pocBCO.first_name || nvl2(pocBCO.mi,' '||pocBCO.mi,'') when ', ' then 'Not Assigned'
else pocBCO.last_name || ', ' || pocBCO.first_name || nvl2(pocBCO.mi,' '||pocBCO.mi,'') end BCO,
con.contractor_name contractor,
do.do_status status,
do.do_actv_status active_status,
nvl(c.prg_name,'Non Program') prg_name,
do_fundtypes_comma(do.do_seq,null) fund_type,
c.contract_instr_num
from delivery_order do,
contract c,
contractor con,
cg_level cgl,
poc_user_info pocPM,
poc_user_info pocCM,
poc_user_info pocBCO
where do.contract_seq = c.contract_seq
and c.contractor_number = con.contractor_number
and do.control_group = cgl.control_group(+)
and do.pm_seq = pocPM.poc_user_seq(+)
and do.cm_seq = pocCM.poc_user_seq(+)
and do.bco_seq = pocBCO.poc_user_seq(+)
and do.do_status in ('CURR')
and do.do_actv_status in ('RESV','ANTC','FORE','COMM','OBLG','FIN_INV')
union
select c.contract_seq,
c.contract_number contract,
''contract_mod,
do.do_number do,
to_char(do.do_seq) do_seq,
domod.do_mod_number do_mod,
c.contract_number||'-'||do.do_number||'-'||domod.do_mod_number co_do,
do.do_title title,
domod.do_mod_description description,
domod.afcee_obligated_do_mod_date award_date,
to_char(do.do_end_date) originalpop,
to_char(do_mod_end_date(do.do_seq)) currentpop,
domod.control_group controlgroup,
domod.fiscal_year_execution fy,
domod.quarter,
(nvl(domod.do_mod_committed_amount,0) + nvl(domod.reserved_amount,0)+ nvl(domod.anticipated_amount,0)
+ nvl(domod.forecasted_amount,0)) pendingamt,
(nvl(domod.afcee_obligated_do_mod_amount, 0)) originalamt,
do_majcoms_comma(do.do_seq, domod.do_mod_number) majcom,
do_installations_desc_comma(do.do_seq, domod.do_mod_number) installation,
case pocPM.last_name || ', ' || pocPM.first_name || nvl2(pocPM.mi,' '||pocPM.mi,'') when ', ' then 'Not Assigned'
else pocPM.last_name || ', ' || pocPM.first_name || nvl2(pocPM.mi,' '||pocPM.mi,'') end pm,
case pocCM.last_name || ', ' || pocCM.first_name || nvl2(pocCM.mi,' '||pocCM.mi,'') when ', ' then 'Not Assigned'
else pocCM.last_name || ', ' || pocCM.first_name || nvl2(pocCM.mi,' '||pocCM.mi,'') end cm,
case pocBCO.last_name || ', ' || pocBCO.first_name || nvl2(pocBCO.mi,' '||pocBCO.mi,'') when ', ' then 'Not Assigned'
else pocBCO.last_name || ', ' || pocBCO.first_name || nvl2(pocBCO.mi,' '||pocBCO.mi,'') end BCO,
con.contractor_name contractor,
do.do_status status,
do.do_actv_status active_status,
nvl(c.prg_name,'Non Program') prg_name,
do_fundtypes_comma(do.do_seq,domod.do_mod_number) fund_type,
c.contract_instr_num
from delivery_order do,
delivery_order_modification domod,
contract c,
contractor con,
cg_level cgl,
poc_user_info pocPM,
poc_user_info pocCM,
poc_user_info pocBCO
where do.do_seq = domod.do_seq
and do.contract_seq = c.contract_seq
and c.contractor_number = con.contractor_number
and do.control_group = cgl.control_group(+)
and do.pm_seq = pocPM.poc_user_seq(+)
and do.cm_seq = pocCM.poc_user_seq(+)
and do.bco_seq = pocBCO.poc_user_seq(+)
and domod.do_mod_status in ('CURR')
and domod.do_mod_actv_status in ('RESV','ANTC','FORE','COMM','OBLG','DEOBLG','FIN_INV');
As you can see, I cannot use the On Commit refresh method because I violate several of the requirements in order to use the On Commit refresh method. I do not have a materialized view logs.
I did the following select from all_mviews:
1 select
2 MVIEW_NAME,
3 UPDATABLE,
4 UPDATE_LOG,
5 REWRITE_ENABLED,
6 REWRITE_CAPABILITY,
7 REFRESH_MODE,
8 REFRESH_METHOD,
9 BUILD_MODE,
10 LAST_REFRESH_TYPE,
11 LAST_REFRESH_DATE,
12 STALENESS
13 from all_mviews
14* where mview_name = 'AUTONOMY_MVW'
MVIEW_NAME U UPDATE_LOG R REWRITE_C REFRES REFRESH_ BUILD_MOD LAST_REF LAST_REFR STALENESS
AUTONOMY_MVW N N NONE DEMAND COMPLETE IMMEDIATE COMPLETE 17-NOV-05 STALE
I then called the dbms_mview package to force a REFRESH on this view and then re-ran the above sql
MVIEW_NAME U UPDATE_LOG R REWRITE_C REFRES REFRESH_ BUILD_MOD LAST_REF LAST_REFR STALENESS
AUTONOMY_MVW N N NONE DEMAND COMPLETE IMMEDIATE COMPLETE 04-MAY-06 STALE
I noticed that while it was refreshed it shows as stale.
How do I get this materialized view (and my other ones) to refresh in a regular manner?
Thanks
Richard AndersonHere is what I got when I ran the sql you provided. BTW, I increased the substr size for the "Command" to 70 so I could see the whole thing. I have 6 materialized views in this instance but one of them has a compile_state of "ERROR" and so it doesn't show in the job queue. All the others show up.
Job User Schem Last Date Next Date B Failed Command
9 MXT MXT 04.05.2006 16:55 04.05.2006 17:55 N 0 dbms_refresh.refresh('"MXT"."PMR_CON_DO_REPORT_MVW"');
51 MXT MXT 04.05.2006 16:55 04.05.2006 17:55 N 0 dbms_refresh.refresh('"MXT"."MIEN_FY_MV"');
4 MXT MXT 04.05.2006 16:55 04.05.2006 17:55 N 0 dbms_refresh.refresh('"MXT"."PMR_ALL_STATUS_AMT_REPORT_MVW"');
7 MXT MXT 04.05.2006 16:55 04.05.2006 17:55 N 0 dbms_refresh.refresh('"MXT"."PMR_AMOUNT_REPORT_MVW"');
31 MXT MXT 04.05.2006 16:58 04.05.2006 17:28 N 0 dbms_refresh.refresh('"MXT"."PMR_TEST_MVW"');
Rick Anderson
PS, this list was run on my DEV server so it doesn't have the AUTONOMY_MVW at all but both my DEV and PROD instances are having the same issues.
I downloaded Oracle SQL Developer and used it to look at the materialized views and they have a details tab which contained the following:
"Name" "Value"
"OWNER" "MXT"
"MVIEW_NAME" "PMR_AMOUNT_REPORT_MVW"
"CONTAINER_NAME" "PMR_AMOUNT_REPORT_MVW"
"QUERY_LEN" "31020"
"UPDATABLE" "N"
"UPDATE_LOG" ""
"MASTER_ROLLBACK_SEG" ""
"MASTER_LINK" ""
"REWRITE_ENABLED" "N"
"REWRITE_CAPABILITY" "NONE"
"REFRESH_MODE" "DEMAND"
"REFRESH_METHOD" "COMPLETE"
"BUILD_MODE" "IMMEDIATE"
"FAST_REFRESHABLE" "NO"
"LAST_REFRESH_TYPE" "COMPLETE"
"LAST_REFRESH_DATE" "04-MAY-06"
"STALENESS" "UNKNOWN"
"AFTER_FAST_REFRESH" "NA"
"UNKNOWN_PREBUILT" "N"
"UNKNOWN_PLSQL_FUNC" "Y"
"UNKNOWN_EXTERNAL_TABLE" "N"
"UNKNOWN_CONSIDER_FRESH" "N"
"UNKNOWN_IMPORT" "N"
"COMPILE_STATE" "VALID"
"USE_NO_INDEX" "N"
Message was edited by:
RichardAnderson -
How Fast is the Fast Refreshed Materialized View ?
Hi all,
In our Front End aplication we have two big view :
V_ALL_TRANS -> this is UNION ALL on about 10 transaction tables
V_SUMM_TRANS -> this query with SUM & GROUP BY on V_ALL_TRANS.
We are having performance problem on V_SUMM_TRANS, I am thinking of making V_ALL_TRANS as materialized view.
The requirement is : every INSERT on the transaction tables ( and some tables with INSERT & UPDATE) will "immediately reflected" in V_ALL_TRANS.
Is this a possible approach ?
How "immediate" the refreahed will be done by oracle ?
Thank you very much for your help,
xtantohi,
Of course this is a possible approach.
I think we have a time that which we can keep with for ther refresh in materialized views.
but using that may become yet another cause of concern because ur front end may experience performance problems if all the time refresh is going on thru materialized views.
Maybe you can time the refreshes to happen at nigh when the user usage is very low.. -
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 -
About Refresh Error In Materialized view
hi
i have
Oracle 9.2.0.1 at the windows server 2003
i have created some materialized view to use in my one web application running on tomcat
i have scheduling for refresh it using refresh utility available in oracle materialized view snapshot refresh
but when its try to run state of refresh become unusable and table according to it
remains empty
when i try to do it manually it gives error log
Ora-12008 error in materialized view refresh path
ora-01114 io error writing block to file 201(block #2621321)
ora-27069 skgfdisp:attmempt to do i/o beyond the range of file
osd-04026 invalid parameter passed(OS 2621327)
ora-01114 io error writing block to file 201(block#2621321)
ora-27069 skgfdisp:attempt do i/o beyond the range of the file
osd-04026 invalid parameter passed (OS 2621327)
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
even i could not understand this error
one strange thing in this when i restart my server and try to refresh
it is going to be refresh
please help meI suspect one of your datafiles has exceeded the 4Gb windows limit. Your tablespace has probably been set to autoextend and this has created the problem. I am not sure what you can do at this point apart from recover from backup. I would open a TAR with Oracle Support as soon as possible to try and resolve this issue.
Please note: This forum is for OLAP issues only. If you need more information I would try posting on the database forum.
Keith Laker
Oracle EMEA Consulting
OLAP Blog: http://oracleOLAP.blogspot.com/
OLAP Wiki: http://wiki.oracle.com/page/Oracle+OLAP+Option
DM Blog: http://oracledmt.blogspot.com/
OWB Blog : http://blogs.oracle.com/warehousebuilder/
OWB Wiki : http://wiki.oracle.com/page/Oracle+Warehouse+Builder
DW on OTN : http://www.oracle.com/technology/products/bi/db/11g/index.html -
Problem creating materialized view
OK, I'm totally new in using materialized views.
I'm trying to create one and to make it refreshed on commit
CREATE MATERIALIZED VIEW VK_CLIENT build immediate refresh fast on commit AS
select c1.code,
c1.fiche fiche_1,
decode( c1.sfam, '04',
decode( c7.sfam, '04', 'M. et Mme', c1.lnte ), c1.lnte ) lnte_1,
decode( c1.sfam, '04',
decode( c7.sfam, '04',
decode( c1.lnte, 'M.', c1.libe, c7.libe ), c1.libe ), c1.libe ) libe_1,
decode( c1.sfam, '04',
decode( c7.sfam, '04',
decode( c1.lnte, 'M.', substr( c1.libe, 1, c1.lgnom ), substr( c7.libe, 1, c7.lgnom ) ), substr( c1.libe, 1, c1.lgnom ) ), substr( c1.libe, 1, c1.lgnom ) ) nom_1,
decode( c1.sfam, '04',
decode( c7.sfam, '04',
decode( c1.lnte, 'M.', initcap( substr( c1.libe, c1.lgnom + 2 ) ), initcap( substr( c7.libe, c7.lgnom + 2 ) ) ), initcap( substr( c1.libe, c1.lgnom + 2 ) ) ), initcap( substr( c1.libe, c1.lgnom + 2 ) ) ) prenom_1,
decode( c1.sfam, '04', decode( c7.sfam, '04', decode( c1.lnte, 'Mlle', 'Mme', c1.lnte ), c1.lnte ), c1.lnte ) lnte_1_bis,
c1.libe libe_1_bis,
substr( c1.libe, 1, c1.lgnom ) nom_1_bis,
initcap( substr( c1.libe, c1.lgnom + 2 ) ) prenom_1_bis,
c1.sfam sfam_1,
c1.dnai dnai_1,
decode( to_char( c1.dnai, 'dd' ), '01', '1er',
decode( substr( to_char( c1.dnai, 'dd' ), 1, 1 ), 0, substr( to_char( c1.dnai, 'dd' ), 2 ), to_char( c1.dnai, 'dd' ) ) ) || ' ' ||
rtrim( to_char( c1.dnai, 'month', 'nls_date_language = french' ) ) || to_char( c1.dnai, ' yyyy' ) dnai_fr_1,
c1.horsfoyer horsfoyer_1,
decode( c1.lnte, 'Mlle', 'f', 'Mme', 'f', 'M.', 'm' ) accord_1,
c7.fiche fiche_7,
decode( c1.sfam, '04',
decode( c7.sfam, '04', null, c7.lnte ), c7.lnte ) lnte_7,
decode( c1.sfam, '04',
decode( c7.sfam, '04', null, c7.libe ), c7.libe ) libe_7,
decode( c1.sfam, '04',
decode( c7.sfam, '04', null, substr( c7.libe, 1, c7.lgnom ) ), substr( c7.libe, 1, c7.lgnom ) ) nom_7,
decode( c1.sfam, '04',
decode( c7.sfam, '04', null, initcap( substr( c7.libe, c7.lgnom + 2 ) ) ), initcap( substr( c7.libe, c7.lgnom + 2 ) ) ) prenom_7,
decode( c7.sfam, '04', decode( c1.sfam, '04', decode( c7.lnte, 'Mlle', 'Mme', c7.lnte ), c7.lnte ), c7.lnte ) lnte_7_bis,
c7.libe libe_7_bis,
substr( c7.libe, 1, c7.lgnom ) nom_7_bis,
initcap( substr( c7.libe, c7.lgnom + 2 ) ) prenom_7_bis,
c7.sfam sfam_7,
c7.dnai dnai_7,
decode( to_char( c7.dnai, 'dd' ), '01', '1er',
decode( substr( to_char( c7.dnai, 'dd' ), 1, 1 ), 0, substr( to_char( c7.dnai, 'dd' ), 2 ), to_char( c7.dnai, 'dd' ) ) ) || ' ' ||
rtrim( to_char( c7.dnai, 'month', 'nls_date_language = french' ) ) || to_char( c7.dnai, ' yyyy' ) dnai_fr_7,
decode( c7.lnte, 'Mlle', 'f', 'Mme', 'f', 'M.', 'm' ) accord_7,
initcap( decode( instr( lower( c1.adr1 ), 'log' ), '1', c1.adr2, decode( instr( lower( c1.adr1 ), 'bât' ), '1', c1.adr2, c1.adr1 ) ) ) adr1,
initcap( decode( decode( instr( lower( c1.adr1 ), 'log' ), '1', c1.adr2, decode( instr( lower( c1.adr1 ), 'bât' ), '1', c1.adr2, c1.adr1 ) ), c1.adr2, null,
decode( instr( lower( c1.adr2 ), 'log' ), '1', c1.adr3, decode( instr( lower( c1.adr2 ), 'bât' ), '1', c1.adr3, c1.adr2 ) ) ) ) adr2,
initcap( decode( instr( lower( c1.adr3 ), 'log' ), '1', null, decode( instr( lower( c1.adr3 ), 'bât' ), '1', null, c1.adr3 ) ) ) adr3,
c1.ptt,
c1.lcom,
decode( c7.fiche, null, decode( c1.lnte, 'Mme', 'Madame', 'Mlle', 'Mademoiselle', 'M.', 'Monsieur', 'Monsieur' ),
decode( nvl( c1.sfam, '07' ), '04',
decode( nvl( c7.sfam, '07' ), '04', 'Madame, Monsieur',
decode( c1.lnte,
'Mme', decode( c7.lnte, 'Mme', 'Mesdames', 'Mlle', 'Madame, Mademoiselle', 'M.', 'Madame, Monsieur', 'Madame, Monsieur' ),
'Mlle', decode( c7.lnte, 'Mme', 'Madame, Mademoiselle', 'Mlle', 'Mesdemoiselles', 'M.', 'Mademoiselle, Monsieur', 'Mademoiselle, Monsieur' ),
'M.', decode( c7.lnte, 'Mme', 'Madame, Monsieur', 'Mlle', 'Mademoiselle, Monsieur', 'M.', 'Mesieurs', 'Mesieurs' ),
'. ', decode( c7.lnte, 'Mme', 'Madame, Monsieur', 'Mlle', 'Mademoiselle, Monsieur', 'M.', 'Mesieurs', 'Mesieurs' ),
decode( c1.lnte,
'Mme', decode( c7.lnte, 'Mme', 'Mesdames', 'Mlle', 'Madame, Mademoiselle', 'M.', 'Madame, Monsieur', 'Madame, Monsieur' ),
'Mlle', decode( c7.lnte, 'Mme', 'Madame, Mademoiselle', 'Mlle', 'Mesdemoiselles', 'M.', 'Mademoiselle, Monsieur', 'Mademoiselle, Monsieur' ),
'M.', decode( c7.lnte, 'Mme', 'Madame, Monsieur', 'Mlle', 'Mademoiselle, Monsieur', 'M.', 'Mesieurs', 'Mesieurs' ),
'. ', decode( c7.lnte, 'Mme', 'Madame, Monsieur', 'Mlle', 'Mademoiselle, Monsieur', 'M.', 'Mesieurs', 'Mesieurs' ),
'-' ) ) ) lnte_long,
decode( c1.cfam, null, c7.cfam, c1.cfam ) cfam,
decode( c1.cfam, null, c7.allo, c1.allo ) allo,
decode( c1.sexe, 'm', decode( c7.sexe, null, 'ms', 'm', 'mp', 'f', 'mp' ), 'f', decode( c7.sexe, null, 'fs', 'm', 'mp', 'f', 'fp' ), '-' ) accord,
c9.fiche fiche_9,
c9.lnte lnte_9,
c9.libe libe_9,
substr( c9.libe, 1, c9.lgnom ) nom_9,
initcap( substr( c9.libe, c9.lgnom + 2 ) ) prenom_9,
initcap( decode( instr( lower( c9.adr1 ), 'log' ), '1', c9.adr2, decode( instr( lower( c9.adr1 ), 'bât' ), '1', c9.adr2, c9.adr1 ) ) ) adr1_9,
initcap( decode( decode( instr( lower( c9.adr1 ), 'log' ), '1', c9.adr2, decode( instr( lower( c9.adr1 ), 'bât' ), '1', c9.adr2, c9.adr1 ) ), c9.adr2, null,
decode( instr( lower( c9.adr2 ), 'log' ), '1', c9.adr3, decode( instr( lower( c9.adr2 ), 'bât' ), '1', c9.adr3, c9.adr2 ) ) ) ) adr2_9,
initcap( decode( instr( lower( c9.adr3 ), 'log' ), '1', null, decode( instr( lower( c9.adr3 ), 'bât' ), '1', null, c9.adr3 ) ) ) adr3_9,
c9.ptt ptt_9,
c9.lcom lcom_9,
decode( c9.lnte, 'Mlle' , 'Mademoiselle', 'Mme', 'Madame', 'M.', 'Monsieur', 'M. et Mme', 'Madame, Monsieur', null ) lnte_long_9,
decode( c9.sexe, 'm', 'ms', 'f', 'fs', null, null, '-' ) accord_9,
no.nbocc
from client c1,
client c7,
client c9,
select z.code code,
count(*) nbocc
from client z
where to_char( sysdate, 'yyyymmdd' ) between to_char( z.cdeb, 'yyyymmdd' ) and to_char( nvl( z.cfin, sysdate ), 'yyyymmdd' )
group by z.code
) no
where c1.code = c7.code (+)
and c1.role = '1'
and c7.role (+) ='7'
and nvl( c7.horsfoyer (+), 0 ) = '0'
and to_char( nvl( c7.cfin (+), sysdate ), 'yyyymmdd' ) >= to_char( sysdate, 'yyyymmdd' )
and c1.code = c9.code (+)
and c9.role (+) = '9'
and to_char( nvl( c9.cfin (+), sysdate ), 'yyyymmdd' ) >= to_char( sysdate, 'yyyymmdd' )
and c9.lnte (+) not in ( '. ', 'Assoc.', 'Ste' )
and c9.lcom (+) is not null
and c1.code = no.code (+);when doing so, I'm getting a ORA-12054:
ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view
12054. 00000 - "cannot set the ON COMMIT refresh attribute for the materialized view"
*Cause: The materialized view did not satisfy conditions for refresh at
commit time.
*Action: Specify only valid options.
When I create the materialized view with just CREATE MATERIALIZED VIEW "H6801_GL_00"."VK_CLIENT" AS
it works but the refresh is only "ON DEMAND"...
Can't find how and why it won't work...
Edited by: MacFizz on Dec 17, 2009 3:22 PMYou could try the DBMS_MVIEW.TUNE_MVIEW and check if you can modify you materialized view or "refactor" it in a smaller, fast refreshable part that you could combine later to the sysdate/rownum part of it.
http://download.oracle.com/docs/cd/E11882_01/server.112/e10821/advisor.htm
Explanation on restrictions of fast refresh:
http://download.oracle.com/docs/cd/E11882_01/server.112/e10706/repmview.htm
Below there's an example of a fast refreshable mview, on creating the materialized view log and so on:
http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/statements_6002.htm#i2080820 -
In 10g release 2,I tried to create following materialized view with join:
test_link is a normal table
test_geom is a table contains a column in SDO_GEOMETRY
CREATE MATERIALIZED VIEW LOG ON test_link with rowid
CREATE MATERIALIZED VIEW LOG ON test_geom with rowid,primary key
CREATE MATERIALIZED VIEW MV_LINK USING INDEX REFRESH FAST ON DEMAND AS
SELECT li.rowid link_rowid,geom.rowid geom_rowid,li.link_id,geom.link
FROM test_link li, test_geom geom
WHERE li.link_id=geom.link_id
But I always got an error like:
ORA-12015: cannot create a fast refresh materialized view from a complex query
If I change the geometry table to another table, everything works fine.
Anyone have ideas?Unfortunately, creating a fast refreshable materialized view on a join with one of the select columns being a user defined type (sdo_geometry is a user defined type) is not allowed. See 5303489 in the metalink bug database.
You could do like the workaround in the article suggests and create two materialized views and then create a regular view on top.
In our scenario, our materialized view also contains unions, so we would really like to have one physical object at the end of the day. One approach that we are currently investigating is to create the materialized view (MV1) without the geometry column, which makes it fast refreshable, and also create a materialized view (MV2) on the table containing the geometry column. MV2 is also fast refreshable. We then create a table (T3) that contains all of the columns from MV1, plus a geometry column. An insert, update, delete trigger on MV1 is created. The trigger is used to push all of the columns from MV1 to T3 and the geometry column from MV2 to T3. I have created the above in one of our test environments and haven't encountered any issues yet.
Let me know if you come up with a better approach. -
Number Precision in Materialized View
Hey,
I have created several materialized views with multiple fields of data type number. I would like to have those number fields created with max length 5 and precision 0 (no decimal places). I am thinking that each of those database fields will then appear as NUMBER(5,0) in the database, maybe I am wrong on that.
How can I code that into my select statement for which the materialized is created?
ThanksTodd gives a better suggestion.
I could be wrong, but I believe views in general pull their datatypes from their base sources. Therefore if you want your materialized view datatypes to be NUMBER(5,0) you will have to alter your base tables as such.
Otherwise, if you don't care about the datatype just the value, then in the select part of your materialized view you could use substr and possibly instr to get the length of five you desire and convert back to a number.
Message was edited by:
splazm -
Materialized views on prebuilt tables - query rewrite
Hi Everyone,
I am currently counting on implementing the query rewrite functionality via materialized views to leverage existing aggregated tables.
Goal*: to use aggregate-awareness for our queries
How*: by creating views on existing aggregates loaded via ETL (+CREATE MATERIALIZED VIEW xxx on ON PREBUILT TABLE ENABLE QUERY REWRITE+)
Advantage*: leverage oracle functionalities + render logical model simpler (no aggregates)
Disadvantage*: existing ETL's need to be written as SQL in view creation statement --> aggregation rule exists twice (once on db, once in ETL)
Issue*: Certain ETL's are quite complex via lookups, functions, ... --> might create overy complex SQLs in view creation statements
My question: is there a way around the issue described? (I'm assuming the SQL in the view creation is necessary for oracle to know when an aggregate can be used)
Best practices & shared experiences are welcome as well of course
Kind regards,
Peterstreefpo wrote:
I'm still in the process of testing, but the drops should not be necessary.
Remember: The materialized view is nothing but a definition - the table itself continues to exist as before.
So as long as the definition doesn't change (added column, changed calculation, ...), the materialized view doesn't need to be re-created. (as the data is not maintained by Oracle)Thanks for reminding me but if you find a documented approach I will be waiting because this was the basis of my argument from the beginning.
SQL> select * from v$version ;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL> desc employees
Name Null? Type
EMPLOYEE_ID NOT NULL NUMBER(6)
FIRST_NAME VARCHAR2(20)
LAST_NAME NOT NULL VARCHAR2(25)
EMAIL NOT NULL VARCHAR2(25)
PHONE_NUMBER VARCHAR2(20)
HIRE_DATE NOT NULL DATE
JOB_ID NOT NULL VARCHAR2(10)
SALARY NUMBER(8,2)
COMMISSION_PCT NUMBER(2,2)
MANAGER_ID NUMBER(6)
DEPARTMENT_ID NUMBER(4)
SQL> select count(*) from employees ;
COUNT(*)
107
SQL> create table mv_table nologging as select department_id, sum(salary) as totalsal from employees group by department_id ;
Table created.
SQL> desc mv_table
Name Null? Type
DEPARTMENT_ID NUMBER(4)
TOTALSAL NUMBER
SQL> select count(*) from mv_table ;
COUNT(*)
12
SQL> create materialized view mv_table on prebuilt table with reduced precision enable query rewrite as select department_id, sum(salary) as totalsal from employees group by department_id ;
Materialized view created.
SQL> select count(*) from mv_table ;
COUNT(*)
12
SQL> select object_name, object_type from user_objects where object_name = 'MV_TABLE' ;
OBJECT_NAME OBJECT_TYPE
MV_TABLE TABLE
MV_TABLE MATERIALIZED VIEW
SQL> insert into mv_table values (999, 100) ;
insert into mv_table values (999, 100)
ERROR at line 1:
ORA-01732: data manipulation operation not legal on this view
SQL> update mv_table set totalsal = totalsal * 1.1 where department_id = 10 ;
update mv_table set totalsal = totalsal * 1.1 where department_id = 10
ERROR at line 1:
ORA-01732: data manipulation operation not legal on this view
SQL> delete from mv_table where totalsal <= 10000 ;
delete from mv_table where totalsal <= 10000
ERROR at line 1:
ORA-01732: data manipulation operation not legal on this view While investigating for this thread I actually made my own question redundant as the answer became gradually clear:
When using complex ETL's, I just need to make sure the complexity is located in the ETL loading the detailed table, not the aggregate
I'll try to clarify through an example:
- A detailed Table DET_SALES exists with Sales per Day, Store & Product
- An aggregated table AGG_SALES_MM exists with Sales, SalesStore per Month, Store & Product
- An ETL exists to load AGG_SALES_MM where Sales = SUM(Sales) & SalesStore = (SUM(Sales) Across Store)
--> i.e. the SalesStore measure will be derived out of a lookup
- A (Prebuilt) Materialized View will exist with the same column definitions as the ETL
--> to allow query-rewrite to know when to access the table
My concern was how to include the SalesStore in the materialized view definition (--> complex SQL!)
--> I should actually include SalesStore in the DET_SALES table, thus:
- including the 'Across Store' function in the detailed ETL
- rendering my Aggregation ETL into a simple GROUP BY
- rendering my materialized view definition into a simple GROUP BY as wellNot sure how close your example is to your actual problem. Also don't know if you are doing an incremental/complete data load and the data volume.
But the "SalesStore = (SUM(Sales) Across Store)" can be derived from the aggregated MV using analytical function. One can just create a normal view on top of MV for querying. It is hard to believe that aggregating in detail table during ETL load is the best approach but what do I know? -
Streams on materialized view table vs. local table
We are in a situation where we temporarily need to implement Streams on several materialized view tables. During development and testing I've noted that a local table with streams implemented on it yields 50% faster performance on apply than the materialized view tables. Can anyone tell me (1) why this is, it doesn't make sense since data is being retrieved from a buffered queue not the tables, and (2) a work around to this to improve performance on the mv tables. Any hellp would be appreciated.
Can't give you an answer why. I would suggest that you try (1) creating the materialzed views on prebuilt tables and (2) add parallelism to the apply process(es)
Maybe you are looking for
-
Linux Mint (based on Ubuntu) 12, KDE desktop Firefox 10.0 Started up Firefox right after Mint was installed. On the add-ons page video download helper was shown as a featured extension and I installed it, then rebooted when prompted. After that, Fire
-
HT1203 Problems sharing iTunes library across multiple accounts on one imac
I have followed the Mac OS instructions in this article http://support.apple.com/kb/HT1203 to share music accounts on the family iMac. When I go to connect to this library the I cannot see the actual ITunes Media folder but the following file path: ~
-
Best practice for invoice posting inSRM
Dear expert, what is the best practice for posting an invoice? Is it in SRM system or MM system? In SRM, the system allows one to use approval procedure for invoice posting; wheras in MM, one cannot use the apporval procedure to post an invoice. simi
-
I have a third generation iPod and I had no problems with 3.0 firmware, but i decided to update to 4.1 and suddenly, it stopped remembering keys in Safari and opening certain pdf's, because it freezes at the first page and I can't see anymore. I thin
-
How to get the previous data?
Hi, I am monitoring a one moving point with coordinates (Xd,Yd). I want to get the two previous data so that I can calculate the point of origin as (Xo,Yo). I made a calculation that if i have three known points I will be able to get the point of ori