[help] materialized view lost + duplicated data on remote - Fast Refresh
I created materialized view by "FAST REFRESH":
MASTER:
create SNAPSHOT log on XXX with rowid;
REMOTE:
create snapshot XXX
REFRESH fast START WITH SYSDATE NEXT SYSDATE + 1/86400 with rowid
as select * from XXX@DB_LINK;
-> I had many transactions insert/update/delete on MASTER.
Please help me any idea to protect data and fast replicate data.....=>
My Problem:
1. data duplicated on Remote server.
2. data lost on Remote server.
I need to know anybody use materialized view log and found the problem like me.
I have changed script:
MASTER:
create SNAPSHOT log on XXX with primary key including new values;
REMOTE:
create snapshot XXX
REFRESH fast START WITH SYSDATE NEXT SYSDATE + 1/86400 with primary key
as select * from XXX@DB_LINK;
I'm sure new script to resolve duplicate, But not sure about data lose.
If you have some idea, Please inform me...............
Similar Messages
-
Hi,
i need to create materialized fast refresh view from 3 base tables.I was tried but below error coming,since i informed to my manger not possible.but his not agrees.Could somone help to create materialized view with fast refresh
ORA-12015:cannot create a fast refresh materialized view from a complex query
create materialized view MV_DGN_TEST_SESSION
refresh start with trunc(sysdate)+4/24
next trunc(sysdate+1)+4/24
as
WITH bad_domain_groups as
SELECT DISTINCT tsd.domain_group_id
FROM test_session_detail tsd,
test_session ts ,
test_detail td
WHERE tsd.test_session_id = ts.test_session_id
AND tsd.test_detail_id =td.test_detail_id
AND ts.test_session_status_id = 4
AND td.test_type_id =8
AND tsd.test_session_status_id <> 3
AND tsd.domain_group_id IS NOT NULL
select a.test_session_id,b.test_session_detail_id,b.test_detail_id,a.completion_date,a.institution_id,
b.score,b.domain_group_id
FROM test_session a ,
test_session_detail b,
test_detail c
, bad_domain_groups bad
WHERE a.test_session_id =b.test_session_id
AND a.test_session_status_id IN (3,4)
AND b.test_detail_id =c.test_detail_id
AND c.test_type_id IN (8)
AND b.domain_group_id = bad.domain_group_id (+)
AND bad.domain_group_id IS NULL
AND b.domain_group_id is not null; Edited by: user575115 on Nov 18, 2009 11:17 PMDocs say:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_6002.htm#i2106785 :
"Restrictions on the Defining Query of a Materialized View The materialized view query is subject to the following restrictions:
* The defining query of a materialized view can select from tables, views, or materialized views owned by the user SYS, but you cannot enable QUERY REWRITE on such a materialized view.
* You cannot define a materialized view with a subquery in the select list of the defining query. You can, however, include subqueries elsewhere in the defining query, such as in the WHERE clause.
* Materialized join views and materialized aggregate views with a GROUP BY clause cannot select from an index-organized table.
* Materialized views cannot contain columns of datatype LONG.
* You cannot create a materialized view log on a temporary table. Therefore, if the defining query references a temporary table, then this materialized view will not be eligible for FAST refresh, nor can you specify the QUERY REWRITE clause in this statement.
* If the FROM clause of the defining query references another materialized view, then you must always refresh the materialized view referenced in the defining query before refreshing the materialized view you are creating in this statement.
If you are creating a materialized view enabled for query rewrite, then:
* The defining query cannot contain, either directly or through a view, references to ROWNUM, USER, SYSDATE, remote tables, sequences, or PL/SQL functions that write or read database or package state.
* Neither the materialized view nor the master tables of the materialized view can be remote.
If you want the materialized view to be eligible for fast refresh using a materialized view log, then some additional restrictions may apply."
Try to reconstruct the query without the WITH-clause. -
ORA-12034: materialized view log on table younger than last refresh
I am getting this error while creating the materialized view.
This error seems to be refresh error.
but when i have a mat view log already and running script to create the materialized view how can that happen?34MCA2K2, Google lover?
I confess perhaps I gave a little info.
View log was created before MV.
It was the first initial load.
No refresh failed.
No DDL.
No purge log.
Not warehouse.
There is no such behavior for MVs on another sites.
P.S. I ask help someone who knows what's wrong or who faced with it or can me follow by usefull link.
P.P.S. It's a pity that there is no button "Useless answer" -
Oracle Materialized view with xmltype data type
this the table having in db1 i need to create materialized view db2 for this table i have followed below steps..
create table WORKSHEETMASTER
METHODID NUMBER(10),
WORKSHEETCODE VARCHAR2(50 BYTE) not null,
WORKSHEET SYS.XMLTYPE);
create materialized view log on db1.WORKSHEETMASTER;
db2
CREATE MATERIALIZED VIEW WORKSHEETMASTER
REFRESH FAST ON DEMAND
AS
SELECT METHODID,
WORKSHEETCODE,
worksheet FROM db1.WORKSHEETMASTER@DBLINK;
when i was create materialized view above script in db2 iam getting error
ORA-22992:cannot use LOB locators selected from remote tables
like this when remove the worksheet column created succesfully may know how achieve this problem
my database version 11g iam searched some sceniour not full filled
need for help
thanksthis the table having with in DB1
create table WORKSHEETMASTER
METHODID NUMBER(10),
WORKSHEETCODE VARCHAR2(50 BYTE) not null,
WORKSHEET SYS.XMLTYPE,
WORKSHEETID NUMBER primary key,
CREATEDDATE DATE,
CREATEDBY VARCHAR2(50 BYTE),
WORKSHEETNAME VARCHAR2(50 BYTE),
UPDATEDDATE DATE,
UPDATEDBY VARCHAR2(50 BYTE),
NOOFROWS NUMBER(3),
NOOFCOLUMNS NUMBER(3),
WORKSHEETTYPE CHAR(1 BYTE),
SUBSTRATEUSED VARCHAR2(50 BYTE),
STATUS NUMBER(1),
APPROVEDBY VARCHAR2(50 BYTE),
APPROVED CHAR(1 BYTE) default 'N',
APPROVALREMARKS VARCHAR2(100 BYTE),
LNG_WORKSHEETNAME VARCHAR2(50)
iam trying to create materailzed view in db2
create materialized view WORKSHEETMASTER
refresh fast on demand
as
SELECT METHODID,
WORKSHEETCODE,
WORKSHEETID,
worksheet,
CREATEDDATE,
CREATEDBY,
WORKSHEETNAME,
UPDATEDDATE,
UPDATEDBY,
NOOFROWS,
NOOFCOLUMNS ,
WORKSHEETTYPE,
SUBSTRATEUSED,
STATUS,
APPROVEDBY,
APPROVED,
APPROVALREMARKS,
LNG_WORKSHEETNAME FROM db1.WORKSHEETMASTER@DBLINK; --remote database
iam creating above scriprt in db2 getting error this my total script -
Materialized view to ensure data integrity over multiple tables
Hello,
I have a problem and I am not able to solve it. Partially, It is because of my poor SQL skills. I have three tables and I am using one sequence to enter data into them.
What I am tying to do is to create a materialized view ( complete or fast, whichever) with refresh on commit option to check that each table contains unique data in comparison to other.
I am posting code so you can get along:
CREATE TABLE table_1 (
ID NUMBER PRIMARY KEY
CREATE TABLE table_2 (
ID NUMBER PRIMARY KEY
CREATE TABLE table_3 (
ID NUMBER PRIMARY KEY
INSERT INTO table_1 VALUES (1);
INSERT INTO table_1 VALUES (2);
INSERT INTO table_2 VALUES (3);
INSERT INTO table_2 VALUES (4);
INSERT INTO table_3 VALUES (5);
INSERT INTO table_3 VALUES (6); I want to write create a materialized view that will give me output only in case that there are same values in two different tables. I got this far.
CREATE MATERIALIZED view mv_test
REFRESH COMPLETE ON COMMIT
AS
SELECT count(1) ROW_COUNT
FROM dual
WHERE EXISTS (
SELECT a.id
FROM table_1 a
WHERE a.id IN(
SELECT b.id
FROM table_2 b))
OR EXISTS (
SELECT a.id
FROM table_1 a
WHERE a.id IN
(SELECT c.id
FROM table_3 c))
OR EXISTS (
SELECT b.id
FROM table_2 b
WHERE b.id IN
(SELECT c.id
FROM table_3 c));
ALTER MATERIALIZED VIEW mv_test
ADD CONSTRAINT cs_mv_test
CHECK (row_count = 0) DEFERRABLE; This sql statement itself returns no rows if my logic is correct. And in case there were some duplicate rows in two different table, it would return 1 and constraint would throw an error.
However, I cannot create this with ON COMMIT option. When I try to compile I get:
ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view I went through documentation, tried creating mat_view logs etc.
I know that one of the mistakes is that I am referencing dual table and I am not sure if I can use EXISTS.
Unfortunately, my SQL wisdom ends here. I need help rewriting the sql, so it would work in materialized view with refresh on commit option. Please, help!!!
I know that since I am using a sequence there is little chance that same value will get into two different tables, but I would like to perform somekind of check.
Thank you in advance.>
I know that since I am using a sequence there is little chance that same value will get into two different tables, but I would like to perform somekind of check.If you are certain that you control all the inputs to the table and you are definitely using one sequence to insert into all three tables then there is physically no possible way you will get duplicate values across tables.
Writing something to check if this is the case would almost be like writing something to verify that 1+1 really does equal 2 in 100% of cases.
if you must, however. consider something similar to the following which may be more performant:
select *
from table_1 t1
full outer join table_2 t2 on (t1.id = t2.id)
full outer join table_3 t3 on (t1.id = t2.id
or
t2.id = t3.id)
where t1.id+t2.id+t3.id not in (t1.id,t2.id,t3.id); -
Refresh fails on materialized view with CLOB data type
Hi,
Hope somebody can help me with this issue.
Some materialized views get status broken on refreshment, but only sometime. When I try to refresh them manually I get following message: "ORA-01400: cannot insert NULL into...". But I know for sure that there are no NULL values in the master table, MV and master tables are declared in the same way and all columns in master tables are NOT NULL columns. Another ting is that this error I get only on columns with data type CLOB.
Please, help!
/Juliahi,
I cant upgrade to 11g.Also i cant change the table structure.
Here is a sample of xmltype field content:
RECID XMLRECORD
D00009999 <row id='D100009999'><c2>10000</c2><c3>xxxxx</c3><c5>xxxx..
And i need to extract in the mv the data from c2, c3 and so on.
Still waiting for a hint.
Thank you. -
AWM does not provide Materialized Views as potential data sources.
Hi
I would like to map OLAP dimensions and cubes directly to materialized views. The Oracle AWM tool, however, only displays Tables, Views and Synonyms as mapping objects and I have to indirectly map to normal views created over the materialized views.
Why does Oracle enforce this limitation?
Thanks
Kind Regards
GregGreg,
Not sure why AWM enforces this limitation, certainly Warehouse Builder does not enforce this rule (at least not to my knowledge). You could raise a bug/enhancement request with Support. However, my recommendation is to never to map directly to a source object, such as a fact table or materialized view, in AWM. This can create all sorts of problems as you move your AWM model across environments. I always suggest to my customers and consultants they create a view over their source objects and use the view within the mapping editor. It will give you more control over the flow of data into your cube/dimension since it allows you to define filters on the view.
Hope this helps
Keith Laker
Oracle EMEA Consulting
BI Blog: http://oraclebi.blogspot.com/
DM Blog: http://oracledmt.blogspot.com/
BI on Oracle: http://www.oracle.com/bi/
BI on OTN: http://www.oracle.com/technology/products/bi/
BI Samples: http://www.oracle.com/technology/products/bi/samples/ -
Materialized view with xmltype data type
Hello to all,
I have a challenge with my 10g r2 database. I need to make a materialized view from a table in this format:
Name Null? Type
RECID NOT NULL VARCHAR2(200)
XMLRECORD XMLTYPE
,my problem is that (as i read from docs) i cant make the view refreshable on commit and also i cant refresh the mv in fast mode ( i dont need to refresh mv complete - takes too long).
Do you have a hint for this?
Thank you in advance.
Danielhi,
I cant upgrade to 11g.Also i cant change the table structure.
Here is a sample of xmltype field content:
RECID XMLRECORD
D00009999 <row id='D100009999'><c2>10000</c2><c3>xxxxx</c3><c5>xxxx..
And i need to extract in the mv the data from c2, c3 and so on.
Still waiting for a hint.
Thank you. -
Unable to drop materialized view with corrupted data blocks
Hi,
The alert log of our database is giving this message
Wed Jan 31 05:23:13 2007
ORACLE Instance mesh (pid = 9) - Error 1578 encountered while recovering transaction (6, 15) on object 13355.
Wed Jan 31 05:23:13 2007
Errors in file /u01/app/oracle/admin/mesh/bdump/mesh_smon_4369.trc:
ORA-01578: ORACLE data block corrupted (file # 5, block # 388260)
ORA-01110: data file 5: '/u03/oradata/mesh/mview.dbf'
No one is using this mview still oracle is trying to recover this transaction (6, 15).
when i tried to drop this mview it gives me this error
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 5, block # 388260)
ORA-01110: data file 5: '/u03/oradata/mesh/mview.dbf'
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2255
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2461
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2430
ORA-06512: at line 1
I have tried to fix the corrupted data blocks by using dbms_repair package, but of no use.
I have marked this block to be skipped by using dbms_repair.skip_block but still unable to drop it.
Please suggest what should I do?
Thanks in advance
AnujYou are lucky if only your undesirable MV is affected by theese corrupted blocks. This is an advice to do a complete-super-full-hot-cold-middle backup of ypur database and search for any disk for a "possible replace".
God save us! -
Materialized view - fast refresh logs
I understand that there will be a Change Data Capture(CDC) log maintained internally for materialized view fast refresh to happen.
My question is, will this log get purged once the changes are applied to corresponding materialized view or will it persist with further changes getting appended to it ?
What would be the size of change log for 150 million records covering 40 base tables ?MV log entries are deleted when all registered materialized views that depend on them have refreshed.
For example: Suppose you have a table T and materialized views A and B that are fast-refresh and depend on the MV log for T.
On Monday you refresh MV A. The log entries are nto purged because B has not yet incorporated them.
On Tuesday you refresh MV B. At this point the log entries are purged up to the time on Monday that A was refreshed, because all MVs have processed them.
On Wednesday you refresh MV A again. At this point the log entries are purged up to the time on Tuesday that A was refreshed. etc. -
Materialized View Fast Refresh. Quick Question
Hi all
I have an assumption that I would love to have validated quickly if possible.
I am assuming that once a refresh operation is kicked off, any changes to the MLOG$ log table subsequent to the start of the refresh will not be picked up on that refresh cycle.
I'm basing this on my understanding of cursor consistency logic, but if someone could validate or refute the above then it would be much appreciated.
Many thanks
ChrisMV log entries are deleted when all registered materialized views that depend on them have refreshed.
For example: Suppose you have a table T and materialized views A and B that are fast-refresh and depend on the MV log for T.
On Monday you refresh MV A. The log entries are nto purged because B has not yet incorporated them.
On Tuesday you refresh MV B. At this point the log entries are purged up to the time on Monday that A was refreshed, because all MVs have processed them.
On Wednesday you refresh MV A again. At this point the log entries are purged up to the time on Tuesday that A was refreshed. etc. -
Regarding error in fast refresh for Materialized
ORA-12015: cannot create a fast refresh materialized view from a complex query
CREATE MATERIALIZED VIEW CRESTELVIEWSDEV510.MVCONTENTHISTORY
TABLESPACE CRESTELVIEWSDEV510
NOCACHE
LOGGING
NOCOMPRESS
NOPARALLEL
BUILD IMMEDIATE
REFRESH FAST
ENABLE QUERY REWRITE
AS
SELECT a.DAY, a.contentname,
SUM
(CASE
WHEN (b.subscriptionstartdate) <= (a.DAY)
AND ((CASE
WHEN b.subscriptionenddate IS NOT NULL
THEN (a.DAY)
ELSE TO_DATE ('01/20/1990', 'MM/DD/YYYY')
END
) <=
(CASE
WHEN b.subscriptionenddate IS NOT NULL
THEN (b.subscriptionenddate)
ELSE TO_DATE ('01/20/1990', 'MM/DD/YYYY')
END
THEN 1
ELSE 0
END
) COUNT,
COUNT
(CASE
WHEN (b.subscriptionstartdate) <= (a.DAY)
AND ((CASE
WHEN b.subscriptionenddate IS NOT NULL
THEN (a.DAY)
ELSE TO_DATE ('01/20/1990', 'MM/DD/YYYY')
END
) <=
(CASE
WHEN b.subscriptionenddate IS NOT NULL
THEN (b.subscriptionenddate)
ELSE TO_DATE ('01/20/1990', 'MM/DD/YYYY')
END
THEN 1
ELSE 0
END
) cnt
FROM TBLTDATEWISECONTENT a,
(SELECT TRUNC (a.subscriptionstartdate) subscriptionstartdate,
TRUNC (a.subscriptionenddate) subscriptionenddate, b.NAME,
b.contentid
FROM syntbltcontentsubscrhistory a, syntblmcontent b
WHERE b.contentid = a.contentid(+)) b
WHERE a.contentid = b.contentid(+)
AND a.DAY = b.subscriptionstartdate(+)
GROUP BY a.contentname, a.DAY;
while creation time of this Materialized I have receive above error ORA-12015
I have also crated log with Primary on all base tables and index on column that is in where clause.
Kindly provide solution .
I want to create this MV with FAST Refresh.
Regards,
nayana chavda.What's your Oracle version?
The error is pretty self explanatory. You can not build fast refresh MView with complex query.
check Oracle document,
http://download.oracle.com/docs/cd/B19306_01/server.102/b14226/repmview.htm#BABEEHGJ
To be fast refreshed, the defining query for a materialized view must observe certain restrictions. If you require a materialized view whose defining query is more general and cannot observe the restrictions, then the materialized view is complex and cannot be fast refreshed.
... -
Do the objects of a Fast Refresh Materialized need to have logs as well?
Hi,
I using Oracle 9.2.0.6
I'd like to change an existing Materialize View to a fast refresh Materialize View.
I understand that I have to create a log file for the Materialized View. But do I also have to Create a log file for every object in the from clause that makes up the View select Statement?
The view is too long to list here. I'm just going to post the tables and views that make up the list.
from
oe_order_headers_all oh
,oe_order_lines_all ol
,hz_cust_site_uses_all ship_su
,hz_party_sites ship_ps
,hz_locations ship_loc
,hz_cust_acct_sites_all ship_cas
,oe_transaction_types_tl olt
,oe_transaction_types_all olta
,oe_transaction_types_tl ott
,oe_transaction_types_all ota
,forx_deal_orders do
,forx_deal_order_types dot
,forx_deals d
,forx_deal_schedules ds
,gl_periods ppm_s
,gl_periods ppm_r
,gl_periods ppm_sh
,gl_periods ppm_b
,gl_periods ppm_df
,gl_periods ppm_dl
,ftbv_customer_all_1d c
ftbv_salesrep_all_1d rs
,ftbv_territories_all_1d terr
,po_lines_all pl
,ftbv_lookup_1d lu_line
,po_headers_all ph
,po_vendors pv
,per_all_people_f ph_agent
fnd_user fu_po_c
,fnd_user fu_po_u
-- received shipment lines from purchase orders
select
/*+
po_header_id
,po_line_id
,min(creation_date) receipt_first_creation_date
,max(last_update_date) receipt_last_update_date
,sum(nvl(quantity_received, 0)) receipt_quantity_received
,sum(nvl(quantity_shipped , 0)) receipt_quantity_shipped
,nvl(count(*),0) receipt_line_count
from
rcv_shipment_lines rsl_i
where
source_document_code = 'PO'
and po_line_id is not null
group by
po_header_id
,po_line_id
) rsl
-- receipt deliveries
select
rd.po_header_id
,rl.po_line_id
,min(rd.actual_ship_date) plc_entered_min_actual_ship_dt
,max(rd.actual_ship_date) plc_entered_max_actual_ship_dt
,count(rl.delivery_line_id) delivery_line_count
from
forx_receipt_deliveries rd
,forx_receipt_lines rl
where
rl.delivery_id = rd.delivery_id
group by
rd.po_header_id
,rl.po_line_id
) rdl
ra_customer_trx_lines_all trx_ln
,ra_customer_trx_all trx_hd
,ra_cust_trx_types_all trx_tp
,ftbv_customer_all_1d c_bill
ftbv_item_all_1d ia
,mtl_parameters mp
fnd_user fu_c
,fnd_user fu_u
WHERE...Am I going to have to create a log for each of these objects in the 'from' clause of the view for the Fast Refresh Materialize view to work or do I just create a log on the Materialized View?
Thanks!I understand that I have to create a log file for the Materialized View.No.
But do I also have to Create a log file for every object in the from clause that makes up the View select Statement?Yes.
However, the nature of your materialized view may prevent it from being fast-refreshable.
Chapters 8 and 9 here are a great reference:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/basicmv.htm
Edited by: SomeoneElse on Feb 25, 2009 1:10 PM -
Creation of materialized view from remote linked table
Hi ,
I am facing problem in creating a materialized view which is based on remote link and my query is involving one equi-join.And both table contributes around 2.75 crore rows. I am trying to create two diff views(MV) but the views are taking very much time to create. If you have any ideas or suggestions.And also I want performance I cant compromise it,so help. Please post it down.
Thanks,user13104802 wrote:
Hi ,
I am facing problem in creating a materialized view which is based on remote link and my query is involving one equi-join.And both table contributes around 2.75 crore rows. I am trying to create two diff views(MV) but the views are taking very much time to create. If you have any ideas or suggestions.And also I want performance I cant compromise it,so help. Please post it down.
Thanks,Welcome to the forum.
You will need to provide more information if you are interested in getting an intelligent response to your post. It appears that you are creating 2 different MVs but the details of each are not provided, ie
Where do each of the source tables exist, ie local or remote?
How many rows in each?
How will the MVs be refreshed?
There are other considerations, ie competition for resources, processing power, network bandwidth, etc, etc.
If all of the source tables exist on the remote database then consider creating the MV there and create a local view across the db link, or possibly, create a MV on the remote server for a subset of the remote data and link to that MV locally. -
Storing missing data in Materialized View
There is 1 View which contains all the web activities on each day and I am extracting summary data as follows.
1. Date
2. User Access counts on the date
But the base table of this view consists of 2 table, log1 and log2, and each
table is switched each 14 days. So, this view can reference the data until
maximum 28 days.
In this environment, I am planning to store the summary data which is made
before 28 days, using Materialized View. But can Materialized View store the
data which is gone in the base table or View? I want to refresh only recent data
and keep past data as it is in the Materialized View.Thank you for the reply.
So, once the materialized view is refreshed, the previous data will be cleared, right? I wanted to store old data and add new data at the same time, but it seems to be impossible.
In our environment, table Log1 and Log2 are used alternately. So, once 14 days data are stored in Log1, new log data will be written into Log2 table and after another 14 days, the new log data will be written in Log1 Table. So, Maximum 28 days data can be stored.
Maybe you are looking for
-
Unable to update Intel HD graphics drivers on my new computer
Hi, I just recently bought a desktop HP Pavilion PC with Windows 8 64-bit which includes an Intel HD Graphics card but when I try to download the latest driver for my graphics (version 15.33.18.64.3496) on Intel's site it says I need to download it f
-
HT4528 how can i connect my phone to itunes after i locked my phone up ?
how can i connect my iphone to itunes after i locked my phone up ?
-
How to debug ABAP Web services from Microsoft Visual Studio
When developing .NET based Web services clients using Visual Studio that call Web services in SAP NetWeaver .NET developers would like to be able to debug inside SAP. In my blog <a href="/people/andre.fischer/blog/2007/02/07/how-to-debug-abap-web-ser
-
I've been disappointed with my DLink Media Center Extender for some time now. Even with TVersity to provide media server services to it, the unit just doesn't match the quality of output my AppleTV has. I have a great deal of content on my PC but can
-
Compare DB objects between different schemas
Hi, I want to compare db objects beween 2 different schemas like QA and PROD. Please suggest me a tool that compares table definitions,stored procedures and other db objects between different schemas.