Replication :: Refresh Fails On MV With CLOB Data Type
May 4, 2011
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.
I have a refresh group that will refresh several materialized views at 4:00am. Sometimes the job failed. We need to enter to the enterprise manager to check the status of the refresh group.
Our target is that notification email is sent to our email once the refresh job failed. I have found some software that can do that. However, we need to handle ourselves. I would like to ask whether we can do that using enterprise manager.
Materialized views are normally used for summarized data access.
CREATE MATERIALIZED VIEW mv_snapshot_A REFRESH FAST START WITH SYSDATE NEXT SYSDATE + 20/1440 WITH PRIMARY KEY AS SELECT * FROM A;
This does not seem to be the case here as the materialized view seems to be just a full select. The overhead of the snapshot logs are concerning for this core table. Can we turn off logging in 10g ? the materialized view is defined as fast refresh/ build immediate .
The main requirement here is to keep the snapshot every 15 minutes so that the users can see the updated information ( the flow of data from one location to other).
User get the location wise count of data and can go further in details like in which location wise system wise data count. As the base table is volatile the materialized view is used so that the moment the user clicks for location wise details the data is static for 15 min and user don't get confused.
I am getting ORA -32320 when I tried to fast fresh MVs that were truncated.I am able to complete refresh all MVs. However, some MVs are still giving me ORA-32320 when I try to do fast refresh even after complete refresh.
DBMS_MVIEW.EXPLAIN_PLAN says the MVIEW can be fast refreshed.
ERROR at line 1: ORA-32320: REFRESH FAST of "dev"."Claim_line" unsupported after cointainer table PMOPs ORA-06512: at "SYS.DBMS_SNAPSHOT", line 803 ORA-06512: at "SYS.DBMS_SNAPSHOT", line 860 ORA-06512: at "SYS.DBMS_SNAPSHOT", line 841 ORA-06512: at line 1
Quote:ORA-32320: REFRESH FAST of "string"."string" unsupported after container table PMOPs Cause: A Partition Maintenance Operation (PMOP) has been performed on the materialized view, and no materialized view supports fast refersh after container table PMOPs. Action: Use REFRESH COMPLETE. Note: you can determine why your materialized view does not support fast refresh after PMOPs using the DBMS_MVIEW.EXPLAIN_MVIEW() API.
I'm trying to configure and run replication. I have two PC's running as Oracle servers, having both of them the same configuration:
Windows XP Pro Oracle 11g Enterprise Edition
First server is called Oracle1, and database name is orcl1. Second server name is Oracle2 and database name is orcl2..I'm running the following
SYSTEM/oracle1 alter system set global_names=true; alter system set job_queue_processes=100; ALTER DATABASE RENAME global_name TO orcl1.world;
SYSTEM/oracle2 alter system set global_names=true; alter system set job_queue_processes=100; ALTER DATABASE RENAME global_name TO orcl2.world;
SYSTEM/oracle1
CREATE PUBLIC DATABASE LINK orcl2.world USING '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(Host=Oracle2)(Port=1521)))(CONNECT_DATA=(SID=orcl2.world)))';
CREATE USER repadmin IDENTIFIED BY clave DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp QUOTA UNLIMITED ON users; [code]...
During the MV refresh we are getting the following error and not able to fix it .
SQL> EXECUTE DBMS_MVIEW.REFRESH('EMP','F'); BEGIN DBMS_MVIEW.REFRESH('EMP','F'); END;
* ERROR at line 1: ORA-12008: error in materialized view refresh path ORA-01400: cannot insert NULL into ("XYZ"."EMP"."DESCRIPTION") ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2251 ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2457 ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2426 ORA-06512: at line 1
The above column:- Emp.Description is a 'CLOB NOT NULL' .
We have created the MV using the below script
create materialized view EMP refresh on demand for update as select *from ABC.EMP@DBLINK;
I have attempted to set up the materialized view below to refresh complete at the time specified below. The problem is that it does not refresh and pick up the changes to one of the base tables.
Have some issue with Materialized view refresh. Have presented scenario which we have .
Schema1 : 1. Have base tables 2. Created MV logs on base tables
Schema2 : 1. Created sysnonyms for Schema1 base tables 2. created Materialized views 3. Created MV group , added views to the group
Executing the below command in schema2 : execute dbms_refresh.refresh('MV_grp');
Error : ORA-12048: error encountered while refreshing materialized view "Schema2"."Table1_MV" ORA-12018: following error encountered during code generation for "Schema2"."Table1_MV "ORA-00942: table or view does not exist ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2255 ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2461 ORA-06512: at "SYS.DBMS_IREFRESH", line 683 ORA-06512: at "SYS.DBMS_REFRESH", line 195 ORA-06512: at line 1
I am using basic replication in oracle 10.2.0.3. My materialized view object contains around 3 million records. Usually we are using FAST refresh but in my materialized view having some problem that’s the reason I am going to Complete refresh.
If I start complete refresh it will take 8-12 hours to complete refresh.
My Question is: During Complete refresh how to monitor complete refresh running or not except using
v$mvrefresh.
Is there any way to monitor complete refresh because suppose target database not available/network problem/ dead lock occur in my database. I can’t able to track refresh.
How can i use refresh option as 1 hr in creation of materialized view, Can i use unoin all in the materialized view and other clause like CONNECT BY PRIOR .
CREATE Materialized View log on t1 with rowid; CREATE Materialized View log on t2 with rowid; CREATE Materialized View log on t3 with rowid; CREATE Materialized View MV_test BUILD IMMEDIATE FAST REFRESH ON COMMIT [code].......
I have created a Materialized View by joining the above 3 tables. The Materialized View logs with ROWID has been created on each of the 3 base tables. One of the base tables has around 160 million rows and i expect the Materialized View to have the same number of rows.
The Materialized View has been built for FAST REFRESH on COMMIT. The SELECT list of the CREATE Materialized View statement includes all the ROWIDS from each base tables for doing the fast refresh.
The DBMS_MVIEW explain view shows that the view is capable of doing fast refresh on any DML. The Materialized View took 3 hrs to get built. I have also created indexes on all the three rowid columns (t1rowid,t2rowid,t3rowid) on the Materialized View.
Now, When i do any update on one of the base table and do a commit,
UPDATE t1 set value=500 where tx_id='1234';
The commit is taking around around 15 minutes. I have generated the trace and had a look at it, and it shows that, to refresh the Materialized View, ORACLE is first deleting that record from the Materialized View and then inserting the new record from the base table to the Materialized View. This delete done by oracle is being done on the basis of the rowid of the updated record stored on the Materialized View log,
However its not using the index created on the t1rowid of the Materialized View and doing a full scan of the MV and hence the delete is taking a lot of time. The delete statement is using a hint NO_MERGE and HASH_SJ which is causing it to do the full table scan of the MV. why is ORACLE not using the index on the t1rowid column of the MV to do this delete?
Also to do the insert in the MV, its selecting the new changed value from the base tables t1,t2 and t2. Here again its doing a full table scan of the base table t1, rather then using the rowid directly or the index coulmn.which is taking a lot of time.
However, I need to refresh the group manually sometimes. Therefore, I cannot set the interval as sysdate+1.have tried setting the interval as follows. However, they are not correct
Quote:trunc(sysdate+1) +4/24 The next interval will show 9:25:20pm.
I created materialized view in Database B. The master table is in Database A. If i shutdown the database B and bring it up again, the next refresh time in dba_jobs tablein database A is coming as 01-jan-00. It is not getting refreshed automatically. The job_queue_process is 10. wat could be the reason, for the refresh failure.
I am working on materialized view replication but i have an crucial issue. I have a refresh group which contain many MVs some are Read only and some are update but all are in Fast refresh mode (logs are created on both replication and MV sites on these objects) and are referentially integrated to each other i.e they have parent child relationship with each other as at replication site on base tables.
When refresh group job runs to refresh these MVs i got the errors
ORA-02292: integrity constraint (string.string) violated - child record found
After that job status has changed to break,but in the same time all the pending transactions at the MVs sites are pushed to Replication site i e ( Base tables at replication site and MVs of these tables are synchronized).In order to change the status of job to Normal, i have to disable some constraints(not all) on the MVs and manually run the job .After that job status will become Normal even i enable these constraints with validation.
What will be the reason ? Are there some MVs trying to complete refresh instead of Fast or increment refresh in this refresh group?If yes how i can trace out MVs and solve this problem?
Some other information , Replication site running with 10gR2 Enterprise Edition. Materialized View site running with 10gR2 Slandered Edition.
/* Step2 Create MATERIALIZED VIEW Refresh after Every 20 Minutes */ CREATE MATERIALIZED VIEW MV_ABC REFRESH FAST START WITH SYSDATE NEXT SYSDATE+20/ (24*60) AS SELECT * FROM ABC WHERE TMSTP > SYSDATE-1;
Scenario:Intially data extracted will be "Greater than SYSDATE-1 = 18/08/2009 11:27:39 " - 76 Millions of Records After 20 Min of FAST Refresh, it will add 2500 Records
i)Is query in the MVIEWS (MV_ABC) SYSDATE-1 will be changed on each FAST Refresh, as observation (as per definition) it is incrementing the records to intial extracted data?
ii)As COMPLETE Refresh will be expensive to execute on the partition base table on each refresh. Is there any alternative way to achieve the Nature of COMPLETE REFRESH in Materialized View?
iii)Is Delete or Conditional Delete option is possible in Materialized View (i.e not a delete from the base table but the delete from MVIEWS)?
iv)What is the machnism for populating the logs for MVIEWS?Is it overhead for the system and better than a Trigger based approach?
how to check the time taken for materialized view to execute at one time.
My materialized view is a complete refresh which automatically executes at 3:00.
a) I have queried dba_jobs and dba_mview_refresh_times, and matched the last_date and last_refresh to find the total time. How can I be know that JOB 80 corresponds to my view MVIEW_UNION in a much easier way?
SQL> select job,last_date,total_time from dba_jobs order by last_date; JOB LAST_DATE TOTAL_TIME ---------- ----------------- ---------- 80 05/05/10 03:00:02 5255
SQL>select name,last_refresh from dba_mview_refresh_times where owner NAME LAST_REFRESH ------------------------------ ----------------- MVIEW_UNION 05/05/10 03:00:02
b) Also is total_time the time it took the query to execute today at 3:00, i.e it started at 3:00 and ended at around 4:45(3+5255 msec) or is it the overall time it has taken since the day it was scheduled in dba_jobs( i.e 1 week back)
c) Also my source table dosent contain any indexes and I have created indexes on materialized view, i want to know if the complete refresh will recreate the indxes.
We are facing serious problem while refreshing materialized views using fast refresh option in ORACLE..For the very first time we are performing Complete refresh of data from DB1 to DB2 for few tables.Ongoing we are performing Fast Refresh.Sometimes the fast refresh works fine without any error and sometimes it fails with the below error.
ERROR at line 1: ORA-32320: REFRESH FAST of "CIR"."C_BO_COMM" unsupported after cointainer table PMOPs ORA-06512: at "SYS.DBMS_SNAPSHOT", line 803 ORA-06512: at "SYS.DBMS_SNAPSHOT", line 860 ORA-06512: at "SYS.DBMS_SNAPSHOT", line 841 ORA-06512: at line 1
let me know when will this error occur during Fast Refresh.
CREATE MATERIALIZED VIEW LOG ON ABC; CREATE MATERIALIZED VIEW MV_ABC REFRESH FAST START WITH SYSDATE NEXT SYSDATE+20/(24*60) FOR UPDATE AS SELECT * FROM ABC WHERE TMSTP> SYSDATE-1;
It is working fine. Appended the Query with WHERE clause in MV_ABC MVIEWS.
DROP MATERIALIZED VIEW LOG ON ABC; DROP MATERIALIZED VIEW MV_ABC; CREATE MATERIALIZED VIEW LOG ON ABC; CREATE MATERIALIZED VIEW MV_ABC REFRESH FAST START WITH SYSDATE NEXT SYSDATE+20/(24*60) FOR UPDATE AS SELECT * FROM ABC WHERE TMSTP> SYSDATE-1;
ORA-12013: updatable materialized VIEWS must be simple enough TO DO fast refresh
I created a custom type what it has a clob member variable:
CREATE TYPE custom_type AS OBJECT( c_type INTEGER, c_number NUMBER(38, 8), c_varchar2 VARCHAR2(4000 CHAR), c_clob CLOB, [code]........
The inserting and updating works with constructor: ... custom_type (to_clob('foo')) . But if the data is longest than 4000 characters then the PHP isn't access to it.
So: The normal case: $sql = ("INSERT INTO table ( clob_field ) VALUES ( EMPTY_CLOB() ) RETURNING clob_field INTO :clob"); $stid = oci_parse($conn, $sql); $clobdescr = oci_new_descriptor($conn, OCI_DTYPE_LOB); oci_bind_by_name($stid, ':clob', $clobdescr, -1, OCI_B_CLOB); oci_execute($stid); $clobdescr->save('more than 4000 chars'); ...
This case: I tried: $sql = ("INSERT INTO table ( ctype ) VALUES ( custom_type(EMPTY_CLOB()) ) RETURNING ctype.c_clob INTO :clob"); $stid = oci_parse($conn, $sql); $clobdescr = oci_new_descriptor($conn, OCI_DTYPE_LOB); oci_bind_by_name($stid, ':clob', $clobdescr, -1, OCI_B_CLOB); oci_execute($stid); $clobdescr->save('more than 4000 chars');
ORA says: "ORA-00904: CTYPE.C_CLOB: invalid identifier";
I have a pl/sql package called advisory_form. It has 3 procs. First one asks for the term it calls another web form to get it then asks for student id. Post id to second procedure and web form shows students course information with a cursor also three empty items. When advisor fills this items for each course the data should be inserted into a table.I try to do this with a loop but it didn't work properly. The data which I get from cursor is inserted properyl but when it comes to filled text boxes and select list it does not work. Some data is lost. I am adding screenshot of my web form and the data inserted to table and of course my package code.
This is what I want to insert.
CREATE OR REPLACE package body advisory_form is
countc number; pidm number;
procedure p_sel_tid(term in term.term_code%type default null) is
hold_term varchar2(30); begin if not tmain.F_Vuser(pidm) then return; end if;