Materialized View hangs with SELECT MAX
Hi there,
I'm using Oracle 10.2.0.4 on a 64bit AIX system and I am having issues with creating a materialized view.
We have a large (1Tb) database and the large table the materialized view looks at is 200m rows.
I've created 5 other materialized views each with a select max clause and all looking at the same table.
When I created my problem MV I forget the select max and it created in 22mins.
I corrected my error by putting in the select max clause (so as to retrieve the top record) and the create MV ran for 16hrs+, I killed it.
If I just run the select statement at a sqlplus prompt it runs through in 22mins, if I create another object e.g. a table from the query it creates in 22mins.
So the question would be, why can I not create a MV using SELECT MAX on 10.2.0.4?
If I've missed any details don't hesitate to ask.
Thanks in advance.
Hi Justin,
Thank you for your reply.
It has been upgraded to 9.2.0.8.0 from 9.1.... I'm not aware about the procedure used.
I could see a job scheduled for the materialized view , but that fails and it's broken after 16 attempts.
How to log the error generated by the Refresh Job?
Recreating the View - After the upgrade I have created the Materialized view again. Object T1 exists in the user schema User1.
I'm not explicitly getting any error but the refresh doesn't happens , so I couldn't find any records in the materialized view.
Thanks
GM
Similar Messages
-
Create materialized view log with rowid hangs indefinitely..
Hi
create materialized view log on advice_note with rowid;
This stmt hangs indefinitely...
Help needed in resolving this issue
Rpi have resolved the issue myself.
Found out the sessions that are locking the object , killed all those sessions & pids.
Rp -
Materialized view, problem in selecting a particular field
Hi,
can anyone please help me with this issue.
I have table which contains data for 3 different years. It usually contains data for the current year, the next year and the previous year i.e the calender current year.
YEAR TL JN Q
2006 1 1 30
2007 1 1 6
2008 1 1 4
2006 1 2 5
2008 1 2 4
This is how my table looks like. For this table i have created a view which looks like this
TL JN Q1 Q2 Q3
1 1 30 6 4
1 2 5 50
The view is a summary for the table.
The problem now is that the Master table on which the view is based keeps getting updated. In some cases it may so happen that the table can contain data for a year other than the calender current year, previous year and next year.
In this case how do i identify the year to create the view.
For example the table can get populated with records for the year 1999, in this case how can i identify the year .
This is the code i have written to create the view
create view vw_summary(TL,JN,Q1,Q2,Q3)
AS SELECT TL.,JN,
MAX(DECODE(YEAR,TO_CHAR(SYSDATE,'YYYY'),Q,NULL)Q1,
MAX(DECODE(YEAR,TO_CHAR(SYSDATE,'YYYY')-1,Q,NULL))Q2,
MAX(DECODE(YEAR,TO_CHAR(SYSDATE,'YYYY')+1,Q,NULL))Q3
FROM TABLE GROUP BY TL,JY
CAN ANYONE PLEASE HELP ME.?
I am creating a materialized view for the tableone more opint to be added is that inside this procedure, i am checking for athe value of column "FLAG" in an other table param. if this flag is set to Y then i wil populate the table(on which the view is based) according to the parameter passed to the procedure. But if the flag value in the table params is set to N then i am suppose to check an other column called ACHYR in the table params. This column holds a year value say 1999.
In this case the procedure should populate the table with the records for the year 1999.
But how do I check this parameter in the view? -
Materialized View creation with REFRESH FAST
Hello ,
Please see below case,
TABLE A1(partitioned range+list)
COLUMN C1 -- Primary key
COLUMN C2 -- NUMBER
TABLE D1
COLUMN C1 -- PRIMARY KEY
created MV log as below
CREATE MATERIALIzED VIEW LOG ON A1 WITH ROWID,PRIMARY KEY INCLUDING NEW VALUES;
CREATE MATERIALIzED VIEW LOG ON D1 WITH ROWID,PRIMARY KEY INCLUDING NEW VALUES;
Trying to create MV like below:
CREATE MATERILIZED VIEW mv1test
REFRESH FAST ON COMMIT
AS
Select
FROM A1,
D1
WHERE A1.C1 = D1.CI
AND A1.C2 IS NOT NULL;
It gives below error message:
ORA-12052: cannot fast refresh materialized view schema.mv1test
12052. 00000 - "cannot fast refresh materialized view %s.%s"
*Cause: Either ROWIDs of certain tables were missing in the definition or
the inner table of an outer join did not have UNIQUE constraints on
join columns.
*Action: Specify the FORCE or COMPLETE option. If this error is got
during creation, the materialized view definition may have be
changed. Refer to the documentation on materialized views.
However ,as discussed in earlier thread i checked all general restrictions of the 'Refresh fast' approach for join.
Restrictions on Fast Refresh on Materialized Views with Joins Only
Defining queries for materialized views with joins only and no aggregates have the following restrictions on fast refresh:
1) They cannot have GROUPBY clauses or aggregates.
2) Rowids of all the tables in the FROM list must appear in the SELECT list of the query.
3)Materialized view logs must exist with rowids for all the base tables in the FROM list of the query.
4)You cannot create a fast refreshable materialized view from multiple tables with simple joins that include an object type column in the SELECTstatement.
As per above restrictions ,
1) Group by clause is not present
2)i do not understand 2nd point , i have added a1.rowid and d1.rowid in select statement of MV, but got same error.
3) observed same as 2nd point.
4)we have CLOB column in select list. Tried removing this column but got same error.
Please do let me know any workaround on this.
Thanks in advanced ..
PMBasic Materialized Views show how to analyse MVs using dbms_mview. I'm not sure about creating MVs on partitioned tables, that partition maintenance might cause problems
-
Updatable materialized view- error with CREATE_SNAPSHOT_REPGROUP
I'm trying to create an updatable materialized view from the replication administrators account (REPADMIN). I use the assistant and in the third step (after creating the replication group and the materialized view), when the materialized view is going to be added to the group, I got this error:
ERROR in line 1:
ORA-01403: No data found
ORA-06512: in "SYS.DBMS_REPCAT_SNA_UTL", line 5927
ORA-06512: in "SYS.DBMS_REPCAT_SNA", line 82
ORA-06512: in "SYS.DBMS_REPCAT", line 1332
ORA-06512: in "SYS.DBMS_REPCAT", line 1307
ORA-06512: in line 2
I have also tried to use the command file that the assistant generates (I add below), and the error is triggered within the CREATE_SNAPSHOT_REPOBJECT procedure.
Has anybody any idea to resolve the problem?
Thanks in advance
BEGIN
DBMS_REPCAT.CREATE_SNAPSHOT_REPGROUP(
gname => '"MYGROUP"',
master => 'DB.DOMAIN.COM',
propagation_mode => 'ASYNCHRONOUS');
END;
CREATE SNAPSHOT "MYUSER"."MYTABLE"
REFRESH COMPLETE WITH ROWID
FOR UPDATE
AS SELECT "COD", "NAME" FROM
"MYUSER"."MYTABLE"@DB.DOMAIN.COM c
BEGIN
DBMS_REFRESH.ADD(
name => '"MYUSER"."REF3"',
list => '"MYUSER"."MYTABLE"',
lax => TRUE);
END;
BEGIN
DBMS_REPCAT.CREATE_SNAPSHOT_REPOBJECT(
gname => '"MYGROUP"',
sname => '"MYUSER"',
oname => '"MYTABLE"',
type => 'SNAPSHOT',
min_communication => FALSE);
END;Hello,
These days I have had some problems with my forum-account and I haven't been able to connect and reply.
Regarding to your doubt, the name of refresh group was correct, and as I see, the problem can't be related to the refresh group.
While the problem with my account was resolved, I created two new databases (*) and the problem within the materialized view process is disappeared. I suppose that my first original databases were degraded, but I don't know where.
(*) of course, I could do that because I use Oracle in an academy institution, not for production, thank God
Anyway, for now I will give up here. Thanks for your help.
Regards, -
Create materialized View fails with "table or view does not exist"
DB: 10.2.0.4
OS: Win 2003
Hi,
Here in my tests, i have 2 databases (A(source) and B(backup)), and i am trying to create an mview in database B to replicate data from one test table from database A, only for test purpose. I'm getting the error "table or view does not exist" when i try to create a mview with REFRESH FAST. Here is my code:
CREATE MATERIALIZED VIEW TESTES.TAB_TESTES_REPLIC_MVIEW_02
REFRESH FAST
START WITH TO_DATE('21/02/2012 18:50:00', 'DD/MM/YYYY HH24:MI:SS')
NEXT SYSDATE + 1/24/60
WITH PRIMARY KEY
AS SELECT REGISTRO1,
REGISTRO2
FROM TESTES.TAB_TESTES_REPLIC_MVIEW_02@DB_LINK_ORA10;
The dblink is workig fine(dblink user has select privilege on TESTES.TAB_TESTES_REPLIC_MVIEW_02), and i have created the mview log on database A.
Where is my mistake.
Thanks a lot.
Edited by: Fabricio_Jorge on 21/02/2012 19:06I found the solution.
I had to grant SELECT on the mview log. The name is avaiable in DBA_MVIEW_LOGS -
How to alter the materialized view defintion with -- For update clause
My db version is 9.2.0.3
My orginal materialized view difination does not have "for update " clause.
how can i alter the mview defination to inclused and exclude the "for update" clause.
I dont want to drop and recreate the mview with for update clause. But I what to change the existing definition.
Please suggest.
Thanks
Naveen.I already have the view definition in place. I want to change the exising defination, by adding the "for update " clause. Is it possible with any " alter mview ... " syntax.
Below is my existing syntax. I don't what to drop and recreate. Just want to alter the existing definition , with for update clause.
create materialized view test
pctfree 0
tablespace DATA storage (pctincrease 0)
build immediate refresh start with sysdate next (trunc(sysdate+1) +1/24)
with primary key
disable query rewrite
as select * from test@isource;
Please suggest!
Thanks
Naveen
Edited by: user12096071 on Apr 8, 2010 2:56 PM -
Create Materialized View hangs
Hi,
I have a query, which contains about 10 tables and returns about 40000 rows. When I execute the query itself it runs about 1minute.
I want to create a Materialized View for that query, but I had to stop it after some hours. There is no error message, it just doesn't stop.
Do you have any ideas what the problem could be or where I should start to look at?
Thank you very much for your help!
DROP MATERIALIZED VIEW A;
CREATE MATERIALIZED VIEW A
TABLESPACE A_T
PCTUSED 0
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
NEXT 1M
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOCACHE
NOLOGGING
NOCOMPRESS
NOPARALLEL
BUILD IMMEDIATE
REFRESH COMPLETE ON DEMAND
WITH PRIMARY KEY
--ENABLE QUERY REWRITE
AS
SELECT...890408 wrote:
It returns all rows after 1 minute. I don't have any DB links btw. and I am using oracle 11g.
We had the same problem with another oracle installation (10g) with another query.
When I watch the session in my TOAD Session Browser I see the event "asynch descriptor resize" in wait, could this be a hint?
Or can I enable somehow tracing to find out why the mat view creation never ends?tracing is enabled by below
DBMS_SESSION.SESSION_TRACE_ENABLE(TRUE,TRUE,'ALL_EXECUTIONS'); -
Materialized view issue with spatial index and UNION all.
Hi guys,
I'm trying to build the following materialized view:
create materialized VIEW MV_ElectricalStuffs
refresh fast
AS
SELECT jb.ROWID,
jb.FID,
JB.NAME_NUMBER
FROM EL_BUS_BAR jb
UNION ALL
SELECT INC.ROWID,
INC.FID,
NULL,
INC.NAME_NUMBER
FROM EL_INTERNAL_CELL INC;
I have this error showing up:
ORA-12015: cannot create a fast refresh materialized view from a complex query
This is because the table EL_INTERNAL_CELL has a SDO_GEOMETRY column that has a spatial index, whose ddl is
CREATE INDEX EL_INTERNAL_CELL_S ON EL_INTERNAL_CELL (GEOM) INDEXTYPE IS MDSYS.SPATIAL_INDEX
PARAMETERS('SDO_INDX_DIMS=2 TABLESPACE=USERS LAYER_GTYPE=COLLECTION');
When I remove the spatial index from EL_INTERNAL_CELL column GEOM, Oracle is very happy and creates the view.
Is there a mean however to keep the spatial index in the materialized view?I've managed to drop the spatial index prior to create the materialized view and it is ok. After the materialized view creation, I've recreated the spatial index on the table and all ran smooth. Hope nothing will go bad in the future because of this trick on spatial index..
-
How to view materials with selected moving average price
Dear Gurus,
How to view materials with moving average price greater than some selected value? ie..Is there any report which takes moving average price as input?
Thanks in advance,
SastryHI
While checking any table or report u cannot give conditions (more than this value).
If it mabe the case, down load the data from table MBEW - Field Name VERPR to excel file. then u apply conditions, like greater than this value.
U'll get the desired out put.
Thanks
Raman -
Problem with select max(FIELD)
I have a table with the following fields:
PARTID ART_TYP AEC SERVICE PLANT STATUS
4711 A A 2 P 230
4711 A B 0 P 230
4712 A B 2 P 230
4713 A B 0 P 230
I need a sqlscript where I get the records with MAX(SERVICE)
In this example
4711 A A 2 P 230
4712 A B 2 P 230
4713 A B 0 P 230
I tried this with:
select distinct partid,
art_typ,
aec,
max(service),
plant,
status
from t_msltmp
group by partid,art_typ,aec,plant,status
But I get both records of partid=4711
Can someone help me with this problem
kind regards
Menk SlotROW_NUMBER() requires explicit ORDER BY clause in OVER:
http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96540/functions105a.htm#86312
SQL> select partid, art_typ, aec, mx, plant, status
2 from(select partid,
3 art_typ,
4 aec,
5 max(service) over (partition by partid) mx,
6 row_number() over (partition by partid order by service desc) rn
7 plant,
8 status
9 from t_t)
10 where rn = 1
11 /
PARTID A A MX P STATUS
4711 A A 2 P 230
4712 A B 2 P 230
4713 A B 0 P 230Rgds.
P.S.
Another way to get this (more tedoius):
SQL> select partid,
2 max(art_typ) keep (dense_rank first order by service desc) art_typ,
3 max(aec) keep (dense_rank first order by service desc) aec,
4 max(service) service,
5 max(plant) keep (dense_rank first order by service desc) plant,
6 max(status) keep (dense_rank first order by service desc) status
7 from t_t
8 group by partid
9 /
PARTID A A SERVICE P STATUS
4711 A A 2 P 230
4712 A B 2 P 230
4713 A B 0 P 230Message was edited by:
dnikiforov -
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 -
Problem with Select MAX( field ) in OO
Hi all,
I have this statement:
SELECT SINGLE RUECK MAX( RMZHL ) BUDAT STZHL
INTO K_CONFIRM
FROM AFRU
WHERE AUFNR EQ P_ORDER
AND VORNR EQ P_OPER
GROUP BY RUECK RMZHL BUDAT STZHL.
My requirement is I need to use a work area (not an internal table) and ENDSELECT is not allowed. The result is not selecting the Maximum RMZHL, it will always return the first record.
How can I correctly do this in OO? Thanks in advanc.eIf you use GROUP BY in your query then the set functions (MAX,SUM, Count) not possible...
refer:
http://help.sap.com/saphelp_nw70/helpdata/en/be/c7fe3f70cac342e10000000a1550b0/frameset.htm -
Rebuild Read-only Materialized view refresh with rowid
Hi,
I have a 6gb table which there is no primary key. I need to rebuild the read-only mv but i can't use the prebuilt option.
Try with the offline instantiation from official doc, but encountered ORA-23308. Not sure what i've missed.
master siteexec dbms_repcat.create_master_repgroup('snap1')
exec dbms_repcat.create_master_repobject('scott', 'emp1', 'TABLE', gname=>'snap1');
exec dbms_repcat.generate_replication_support('scott', 'emp1','TABLE', min_communication=>false);But there is an error ORA-23308
Appreciate any help. Thanksthat option is only support primary key and not rowid.WHAT option ?
And, in any case, you can build a Primary Key on an imported table.
Hemant K Chitale -
Unexpected result with select max(colmn) in anonymous block
Hi
The following query gives me 28,800 as sum(sal)
SELECT SUM(salary)
FROM employees
WHERE department_id =60
O/P is : 28800But when i use the above query in anonymous block it gives me 684400
DECLARE
v_sum_sal NUMBER;
department_id employees.department_id%TYPE := 60;
BEGIN
dbms_output.put_line ('The department_id is'||department_id);
SELECT SUM(salary)
into v_sum_sal
FROM employees
WHERE department_id = department_id ;
dbms_output.put_line ('The sum of sal is'||v_sum_sal);
END;The above output statements gives me 684400 as output.. But the expected is 28800
Could you please hint me why the output differs in anonymous blockSmile wrote:
Hi
The following query gives me 28,800 as sum(sal)
SELECT SUM(salary)
FROM employees
WHERE department_id =60
O/P is : 28800But when i use the above query in anonymous block it gives me 684400
DECLARE
v_sum_sal NUMBER;
department_id employees.department_id%TYPE := 60;
BEGIN
dbms_output.put_line ('The department_id is'||department_id);
SELECT SUM(salary)
into v_sum_sal
FROM employees
WHERE department_id = department_id ;
dbms_output.put_line ('The sum of sal is'||v_sum_sal);
END;The above output statements gives me 684400 as output.. But the expected is 28800
Could you please hint me why the output differs in anonymous blockBecause you've made the mistake of having the same name for your column and your variable.
department_id is taken to be the column on both sides of the equality in your query - so it's picking up all rows.
Maybe you are looking for
-
Usage of @NEXTSIBLING in FIX statement for a parameter of Range
Hi I am trying to use @NEXTSIBLING. I could find in the document that it could be passed as a parameter to a RANGE function. I am trying to use it inside a FIX ( @XRANGE(@NEXTSIBLING(&1year),&lastyear,"Jan":"Dec") But this is not getting validated. A
-
Request for author in Beginners Guide/Wireless Netctl
Since netctl has been in [core] for a while now and since netcfg has been depreciated, it's pretty poor that one of the most popular pages on our wiki is out-of-date. I am asking for someone with knowledge of netctl/wireless to make an edit the sect
-
Adoobe Reader "Attempt to access invalid address"
I have installed Adobe Reader XI. The installation seems to complete successfully but when I try to launch aplication I get an error with the file path followed by the message "Attempt to access invalid address". I have tried uninstalling and reins
-
Multiple Column hiding in advance table using Switcher
Hi All, I am having requirement of hiding multiple columns in advance table using swithers. Lets says I am searching for the the parties in party search page. If the party is of type person then two columns should be visible one is firstName and Last
-
FileDialog File Types show *.txt, please help.
Hi, I have created a very basic text editor. I created a FileDialog in order to save and open files. However, what's the method or class that I can use in order to make the File Types shows the specific extension I am looking for. e.g. *.txt instead