All about Materialized views
Hi,
Can you please give me some link or info about Materilized view.I want to know in what cases Materilized views are most efficient.Can you also send me advantages and disadvantages of Materialized views
Thanks
Anand
Data warehousing guide
http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/toc.htm
Four chapters:
Basic materialized views
Advanced materialized views
Basic Query Rewrite
Advanced Query Rewrite
Gints Plivna
http://www.gplivna.eu
Similar Messages
-
Updating one table is updating ALL the materialized views
We have a number of tables and also a number of materialized views that are interconnected. For some unexplained reason, when we update one table that should refresh one materialized view, all the materialized views are refreshed. It's causing massive bottlenecks on our system and we can't find the cause. Does anyone have any thoughts?
"when we update one table that should refresh one materialized view, all the materialized views are refreshed" --If that table is used in the creation of all materialized views,then it will try to refresh all of them..(ON COMMIT REFRESH)
-
I want detail info about materialized views?
I want detail info about materialized views?
The best place to start is the documentation available free online:
http://www.oracle.com/pls/db102/ -
A peculiar matter about Materialized Views
Hi ,
I have created successfully some months ago some MV. Later on , I was made to destroy the database and create a new one , using the DBCA. The peculiar is that whenever i issue the command :
sql> drop materialized view stat_biox_f_mv;
Oracle displays the error ORA-12003: the materialized view stat_biox_f_mv does not exist.
When i issue the command:
sql>create materialized view stat_biox_f_mv
build immediate
refresh start with (sysdate)+(10/1440)
next (sysdate)+10/1440
as
select count(f) N_f,sum(f) Sx_f,round(avg(f),3) x_f,round(stddev(f),3) SD_f,
round(avg(f)+2*stddev(f),3) Ru_f,round(avg(f)-2*stddev(f),3) Rd_f,
round(stddev(f)/sqrt(count(f)),3) SE_f,round((100*stddev(f))/avg(f),3) CV_f,
round(count(f)*((sum(power(f,4))-(power(sum(f),4)/count(f)))/
(power((sum(power(f,2))-(power(sum(f),2)/count(f))),2)))-3,3) Sk_f,
round((sum(power(f,2))-(power(sum(f),3)/count(f)))/
(power(stddev(f),2)*count(f)),3) Sa_f
from biox
Oracle displays the error ORA-00955: the object does exist
Eventually , the object exists or does not...?????
Thanks , a lot
SimonHave you queried all_objects? Perhaps the materialized view doesn't exist but a table with the same name does. If you do find any objects with that name, drop them.
SELECT * FROM all_objects WHERE object_name = UPPER('stat_biox_f_mv');
Have you tried creating this MV with a different name? Does that work? -
I want to know about Materialized Views
Hi,
I am very new to this Oracle.
In my project, we are using Materialized Views to refresh. but I am not having the good Idea on this. and in our project we golden gate also. both are refreshing purpose i think so. So could you please help me...
Best Regards,
Naresh.Tuser13405404 wrote:
yes,
I have gone through the pages. And please i ahve dought, like
1)How it is going to be refreshed..?(Manuall/Auto)That depends on how you define the materialized view. You can (subject to various restrictions) have the materialized view refresh as part of the transaction that modifies the underlying tables, on a fixed schedule, or on demand.
2)will occupie space(No, because its a view)A materialized view does occupy space. You are creating a copy of the underlying data.
Justin -
How do I figure where is the data in a materialized view coming from
Hi: when I run select NAME, OWNER from dba_mview_refresh_times, I see a number of materialized views. How do I find more details about this view i.e where is the data coming from and which fields. The source table that is in another database changed. But the view on my database where the materialized view exist has not changed. I want to confirm from where is data coming in this view
TIA
RaviSQL> select * from dict where table_name like 'ALL%MVIEW%'
TABLE_NAME COMMENTS
ALL_BASE_TABLE_MVIEWS All materialized views with log(s) in the database that the user can s
ee
ALL_MVIEWS All materialized views in the database
ALL_MVIEW_AGGREGATES Description of the materialized view aggregates accessible to the user
ALL_MVIEW_ANALYSIS Description of the materialized views accessible to the user
ALL_MVIEW_COMMENTS Comments on materialized views accessible to the user
ALL_MVIEW_DETAIL_PARTITION Freshness information of all PCT materialized views in the database
ALL_MVIEW_DETAIL_RELATIONS Description of the materialized view detail tables accessible to the u
ser
ALL_MVIEW_DETAIL_SUBPARTITION Freshness information of all PCT materialized views in the database
ALL_MVIEW_JOINS Description of a join between two columns in the
WHERE clause of a materialized view accessible to the user
ALL_MVIEW_KEYS Description of the columns that appear in the GROUP BY
list of a materialized view accessible to the user
ALL_MVIEW_LOGS All materialized view logs in the database that the user can see
ALL_MVIEW_REFRESH_TIMES Materialized views and their last refresh times for each master table
that the user can look at
ALL_REGISTERED_MVIEWS Remote materialized views of local tables that the user can see
13 rows selected. -
Query rewrites with Nested materialized views with different aggregations
Platform used : Oracle 11g.
Here is a simple fact table (with measures m1,m2) and dimensions (a) Location (b) Calendar and (c) Product. The business problem is that aggregation operator for measure m1,m2 are different along location dimension and Calendar dimension. The intention is to preaggregate the measures for a product along the calendar dimension and Location dimension and store it as materialized views.
The direct option is to define a materialized view with Inline queries (Because of the different aggrergation operator, it is not possible to write a query without Inline query). http://download-uk.oracle.com/docs/cd/B28359_01/server.111/b28313/qradv.htm#BABEAJBF documents the limitations that it works only for 'Text match' and 'Equivalent queries' and that is too limiting.
So decided to have nested materialized view, with first view having just joins(my_dim_mvw_joins), the second view having aggregations along Calendar dimension (my_dim_mvw_calendar) and third view having aggregations along the Location dimension(my_dim_mvw_location). Obviously I do not want the query I fire to know about materialized views and I fire it against the fact table. I see that for the fired query (Which needs aggregations along both Calendar and Location), is rewritten with just second materialized view but not the third. (Had set QUERY_REWRITE_INTEGRITY as TRUSTED) .
Wanted to know whether there are limitations on Query Writes with nested materialized views? Thanks
(Have given a simple testable example below. Pls ignore the values given in 'CALENDAR_IDs', 'PRODUCT_IDs' etc as they are the same for all the queries)
-- Calendar hierarchy table
CREATE TABLE CALENDAR_HIERARCHY_TREE
( "CALENDAR_ID" NUMBER(5,0) NOT NULL ENABLE,
"HIERARCHY1_ID" NUMBER(5,0),
"HIERARCHY2_ID" NUMBER(5,0),
"HIERARCHY3_ID" NUMBER(5,0),
"HIERARCHY4_ID" NUMBER(5,0),
CONSTRAINT "CALENDAR_HIERARCHY_TREE_PK" PRIMARY KEY ("CALENDAR_ID")
-- Location hierarchy table
CREATE TABLE LOCATION_HIERARCHY_TREE
( "LOCATION_ID" NUMBER(3,0) NOT NULL ENABLE,
"HIERARCHY1_ID" NUMBER(3,0),
"HIERARCHY2_ID" NUMBER(3,0),
"HIERARCHY3_ID" NUMBER(3,0),
"HIERARCHY4_ID" NUMBER(3,0),
CONSTRAINT "LOCATION_HIERARCHY_TREE_PK" PRIMARY KEY ("LOCATION_ID")
-- Product hierarchy table
CREATE TABLE PRODUCT_HIERARCHY_TREE
( "PRODUCT_ID" NUMBER(3,0) NOT NULL ENABLE,
"HIERARCHY1_ID" NUMBER(3,0),
"HIERARCHY2_ID" NUMBER(3,0),
"HIERARCHY3_ID" NUMBER(3,0),
"HIERARCHY4_ID" NUMBER(3,0),
"HIERARCHY5_ID" NUMBER(3,0),
"HIERARCHY6_ID" NUMBER(3,0),
CONSTRAINT "PRODUCT_HIERARCHY_TREE_PK" PRIMARY KEY ("PRODUCT_ID")
-- Fact table
CREATE TABLE RETAILER_SALES_TBL
( "PRODUCT_ID" NUMBER,
"PRODUCT_KEY" VARCHAR2(50 BYTE),
"PLAN_ID" NUMBER,
"PLAN_PERIOD_ID" NUMBER,
"PERIOD_ID" NUMBER(5,0),
"M1" NUMBER,
"M2" NUMBER,
"M3" NUMBER,
"M4" NUMBER,
"M5" NUMBER,
"M6" NUMBER,
"M7" NUMBER,
"M8" NUMBER,
"LOCATION_ID" NUMBER(3,0),
"M9" NUMBER,
CONSTRAINT "RETAILER_SALES_TBL_LOCATI_FK1" FOREIGN KEY ("LOCATION_ID")
REFERENCES LOCATION_HIERARCHY_TREE ("LOCATION_ID") ENABLE,
CONSTRAINT "RETAILER_SALES_TBL_PRODUC_FK1" FOREIGN KEY ("PRODUCT_ID")
REFERENCES PRODUCT_HIERARCHY_TREE ("PRODUCT_ID") ENABLE,
CONSTRAINT "RETAILER_SALES_TBL_CALEND_FK1" FOREIGN KEY ("PERIOD_ID")
REFERENCES CALENDAR_HIERARCHY_TREE ("CALENDAR_ID") ENABLE
-- Location dimension definition to promote query rewrite
create DIMENSION LOCATION_DIM
LEVEL CHAIN IS LOCATION_HIERARCHY_TREE.HIERARCHY1_ID
LEVEL CONSUMER_SEGMENT IS LOCATION_HIERARCHY_TREE.HIERARCHY3_ID
LEVEL STORE IS LOCATION_HIERARCHY_TREE.LOCATION_ID
LEVEL TRADING_AREA IS LOCATION_HIERARCHY_TREE.HIERARCHY2_ID
HIERARCHY PROD_ROLLUP (
STORE CHILD OF
CONSUMER_SEGMENT CHILD OF
TRADING_AREA CHILD OF
CHAIN
-- Calendar dimension definition
create DIMENSION CALENDAR_DIM
LEVEL MONTH IS CALENDAR_HIERARCHY_TREE.HIERARCHY3_ID
LEVEL QUARTER IS CALENDAR_HIERARCHY_TREE.HIERARCHY2_ID
LEVEL WEEK IS CALENDAR_HIERARCHY_TREE.CALENDAR_ID
LEVEL YEAR IS CALENDAR_HIERARCHY_TREE.HIERARCHY1_ID
HIERARCHY CALENDAR_ROLLUP (
WEEK CHILD OF
MONTH CHILD OF
QUARTER CHILD OF
YEAR
-- Materialized view with just joins needed for other views
CREATE MATERIALIZED VIEW my_dim_mvw_joins build immediate refresh complete enable query rewrite as
select product_id, lht.HIERARCHY1_ID, lht.HIERARCHY2_ID, lht.HIERARCHY3_ID, lht.location_id, cht.HIERARCHY1_ID year,
cht.HIERARCHY2_ID quarter, cht.HIERARCHY3_ID month, cht.calendar_id week, m1, m3, m7, m9
from retailer_sales_tbl RS, calendar_hierarchy_tree cht, location_hierarchy_tree lht
WHERE RS.period_id = cht.CALENDAR_ID
and RS.location_id = lht.location_id
and cht.CALENDAR_ID in (10,236,237,238,239,608,609,610,611,612,613,614,615,616,617,618,619,1426,1427,1428,1429,1430,1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445,1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1476,1477)
AND product_id IN (5, 6, 7, 8, 11, 12, 13, 14, 17, 18, 19, 20)
AND lht.location_id IN (2, 3, 11, 12, 13, 14, 15, 4, 16, 17, 18, 19, 20)
-- Materialized view which aggregate along calendar dimension
CREATE MATERIALIZED VIEW my_dim_mvw_calendar build immediate refresh complete enable query rewrite as
select product_id, HIERARCHY1_ID , HIERARCHY2_ID , HIERARCHY3_ID ,location_id, year, quarter, month, week,
sum(m1) m1_total, sum(m3) m3_total, sum(m7) m7_total, sum(m9) m9_total,
GROUPING_ID(product_id, location_id, year, quarter, month, week) dim_mvw_gid
from my_dim_mvw_joins
GROUP BY product_id, HIERARCHY1_ID , HIERARCHY2_ID , HIERARCHY3_ID , location_id,
rollup (year, quarter, month, week);
-- Materialized view which aggregate along Location dimension
CREATE MATERIALIZED VIEW my_dim_mvw_location build immediate refresh complete enable query rewrite as
select product_id, year, quarter, month, week, HIERARCHY1_ID, HIERARCHY2_ID, HIERARCHY3_ID, location_id,
sum(m1_total) m1_total_1, sum(m3_total) m3_total_1, sum(m7_total) m7_total_1, sum(m9_total) m9_total_1,
GROUPING_ID(product_id, HIERARCHY1_ID, HIERARCHY2_ID, HIERARCHY3_ID, location_id, year, quarter, month, week) dim_mvw_gid
from my_dim_mvw_calendar
GROUP BY product_id, year, quarter, month, week,
rollup (HIERARCHY1_ID, HIERARCHY2_ID, HIERARCHY3_ID, location_id)
-- SQL Query Fired (for simplicity have used SUM as aggregation operator for both, but they will be different)
select product_id, year, HIERARCHY1_ID, HIERARCHY2_ID,
sum(m1_total) m1_total_1, sum(m3_total) m3_total_1, sum(m7_total) m7_total_1, sum(m9_total) m9_total_1
from
select product_id, HIERARCHY1_ID , HIERARCHY2_ID , year,
sum(m1) m1_total, sum(m3) m3_total, sum(m7) m7_total, sum(m9) m9_total
from
select product_id, lht.HIERARCHY1_ID , lht.HIERARCHY2_ID , lht.HIERARCHY3_ID ,lht.location_id, cht.HIERARCHY1_ID year, cht.HIERARCHY2_ID quarter, cht.HIERARCHY3_ID month, cht.calendar_id week,m1,m3,m7,m9
from
retailer_sales_tbl RS, calendar_hierarchy_tree cht, location_hierarchy_tree lht
WHERE RS.period_id = cht.CALENDAR_ID
and RS.location_id = lht.location_id
and cht.CALENDAR_ID in (10,236,237,238,239,608,609,610,611,612,613,614,615,616,617,618,619,1426,1427,1428,1429,1430,1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445,1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1476,1477)
AND product_id IN (5, 6, 7, 8, 11, 12, 13, 14, 17, 18, 19, 20)
AND lht.location_id IN (2, 3, 11, 12, 13, 14, 15, 4, 16, 17, 18, 19, 20)
GROUP BY product_id, HIERARCHY1_ID , HIERARCHY2_ID , HIERARCHY3_ID , location_id, year
) sales_time
GROUP BY product_id, year,HIERARCHY1_ID, HIERARCHY2_ID
This Query rewrites only with my_dim_mvw_calendar. (as saw in Query Plan and EXPLAIN_MVIEW). But we would like it to use my_dim_mvw_location as that has aggregations for both dimensions.blackhole001 wrote:
Hi all,
I'm trying to make my programmer's life easier by creating a database view for them to query the data, so they don't have to worry about joining tables. This sounds like a pretty horrible idea. I say this because you will eventually end up with programmers that know nothing about your data model and how to properly interact with it.
Additionally, what you will get is a developer that takes one of your views and see's that of the 20 columns in it, it has 4 that he needs. If all those 4 columns comes from a simple 2 table join, but the view has 8 tables, you're wasting a tonne of resources by using the view (and heaven forbid they have to join that view to another view to get 4 of the 20 columns from that other view as well).
Ideally you'd write stored routines that satisfy exactly what is required (if you are the database resource and these other programmers are java, .net, etc... based) and the front end developers would call those routines customized for an exact purpose.
Creating views is not bad, but it's by no means a proper solution to having developers not learn or understand SQL and/or the data model. -
Materialized View - Point in time refresh
I have a MV group which refreshes from a bunch of master tables. The master tables are constantly getting updated from an OLTP application. In this scenario, I want all the MVs to hold data which was available at the time the refresh started and not the changes after that.
Eg:
Master tables are T1, T2 ... T20 refresh to MVs T1_MV, T2_MV ...T20_MV
All the MVs T1_MV to T20_MV are in a refresh group.
At 3 PM: Execute an explicit refresh for the MV refresh group
At 3:05 PM: OLTP application inserts a record into table T5 & commits
At 3:06 PM (rather any time after 3:05 PM): Refresh of T5_MV happens. Will the latest insert get captured in T5_MV? I actually don't want this to happen for my requirement, because I want the data captured as of 3 PM into the MVs.
The Oracle Advanced Replication guide says the following about Materialized Views -
+"A materialized view is a replica of a target master from a single point in time."+
From the above line, it looks like by default this will not be captured in the MV. Can someone please confirm my understanding ?MVs in a Refresh Group when refreshed as a Refresh Group are refreshed as of the same point in time.
So if the Refresh Group begins at 3:00pm and ends at 3:25pm, all the MVs in that group reflect the data as in the source tables as of 3:00pm, ignoring any updates to source tables after 3:00pm (i.e. while the Group is being refreshed).
However, if you refresh MVs individually, then each MV is refreshed at it's relative point in time -- so individual Refreshs of MVs would not be to the same point in time.
How have you defined the Refresh Group ?
How do you execute the Refresh for the whole Group ? What PLSQL procedure do you use ? What parameters do you use ?
Ensure that you do not execute an individual MV Refresh.
Hemant K Chitale
http://hemantoracledba.blogspot.com -
MLOGS not purge after a fast refresh (Materialized view) ...
Hi,
I have a database on my own site (Quebec) that has 36 materialized views refresh by a master table site that is physically at Montreal. The MVIEWs are refreshed every day of the week (monday to friday) at 7h00 until 19h00. We use the "fast refresh" technic to refresh the materialized views.
Last weekend, I transfered this database on a new server. So, I created a new SID (I rename the old SID "ORCL" by "ATQP") and I created this instance with a DB_BLOCK_SIZE of 16k rather than 8k. It's the only difference between the two instances (the old one and the new one). I also created the owner schema "ATQP" and I made an Export on the old server followed by an Import of the schema that owned the Materialized views (not a Full import) on the new server. The export was made many hours (saturday morning) after the last refresh of the week (friday, at 19h00) on the old server.
After the successul import on my new server, I'm looking for the information about the creation of the MVIEW. Everything seems OK. I can see that the last refresh date indicated "2008-02-22 19:00" (date / time of the last refresh of the week). I made a quick test on a small MVIEW (a fast refresh) and it worked, no error.
Yesterday morning, the DBA of the master table site mentionned us that the DELETE on the MLOGS didn't work on the master site. The refresh was made successfully but the MLOGS continue to grow up, again and again ... On my database, I'm looking in the SYS.SNAP$ table and I saw that the SNAPTIME date is '1950-01-01 12:00' rather than '2008-02-25 19:00'. In the SYS.SNAP_REFTIME, the SNAPTIME is OK but the LOADERTIME column contains the same strange date '1950-01-01 12:00'.
I made a quick check on my old server and the SYS.SNAP$ table is empty !!! I think it's normal because the last refresh on this node was made last friday night and I made the transfert last saturday (I shutdown the old database after).
I know how to solve the problem, by recreate the MVIEW, but it causes a big problem for us. We are in PRODUCTION and we don't want to refresh many millions of records. I think it will take a couple of days to refresh all the materialized views of my schema. And it doesn't sound good by the master table site management team ...
The master table site "rush" us to solve the problem before the weekend. They don't want that we overcharge the network link between them and us by refreshing those MVIEWS.
So, is it possible to make something simple to resynchronized the SNAPTIME date without refreshing completely all the materialized views ?
If the master site table recreate the MLOG (purge manually), is it possible that it will solve our problem ?
Is it also possible to recreate the MVIEW without refreshing the data (specify to Oracle to recreate the MVIEW but indicate that the table associated already exist) ?
All of my materialized view are up to date concerning the data. I don't want to refresh all of it.
Thank's in advance ...Hi Justin,
The DBA of the master table site sent me a email about the fact he unregistered the MVIEW. He told me that the script for the unregistered worked well. He tried to purge the MLOG and he got the error ORA-23424 but I think it's normal (It's what you said yesterday about the fact that the UNREGISTER command also purge the MLOGS).
So, it seems that the MLOGS are still not purged (that's what the DBA of the master table site said). I ran the following query:
SQL> select * from [email protected];
LOG_OWNER MASTER LOG_TABLE LOG_TRIGGER ROW PRI OBJ FIL SEQ INC
ATQ ALIAS_ANILOTS MLOG$_ALIAS_ANILOTS NO YES NO YES NO YES
ATQ ALIAS_INTERVENANTS MLOG$_ALIAS_INTERVENANTS NO YES NO YES NO YES
ATQ ANILOTS MLOG$_ANILOTS NO YES NO YES NO YES
ATQ CATEGORIES MLOG$_CATEGORIES NO YES NO YES NO YES
ATQ CODES_POSTAUX MLOG$_CODES_POSTAUX NO YES NO YES NO YES
ATQ COMMANDES MLOG$_COMMANDES NO YES NO YES NO YES
ATQ COMMUNICATIONS MLOG$_COMMUNICATIONS NO YES NO YES NO YES
ATQ DEPLACEMENTS MLOG$_DEPLACEMENTS NO YES NO YES NO YES
ATQ DETAILS_STATUTS_COMMANDES MLOG$_DETAILS_STATUTS_COMM NO YES NO YES NO YES
ATQ DOMAINES MLOG$_DOMAINES NO YES NO YES NO YES
ATQ ENREGISTREMENT_LOGS MLOG$_ENREGISTREMENT_LOGS NO YES NO YES NO YES
ATQ ENREGISTREMENT_NOTES MLOG$_ENREGISTREMENT_NOTES NO YES NO YES NO YES
ATQ ESPECES MLOG$_ESPECES NO YES NO YES NO YES
ATQ EVENEMENTS MLOG$_EVENEMENTS NO YES NO YES NO YES
ATQ EVENE_DIFFERES MLOG$_EVENE_DIFFERES NO YES NO YES NO YES
ATQ IDENTIFIANTS MLOG$_IDENTIFIANTS NO YES NO YES NO YES
ATQ INTERVENANTS MLOG$_INTERVENANTS NO YES NO YES NO YES
ATQ INTERVENANTS_CLIENTS MLOG$_INTERVENANTS_CLIENTS NO YES NO YES NO YES
ATQ INTERVENANTS_SITES MLOG$_INTERVENANTS_SITES NO YES NO YES NO YES
ATQ MAX_EVENE_DIFFERES MLOG$_MAX_EVENE_DIFFERES NO YES NO YES NO YES
ATQ MESSAGES MLOG$_MESSAGES NO YES NO YES NO YES
ATQ MUNICIPALITES MLOG$_MUNICIPALITES NO YES NO YES NO YES
ATQ NEW_ANILOTS MLOG$_NEW_ANILOTS NO YES NO YES NO YES
ATQ NEW_EVENEMENTS MLOG$_NEW_EVENEMENTS NO YES NO YES NO YES
ATQ NEW_IDENTIFIANTS MLOG$_NEW_IDENTIFIANTS NO YES NO YES NO YES
ATQ NEW_SITES MLOG$_NEW_SITES NO YES NO YES NO YES
ATQ PAYS MLOG$_PAYS NO YES NO YES NO YES
ATQ PRODUCTIONS MLOG$_PRODUCTIONS NO YES NO YES NO YES
ATQ PROPRIETES_ANILOTS MLOG$_PROPRIETES_ANILOTS NO YES NO YES NO YES
ATQ PROVINCES MLOG$_PROVINCES NO YES NO YES NO YES
ATQ SITES_EXPLOITATIONS MLOG$_SITES_EXPLOITATIONS NO YES NO YES NO YES
ATQ TYPES_IDENTIFIANTS MLOG$_TYPES_IDENTIFIANTS NO YES NO YES NO YES
ATQ UTILISATEURS MLOG$_UTILISATEURS NO YES NO YES NO YES
ATQ VALEURS MLOG$_VALEURS NO YES NO YES NO YES
ATQ VALEURS_DETAILS MLOG$_VALEURS_DETAILS NO YES NO YES NO YES
ATQ VEHICULES MLOG$_VEHICULES NO YES NO YES NO YES
36 ligne(s) sélectionnée(s).
SQL>
I supposed that is the result of the MLOG of the MVIEW associated with my new server. How can I be sure that the MLOG associated with the old one are really deleted ?
Thank you -
Fast refresh materialized view on demand but not working
Hi all,
I've created a simple table called xx using the following statements:
1.) create table xx(x1 varchar2(10),x2 varchar2(10),x3 varchar2(10);
2.) alter table xx add primary key (x1,x2);
I've also created a materialized log on xx using:
3.) create materialized view log on xx;
Finally, I've create a very simple materialized view based on the table xx using:
4.) create materialized view mv_xx refresh fast on demand as select * from xx;
The version of Oracle I'm currently using is:
Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
PL/SQL Release 9.2.0.6.0 - Production
CORE 9.2.0.6.0 Production
TNS for 32-bit Windows: Version 9.2.0.6.0 - Production
NLSRTL Version 9.2.0.6.0 - Production
Everything seems to be ok. However when I execute the dbms_mview.refresh('mv_xx','f') after performing any DMLs like INSERT, DELETE or UPDATE statements to the xx table. The data never gets refreshed to mv_xx and it only works on the complete refresh. Could anyone help me please as I must have missed or misunderstood some of the points about materialized view. By the way, do I need to set any flags or alter any system or session parameters prior to creating the materialized view or any other related components. Thank you.
Regards,
JohnYes, mv_xx is created in the same schema as xx. Do you have any ideas.
-
Hi all,
I am reading about materialized view from 9i documentation. In this it is mentioned that for updatable materialized views one needs to have updatable materialized view log, but it is not given the log has to be created by us like the materialized view log used for fast refresh or is it automatically created. Also in types of materialized view I can see primary key materialized view and row id materialized view and in materialized view log creation I can see that two type of log creation is possible, one is primary kep MV log and rowid MV log. If mmy understanding is correct then Primary key MV can have only primary key log created. Am I right? One more fact is that one cant import MV from one schema to other by mentioning fromuser to user parameter in 9i, but when I tried doing it in 11g it got imported fine. So is it a new feature too?
Thanks
Kris.When you create a materialized view you should be able to set the refresh interval. Using that, you can refresh the M view based on your needs. Below example has the sytanx:
CREATE MATERIALIZED VIEW mv_emp_pk
REFRESH FAST START WITH SYSDATE
NEXT SYSDATE + 1/48
WITH PRIMARY KEY
AS SELECT * FROM emp@remote_db; -
JOB to refresh the materialized views
Hi,
I have created the following job to call a procedure which refreshes all the materialized views but it that job has been running from ages although in the past it seems to work.
Can u advise me what im missing
REM : procedure to refresh all the job
PROCEDURE PROC_REFRESH_MVS AS
BEGIN
This procedure will refresh all of the MVs
DBMS_MVIEW.REFRESH('MV_A','c');
DBMS_MVIEW.REFRESH('MV_B','c');
DBMS_MVIEW.REFRESH('MV_Z','c');
END PROC_REFRESH_MVS;
REM Job to call the procedure
BEGIN
sys.dbms_scheduler.create_job(
job_name => '"SCHEMAOWNER"."REFRESH_MVS"',
job_type => 'STORED_PROCEDURE',
job_action => 'SCHEMAOWNER.PROC_REFRESH_MVS',
start_date => systimestamp at time zone 'Europe/Lisbon',
job_class => 'DEFAULT_JOB_CLASS',
comments => 'Refresh all the materialized views ',
auto_drop => FALSE,
enabled => FALSE);
sys.dbms_scheduler.set_attribute( name => '"SCHEMAOWNER"."REFRESH_MVS"', attribute => 'logging_level', value => DBMS_SCHEDULER.LOGGING_FULL);
sys.dbms_scheduler.enable( '"SCHEMAOWNER"."REFRESH_MVS"' );
END;Hi
To understand what's going on you should analyze the trace file that is generated when such an error occurs. Metalink note 131885.1 may be helpful.
HTH
Chris -
Refreh of a materialized view!
Dear All,
My Oracle Database is 11gR1 and Linux is the OS.
What I am trying to achieve by creating materialized view logs and materialize views is, that as soon as there is a change in materialize view log (master table) on remote site, the materialize view on another local server is also updated. Both system are on the same network.
I mean this will be then very near to real time replication. If i specify a time limit then even if there is no change in master table, snapshot will be updated and it will depend on the data size how much time snapshot takes to update.
So that's y i need to perform a snapshot update as soon as there is any change in materialize view log.
What clause i need to specify while creating such a materialize view?
REFRESH <FAST | FORCE> ON <COMMIT | DEMAND> is the clause i need to understand from you guys, what suits the best in my situation.
Also please if there is another way to achieve this task using materialize view kindly do let me know. Maybe there is some other type of materialized view doing this. All my materialized views are based on single master table.
Thanks a lot.
Regards, Imrana. remote means a db_link, even if the db_link is a loop back (in the same database):
e.g.
SQL> create table mv_test(pk number primary key);
Table created.
SQL> create materialized view log on mv_test;
Materialized view log created.
SQL> create database link loop_back connect to ami identified by ami
2 using 'ocm12';
SQL> select * from dual@loop_back;
D
X
SQL> create materialized view mv_test_check
2 refresh on commit
3 as select * from mv_test@loop_back;
create materialized view mv_tet_check
ERROR at line 1:
ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view
SQL> create materialized view mv_test_check
2 refresh on commit
3 as select * from mv_test;
Materialized view created.b. no, you need to create a job that will call dbms_mview.refresh
Amiel Davis -
Fast Refresh Materialized View - failure
Okay, this issue currently has me stumped. I searched the world wide web and still cannot seem to identify the cause of this issue.
Here is the scenario:
I created a materialized view log for the source table (let's say table1) found at DB1.
I then create a materialized view (fast refresh, with logging) at a remote database (let's say DB2). The query for the MV is basic: select * from schema1.table1@db1_link;
I set the materialized view to refresh every 30 seconds (for testing purposes).
This creates a dbms job that executes every 30 seconds. The materialized view gets created successfully. I purposely enter new data into table1. The materialized view log for table1 successfully captures these changes. However, the materialized view found at DB2 does not get refreshed (updated) successfully.
In fact, the dbms job errors-out. It keeps failing and failing. After 16 times, it gets marked as 'broken.'
The error message is as such:
RDBA WARNING: ORA-12012: error on auto execute of job 1472
RDBA WARNING: ORA-00604: error occurred at recursive SQL level 3
RDBA WARNING: ORA-01017: invalid username/password; logon denied
RDBA WARNING: ORA-02063: preceding line from db1
RDBA WARNING: ORA-06512: at "SYS.DBMS_SNAPSHOT", line 820
RDBA WARNING: ORA-06512: at "SYS.DBMS_SNAPSHOT", line 877
RDBA WARNING: ORA-06512: at "SYS.DBMS_IREFRESH", line 683
RDBA WARNING: ORA-06512: at "SYS.DBMS_REFRESH", line 195
RDBA WARNING: ORA-06512: at line 1
The strange thing is, that the error supposedly claims invalid username/password. But I've used the db links successfully before & the username/password is not invalid. Has anyone encountered this issue before?Justin,
From reading earlier posts about issues with materialized views, I remember reading something about materialized views (fast refreshable) not working with sysdate. What did you mean by such a statement? (I would copy & paste it here, but I am unable to find it at the moment).
The reason I am curious, is the fact that I am setting my MV to refresh every 30 seconds let's say (for testing). At this moment - it starts failing & failing & failing. -
Materialized view logs in cloned database
Hi all!
We have materlialized views and materlialized view logs in two separate databases which are connected with a database link. The MV logs are in DB1_PROD, which is the database being cloned. The database link goes from DB2_PROD (where the MVs are located) to DB1_PROD:
DB2_PROD (materialized views) ----DB link---> DB1_PROD (materialized view logs)
When cloning DB1_PROD to DB3_DEV, the MV logs still have a reference to DB2_PROD. However, there is no connection between DB3_DEV and DB2_PROD.
In my opinion this is not harmful, but I would like to know if any of you can see any problems with this.
In summary;
DB1_PROD: Materialized view logs
DB3_DEV: Materialized view logs. Clone of DB1_PROD
DB2_PROD: Materialized views.
DB1_PROD and DB3_DEV:
select * from v$version;
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
DB2_PROD:
select * from v$version;
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - ProductionPlease let me know if you need further information.Oracle automatically purges rows in the materialized view log when they are no longer needed. Because Oracle must wait for all dependent materialized views to refresh before purging rows from a materialized view log, unwanted situations can occur that cause a materialized view log to grow indefinitely when multiple materialized views are based on the same master table or master materialized view.
For example, such situations can occur when more than one materialized view is based on a master table or master materialized view and one of the following conditions is true:
Materialized view is not configured for automatic refreshes and has not been manually refreshed for a long time. OR
Materialized view has an infrequent refresh interval, such as every year, etc
You can also refresh the materialized views associated with the log so that Oracle can purge rows from the materialized view log.
If a materialized view log needs to be purged manually for some reason a procedure called DBMS_MVEW.PURGE_LOG can be used.
Edited by: user130038 on Sep 30, 2011 6:49 AM
Maybe you are looking for
-
I left it running over night, it was running perfectly, in the morning the screen was black. i tried to restart it and got no display but i can hear the machine running. so i put away for several months, plug it in, charge the battery, it boots, i ha
-
Itunes 9.2 - Itunes Store problems
ok this is a minor thing I'm sure, but when I go into the itunes store and preview music it plays about 15-20 seconds of the song and quits. Very annoying. Is this happening to anyone else, and is there a way to fix it? thx
-
Lightroom 5 and Bridge 6- Color Label and Keyword compatibility
I've added color labels and keywords to images in Lightroom 5 but I'm not seeing them in Bridge CC. Lightroom Metadata > Color Label Set is set to Lightroom Default (Red-Yellow etc. And Bridge Preferences > Labels is also set with "Red, Yellow etc" t
-
Crackly Sound on L755 Laptop, no headphone jack output
I have a L755 - S5366 laptop. Windows 7 Home Premium. Crackly sound comes from onboard speakers when using internet explorer or any of the "TEST" functions located in the Sound properties dialog boxes. When playing YouTube, no sound at all. U
-
Installing Elements 11 and Premier Elements 11
I just bought Elements 11 & Premier Elements 11 but cannot install it. When I click download, I get the Adobe Site Requirements screen, which says I have IE 4 or earlier. However, I have IE 10. What do I need to do?