Problem refreshing Materialized View in SQL Developer
I have a database schema with a Materialized View (MV) that updates a products table shown on a website. This schema was recently imported to an 11g database from 8i, but since this import I have been unable to refresh my schema’s Materialized View.
The MV_PRODUCT_MASTER Materialized View attaches price data to product data that is stored in a normal WEB_PRODUCT table, and create an MV table as a result. The output MV table is what the website pulls data from to display to the site users. Since it is an MV table, this table cannot be edited directly. In order to change, say, a product description, I need to alter the description field in WEB_PRODUCT and manually refresh the MV_PRODUCT_MASTER table. Only through the refresh will the upstream edits appear in the MV_PRODUCT_MASTER table and be visible on the website.
In my old 7.6.0.11 copy of TOAD, I could manually refresh these MVs easily, by opening the “Snapshots” tab, right clicking on the MV I wanted to refresh and selecting the “Refresh” option. Since the schema was imported to 11g, I have been using the Oracle SQLDeveloper tool to manage the schema. SQLDeveloper doesn’t have a clear method for manually refreshing an MV, or else the method I am using isn’t working.
If I right click on the MV_PRODUCT_MASTER Materialized View object, and choose “Other Actions”, I see the following choices:
Shrink Materialized View
Compile Materialized View
Force Materialized View Refresh
Rebuild Materialized View
…I assumed that “Force Materialized View Refresh” was the right choice, and chose that. This option displays the SQL:
alter materialized view "WEBADMIN"."MV_PRODUCT_MASTER" consider fresh
When I apply this, I get the message: “Materialized view “MV_PRODUCT_MASTER” has been set torefreshed”. However, no changes appear in the MV output table. i.e. if I make a specific change to a row in the WEB_PRODUCT table, the change is not being carried into the MV_PRODUCT_MASTER table, so that indicated that the refresh is not actually happening. The MV table appears to believe it is being refreshed:
REWRITE_CAPABILITY GENERAL
REFRESH_MODE DEMAND
REFRESH_METHOD COMPLETE
BUILD_MODE IMMEDIATE
FAST_REFRESHABLE NO
LAST_REFRESH_TYPE COMPLETE
LAST_REFRESH_DATE 06-APR-10
STALENESS UNKNOWN
…but it isn’t showing any changes.
What am I doing wrong? Is there a plain SQL statement I can run in order to run these refreshes, instead of using the SQLDeveloper GUI? Thanks for any advice on this.
Hi Blama,
DDL for Index-organized Materialized Views is generated in the Early Adopter release 4.1.0.866, which is now available for download.
The Organization on the Table that is implemented as the Materialized View should be set to INDEX, and the Table's IOT properties will be used during DDL generation.
David
Similar Messages
-
How to view SQL for a materialized view in SQL Developer (Oracle 11g R2)
Good Morning,
I am new to SQL Developer 3.1.07 and just installed it on a Windows 7 PC yesterday.
There's a materialized view for which I need to view (and eventually update) the SQL. The mat'lized view is in another schema, but my Oracle user does have access to the schema and to this particular mat'lized view. My user also has SELECT, INSERT, UPDATE, DELETE, DEBUG, and ALTER permissions. When I select (click on) the matl'ized view in the object tree on the left, a multi-tab window opens with information in the Columns, Indexes, Grants, Dependencies and Details tabs, but the SQL pane is blank. I don't know if there's some other GRANT that I need in Oracle, or if there's something else I need to do in SQL Developer to see the matl'ized view SQL.
Thanks
Bob Gardner
[email protected]1007420 wrote:
There's a materialized view for which I need to view (and eventually update) the SQL. The mat'lized view is in another schema, but my Oracle user does have access to the schema and to this particular mat'lized view. My user also has SELECT, INSERT, UPDATE, DELETE, DEBUG, and ALTER permissions. When I select (click on) the matl'ized view in the object tree on the left, a multi-tab window opens with information in the Columns, Indexes, Grants, Dependencies and Details tabs, but the SQL pane is blank. I don't know if there's some other GRANT that I need in Oracle, or if there's something else I need to do in SQL Developer to see the matl'ized view SQL.SQL*Developer can be tricky regarding what it shows for other schemas. I'm not sure what privileges you might need besides the one you listed except RESOURCE on the MV, or maybe CREATE ANY MATERIALIZED VIEW.
Can you use DBMS_METADATA.GET_DDL to get the data you want (may/may not work due to privileges)? -
Index organized Materialized View in SQL Developer Datamodeler
Hello SQL Developer Datamodeler Team,
I'm using version 4.0.2.840 and looking for a how-to to change a MV to an IOMV.
So far I do the following:
Create Table in Relational Model
Create MV in Oracle 11g Physical Model
Double Click Table in Oracle 11g Physical Model
Set "Implement as MV" to my MV
OK
Now I can't find an option for index organized in Physical Model Materialized View properties.
The setting "Organization: Head/Index" for Physical Model MV-Basetable properties does not change the generated DDL.
Also, setting this to "Index" does not enable the window's "IOT Properties"-tab (like it does for normal tables).
Is it possible to create an Index organized Materialized View in current SQL Developer Datamodeler?
Thank you & Best regards,
BlamaHi Blama,
DDL for Index-organized Materialized Views is generated in the Early Adopter release 4.1.0.866, which is now available for download.
The Organization on the Table that is implemented as the Materialized View should be set to INDEX, and the Table's IOT properties will be used during DDL generation.
David -
Problem in Refresh Materialized Views
Hi
we are facing a problem in deleting data.
delete process got stuck at refresh materialized view. Can anyone tells me what are possible causes?
Regards,
RJ.> we are using PL/SQL Developer
Good choice :)
I have the following custom tabs (among others) set up in the Sessions screen:
Current Wait:
SELECT wait_time
, seconds_in_wait
, state
, event
FROM v$session_wait
WHERE sid = :sid
ORDER BY seq#Session waits:
SELECT sid
, event
, total_waits
, total_timeouts
, ROUND(time_waited/*_micro*/ /100) as seconds
, ROUND(average_wait,1) AS average_wait
, max_wait
, time_waited/*_micro*/
, ROUND(100 * RATIO_TO_REPORT(time_waited) OVER ()) AS percent
FROM v$session_event
WHERE sid = :sid
ORDER BY time_waited_micro DESCCurrent Plan in 9i requires a view such as Tom Kyte's DYNAMIC_PLAN_TABLE (view owner needs SELECT permission on SYS.V_$SQL_PLAN).
Then the "Current Plan" tab is:
SELECT /*+ RULE */ plan_table_output
FROM TABLE(dbms_xplan.display
( 'DYNAMIC_PLAN_TABLE'
, ( SELECT DISTINCT rawtohex(sql_address) || '_0' x
FROM v$session
WHERE sid = :sid
AND serial# = :serial# )
, 'serial') ) -
Need to refresh materialized view from procedure and pl/sql block
Hi,
I need to refresh materialized view (complete refresh)from procedure and pl/sql block .can some one help.
MV name:MV_DGN_TEST_SESSION
Thanks,
Rajasekhardbms_mview.REFRESH ('MV_DGN_TEST_SESSION', 'C');Regards,
Mahesh Kaila
Edited by: user4211491 on Dec 1, 2009 10:41 PM -
Unable to refresh Materialized view group when an Mview is added
Hi,
I have 8 MVs present in my DB and added them to a MV refresh group. But I am getting the error below when I try to refresh the group.
SQL> exec DBMS_REFRESH.refresh('MVRFRSHGRP_EAIGHD');
begin DBMS_REFRESH.refresh('MVRFRSHGRP_EAIGHD'); end;
ORA-12048: error encountered while refreshing materialized view "MYUAT"."MV_EAI_PJRM_EMP_ALLOC_DTLS"
ORA-12018: following error encountered during code generation for "MYUAT"."MV_EAI_PJRM_EMP_ALLOC_DTLS"
ORA-00942: table or view does not exist
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2563
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2776
ORA-06512: at "SYS.DBMS_IREFRESH", line 685
ORA-06512: at "SYS.DBMS_REFRESH", line 195
ORA-06512: at line 1
SQL> Actually the view MV_EAI_PJRM_EMP_ALLOC_DTLS exists and MVlog$ are present at source site.
When I remove this view from the group, I am able to refresh it successfully.
I destroyed the group, recreated and added all the views and tried. But no luck.
Can some one suggest what could be the problem?
Regards
DeepHi,
You didn't leave a version (Again), so I can only guess.
You may be suffering from
Bug 10096159 ORA-12048 error message raised by DBMS_REFRESH.REFRESH is not corrrect
Meaning it could be a different MV that fails to refresh.
Regards
Peter
Edit:
Versions confirmed as being affected (There could be others, mind)
11.2.0.1
11.1.0.7
10.2.0.5
10.2.0.3
Edited by: Peter on Sep 4, 2012 8:45 AM -
ORA-12015: cannot create a fast refresh materialized view from a complex qu
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit 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 - ProductionI'm trying to create a fast refresh materialized view that uses a column of xmltype. The problem is I cannot create an MV log that accounts for the xmltype column. I tried excluding it and got the above error. Is there another way I can incrementally update a materialized view where I don't have to do a COMPLETE refresh or use FAST refresh?
CREATE TABLE "DAS_DESC"."AUTHORITY_TEST"
"NAID" NUMBER(20,0) NOT NULL ENABLE,
"AUTH_TYPE" VARCHAR2(40 BYTE),
"XML_DATA" "SYS"."XMLTYPE" ,
"TERM_NAME" VARCHAR2(4000 BYTE)
CREATE TABLE "DAS_DESC"."AUTH_ASSC_TEST"
"NAID" NUMBER(20,0),
"P_NAID" NUMBER(20,0),
"REL_TYPE" VARCHAR2(25 BYTE),
"XML_DATA" "SYS"."XMLTYPE"
CREATE
MATERIALIZED VIEW person_mv
AS
SELECT p.naid
, p.auth_type
, INSERTCHILDXML
p.xml_data -- Parent XML Column
, '//*[contains(local-name(), ''person'')]' --XPATH to Person
, 'nonPreferredHeadingArray' -- Value for new child element
( -- Sub query for injecting new variant person array
SELECT XMLELEMENT
"nonPreferredHeadingArray"
, XMLAGG -- Aggregator for Variant Persons Array
XMLELEMENT
"variantPersonName" -- Wrapper for each entry in array
, extract(a.xml_data,'*/*')
FROM auth_assc_table -- Link table
WHERE a.p_naid = p.naid
) AS XML_DATA
FROM authority p -- Parent table
WHERE p.auth_type = 'Person';The views are created fine and they work perfectly for what we need. The problem is the refresh when we edit the base tables. Ideally, it should take a couple seconds. Right now, it takes a couple minutes. XMLTYPE is one problem and the Complex Query exception is the other. If there is a work-around for fast refresh, please let me know. Greatly appreciated.jjmdb wrote:
I'm trying to create a fast refresh materialized view that uses a column of xmltype. The problem is I cannot create an MV log that accounts for the xmltype column. I tried excluding it and got the above error. Is there another way I can incrementally update a materialized view where I don't have to do a COMPLETE refresh or use FAST refresh? Besides XMLTYPE column, your MV definition has a subquery which prevents it from being fast refreshable.
I could not find any specific reference in documentation about restriction on XMLTYPE (or CLOB) columns but it seems logical that oracle will not be able to keep track of changes to binary data. What does DBMS_MVIEW.EXPLAIN_MVIEW generate for your MV definition? That should tell you which all conditions (for FAST REFRESH) your MV violates. Since you can not create a MV LOG to include XMLTYPE column, it will not be possible to create a FAST REFRESHABLE MV that includes the XMLTYPE column.
I am afraid there is not much you can do here unless you are prepared to change the way data is stored in your base tables. If you can store data in base tables using standard data types instead of binary/XML storage, you might be able to create a FAST REFRESHABLE MV. -
How to refresh materialized view by trigger
hi,
im having a problem in refreshing materialized view through a trigger.
CREATE OR REPLACE TRIGGER L_TRG_MARC_TEST
BEFORE DELETE OR INSERT OR UPDATE ON MARC_BOOK_B_ENG
BEGIN
DBMS_MVIEW.REFRESH('TITLE_ENG_MV','C','',TRUE,FALSE,0,0,0,TRUE);
END;
Trigger created.
SQL> DELETE FROM MARC_BOOK_B_ENG;
DELETE FROM MARC_BOOK_B_ENG
ERROR at line 1:
ORA-04092: cannot COMMIT in a trigger
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 849
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 832
ORA-06512: at "LIBQAL1.L_TRG_MARC_TEST", line 2
ORA-04088: error during execution of trigger 'LIBQAL1.L_TRG_MARC_TEST'
plz tell me how to refresh materialized view thru trigger,,and what is wrong in above mentioned situation.
RegardsDBMS_MVIEW.REFRESH implicitly commits. COMMIT is not permitted in triggers, as you can see, unless you use AUTONOMOUS_TRANSACTION.
Try
CREATE OR REPLACE TRIGGER L_TRG_MARC_TEST
BEFORE DELETE OR INSERT OR UPDATE ON MARC_BOOK_B_ENG
DECLARE
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
DBMS_MVIEW.REFRESH('TITLE_ENG_MV','C','',TRUE,FALSE,0,0,0,TRUE);
END; -
Problem with Materialized Views after an export
Hi @ everybody,
At an Oracle 11g R2 (11.2.0.3.0) instance, all actual CPU's/SPU's are installed, on a Red Hat 6 Machine i have a problem with Materialized Views from a schema, which i have exportet from an old database machine on Oracle 10g (10.2.0.1.0) to the new machine.
I've exportet with the old exp and imported with imp, because i know, that i get some strange errors because of the materialized views when i'm using the new expdp and impdp tools.
At the old machine the materialized views are so programmed, that they get an update of data at a defined time like this:
START WITH TRUNC(SYSDATE) + 21/24
NEXT SYSDATE+1
...But after the export this "update function" of the materialized view is not available. So i have deleted that views and recreated them with the START WITH parameters. So now they are running.
But why do i have this problem?
Is this "START WITH" somewhere written as a job or so in, for example, DBMS_SCHEDULER or something else? So i had forgotten to export these jobs or where is that defined?
Is this a bug?
Thanks for answers and help!
Best regards,
DavidI can't remember the error of expdp/impdp. That is some days ago, i have to rebuild this.
I think in my scenario for the import i don't need the TABLE_EXISTS_ACTION, because by importing at the new server i've just createt the naked tablespace for the data and the users, not more. So he didn't has something to overwrite.
And i have to tell you: i'm just the dbA. The desining of the tables and materialized views is many years ago by installing the old server. I'm just to young in my company to know about the design of the instance and why it was designed so.
Anyway: my problem is, that after the import of the schemas to a new server the "START WITH" option in the materialized views is not there anymore and i just want to why so i can think about a solution for that and create it with the database designers of my company.
EDIT: And here are the SQL Statements for creating the Materialized Views:
First, at the OLD Server (Oracle 10g 10.2.0.1.0)
CREATE MATERIALIZED VIEW "DUPONT_CCG2_P"."PR_PRODUCT_ITEMS"
ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "DUPONT_14523"
BUILD IMMEDIATE
USING INDEX
REFRESH COMPLETE ON DEMAND START WITH sysdate+0 NEXT SYSDATE+1
USING DEFAULT LOCAL ROLLBACK SEGMENT
DISABLE QUERY REWRITE
AS (SELECT DISTINCT
PR_CUSTOMER_MASTER_DATA.CLIENT_ID,
PR_CUSTOMER_MASTER_DATA.ILN_USER,
PR_ARTICLE.EAN,
PR_ARTICLE.CODE,
PR_USED_ARTICLE_TEXT.ARTICLE_TEXT,
PR_USED_ARTICLE_TEXT.LANG_CODE,
PR_ARTICLE.SUP_ITEM_NO,
PR_ARTICLE.OLD_ITEM_NO,
PR_COMPANY_ITEM_MATCH.ITEM_BY_NO,
PR_COMPANY_ITEM_MATCH.UOM_UNIT,
PR_COMPANY_ITEM_MATCH.PRICE_UOM,
PR_COMPANY_ITEM_MATCH.PRICE,
PR_COMPANY_ITEM_MATCH.CURRENCY,
PR_COMPANY_ITEM_MATCH.PRICE_QTY,
PR_COMPANY_ITEM_MATCH.SALES_UNIT,
PR_COMPANY_ITEM_MATCH.START_DATE,
PR_COMPANY_ITEM_MATCH.END_DATE,
PR_ARTICLE.UPDATED_AT
FROM PR_ARTICLE, PR_COMPANY_ITEM_MATCH, PR_USED_ARTICLE_TEXT, PR_CUSTOMER_MASTER_DATA, PR_ADDRESS
WHERE PR_ADDRESS.ORDER_TYPE='REP'
AND PR_CUSTOMER_MASTER_DATA.ILN_USER=PR_ADDRESS.ILN_USER
AND PR_COMPANY_ITEM_MATCH.ILN_USER=PR_ADDRESS.ILN_LINK
AND PR_CUSTOMER_MASTER_DATA.SALES_ORG=PR_COMPANY_ITEM_MATCH.SALES_ORG
AND PR_CUSTOMER_MASTER_DATA.CLIENT_ID=PR_COMPANY_ITEM_MATCH.CLIENT_ID
AND PR_CUSTOMER_MASTER_DATA.CLIENT_ID=PR_ADDRESS.CLIENT_ID
AND PR_ARTICLE.SUP_ITEM_NO=PR_COMPANY_ITEM_MATCH.SUP_ITEM_NO
AND PR_COMPANY_ITEM_MATCH.SALES_ORG=PR_USED_ARTICLE_TEXT.SALES_ORG
AND PR_ARTICLE.SUP_ITEM_NO=PR_USED_ARTICLE_TEXT.SUP_ITEM_NO
AND PR_CUSTOMER_MASTER_DATA.LANG_CODE=PR_USED_ARTICLE_TEXT.LANG_CODE
AND ( PR_COMPANY_ITEM_MATCH.END_DATE IS NULL OR to_date(PR_COMPANY_ITEM_MATCH.END_DATE,'YYYYMMDD') - sysdate > 0)
AND ( PR_COMPANY_ITEM_MATCH.START_DATE IS NULL OR sysdate - to_date(PR_COMPANY_ITEM_MATCH.START_DATE,'YYYYMMDD') > 0)
)And here the at the NEW Server (Oracle 11g R2 11.2.0.3.0)
CREATE MATERIALIZED VIEW "DUPONT_CCG2_P"."PR_PRODUCT_ITEMS" ("CLIENT_ID", "ILN_USER", "EAN", "CODE", "ARTICLE_TEXT", "LANG_CODE", "LANR", "OLD_LANR", "ITEM_BY_NO", "UOM_UNIT", "PRICE_UOM", "PRICE", "CURRENCY", "PRICE_QTY", "SALES_UNIT", "START_DATE", "END_DATE", "UPDATED_AT")
ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "DUPONT_14523"
BUILD IMMEDIATE
USING INDEX
REFRESH COMPLETE ON DEMAND START WITH sysdate+0 NEXT SYSDATE+1
USING DEFAULT LOCAL ROLLBACK SEGMENT
USING ENFORCED CONSTRAINTS DISABLE QUERY REWRITE
AS (SELECT DISTINCT
PR_CUSTOMER_MASTER_DATA.CLIENT_ID,
PR_CUSTOMER_MASTER_DATA.ILN_USER,
PR_ARTICLE.EAN,
PR_ARTICLE.CODE,
PR_USED_ARTICLE_TEXT.ARTICLE_TEXT,
PR_USED_ARTICLE_TEXT.LANG_CODE,
PR_ARTICLE.SUP_ITEM_NO,
PR_ARTICLE.OLD_ITEM_NO,
PR_COMPANY_ITEM_MATCH.ITEM_BY_NO,
PR_COMPANY_ITEM_MATCH.UOM_UNIT,
PR_COMPANY_ITEM_MATCH.PRICE_UOM,
PR_COMPANY_ITEM_MATCH.PRICE,
PR_COMPANY_ITEM_MATCH.CURRENCY,
PR_COMPANY_ITEM_MATCH.PRICE_QTY,
PR_COMPANY_ITEM_MATCH.SALES_UNIT,
PR_COMPANY_ITEM_MATCH.START_DATE,
PR_COMPANY_ITEM_MATCH.END_DATE,
PR_ARTICLE.UPDATED_AT
FROM PR_ARTICLE, PR_COMPANY_ITEM_MATCH, PR_USED_ARTICLE_TEXT, PR_CUSTOMER_MASTER_DATA, PR_ADDRESS
WHERE PR_ADDRESS.ORDER_TYPE='REP'
AND PR_CUSTOMER_MASTER_DATA.ILN_USER=PR_ADDRESS.ILN_USER
AND PR_COMPANY_ITEM_MATCH.ILN_USER=PR_ADDRESS.ILN_LINK
AND PR_CUSTOMER_MASTER_DATA.SALES_ORG=PR_COMPANY_ITEM_MATCH.SALES_ORG
AND PR_CUSTOMER_MASTER_DATA.CLIENT_ID=PR_COMPANY_ITEM_MATCH.CLIENT_ID
AND PR_CUSTOMER_MASTER_DATA.CLIENT_ID=PR_ADDRESS.CLIENT_ID
AND PR_ARTICLE.SUP_ITEM_NO=PR_COMPANY_ITEM_MATCH.SUP_ITEM_NO
AND PR_COMPANY_ITEM_MATCH.SALES_ORG=PR_USED_ARTICLE_TEXT.SALES_ORG
AND PR_ARTICLE.SUP_ITEM_NO=PR_USED_ARTICLE_TEXT.SUP_ITEM_NO
AND PR_CUSTOMER_MASTER_DATA.LANG_CODE=PR_USED_ARTICLE_TEXT.LANG_CODE
AND ( PR_COMPANY_ITEM_MATCH.END_DATE IS NULL OR to_date(PR_COMPANY_ITEM_MATCH.END_DATE,'YYYYMMDD') - sysdate > 0)
AND ( PR_COMPANY_ITEM_MATCH.START_DATE IS NULL OR sysdate - to_date(PR_COMPANY_ITEM_MATCH.START_DATE,'YYYYMMDD') > 0)
)The own differences i can see is at the "header". In the new one is the NOCOMPRESS LOGGING Option and in the first line the code has the columns diretcly defined.
But, i think, for my problem this line is determining:
REFRESH COMPLETE ON DEMAND START WITH sysdate+0 NEXT SYSDATE+1And this line is the same at both server.
Edited by: David_Pasternak on 12.04.2013 00:06 -
PX Deq Credit: send blkd is getting hang while refreshing materialized view
Hi All,
When we are refreshing materialized view. It is taking more than 2.30 mins. Initially it was taking 1.40 Mins.
We are using parallel and base tables are partitioned. When i checked the tkprof report i see lots of insert query is mostly waiting for PX Deq Credit: send blkd event. When i check the ASH report I don't find any query related to MV was running but still MV refresh was going on
TKPROF: Release 11.2.0.1.0 - Development on Wed Jun 5 16:27:29 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Trace file: CHDFCI_p001_43384918_PARALLEL.trc
Sort options: exeela prsela fchela
count = number of times OCI procedure was executed
cpu = cpu time in seconds executing
elapsed = elapsed time in seconds executing
disk = number of physical reads of buffers from disk
query = number of buffers gotten for consistent read
current = number of buffers gotten in current mode (usually for update)
rows = number of rows processed by the fetch or execute call
EXPLAIN PLAN option disabled.
SQL ID: 2x210q5g30m4t
Plan Hash: 2058446196
INSERT /*+ BYPASS_RECURSIVE_CHECK APPEND */ INTO
"APPS"."GL_BAL_MV" SELECT * FROM
GL_BAL_V
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 362.20 9372.04 1158765 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
total 2 362.20 9372.04 1158765 0 0 0
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: 175 (recursive depth: 1)
Rows Row Source Operation
0 LOAD AS SELECT (cr=0 pr=0 pw=0 time=0 us)
0 PX COORDINATOR (cr=0 pr=0 pw=0 time=0 us)
0 PX SEND QC (RANDOM) :TQ10003 (cr=0 pr=0 pw=0 time=0 us cost=1041298 size=389555904 card=2028937)
78448967 HASH JOIN BUFFERED (cr=0 pr=1158765 pw=1158765 time=276842112 us cost=1041298 size=389555904 card=2028937)
410944 BUFFER SORT (cr=0 pr=0 pw=0 time=492466 us)
410944 PX RECEIVE (cr=0 pr=0 pw=0 time=34526636 us cost=64715 size=147944250 card=1643825)
0 PX SEND HASH :TQ10001 (cr=0 pr=0 pw=0 time=0 us cost=64715 size=147944250 card=1643825)
0 PARTITION RANGE ALL PARTITION: 1 39 (cr=0 pr=0 pw=0 time=0 us cost=64715 size=147944250 card=1643825)
0 TABLE ACCESS FULL GL_CODE_COMBINATIONS PARTITION: 1 39 (cr=0 pr=0 pw=0 time=0 us cost=64715 size=147944250 card=1643825)
78448967 PX RECEIVE (cr=0 pr=0 pw=0 time=2453949696 us cost=976582 size=395060280 card=3873140)
0 PX SEND HASH :TQ10002 (cr=0 pr=0 pw=0 time=0 us cost=976582 size=395060280 card=3873140)
0 HASH JOIN (cr=0 pr=0 pw=0 time=0 us cost=976582 size=395060280 card=3873140)
0 BUFFER SORT (cr=0 pr=0 pw=0 time=0 us)
0 PX RECEIVE (cr=0 pr=0 pw=0 time=0 us cost=32 size=133920 card=2480)
0 PX SEND BROADCAST :TQ10000 (cr=0 pr=0 pw=0 time=0 us cost=32 size=133920 card=2480)
0 HASH JOIN (cr=0 pr=0 pw=0 time=0 us cost=32 size=133920 card=2480)
0 TABLE ACCESS FULL GL_SETS_OF_BOOKS (cr=0 pr=0 pw=0 time=0 us cost=7 size=108 card=6)
0 TABLE ACCESS FULL GL_PERIODS (cr=0 pr=0 pw=0 time=0 us cost=24 size=44640 card=1240)
0 PX BLOCK ITERATOR PARTITION: 1 39 (cr=0 pr=0 pw=0 time=0 us cost=976550 size=30099548160 card=627073920)
0 TABLE ACCESS FULL GL_BALANCES PARTITION: 1 39 (cr=0 pr=0 pw=0 time=0 us cost=976550 size=30099548160 card=627073920)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
PX Deq: Execution Msg 3 0.16 0.17
PX Deq Credit: send blkd 1061004 1.99 5084.61
PX Deq: Table Q Normal 250856 2.00 2306.87
asynch descriptor resize 1 0.00 0.00
Disk file operations I/O 10 0.23 0.26
direct path write temp 3608 1.20 958.39
latch free 26 0.02 0.19
PX qref latch 7647924 0.05 11.85
direct path read temp 578 0.43 35.19
PX Deq Credit: need buffer 4037 0.08 5.84
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 0 0.00 0.00 0 0 0 0
Execute 0 0.00 0.00 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
total 0 0.00 0.00 0 0 0 0
Misses in library cache during parse: 0
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
PX Deq: Execution Msg 3 0.47 0.75
PX Deq: Slave Session Stats 1 0.15 0.15
OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 362.20 9372.04 1158765 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
total 2 362.20 9372.04 1158765 0 0 0
Misses in library cache during parse: 0
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
PX Deq: Execution Msg 3 0.16 0.17
PX Deq Credit: send blkd 1061004 1.99 5084.61
PX Deq: Table Q Normal 250856 2.00 2306.87
asynch descriptor resize 1 0.00 0.00
Disk file operations I/O 10 0.23 0.26
direct path write temp 3608 1.20 958.39
latch free 26 0.02 0.19
PX qref latch 7647924 0.05 11.85
direct path read temp 578 0.43 35.19
PX Deq Credit: need buffer 4037 0.08 5.84
1 user SQL statements in session.
0 internal SQL statements in session.
1 SQL statements in session.
0 statements EXPLAINed in this session.
Trace file: CHDFCI_p001_43384918_PARALLEL.trc
Trace file compatibility: 11.1.0.7
Sort options: exeela prsela fchela
1 session in tracefile.
1 user SQL statements in trace file.
0 internal SQL statements in trace file.
1 SQL statements in trace file.
1 unique SQL statements in trace file.
8986825 lines in trace file.
9372 elapsed seconds in trace file.When i checked the ASH report during this time. I don't see anything running related to MV.
I am using parallel degree 8 for GL_BALANCES.
Please suggest.Hi
After enabling the DML also, same plan is getting generated.
MV refresh is taking same time.
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop | TQ |IN-OUT| PQ Distrib |
PLAN_TABLE_OUTPUT
| 0 | INSERT STATEMENT | | | | 1027K(100)| | | | | | |
| 1 | LOAD AS SELECT | | | | | | | | | | |
| 2 | PX COORDINATOR | | | | | | | | | | |
| 3 | PX SEND QC (RANDOM) | :TQ10003 | 1998K| 365M| 1027K (1)|999:59:59 | | | Q1,03 | P->S | QC (RAND) |
| 4 | HASH JOIN BUFFERED | | 1998K| 365M| 1027K (1)|999:59:59 | | | Q1,03 | PCWP | |
| 5 | BUFFER SORT | | | | | | | | Q1,03 | PCWC | |
| 6 | PX RECEIVE | | 1642K| 141M| 64715 (0)|999:59:59 | | | Q1,03 | PCWP | |
| 7 | PX SEND HASH | :TQ10001 | 1642K| 141M| 64715 (0)|999:59:59 | | | | S->P | HASH |
| 8 | PARTITION RANGE ALL | | 1642K| 141M| 64715 (0)|999:59:59 | 1 | 39 | | | |
| 9 | TABLE ACCESS FULL | GL_CODE_COMBINATIONS | 1642K| 141M| 64715 (0)|999:59:59 | 1 | 39 | | | |
| 10 | PX RECEIVE | | 3820K| 371M| 963K (1)|999:59:59 | | | Q1,03 | PCWP | |
PLAN_TABLE_OUTPUT
| 11 | PX SEND HASH | :TQ10002 | 3820K| 371M| 963K (1)|999:59:59 | | | Q1,02 | P->P | HASH |
| 12 | HASH JOIN | | 3820K| 371M| 963K (1)|999:59:59 | | | Q1,02 | PCWP | |
| 13 | BUFFER SORT | | | | | | | | Q1,02 | PCWC | |
| 14 | PX RECEIVE | | 2480 | 130K| 32 (4)| 00:40:12 | | | Q1,02 | PCWP | |
| 15 | PX SEND BROADCAST | :TQ10000 | 2480 | 130K| 32 (4)| 00:40:12 | | | | S->P | BROADCAST |
| 16 | HASH JOIN | | 2480 | 130K| 32 (4)| 00:40:12 | | | | | |
| 17 | TABLE ACCESS FULL| GL_SETS_OF_BOOKS | 6 | 108 | 7 (0)| 00:08:48 | | | | | |
| 18 | TABLE ACCESS FULL| GL_PERIODS | 1240 | 44640 | 24 (0)| 00:30:09 | | | | | |
| 19 | PX BLOCK ITERATOR | | 618M| 27G| 963K (1)|999:59:59 | 1 | 39 | Q1,02 | PCWC | |
| 20 | TABLE ACCESS FULL | GL_BALANCES | 618M| 27G| 963K (1)|999:59:59 | 1 | 39 | Q1,02 | PCWP | |
--------------------------------------------------------------------------------------------------------------------------------------------------Please find the completion time for MV refresh.
14:58:47 SQL> alter session enable parallel dml;
Session altered.
Elapsed: 00:00:00.27
14:59:50 SQL> exec dbms_mview.REFRESH ('GL_BAL_MV','C',atomic_refresh=>FALSE);
PL/SQL procedure successfully completed.
Elapsed: 02:30:58.37
Thanks -
Reg:package code to refresh materialized views
i am new to pl/sql packages and procedures.i want it to execute for running mappings in informatica which takes 0 and gives 1 when executed successfully
create or replace PACKAGE BODY pkg_refresh_mv as
procedure prc_mv (p_mv_name varchar2) is
begin
dbms_mview.refresh (p_mv_name);
end prc_mv;
procedure refresh_all_mv (proc_response IN OUT number) is
begin
dbms_mview.refresh('materialized view','C');
dbms_mview.refresh('materialized view','C');
proc_response := 1;
exception
when others then
proc_response := 0;
end refresh_all_mv ;
end pkg_refresh_mv;
when i execute this code i get the following errors
PLS-00201: identifier 'PKG_REFRESH_MV' must be declared
PLS-00304: cannot compile body of 'PKG_REFRESH_MV' without its specification
what needs to be changed
thankstry this one :
CREATE OR REPLACE PACKAGE pkg_refresh_mv
AS
PROCEDURE prc_mv (p_mv_name VARCHAR2);
PROCEDURE refresh_all_mv (proc_response IN OUT NUMBER);
END pkg_refresh_mv;
CREATE OR REPLACE PACKAGE BODY pkg_refresh_mv
AS
PROCEDURE prc_mv (p_mv_name VARCHAR2)
IS
BEGIN
dbms_mview.refresh (p_mv_name);
END prc_mv;
PROCEDURE refresh_all_mv (proc_response IN OUT NUMBER)
IS
BEGIN
dbms_mview.refresh ('materialized view', 'C');
dbms_mview.refresh ('materialized view', 'C');
proc_response := 1;
EXCEPTION
WHEN OTHERS
THEN
proc_response := 0;
END refresh_all_mv;
END pkg_refresh_mv;
/ -
Error While Creating Fast Refresh Materialized view.
Table Scripts:
CREATE TABLE CONTRACT_MASTER
CONTRACT_SEQ NUMBER(10) NOT NULL,
PDN CHAR(5) NOT NULL,
APPID NUMBER(10) NOT NULL,
CONTRACT_LOB_DESC VARCHAR2(20) NOT NULL,
CUSTOMER_NAME VARCHAR2(57) NOT NULL,
CONTRACT_DT DATE NOT NULL,
CONTRACT_RECD_DT DATE NOT NULL,
HELD_OFFERING_DT DATE NOT NULL,
DRAFT_AMT NUMBER(15,2) NOT NULL,
STATUS_DESC VARCHAR2(20) NOT NULL,
GIF_UPLOAD_TM TIMESTAMP NOT NULL
CREATE table CONTRACT_COMMENTS
CONTRACT_COMMENTS_SEQ NUMBER(10) NOT NULL,
APPID NUMBER(10) NOT NULL,
COMMENTS VARCHAR2(1000) NOT NULL,
GIF_UPLOAD_TM TIMESTAMP NOT NULL
Constraints on tables
ALTER TABLE CONTRACT_MASTER ADD
CONSTRAINT XPKCONTRACT_MASTER PRIMARY KEY (CONTRACT_SEQ) USING INDEX ;
ALTER TABLE CONTRACT_COMMENTS ADD
CONSTRAINT XPKCONTRACT_COMMENTS PRIMARY KEY (CONTRACT_COMMENTS_SEQ) USING INDEX ;
alter table CONTRACT_MASTER add CONSTRAINT XUIAPPCONTRACT_MASTER UNIQUE (APPID) USING INDEX;
CREATE INDEX XUIAPPCONTRACT_COMMENTS ON
CONTRACT_COMMENTS(APPID) ;
Materialized View Creation:
CREATE MATERIALIZED VIEW LOG ON CONTRACT_MASTER WITH PRIMARY KEY,ROWID;
CREATE MATERIALIZED VIEW LOG ON CONTRACT_COMMENTS WITH PRIMARY KEY, ROWID;
CREATE MATERIALIZED VIEW MV_CONTRACT_COMMENTS_HELDOFFERING
REFRESH FAST
ENABLE QUERY REWRITE AS
SELECT APPID,COMMENTS FROM CONTRACT_COMMENTS WHERE APPID IN (
SELECT APPID FROM CONTRACT_MASTER WHERE STATUS_DESC = 'Held Offering' )
Errors generated:
ERROR at line 4:
ORA-12015: cannot create a fast refresh materialized view from a complex query
_*Afer That I have changed the query but still it was not created like:*_
CREATE MATERIALIZED VIEW MV_CONT_COMMNTS_HELDOFFERNG
REFRESH FAST
ENABLE QUERY REWRITE AS
SELECT CONTRACT_COMMENTS_SEQ,c.APPID,COMMENTS
FROM CONTRACT_COMMENTS c,CONTRACT_MASTER m
WHERE m.APPID = c.APPID and m.STATUS_DESC = 'Held Offering'
*even though error displayed:
SQL> CREATE MATERIALIZED VIEW MV_CONT_COMMNTS_HELDOFFERNG*
2 REFRESH FAST
3 ENABLE QUERY REWRITE AS
4 SELECT CONTRACT_COMMENTS_SEQ,c.APPID,COMMENTS
5 FROM CONTRACT_COMMENTS c,CONTRACT_MASTER m
6 WHERE m.APPID = c.APPID and m.STATUS_DESC = 'Held Offering';
FROM CONTRACT_COMMENTS c,CONTRACT_MASTER m
ERROR at line 5:
ORA-12052: cannot fast refresh materialized view GSSIO.MV_CONT_COMMNTS_HELDOFFERNG
*Again I have done "Analyzing Materialized Views for Fast Refresh" as follows:*
1: exec dbms_mview.explain_mview('MV_CONT_COMMNTS_HELDOFFERNG');
2: SELECT capability_name, possible, SUBSTR(msgtxt,1,60) AS msgtxt
FROM mv_capabilities_table
WHERE capability_name like '%FAST%';
Output is :
CAPABILITY_NAME P MSGTXT
REFRESH_FAST N
REFRESH_FAST_AFTER_INSERT N the SELECT list does not have the rowids of all the detail t
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
REFRESH_FAST_PCT N PCT is not possible on any of the detail tables in the mater
Please suggest what to do to implement fast refresh materialized view for same.Edited by: dba on Sep 20, 2010 12:00 AMIf the two MVs have to be consistent with each other as of a specific time, put them into a Refresh Group and refresh them with DBMS_MVIEW.REFRESH
If an MV is dependent on another, use DBMS_MVIEW.REFRESH_DEPENDENT
See the "Oracle® Database PL/SQL Packages and Types Reference" documentation pages for DBMS_MVIEW.
Hemant K Chitale
http://hemantoracledba.blogspot.com --- this is NOT a documentation site.
Edited by: Hemant K Chitale on Sep 20, 2010 5:19 PM -
ORA-12015: cannot create a fast refresh materialized view from a complex q
Hi,
I'm facing very strange problem. Please help me why this error is coming
I'm creating a simple materialized view, but it is giving below error since this is simple select * from.
CREATE MATERIALIZED VIEW EFMS.MS_TASK
BUILD IMMEDIATE
REFRESH FAST
START WITH SYSDATE
NEXT (SYSDATE + 1/24)
WITH ROWID
AS
SELECT * FROM MS_TASK@efms_link;
SELECT * FROM MS_TASK@efms_link
ERROR at line 8:
ORA-12015: cannot create a fast refresh materialized view from a complex query
CREATE MATERIALIZED VIEW LOG ON MSDBO.MS_TASK
TABLESPACE DBOR_MVLOG
PCTUSED 0
PCTFREE 60
INITRANS 20
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOCACHE
NOLOGGING
PARALLEL ( DEGREE 2 INSTANCES 1 )
WITH ROWID, PRIMARY KEY
EXCLUDING NEW VALUES;1º
Not is a best practice to use 'select *'
2º
ORA-12015: cannot create a fast refresh materialized view from a complex query
Cause: Neither ROWIDs and nor primary key constraints are supported for complex queries.
Action: Reissue the command with the REFRESH FORCE or REFRESH COMPLETE option or create a simple materialized view.
Then you have to change REFRESH FAST or create a primary key in MS_TASK@efms_link to avility fast refresh.
. :-) any help with my english is wellcome :-) . -
Alternative for OUTER Join for use in fast refresh materialized view
Hi ,
I have two tables as :
CREATE TABLE TEST_SANDY1
COL1 NUMBER
CREATE TABLE TEST_SANDY2
COL1 NUMBER,
COL2 VARCHAR2(10 BYTE)
Data for the tables are :
INSERT INTO TEST_SANDY1 ( COL1 ) VALUES (
1);
INSERT INTO TEST_SANDY1 ( COL1 ) VALUES (
2);
INSERT INTO TEST_SANDY1 ( COL1 ) VALUES (
3);
COMMIT;
INSERT INTO TEST_SANDY2 ( COL1, COL2 ) VALUES (
1, 'a');
INSERT INTO TEST_SANDY2 ( COL1, COL2 ) VALUES (
2, 'b');
INSERT INTO TEST_SANDY2 ( COL1, COL2 ) VALUES (
4, 'd');
COMMIT;
Now when I run the following select statement :
select
b.col1
from
test_sandy1 a,
test_sandy2 b
where
b.COL1 = a.COL1(+)
I get :
COL1
1
2
4
I want to build a materialized view to generate the same values but it has to be fast refresh. But since I am using outer join I am unable to create a fast refresh one.
Can someone suggest an alternate select to create fast refresh materialized view.
Thanks,
SandipanThe select statement was not fitting my problem , so I'll change it as :
select
a.col1, nvl(b.col2, 'DEFAULT')
from
test_sandy1 a,
test_sandy2 b
where
b.COL1(+) = a.COL1
I get :
COL1 VAL
1 a
2 b
3 DEFAULT
How do I this ? -
How to get the script of a table or view in SQL Developer?
Dear friends/expert,
Could you tell me how to get the script for a view or a table easily in SQL Developer like pressing F4 in TOAD?
I found that I can press SHIFT+F4 for a view in SQL Developer and get the script of the view in Details Tab. But how to move the script to SQL worksheet to edit? It is very easy to do in TOAD.
And I didn't find a way to get the script for a table till now. Is there any way to do that?
Thanks in advance.
Best regards,
Ning1. Although the team might put a lot of effort in keeping track on the forum, a lot of posts still go by without answer.
2. If you have an enhancement request, log it at the announced SQL Developer Exchange, so others can vote to add weight on the issue. Be clear and detailed in the explanation.
3. Given the structure of the application, I guess it won't be easy (maybe impossible) to add the functionality you are asking. Do you have a suggestion on how to access the info?
4. If your request gets accepted, still another year or two may go by until the functionality gets added. For sure you'll be better off writing a user defined extension or report (querying DBMS_METADATA.GET_DDL).
Hope that helps,
K.
Edited by: -K- on 12/01/2009 09:37
Maybe you are looking for
-
Is there a way to automatically clear GLs against a lump sum bank statement
Good day, everyone. I would like to ask if there is anyone aware of a a process that can help resolve the following. Currently, whenever we execute an EFT payment run through f110, SAP knows to credit the relevant GL account. If, for example, there
-
TX: Tiny portion of screen not registering.
I've only had my TX for a few months and have always had a screen protector on my TX's screen and have never dropped it. Thinking that the screen protector was just worn out, I changed it this morning, hoping that would be the answer. I cleaned the
-
I want to stream Netflix and other media to my TV. I'm not interested in viewing my photos and do not have much media saved to my Mac. How much better is Apple TV for this than the new iPhone, if making calls is not an issue? I have 2 TV's and it
-
Which SSN/Billing Zip Code do I use for the iPhone I plan to purchase
I plan to buy a new iPhone 4S on Amazon, and then use a friend's SIM card to activate it. But I heard there was an activation stage that requires the last 4 numbers of SSN and Billing Zip code. So whose SSN and Billing Zip Code would I use? Do I use
-
Getting the JScrollpane to be the correct size?
I am having a problem with my scroll bars in the scroll pane. They are allowing me to scroll way more than I would like them to. I have added a screenshot of my problem here: http://www.minds.may.ie/~colly/problem.JPG I know that I could make the Scr