Logging option in materialized view
Hi all,
Anyone know about the meaning of "Logging option"(LOGGING, NOLOGGING) in Materialized view of node Snapshot in Oracle enterprise manager(Warehouse -->Summary management -->Materialized view(snapshot))
Pls explain me.
Thank you
Mcka
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/clauses005.htm#i999782
Similar Messages
-
Materialized view log with multiple materialized views
DB: 9.2.0.8
Yes its old. I am not allowed to upgrade it.
I have a set of materialized views that are created off of 5 base tables. They do fast refreshes. So I have multiple materialized views for the same base table and same materialized view log.
1. how do materialized view logs manage multiple dependent materialized views?
2. How do I tell by looking at the materialized view log which rows have not been fast refresh for a specific materialized view?As a starter for 10 try reading: Materialized View Refresh : Log Population and Purge (Doc ID 236233.1) on MOS.
Thanks
Paul -
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 -
Materialized view logs for Fast refreshes
Hi,
I created MV and MV logs on the base table/main table. I set the base table in NOLOGGING MODE. so ofcourse redo is not gonna generate during DML but i wanted to know that:
Will NOLOGGING effect the MV logs for fast refreshes?
I came up on conclusion that MV logs are nothing to do with Redo Logs and would have no impact on MV logs for fast refresh since i have set my all base table in NOLOGGING MODE.
Looking forward for expert opinion.
REGARDS,Though I'm not an expert...
SQL> alter table emp nologging;
Table altered.
SQL> create materialized view log on emp;
Materialized view log created.
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
EMP TABLE
BONUS TABLE
SALGRADE TABLE
RUPD$_EMP TABLE
MLOG$_EMP TABLE
SQL> insert into emp values(1000,'Matt','Test',100,sysdate,1000,1000,10,11,11);
1 row created.
SQL> select *From mlog$_emp;
EMPNO SNAPTIME$ D O
CHANGE_VECTOR$$
1000 01-JAN-00 I N
FEFF -
Hi, I need some help understanding MV Logs. The information I find on MV Logs, is very basic, ie. the general syntax of creating a log, the types of logs, how they are refreshed etc.
Let me put my question this way. I want to create an MV, with a where clause that joins 3 tables. This should be simple enough. But how does the LOG(s) work ? Is there an MV Log for each table in the where-clause of the select statement ?
And, is there only 1 way of creating an MV Log? CREATE MATERIALIZED VIEW LOG ON mis.prov_cat_link with .......
Can't I specify the columns I want to "log" ? What if the select statement in my MV create statement only selects certain columns, and not all ? Maybe if I understand how the log works, I will understand the logic behind it, and how to create it.
I hope the above makes sense !Using the WITH clause you can provide filter columns that are stored in the MV log.
Mike -
Can I create index on Materialized view log
Hello
The ADDM suggest me to create index on some fields of my materialized view log , I don't know does it cause any problem ? Is it safe ? have you done it before ?
thanksActually you can do it since materialized view log is in fact a table.
SQL> create table t(x int primary key);
Table created.
SQL> create materialized view log on t;
Materialized view log created.
SQL> select segment_name, segment_type from user_segments;
SEGMENT_NAME
SEGMENT_TYPE
MLOG$_T
TABLE
T
TABLE
SYS_C004857
INDEX
SQL> desc mlog$_t;
Name Null? Type
X NUMBER
SNAPTIME$$ DATE
DMLTYPE$$ VARCHAR2(1)
OLD_NEW$$ VARCHAR2(1)
CHANGE_VECTOR$$ RAW(255)
SQL> create index i on mlog$_t(x);
Index created.However I don't know if this is really supported and makes sense. -
Error creating materialized view log using DBlink
Hi guys,
I have 2 databases in diferent machines . (machine A and B)
Machine A is my production database and I have a database link in machine B accessing Machine A
CREATE MATERIALIZED VIEW vm_test
BUILD IMMEDIATE
REFRESH FAST ON commit as
select * from test@A
-- no problem in this first operation the materialized view was created sucessfully
Now I need to create the LOG
SQL> CREATE MATERIALIZED VIEW LOG ON test
2 PCTFREE 5
3 TABLESPACE prodemge_2006
4 STORAGE (INITIAL 10K NEXT 10K);
CREATE MATERIALIZED VIEW LOG ON test
ERROR at line 1:
ORA-02050: transaction 5.21.8771 rolled back, some remote DBs may be in-doubt
ORA-02068: following severe error from A
ORA-03113: end-of-file on communication channel
What could be causing this error ?
Thank you,
FelipeORA-02050 transaction string rolled back, some remote DBs may be in-doubt
Cause: Network or remote failure during a two-phase commit.
Action: Notify operations; remote databases will automatically re-sync when the failure is repaired.
ORA-02068 following severe error from stringstring
Cause: A severe error (disconnect, fatal Oracle error) was received from the indicated database link. See following error text.
Action: Contact the remote system administrator.
M.S.Taj -
Hi,
I would like to create Fast refresh Materialized View in owb
Create Materialized View F_CALL_DAY_MV PARALLEL LOGGING BUILD IMMEDIATE REFRESH FAST ENABLE QUERY REWRITE AS
SELECT
FCALL.ACCOUNT_DIM_ID,
FCALL.INVOICE_DIM_ID,
FCALL.SCHEDULER_DIM_ID,
FCALL.CHAIRPERSON_DIM_ID,
FCALL.DATE_DIM_ID,
FCALL.RESERVATION_DIM_ID,
FCALL.PRODUCT_DIM_ID,
FCALL.CALL_STATUS_DIM_ID,
FCALL.REVENUE_CENTER_DIM_ID,
FCALL.CAMPAIGN_DIM_ID,
FCALL.SALESPERSON_DIM_ID,
count(*),
count (FCALL.CAMPAIGN_ELAPSED_DAYS_TO_CALL) cnt_CAMP_ELAPSED_DAYS_TO_CALL,
AVG(FCALL.CAMPAIGN_ELAPSED_DAYS_TO_CALL) AVG_CAMP_ELAPSED_DAYS_TO_CALL,
SUM(FCALL.SCHEDULED_CONNECTIONS) SCHEDULED_CONNECTIONS,
SUM(FCALL.ACTUAL_CONNECTIONS) ACTUAL_CONNECTIONS,
DDATE.THE_DATE,
DDATE.YEAR_NUM,
DDATE.MONTH_NUM,
DDATE.WEEK_OF_THE_YEAR,
DACCOUNT.BILL_ACCOUNT_CD,
DACCOUNT.ACCOUNT_NM,
DCHAIRPERSON.CONTACT_FULL_NAME,
DCHAIRPERSON.CONTACT_FULL_ADDRESS,
DCHAIRPERSON.MAIN_PHONE_NUM,
DCHAIRPERSON.MOBILE_PHONE_NUM,
DCHAIRPERSON.EMAIL_ADDR
FROM F_CALL FCALL,
D_ACCOUNT DACCOUNT,
D_CALL DCALL,
D_INVOICE D_INVOICE,
D_SCHEDULER DSCHEDULER,
D_CHAIRPERSON DCHAIRPERSON,
D_DATE DDATE,
D_RESERVATION DRESERVATION,
D_PRODUCT DPRODUCT,
D_CALL_STATUS DCALLSTATUS,
D_REVENUE_CENTER DREVENUECENTER,
D_CAMPAIGN DCAMPAIGN,
D_SALESPERSON DSALESPERSON
WHERE FCALL.ACCOUNT_DIM_ID = DACCOUNT.ACCOUNT_DIM_ID
AND FCALL.CALL_DIM_ID = DCALL.CALL_DIM_ID
AND FCALL.INVOICE_DIM_ID = D_INVOICE.INVOICE_DIM_ID
AND FCALL.SCHEDULER_DIM_ID = DSCHEDULER.SCHEDULER_DIM_ID
AND FCALL.CHAIRPERSON_DIM_ID = DCHAIRPERSON.CHAIRPERSON_DIM_ID
AND FCALL.DATE_DIM_ID = DDATE.DATE_DIM_ID
AND FCALL.RESERVATION_DIM_ID = DRESERVATION.RESERVATION_DIM_ID
AND FCALL.PRODUCT_DIM_ID = DPRODUCT.PRODUCT_DIM_ID
AND FCALL.CALL_STATUS_DIM_ID = DCALLSTATUS.CALL_STATUS_DIM_ID
AND FCALL.REVENUE_CENTER_DIM_ID = DREVENUECENTER.REVENUE_CENTER_DIM_ID
AND FCALL.CAMPAIGN_DIM_ID = DCAMPAIGN.CAMPAIGN_DIM_ID
AND FCALL.SALESPERSON_DIM_ID = DSALESPERSON.SALESPERSON_DIM_ID
GROUP BY
FCALL.ACCOUNT_DIM_ID,
FCALL.INVOICE_DIM_ID,
FCALL.SCHEDULER_DIM_ID,
FCALL.CHAIRPERSON_DIM_ID,
FCALL.DATE_DIM_ID,
FCALL.RESERVATION_DIM_ID,
FCALL.PRODUCT_DIM_ID,
FCALL.CALL_STATUS_DIM_ID,
FCALL.REVENUE_CENTER_DIM_ID,
FCALL.CAMPAIGN_DIM_ID,
FCALL.SALESPERSON_DIM_ID,
DDATE.THE_DATE,
DDATE.YEAR_NUM,
DDATE.MONTH_NUM,
DDATE.WEEK_OF_THE_YEAR,
DACCOUNT.BILL_ACCOUNT_CD,
DACCOUNT.ACCOUNT_NM,
DCHAIRPERSON.CONTACT_FULL_NAME,
DCHAIRPERSON.CONTACT_FULL_ADDRESS,
DCHAIRPERSON.MAIN_PHONE_NUM,
DCHAIRPERSON.MOBILE_PHONE_NUM,
DCHAIRPERSON.EMAIL_ADDR
For this i need to create Materialized View Log as specified below for all the tables
used for creating above MV
CREATE MATERIALIZED VIEW LOG ON D_SALESPERSON
WITH ROWID, SEQUENCE(SALESPERSON_DIM_ID)
INCLUDING NEW VALUES;
But i'm not able to create MV log in oracle warehouse builder as specified above. When i specify base tables in owb it creates default mv log as
CREATE MATERIALIZED VIEW LOG ON D_SALESPERSON but i need to create MV log with "WITH ROWID, SEQUENCE(SALESPERSON_DIM_ID)
INCLUDING NEW VALUES"
Please could you help me to resolve this issue
Thanks
KavithaHi,
I would just create the MV Log manually from SQL*Plus.
Best regards,
Erik -
Overhead of Triggers VS Materialized View Logs
If I need to log INSERTs, UPDTEs, and DELETEs on a table - is there a difference in the overhead of doing so via triggers vs MV logs?
ThanksYou said that MV log is marginally more efficient than a trigger. I am curious why. In what way do they work differently under the hood?If the essence of discussion is only why MV log is more efficient than trigger than I think Justin has pointed out below good technical points i.e.
1.You don't have to pass control over to the PL/SQL engine.
2.You're also writing the binary data that you'd put in the redo logs rather than column level data.
And below text from docs :
Internal Trigger for the Materialized View Log
When changes are made to the master table or master materialized view using DML, an internal trigger records information about the affected rows in the materialized view log. This information includes the values of the primary key, rowid, or object id, or both, as well as the values of the other columns logged in the materialized view log. This is an internal AFTER ROW trigger that is automatically activated when you create a materialized view log for the target master table or master materialized view. It inserts a row into the materialized view log whenever an INSERT, UPDATE, or DELETE statement modifies the table's data. This trigger is always the last trigger to fire.http://docs.oracle.com/cd/B28359_01/server.111/b28326/repmview.htm#i30732
3.Trigger i.e. we are coding to track the changes, MV log i.e. tool/technology which is provided by Oracle itself; so definately "We are not that much capable to write the code which is equal or more efficient than Oracle itself right ?"
In fact, functionality of MV is Instead of Trigger, but under the cover, with near to Oracle's internals.
Regards
Girish Sharma -
Is materialized view logging feature requied?
Hi Professionals,
I have a doubt regarding Materialized View loggind feature,is it required? if required ,in what real time scenerios it will be used? For Example For a Materialized view of 1 million rows how much space it occupies? Can we determine size of logging information? Is it space consuming? If any error occurs in Materialized View can we trace the error using logging? Please clarify me.
Thanks
GaneshNo, it is not mandatory to have logging on your materialized view, unless you want to do incremental refreshes.
http://docs.oracle.com/cd/B19306_01/server.102/b14220/schema.htm#i18093 -
Refresh a materialized view in parallel
Hi,
To improve the refresh performance for a materialized view, I set up it to be refreshed in parallel. The view can be refreshed successfully, however, I did not see the view is refreshed in parallel from session browser, can someone let me know if I miss any steps?
1) In DB A (running 8 CPUs), set up the base table to be parallelized, the base table is called table1
ALTER TABLE A.table1 PARALLEL ( DEGREE Default INSTANCES Default );
2) In Database A, set up the materialized view log
CREATE MATERIALIZED VIEW LOG
ON table1 WITH primary key
INCLUDING NEW VALUES;
3) In Database B (in the same server with Database A), there is an existing table called table1, prebuilt with millions of records in the table. Due to the size of table1, I have to use prebuilt option
Drop MATERIALIZED VIEW table1;
CREATE MATERIALIZED VIEW table1 ON PREBUILT TABLE
REFRESH FAST with primary key
AS
select /*+ PARALLEL(table1, 8) */ *
from table1@A;
4) in Database B, I executed this stored procedure -
EXECUTE DBMS_MVIEW.REFRESH(LIST=>'table1',PARALLELISM=>8, METHOD=>'F');
Thanks in advance!
LizI checked the execution plan when I executed the refresh stored procedure again, Does the plan indicates the parallel execution is working or not?
SELECT STATEMENT REMOTE ALL_ROWSCost: 32,174 Bytes: 775,392 Cardinality: 1,182
13 PX COORDINATOR
12 PX SEND QC (RANDOM) PARALLEL_TO_SERIAL SYS.:TQ10001 :Q1001
11 NESTED LOOPS PARALLEL_COMBINED_WITH_PARENT :Q1001
9 NESTED LOOPS PARALLEL_COMBINED_WITH_PARENT :Q1001Cost: 32,174 Bytes: 775,392 Cardinality: 1,182
6 BUFFER SORT PARALLEL_COMBINED_WITH_CHILD :Q1001
5 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1001
4 PX SEND ROUND-ROBIN PARALLEL_FROM_SERIAL SYS.:TQ10000 A
3 VIEW APP_USR. Cost: 12,986 Bytes: 6,070,196 Cardinality: 275,918
2 HASH UNIQUE Cost: 12,986 Bytes: 9,105,294 Cardinality: 275,918
1 TABLE ACCESS FULL TABLE A.MLOG$_TABLE1 A Cost: 10,518 Bytes: 9,105,294 Cardinality: 275,918
8 PARTITION RANGE ITERATOR PARALLEL_COMBINED_WITH_PARENT :Q1001Cost: 0 Cardinality: 1
7 INDEX RANGE SCAN INDEX (UNIQUE) PARALLEL_COMBINED_WITH_PARENT A.PK_TABLE1 :Q1001Cost: 0 Cardinality: 1
10 TABLE ACCESS BY LOCAL INDEX ROWID TABLE PARALLEL_COMBINED_WITH_PARENT A.TABLE1 :Q1001Cost: 0 Bytes: 634 Cardinality: 1 -
Refresh Fast option in Materialize view
Dear All,
We have oracle 10g On windows.
We have database A having SCOTT schema and tables Emp and Dept.
I have another database B having TEST schema and this schema does not have any objects (Moto is to create mview on this database).
We have created DB LINK between TEST schema to SCOTT schema and planning to create materialize view in TEST schema.
Now I am confuse....
1) I am creating mview in TEST schema and i want to refresh mview increamentally. I search on internet and found only if you want to use FAST REFRESH then you must have to create log table for the base table.
--Query is
1) I am creating mview in TEST schema and my base tables are in SCOTT schema on different database. Where should i create log table(on SCOTT SCHEMA or TEST schema).
2) Does this log tables will occupy more space or log table will truncate after refresh of mview.
3) For using incremental refresh i need to use +REFRESH FORCE+ option or anything else.
4) If log table will not truncate then it will occupy more space so is there anything that we can come up out of this situation.Thanks..1) You should create log in Scott Schema
2)
Managing Materialized View Log Space
Oracle automatically tracks which rows in a materialized view log have been used during the refreshes of materialized views, and purges these rows from the log so that the log does not grow endlessly. Because multiple simple materialized views can use the same materialized view log, rows already used to refresh one materialized view might still be needed to refresh another materialized view. Oracle does not delete rows from the log until all materialized views have used them.
For example, suppose two materialized views were created against the customers table in a master site. Oracle refreshes the customers materialized view at the spdb1 database. However, the server that manages the master table and associated materialized view log does not purge the materialized view log rows used during the refresh of this materialized view until the customers materialized view at the spdb2 database also refreshes using these rows.
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:
One materialized view is not configured for automatic refreshes and has not been manually refreshed for a long time.
One materialized view has an infrequent refresh interval, such as every year (365 days).
A network failure has prevented an automatic refresh of one or more of the materialized views based on the master table or master materialized view.
A network or site failure has prevented a master table or master materialized view from becoming aware that a materialized view has been dropped.
Note:
If you purge or TRUNCATE a materialized view log before a materialized view has refreshed the changes that were deleted, then the materialized view must perform a complete refresh.
Purging Rows from a Materialized View Log
Always try to keep a materialized view log as small as possible to minimize the database space that it uses. To remove rows from a materialized view log and make space for newer log records, you can perform one of the following actions:
Refresh the materialized views associated with the log so that Oracle can purge rows from the materialized view log.
Manually purge records in the log by deleting rows required only by the nth least recently refreshed materialized views.
To manually purge rows from a materialized view log, execute the PURGE_LOG procedure of the DBMS_MVIEW package at the database that contains the log. For example, to purge entries from the materialized view log of the customers table that are necessary only for the least recently refreshed materialized view, execute the following procedure:
3) REFRESH FAST
4) See step 2 -
Fast Refresh on Materialized View With Join
Hi All,
i have created following Materialized View Logs and MV
on EMP and DEPT
CREATE MATERIALIZED VIEW LOG ON DEPT
WITH PRIMARY KEY,SEQUENCE
INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW LOG ON EMP
WITH PRIMARY KEY,SEQUENCE
INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW EMP_MVW
TABLESPACE OSMIS_REPORT_DATA
REFRESH FAST ON COMMIT
AS
SELECT A.EMPNO,A.ENAME,A.DEPTNO,A.JOB,A.MGR,A.HIREDATE,A.SAL,A.COMM,B.DNAME,B.LOC
FROM EMP A,DEPT B
WHERE A.DEPTNO=B.DEPTNO
The Create MV Stmnt raised following error.
ERROR at line 6:
ORA-12052: cannot fast refresh materialized view SCOTT.EMP_MVW
I have tried the same with ROWID also,but same error
while creating MV.
Pls anyone give idea to Fast Refersh on MV with Joins
Thnks
Raj.G.
mail : [email protected]Actually you can get Oracle to tell you why the view does not have the capabilities you want using the DBMS_MVIEW package. For example you could have done something like this...
Personal Oracle Database 10g Release 10.1.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> CREATE MATERIALIZED VIEW LOG ON dept
2 WITH PRIMARY KEY, SEQUENCE
3 INCLUDING NEW VALUES;
Materialized view log created.
SQL> CREATE MATERIALIZED VIEW LOG ON emp
2 WITH PRIMARY KEY,SEQUENCE
3 INCLUDING NEW VALUES;
Materialized view log created.
SQL> CREATE MATERIALIZED VIEW emp_mvw
2 REFRESH FAST ON COMMIT
3 AS
4 SELECT a.empno, a.ename, a.deptno,
5 a.job, a.mgr, a.hiredate,
6 a.sal, a.comm, b.dname, b.loc
7 FROM emp a,dept b
8 WHERE a.deptno = b.deptno;
FROM emp a,dept b
ERROR at line 7:
ORA-12052: cannot fast refresh materialized view SCOTT.EMP_MVW
SQL> CREATE MATERIALIZED VIEW emp_mvw
2 REFRESH ON COMMIT -- remove the FAST to allow view to compile
3 AS
4 SELECT a.empno, a.ename, a.deptno,
5 a.job, a.mgr, a.hiredate,
6 a.sal, a.comm, b.dname, b.loc
7 FROM emp a,dept b
8 WHERE a.deptno = b.deptno;
Materialized view created.
SQL> @\oracle\product\10.1.0\Db_1\RDBMS\ADMIN\utlxmv.sql -- create mv_capabilities_table
Table created.
SQL> EXEC DBMS_MVIEW.EXPLAIN_MVIEW ('EMP_MVW');
PL/SQL procedure successfully completed.
SQL> SELECT capability_name, possible, msgtxt
2 FROM mv_capabilities_table
3 WHERE capability_name LIKE '%REFRESH_FAST_AFTER%';
CAPABILITY_NAME P MSGTXT
REFRESH_FAST_AFTER_INSERT N the SELECT list does not have the rowids of all the detail tables
REFRESH_FAST_AFTER_INSERT N mv log must have ROWID
REFRESH_FAST_AFTER_INSERT N mv log must have ROWID
REFRESH_FAST_AFTER_ONETAB_DML N see the reason why REFRESH_FAST_AFTER_INSERT is disabled
REFRESH_FAST_AFTER_ANY_DML N see the reason why REFRESH_FAST_AFTER_ONETAB_DML is disabled
SQL> DROP MATERIALIZED VIEW LOG ON dept;
Materialized view log dropped.
SQL> DROP MATERIALIZED VIEW LOG ON emp;
Materialized view log dropped.
SQL> DROP MATERIALIZED VIEW emp_mvw;
Materialized view dropped.
SQL> CREATE MATERIALIZED VIEW LOG ON dept
2 WITH ROWID, SEQUENCE
3 INCLUDING NEW VALUES;
Materialized view log created.
SQL> CREATE MATERIALIZED VIEW LOG ON emp
2 WITH ROWID,SEQUENCE
3 INCLUDING NEW VALUES;
Materialized view log created.
SQL> CREATE MATERIALIZED VIEW emp_mvw
2 REFRESH FAST ON COMMIT
3 AS
4 SELECT a.ROWID emp_rowid, b.ROWID dept_rowid,
5 a.empno, a.ename, a.deptno,
6 a.job, a.mgr, a.hiredate,
7 a.sal, a.comm, b.dname, b.loc
8 FROM emp a,dept b
9 WHERE a.deptno = b.deptno;
Materialized view created.
SQL> DELETE mv_capabilities_table;
18 rows deleted.
SQL> EXEC DBMS_MVIEW.EXPLAIN_MVIEW ('EMP_MVW');
PL/SQL procedure successfully completed.
SQL> SELECT capability_name, possible, msgtxt
2 FROM mv_capabilities_table
3 WHERE capability_name LIKE '%REFRESH_FAST_AFTER%';
CAPABILITY_NAME P MSGTXT
REFRESH_FAST_AFTER_INSERT Y
REFRESH_FAST_AFTER_ONETAB_DML Y
REFRESH_FAST_AFTER_ANY_DML Y
SQL> -
Fast refresh of "materialized view with joins only"
Hi,
My Requirement:
I need to create a materialized view joining two tables.
Table1 -> Does not have primary key
Table2 -> Has a primary key
I need to refesh the mat view only when DML commands are done on Table1 alone.
And it will be better if i have a Refresh on commit rather on demand.
The following code is what i used and it dint work for me:
CREATE MATERIALIZED VIEW LOG ON Table1 WITH ROWID;
CREATE MATERIALIZED VIEW LOG ON Table2;
CREATE MATERIALIZED VIEW AAYT_ETF
REFRESH FORCE ON COMMIT
ENABLE QUERY REWRITE
AS
SELECT A.rowid "table1_rowid", A.ACCTNUM, A.CORR_NUM, A.OFC_NUM, A.RR_NUM, A.BUY_SELL_CDE, A.ACT_AMT, A.CSP_SYM, A.SECR_DESC, A.ACT_QTY
FROM Table1 A, Table2 G WHERE
A.CSP_NUM = G.CSP_NUM AND
G.ASST_SUB_STYP = 'ETF';
Issue Faced: In this case the refresh happends even while i do DML on Table2.
But i need the refresh only when i do DML on Table1. I also unable to create Refresh Fast Mat view.
Can anyone please tell me how to create the Materialized view Log and the Materialized view. Thanks in advance.This forum only is for questions relating to the use of OLAP Option. I would post your question on the database forum.
Keith Laker
Oracle Data Warehouse Product Management
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 -
ORA-12008: error in materialized view refresh path... Bug?
SQL> select * from v$version;
BANNER
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 - Production
SQL> drop materialized view log on test_tbl;
Materialized view log dropped.
SQL> drop materialized view mv_test_tbl;
Materialized view dropped.
SQL> drop table test_tbl;
Table dropped.
SQL> create table test_tbl(
2 test_id number(10) primary key,
3 test_name varchar2(10) not null)
4 ;
Table created.
SQL> insert into test_tbl values (1,'bob');
1 row created.
SQL> insert into test_tbl values (2,'joe');
1 row created.
SQL> insert into test_tbl values (3,'john');
1 row created.
SQL> commit;
Commit complete.
SQL> create materialized view log on test_tbl
2 with primary key , rowid, sequence
3 (
4 test_name
5 )
6 including new values;
Materialized view log created.
SQL> create materialized view mv_test_tbl
2 refresh fast on commit
3 as
4 select test_id,
5 test_name
6 from test_tbl;
Materialized view created.
SQL> update test_tbl set test_name = 'hello' where test_id = 1000;
0 rows updated.
SQL> commit;
Commit complete.Ok, so that's all good. Now if I create the materialized view log with the COMMIT SCN option:
SQL> drop materialized view log on test_tbl;
Materialized view log dropped.
SQL> drop materialized view mv_test_tbl;
Materialized view dropped.
SQL> create materialized view log on test_tbl
2 with primary key , rowid, sequence
3 (
4 test_name
5 ),
6 commit scn
7 including new values;
Materialized view log created.
SQL> create materialized view mv_test_tbl
2 refresh fast on commit
3 as
4 select test_id,
5 test_name
6 from test_tbl;
Materialized view created.
SQL> update test_tbl set test_name = 'hello' where test_id = 1000;
0 rows updated.
SQL> commit;
commit
ERROR at line 1:
ORA-12008: error in materialized view refresh path
ORA-01006: bind variable does not exist
SQL>Committing an update that updates no rows against a master table for a single table fast refreshable materialized view results in the error above when the materialized view log on the master table is created with the COMMIT SCN option. I'm guessing that this isn't how things are supposed to work. Or am I missing something here? Anyone else encountered this before?
Cheers.
Edited by: Stain on Jan 25, 2013 1:27 PMQuery Rewrite is an option for a Materialized View, not a Materialized View Log. Also, query rewrite is used as an optimization technique which "transforms a SQL statement expressed in terms of tables or views into a statement accessing one or more materialized views that are defined on the detail tables". I don't think it plays any role in the refresh path.
Regardless, it made no difference.
SQL> create materialized view mv_test_tbl
2 refresh fast on commit
3 ENABLE QUERY REWRITE
4 as
5 select test_id,
6 test_name
7 from test_tbl
8 ;
Materialized view created.
SQL> update test_tbl set test_name = 'hello' where test_id = 1000;
0 rows updated.
SQL> commit;
commit
ERROR at line 1:
ORA-12008: error in materialized view refresh path
ORA-01006: bind variable does not exist
SQL>Edited by: Stain on Jan 25, 2013 2:06 PM
Maybe you are looking for
-
My macbook pro won't boot, I just get the apple logo but no progression.
P.S. (pre script) I'm in the UK I think my macbook's Hard-drive is capooot, here's my symptoms, windows takes 10-15 minutes to boot and when it does every program I open becomes non responsive every 20 seconds or so, so it's unusable. I've tried play
-
using a mac 10.6.8 to print duplex to HP laserjet P1606dn, order of paper comes out mixed up as follows: the first page out is page 2, with 1 on reverse side, next page is page 4, with 3 on reverse side., etc. This requires that I re-collate every p
-
Read only list as an entity property
Apologies if this is covered elsewhere - I did search... I have an entity representing a user. The user may be in zero or more roles. I have initially coded this as the User entity having a list of Role entities with a join table. However, I'm a litt
-
Connection to serial port via USB adapter- error -214722150​3
I am trying to drive a stepper motor provided with possible Labview or VB programs. This motor is supposed to be connected via serial port, but the computer has not some, so I bought an USB adpater to connect my motor via USB. I am using the labview
-
Hi. I've built a page with several collapsible panels and inserted some flash animations on the tabs. When I click on a part of the panel tab that is not filled with the animation, it opens and closes normally. When I click on the animation, however,