Create materialized view across dblink gets ORA-980?
Hi!
Oracle 9.2.0.5. Creating a materialized view on on a synonym that points to a table across a dblink. I am getting a ORA-980 error that synonym translation is no longer valid. However selecting against the same synonym returns the rows or the count, etc. What am I missing here?
This is the code that is being run:
create materialized view gxp_sc_item as select * from sc_item_db2;
Hints, tips, ideas, etc. gratefully accepted!
Dave Venus
Hi!
Thanks for the reply!
Yes that is a solution, however why does the synonym work for everything else? I can't find anything that says this should not work.
Yes running 9.2.0.8 would be my first choice. The application vendor does not certify anything higher than 9.2.0.5.
Thanks!
Dave Venus
Similar Messages
-
Error while creating Materialized View in AWM
Hello,
I am using Oracle 11g with Analytic WorkSpace Manager 11.1.0.6.0A
I am trying to create materialized view on my Cube..
The Cube has 5 Dimensions out of which Four are having two levels i.e.,
TotalA-->DimensionA
TotalB-->DimensionB...and so on
And one time Dimension having 4 levels
TotalTime-->YEAR-->QUARTER-->MONTH
When i try to create the materialized view, i get an error saying that
"Your metadata changes have been saved, with the following errors
CREATE MATERIALIZED VIEW "ENT.CB$TIME_TIME_HIER"
ORA-02267:column type incompatible with referenced column type"
When i googled regarding this error, it says to change the datatype of the column..
But which column's data type is to be changed..Please throw some light regarding this...
Awaiting for reply..My query is as follows:
SELECT
sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.level_name='ALL_MODE' AND m.LONG_DESCRIPTION = 'Type1')then 1 else 0 end)) as Cumm_Type1Txn_Amount,
sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.level_name='ALL_MODE' AND m.LONG_DESCRIPTION = 'Type2')then 1 else 0 end)) as Cumm_Type2Txn_Amount,
sum(cd.SALESAMT *(case when (k.LONG_DESCRIPTION='product1'AND l.level_name='ALL_MODE'AND m.LONG_DESCRIPTION = 'Type1' )then 1 else 0 end)) as Cumm_product1_Type1Txn_Amount,
sum(cd.SALESAMT *(case when (k.LONG_DESCRIPTION='product1'AND l.level_name='ALL_MODE'AND m.LONG_DESCRIPTION = 'Type2')then 1 else 0 end)) as Cumm_product1_Type2Txn_Amount,
sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.LONG_DESCRIPTION='Mode1'AND m.LONG_DESCRIPTION = 'Type1')then 1 else 0 end)) as Cumm_Mode1_Type1Txn_Amount,
sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.LONG_DESCRIPTION='Mode1'AND m.LONG_DESCRIPTION = 'Type2')then 1 else 0 end)) as Cumm_Mode1_Type2Txn_Amount,
sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.LONG_DESCRIPTION='Mode2'AND m.LONG_DESCRIPTION = 'Type1')then 1 else 0 end)) as Cumm_CLRING_Type1Txn_Amount,
sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.LONG_DESCRIPTION='Mode2'AND m.LONG_DESCRIPTION = 'Type2')then 1 else 0 end)) as Cumm_Mode2_Type2Txn_Amount,
sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.LONG_DESCRIPTION='Mode3'AND m.LONG_DESCRIPTION = 'Type1')then 1 else 0 end)) as Cumm_TRSFER_Type1Txn_Amount,
sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.LONG_DESCRIPTION='Mode3'AND m.LONG_DESCRIPTION = 'Type2')then 1 else 0 end)) as Cumm_Mode3_Type2Txn_Amount,
sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.level_name='ALL_MODE' AND m.level_name = 'ALL_TYPE')then 1 else 0 end)) as Cumm_Txn_Amount,
sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.long_description='Mode3' AND m.level_name = 'ALL_TYPE')then 1 else 0 end)) as Cumm_Mode3_Txn_Amount,
sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.long_description='Mode2' AND m.level_name = 'ALL_TYPE')then 1 else 0 end)) as Cumm_Mode2_Txn_Amount,
sum(cd.SALESAMT *(case when (k.long_description = 'product1' AND l.level_name='ALL_MODE' AND m.level_name = 'ALL_TYPE')then 1 else 0 end)) as Cumm_product1_Txn_Amount,
sum(cd.SALESAMT *(case when (k.long_description = 'product1' AND l.long_description='Mode1' AND m.LONG_DESCRIPTION = 'Type1')then 1 else 0 end)) as Cumm_product1Mode1Type1_Txn_Amount,
sum(cd.SALESAMT *(case when (k.long_description = 'product1' AND l.long_description='Mode1' AND m.LONG_DESCRIPTION = 'Type2')then 1 else 0 end)) as Cumm_product1_Mode1_Type2_Txn_Amount,
sum(cd.SALESAMT *(case when (k.long_description = 'product1' AND l.long_description='Mode1' AND m.level_name = 'ALL_TYPE')then 1 else 0 end)) as Cumm_product1_Mode1_Total_Txn_Amount
/* From dimension views and cube view */
FROM CUSTOMER_ID_CUSTOMER_ID_HIE_VIEW b,
TIME_TIME_HIER_VIEW j,
product_product_HIER_VIEW k,
MODE_MODE_HIER_VIEW l,
TYPE_TYPE_HIER_VIEW m,
CUBETEST_VIEW cd
/* Create level filters */
WHERE b.level_name = 'CUSTOMER_ID'
AND b.LONG_DESCRIPTION='xyz'
AND j.LEVEL_NAME='MONTH'
AND j.END_DATE between to_date('2007-10-31','YYYY-MM-DD') and to_date('2007-10-31','YYYY-MM-DD')
/* Join dimension views to cube view */
AND b.DIM_KEY=cd.ACCOUNT_ID
AND j.DIM_KEY=cd.TIME
AND k.DIM_KEY=cd.product
AND l.DIM_KEY=cd.MODE
AND m.DIM_KEY=cd.TYPE
ORDER BY j.end_date,
k.level_name,
l.level_name,
m.level_name; -
Create materialized view get ora-00998 error cause by subquery
hi all,
my create statement as follow,
create materialized view MV_DM_DIM_DEALER01
Build deferred
Refresh complete
ON DEMAND
Enable query rewrite
as
select a.dealer_no,a.sk_period from DM_DIM_DEALER a
where A.SK_PERIOD=201210 and a.dealer_no in (select dealer_No from dm00_fav_dealer)
ORA-00998: must name this expression with a column alias
so what's the problem?
thx all>
my create statement as follow,
create materialized view MV_DM_DIM_DEALER01
Build deferred
Refresh complete
ON DEMAND
Enable query rewrite
as
select a.dealer_no,a.sk_period from DM_DIM_DEALER a
where A.SK_PERIOD=201210 and a.dealer_no in (select dealer_No from dm00_fav_dealer)
ORA-00998: must name this expression with a column alias
so what's the problem?
>
Well since the error is 'ORA-00998: must name this expression with a column alias' you might try naming your expressions with aliases
select a.dealer_no dealer_no,a.sk_period sk_period from DM_DIM_DEALER a -
Error: ORA-00905:Missing keyword while creating Materialized view
Hi Gurus,
I am trying to create a materialized view as :
1 CREATE MATERIALIZED VIEW AMREG.ClientData
2 TABLESPACE AMREG_DATA
3 COMPRESS
4 PARALLEL
5 NOLOGGING
6 BUILD IMMEDIATE
7 REFRESH COMPLETE
8 ON DEMAND
9 DISABLE QUERY REWRITE
10 REFRESH START WITH TRUNC( SYSDATE + 1 ) + 3/24 NEXT TRUNC( SYSDATE + 1 ) + 3/24
11 AS
12 SELECT
13 CHILD.CLIENT_SGK "Child SGK",
14 CHILD.CLIENT_NAME "Child Name",
15 CHILD.ARC_ACCT_CD "Child ARC Acct Code",
16 ULTIMATE.CLIENT_SGK "Ultimate Parent SGK",
17 ULTIMATE.CLIENT_NAME "Ultimate Parent Name",
18 ULTIMATE.ARC_ACCT_CD "Ultimate ARC Acct Code",
19 HIER.LVL_FROM_ANCESTOR ,
20 FROM [email protected] CHILD,
21 [email protected] HIER,
22 [email protected] ULTIMATE
23 WHERE HIER.DESCENDANT_CLIENT_SGK = CHILD.CLIENT_SGK
24* AND ULTIMATE.CLIENT_SGK = HIER.ANCESTOR_CLIENT_SGK;
SQL> /
REFRESH START WITH TRUNC( SYSDATE + 1 ) + 3/24 NEXT TRUNC( SYSDATE + 1 ) + 3/24
ERROR at line 10:
ORA-00905: missing keyword
DBLink name is : DNYCPH60.WORLD
Please guide me on this and help to resolve the issue.I provided the answer over at the duplicate post ...
ORA-00905: missing keyword error while creating a materialised view
Please, please, please ... please do not duplicate posts. Pick one. If you don't get an answer in a reasonable time - close it (edit the title) and THEN open in a different forum. -
CREATE MATERIALIZED VIEW ORA-00957
Hi
I have tried using this query to create a MVIEW and I get an ORA-00957 (duplicate column name)
select t.month
,t.year
,t.entity_code
,t.itemref_local
,t.qty
,t.revenue
,t.cogs
,t.ppv
,t.FD
,t.var_labor
,t.var_ovhd
,n.code entity_code
,n.name entity_name
,n.finance_responsible
,c.local_name
,c.emea_name
,c.segment
,c.country
,c.origin_entity
,c.icp_code
,c.type
,c.rmm
,c.sales_rep
,c.sales_leader
,c.emea_director
,c.nat_accounts
,o.code country_code
,o.NAME country_name
,o.REGION country_region
,e.ELIMINATED
,i.PART_NUMBER
,i.DESCRIPTION part_description
,i.PRODUCT_GROUP
,i.LINE
,i.CATEGORY
,i.FAMILY
,i.RANGE
,i.SUPPLIER
,i.PLM
FROM hsce_transactions T
, hsce_entity N
, hsce_customers C
, hsce_country O
, hsce_elim E
, HSCE_ITEMS I
, HSCE_MAPPING M
WHERE T.entity_code = N.code
AND T.customer_code = C.customer_code
AND C.ICP_CODE = E.ICP_CODE
AND C.country = O.code
AND T.ITEMREF_LOCAL = M.ITEM_REF
and M.PART_NUMBER = I.PART_NUMBERCan anyone point me to where I have gone wrong?
Thanks
AdamI'm getting the duplicate column name on my query as well; however the validate feature in Toad, validated the query. I can select and even try to tune the query. therefore, I don't understand the error.
CREATE MATERIALIZED VIEW SYSADM.BAHAR_MV
STORAGE (
BUFFER_POOL DEFAULT
NOCACHE
NOLOGGING
COMPRESS
NOPARALLEL
BUILD IMMEDIATE
USING INDEX
STORAGE (
BUFFER_POOL DEFAULT
REFRESH COMPLETE ON DEMAND
WITH ROWID
USING DEFAULT LOCAL ROLLBACK SEGMENT
AS
/* Formatted on 2009/02/12 13:55 (Formatter Plus v4.8.7) */
SELECT a.business_unit, a.deptid, a.jobcode, a.emplid, f.oth_hrs, f.oth_earns,
h.gl_expense, f.erncd, d.descr, b.descr, c.descr, g.NAME, c.setid,
c.effdt, b.setid, b.deptid, b.effdt, e.check_dt, a.pay_end_dt,
i.ah89_ldr_summary, i.ah89_ldr_summ_grp
FROM ps_pay_earnings_bk a,
ps_bus_unit_tbl_hr d,
ps_pay_calendar e,
ps_pay_oth_earns f,
ps_pay_check g,
ps_earnings_tbl h,
ps_jobcode_tbl c,
ps_job j,
ps_emplmt_srch_qry j1,
ps_dept_tbl b,
ps_ah89_ldr_mappng i
WHERE j.jobcode = a.jobcode
AND j.business_unit = d.business_unit
AND j.setid_dept = d.business_unit
AND j.jobcode = c.jobcode
AND j.emplid = a.emplid
AND j.emplid = j1.emplid
AND j.empl_rcd = j1.empl_rcd
AND j.effdt =
(SELECT MAX (j_ed.effdt)
FROM ps_job j_ed
WHERE j.emplid = j_ed.emplid
AND j.empl_rcd = j_ed.empl_rcd
AND j_ed.effdt <= a.pay_end_dt)
AND j.effseq =
(SELECT MAX (j_es.effseq)
FROM ps_job j_es
WHERE j.emplid = j_es.emplid
AND j.empl_rcd = j_es.empl_rcd
AND j.effdt = j_es.effdt)
AND j.setid_jobcode = c.setid
AND j1.oprid = 'RECPRCSS'
AND a.company = f.company
AND a.paygroup = f.paygroup
AND a.pay_end_dt = f.pay_end_dt
AND a.off_cycle = f.off_cycle
AND a.page_num = f.page_num
AND a.line_num = f.line_num
AND a.addl_nbr = f.addl_nbr
AND a.company = g.company
AND a.paygroup = g.paygroup
AND a.pay_end_dt = g.pay_end_dt
AND a.off_cycle = g.off_cycle
AND a.page_num = g.page_num
AND a.line_num = g.line_num
AND a.sepchk = g.sepchk
AND a.business_unit = b.setid
AND a.company = e.company
AND a.paygroup = e.paygroup
AND a.pay_end_dt = e.pay_end_dt
AND h.erncd = f.erncd
AND h.erncd = i.erncd
AND b.deptid = a.deptid
AND h.effdt = (SELECT MAX (h_ed.effdt)
FROM ps_earnings_tbl h_ed
WHERE h.erncd = h_ed.erncd AND h_ed.effdt <= a.pay_end_dt)
AND c.effdt =
(SELECT MAX (c_ed.effdt)
FROM ps_jobcode_tbl c_ed
WHERE c.setid = c_ed.setid
AND c.jobcode = c_ed.jobcode
AND c_ed.effdt <= SYSDATE)
AND b.effdt =
(SELECT MAX (b_ed.effdt)
FROM ps_dept_tbl b_ed
WHERE b.setid = b_ed.setid
AND b.deptid = b_ed.deptid
AND b_ed.effdt <= SYSDATE)
AND EXISTS (SELECT i.rowsecclass
FROM ps_scrty_tbl_dept i
WHERE i.rowsecclass = 'DPALL' AND i.setid = a.business_unit); -
Create materialized view, ORA-00942
I would like to create a materialized view on user scott@orcl for user colinsuper. User scott@orcl have
"CREATE ANY MATERIALIZED VIEW" permissions. Why does I get an ORA-00942 error?
Remote-Database: remote_orcl.world
Remote-Database-User: lindasuper
Remote-Database-Table: cars
scott@orcl>create synonym cars for lindasuper.cars@remote_orcl.world
2 /
Synonym created.
scott@orcl>select car_no cno, car_bez cbez from cars
2 where rownum <= 1;
cno cbez
3 32-mxl
scott@orcl
scott@orcl
scott@orcl>CREATE MATERIALIZED VIEW colinsuper.CARS_MV
2 TABLESPACE my_tablespace
3 BUILD IMMEDIATE
4 USING INDEX TABLESPACE my_idx
5 REFRESH
6 START WITH sysdate
7 NEXT ROUND(SYSDATE)+5/24
8 WITH PRIMARY KEY
9 ENABLE QUERY REWRITE
10 AS
11 SELECT car_no cno
12 car_bez cbez
13 FROM cars
14 /
CREATE MATERIALIZED VIEW colinsuper.CARS_MV
FEHLER in Zeile 1:
ORA-00942: Tabelle or View does not exist
scott@orcl>
scott@orcl>
scott@orcl>When I am creating the materialized view without the user colinsuper, materialized view
is creating without problems.
scott@orcl>CREATE MATERIALIZED VIEW CARS_MV
2 TABLESPACE my_tablespace
3 BUILD IMMEDIATE
4 USING INDEX TABLESPACE my_idx
5 REFRESH
6 START WITH sysdate
7 NEXT ROUND(SYSDATE)+5/24
8 WITH PRIMARY KEY
9 ENABLE QUERY REWRITE
10 AS
11 SELECT car_no cno
12 car_bez cbez
13 FROM cars
14 /
Materialized View wurde erstellt.
scott@orcl>
scott@orcl>I think there is somthing wrong with the permissions of colinsuper!?Is this colinsuper a user in the remote database.
ORA-00942: table or view does not exist
Cause:
The table or view entered does not exist, a synonym that is not allowed here was used, or a view was referenced where a table is required. Existing user tables and views can be listed by querying the data dictionary. Certain privileges may be required to access the table. If an application returned this message, the table the application tried to access does not exist in the database, or the application does not have access to it.
Action:
Check each of the following:
the spelling of the table or view name.
that a view is not specified where a table is required.
that an existing table or view name exists.
Contact the database administrator if the table needs to be created or if user or application privileges are required to access the table.
Also, if attempting to access a table or view in another schema, make certain the correct schema is referenced and that access to the object is granted. -
Create Materialized view Error ORA-22818
Hi,
I am creating a materialized view based on a complex query with inline queries, below is a simplified version of the query:
CREATE MATERIALIZED VIEW CM_FA_PEND_mvu
TABLESPACE CISTS_TH
BUILD IMMEDIATE
REFRESH COMPLETE
ENABLE QUERY REWRITE
AS
SELECT/*+ index (a,XT094S3) index (b,XT232S1) index (c, XM143P0) index (d, XM185S1)*/
a .fa_id,
a.fa_type_cd,
a.fa_status_flg,
a.disp_grp_cd,
(SELECT dl.descr
FROM ci_disp_grp_l dl
WHERE dl.disp_grp_cd = a.disp_grp_cd AND dl.language_cd = 'ENG')
disp_grp_cd_descr
FROM ci_fa a,
ci_sp_mtr_hist b,
ci_mtr_config c,
ci_reg d,
ci_fapr_faty e
WHERE a.fa_type_cd = e.fa_type_cd
AND a.sp_id = b.sp_id(+)
AND b.mtr_config_id = c.mtr_config_id(+)
AND c.mtr_id = d.mtr_id(+)
AND a.fa_status_flg = 'P'
AND e.fa_type_prof_cd = 'METERED'
AND ( (b.removal_dttm IS NULL))
I am getting error "ORA-22818: subquery expressions not allowed here". the problem is in columns "disp_grp_cd_descr" (when I remove this column from the query, the MView is created successfully)
Is using inline queries as columns a limitation on creating materialized view?
Is there a workaround ?
Thanks
AKNo version and no exception ... the full text is necessary the number alone insufficient ... to help you much other than recommend you read this:
http://download.oracle.com/docs/cd/E11882_01/server.112/e10810/basicmv.htm#DWHSG8195
where it says:
"The SELECT clause in the materialized view creation statement defines the data that the materialized view is to contain. Only a few restrictions limit what can be specified. Any number of tables can be joined together. Besides tables, other elements such as views, inline views (subqueries in the FROM clause of a SELECT statement), subqueries, and materialized views can all be joined or referenced in the SELECT clause. You cannot, however, define a materialized view with a subquery in the SELECT list of the defining query. You can, however, include subqueries elsewhere in the defining query, such as in the WHERE clause."
Something you could have found in a second or two in the docs at http://tahiti.oracle.com by searching for "Materialized Views Restrictions"
But without your version and the actual error message this may not apply. -
Create Materialized View ORA-01723: zero-length columns are not allowed
I am trying to create a materialized view which derives a column from a function and I get: ORA-01723: zero-length columns are not allowed.
I am using 10gR2 with the following definition (simple version):
CREATE MATERIALIZED VIEW AS
SELECT
function_name(column_name) COLUMN_ALIAS
FROM table_name;
I have even tried to cast it like below:
CREATE MATERIALIZED VIEW AS
SELECT
CAST(function_name(column_name) AS VARCHAR2(200)) COLUMN_ALIAS
FROM table_name;
My function does have an exception to return a value even if no values are found.
I have looked all over for the solution. Does anyone have a way around this issue? I really need my function to derive the column as it has business rules which I cannot join into my materialized view definition. My only hope around this is to insert the values into a table and then create a materialized view from that table, I don't want to do that if someone has a solution around this.
Any help would be greatly appreciated.
Thank you,
Kyle
Edited by: Kyle Miller on Apr 19, 2011 8:28 AMHave you tried creating a table with the correct structure and then creating the materialized view based on the prebuilt table as described here...
http://www.oaktable.net/content/ultra-fast-mv-alteration-using-prebuilt-table-option
Cheers
Ben -
ORA-04052 creating Materialized View
ORA-04052 creating Materialized View
Hi All !!
I'm trying to create a Materialized view and his query definition uses an active public database link. When I ran the script for creating the view I get the following message:
ERROR in line 1:
ORA-04052: error occurred when looking up remote object
USER.TABLE@ORCL2
ORA-00604: error occurred at recursive SQL level 1
ORA-03106: fatal two-task communication protocol error
ORA-02063: preceding line from ORCL2
But when I execute his definition query all is ok, the query works fine.
I mean, I'm using the following sentence to create the view:
CREATE MATERIALIZED VIEW my_view TABLESPACE tbsname BUILD IMMEDIATE
REFRESH FORCE
WITH ROWID
ENABLE QUERY REWRITE
AS
SELECT ...
FROM SCHEMA_NAME.TABLE_NAME@ORCL2;
The above sentence give me ORA-04052. Nevertheless the SELECT... FROM SCHEMA_NAME.TABLE_NAME@ORCL2; works fine...
I checked for the GLOBAL_NAMES parameter and it is set to FALSE. Please help me, How can I fix this problem ?
I'm using Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production running over Win XP for create the view.
The Database Link points to Oracle Database 10g Release 10.1.0.4.0 - 64bit Production running over Solaris
Thanks in advance !!I've checked the NLS_LANG settings in both servers, and are set to AMERICAN. NLS TERRITORY are set to America also.
-
Create materialized view with ora-12054 error
Oracle 10g R2 on AIX 5.3L
I create a script (with help of EM) for a materilaized view
CREATE MATERIALIZED VIEW "BAANDB"."R2_MV"
TABLESPACE "USERS" NOLOGGING STORAGE ( INITIAL 128K) USING INDEX TABLESPACE "BAANIDX" STORAGE ( INITIAL 256K)
REFRESH FORCE ON COMMIT
ENABLE QUERY REWRITE AS
SELECT CM.ROWID c_rid, PC.ROWID p_rid, CM."T$CWOC", "T$EMNO", CM."T$NAMA", CM."T$EDTE", PC."T$PERI", PC."T$QUAN", PC."T$YEAR", PC."T$RGDT" From BAANDB.TTPPPC235201 PC RIGHT OUTER JOIN BAANDB.TTCCOM001201 CM Using (T$EMNO)
but I got error
ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view
acooding to the oerr
// *Cause: The materialized view did not satisfy conditions for refresh at
// commit time.
// *Action: Specify only valid options.
what dose it mean? both my master tables are not IOT and are locale ones. It seems that only changing to ON DEMAND works. If I use the "REFRESH FORCE START ..NEXT", it also failed.
I have created the materalized view logs with rowid on each master table. I think my script met every prequirement of ON COMMIT.
table owner has "on commit refresh" privilegeAfter googling on line, someone mentioned that for "ON COMMIT" on join tables, we have to use th old OUTER JOINT syntax (+) on WHERE. The new "outer joint" in FROM clause won't work.
I tested it, it seemed to be true. -
ORA-12052 when create materialized view
I following the sample in Oracle document to create materialized viewCREATE MATERIALIZED VIEW LOG ON sales
WITH ROWID, SEQUENCE(amount_sold, time_id, prod_id) INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW LOG ON times
WITH ROWID, SEQUENCE (time_id, calendar_year) INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW LOG ON products
WITH ROWID, SEQUENCE (prod_id,prod_name) INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW sales_mv
BUILD IMMEDIATE REFRESH FAST ON COMMIT
AS SELECT t.calendar_year, p.prod_id, p.prod_name,
SUM(s.amount_sold) AS sum_sales
FROM times t, products p, sales s
WHERE t.time_id = s.time_id AND p.prod_id = s.prod_id
GROUP BY t.calendar_year, p.prod_id, p.prod_name; This works. BUt I actually does not want do aggregation. Thus I changed the MV creation statement toCREATE MATERIALIZED VIEW sales_mv
BUILD IMMEDIATE REFRESH FAST ON COMMIT
AS SELECT t.calendar_year, p.prod_id, p.prod_name,s.amount_sold
FROM times t, products p, sales s
WHERE t.time_id = s.time_id AND p.prod_id = s.prod_id;I got errorSQL Error: ORA-12052: cannot fast refresh materialized view GLU.SALES_MV
*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.Please help or point me to the relevant document.
Thanksdamorgan, Thank you for you reply.
the inner table of an outer join did not have UNIQUE constraints on join columns.
I am not sure how much clearer and explanation can be written.If you look at the query, you will find that there is no outer join in the query.
sales table does not have unique constraints on prod_id and time_id. If this is the cause of the problem, I cannot change the data but is there a work around. That is way I ask for specific doc. In 11g documents, I only find some info on CREATE MV. That is mainly on syntax but not on requirement. -
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 -
ORA-25175 when trying to create materialized view, organization index SOLV
Hi,
I'm trying to create a materialized view to compensate for non-normalized table.
I have table anormal, and mv is to be on distinct agency, company in that table.
Here goes:
SQL> select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for IBM/AIX RISC System/6000: Version 10.2.0.3.0 - Productio
NLSRTL Version 10.2.0.3.0 - Production
SQL> create table anormal (company varchar2(8) not null
2 ,dept varchar2(8) not null
3 ,agency varchar2(8) not null
4 ,constraint anormal_pk primary key (company,dept));
Table created.
SQL> insert into anormal values('c1', 1, 'Ajax');
1 row created.
SQL> insert into anormal values('c1', 2, 'Ajax');
1 row created.
SQL> insert into anormal values('c1', 3, 'Acme');
1 row created.
SQL> insert into anormal values('c2', 1, 'Acme');
1 row created.
SQL> insert into anormal values('c2', 2, 'Acme');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from anormal;
COMPANY DEPT AGENCY
c1 1 Ajax
c1 2 Ajax
c1 3 Acme
c2 1 Acme
c2 2 Acme
SQL> create materialized view agency_comp_mv
2 organization index --primary key (agency, company)
3 build deferred
4 refresh on demand
5 as
6 select distinct agency, company from anormal
7 /
select distinct agency, company from anormal
ERROR at line 6:
ORA-25175: no PRIMARY KEY constraint found
SQL>The error tells me that there is no primary key, but is there any way to add such?
- or is my problem rather that I cannot use DISTINCT with organization index?
Regards
Peter
bump
Message was edited by:
Peter Gjelstrup
<SOLVED>
Message was edited by:
Peter GjelstrupThanks William,
I tried with ON PREBUILT TABLE, just to see what happens.
Building on my OP:
SQL> create table iot(agency varchar2(8) not null, company varchar2(8) not null
2 ,constraint iot_pk primary key (agency,company))
3 organization index;
Table created.
SQL> insert into iot select distinct agency, company from anormal;
4 rows created.
SQL> commit;
Commit complete.
SQL> create materialized view iot on prebuilt table
2 as
3 select distinct agency, company from anormal;
Materialized view created.
SQL> select * from iot;
AGENCY COMPANY
Acme c1
Acme c2
Ajax c1
SQL> insert into anormal values('c3', 2, 'Foo');
insert into anormal values('c3', 2, 'Foo')
1 row created
SQL> select * from anormal;
COMPANY DEPT AGENCY
c1 1 Ajax
c1 2 Ajax
c1 3 Acme
c2 1 Acme
c2 2 Acme
c3 2 Foo
6 rows selected.
SQL> select * from iot;
AGENCY COMPANY
Acme c1
Acme c2
Ajax c1
3 rows selectedNow, try to refresh and MV
SQL> alter materialized view iot refresh complete;
Materialized view altered.
SQL> select object_type, to_char(last_ddl_time, 'hh:mi:ss'), status
2 from user_objects where object_name = 'IOT';
OBJECT_TYPE DDL_TIME STATUS
TABLE 10:40:42 VALID
MATERIALIZED VIEW 10:41:13 VALID
SQL> select * from iot;
AGENCY COMPANY
Acme c1
Acme c2
Ajax c1Agency "Foo" is not in MV,
Looks like that IOT select'ed from is indeed the MV:
SQL> drop table iot;
drop table iot
ERROR at line 1:
ORA-12083: must use DROP MATERIALIZED VIEW to drop "STIK"."IOT"
SQL>So, seems that Maxim is right, it just can't be done. And it seems my options are:
Create HEAP organized MV or
Create and maintain IOT
Regards
Peter -
Create materialized view in SE referring table in EE
Hi DBAs,
I am trying to create a Materialized view on Oracle 10g Standard Edition which is installed on Linux Debian Lenny.
The master table is on Oracle 10g Enterprise Edition installed on Red Hat Linux 4.1.2.
When I run,
create materialized view t1 build immediate refresh fast as (select * from aksharaemsmigrated.t1@db102)
i get,
ORA-12028: materialized view type is not supported by master site
When I run,
create materialized view t1 build immediate refresh fast on commit as (select * from aksharaemsmigrated.t1@db102);
I get,
ORA-01031: insufficient privileges
When I run,
select * from aksharaemsmigrated.t1@db102
I get,
the rows from aksharaemsmigrated.t1@db102
NOTE: 'db102' is remote DB on 10g EE for which I created db link.
I am able to create Mview for local table.
Is this not supported? I mean creating Mview on Oracle SE referring base table from Oracle EE.
I have to give solution soon. Can you please throw some light.
Regards,
VijayDon't put select statement inside parantheses.
Test these
create table x1 as select * from aksharaemsmigrated.t1@db102;
create materialized view t1 build immediate refresh fast as select * from aksharaemsmigrated.t1@db102 ;Note that you cannot create an MV that is REFRESH ON COMMIT when across Databases.
See my explanation at http://hemantoracledba.blogspot.com/2008/06/mvs-with-refresh-on-commit-cannot-be.html
Hemant K Chitale -
Error while creating materialized view which using database link
Helo!
I'm getting error "ORA-00942: table or view does not exist" when I want to create materialized view.
Details:
1. On destination database I create a database link:
CREATE DATABASE LINK SDATABASE
CONNECT TO MYUSER
IDENTIFIED BY MYUSERPASS
USING 'ORCL';
=> Command "SELECT * FROM TABLE1@SDATABASE" returns data normally!
2. On source database I create MATERIALIZED VIEW LOG:
CREATE MATERIALIZED VIEW LOG
ON TABLE1
WITH PRIMARY KEY
INCLUDING NEW VALUES;
3. Now, when I want to create MATERIALIZED VIEW on destination database:
CREATE MATERIALIZED VIEW TABLE1
REFRESH FAST
START WITH SYSDATE
NEXT SYSDATE + 1/1440
WITH PRIMARY KEY
AS SELECT * FROM TABLE1@SDATABASE;
...I get error "ORA-00942: table or view does not exist"!
How is that possible if command "SELECT * FROM TABLE1@SDATABASE" returns data normally?
Thanks,
VorancAnd, I'm using Oracle 10g.
Voranc
Maybe you are looking for
-
Default Web Application is not visible in Weblogic Console
We are using Weblogic 5.1.0 SP7 We moved our Application from the Implicitly Defined Default Web Application which is configurated by the weblogic properties to a Web Application. Because we don't want to chang
-
I shoot in raw and when I export images to photo labs the size is too small. Instead of mb, the size is reduces to kb. I have export set for tiff 16 bit. What am I doing wrong?
-
Preparing Solution Manager for SMD Agents Installation
Hello everyone I have to configure the Solution Manager of QAS to receive new SMD Agents, I looking at the transaction SOLMAN_SETUP. Does anybdoy know what do I have to do to prepare the environment for the installation of SMD agents? Thank
-
I have paid and installed iWorks from disk do I now need to pay to get the app on my iPad
So on y mac i have iwork09 installed but noow i want it on my iPad so i sync everything through iCloud how do I do it
-
I have enrolled in the Cloud and the money has gone from my account and yet my copy of Audition is still in trial mode with three days left. Telephone help is useless as they can barely speak any English. Answers please anyone?? osx 10.8.5