Materialized view creation.
hi experts.
I have a requirement wherein I need to create a mview based on a single table.Mview is going to be a complex mview(uses correlated sub-queries in SELECT) and the source table resides in some other database. I need this mview refreshed once for a day.
I created mview as BUILD IMMEDIATE REFRESH COMPLETE START WITH sysdate NEXT sysdate+1. Is this fine ?
Please suggest if there is much efficient way of creating mview in this case?
Thank you.
How large is the source table? Have you considered the time it will take to complete the refresh?
Similar Messages
-
Materialized view creation taking long time
Hi All,
We are creating a dimensional OLAP model with the Materialized views. In that we are having 7 dimensions and 1 fact table. I have created all the dimensions with the materialized views with out any problem. But when im trying to create my Fact materialized view it is running for 14 hours and is still running. I'm waiting to see when it will complete. The select statement in the Fact MV returns only 19 records and that too in seconds. But when i use the same select statement for MV creation it is taking a long time. I dont know how long it gonna take. How can i reduce this long running time. Mean while my fact MV is having nearly 15 joins with other physical tables and dimensions.
Thanks in advance,
KarthickHi all,
Thanks for your reply..
I think i dint clearly mention my problem..
The select statement for the MV will return 19 records. But when im trying to create the MV it is taking quite a long time. it ran for >14 hours but still it dint create a MV. Why is it happening like this? Is it possible to increase the performance.
Thanks,
Karthick -
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
-
Materialized view creation issue
I am running into an issue and trying to ascertain issue.
Scenario:
I have 2 MV creation scripts. The MV is supposed to get populated by connection from schema to another schema USING DB Links.
Basically, SAME HOST, SAME RAC DATABASE, just separate schemas.
The MV creations are just hanging. I see NO alert log mentions. I ran a SQL trace and yes, I see:
call count cpu elapsed disk query current rows
Parse 0 0.00 0.00 0 0 0 0
Execute 1011 1.40 73.80 0 0 0 0
Fetch 1010 1.08 317.57 0 0 0 1010
total 2021 2.49 391.38 0 0 0 1010
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: 109 (recursive depth: 2)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to dblink 2022 0.00 0.00
SQL*Net message from dblink 2021 0.46 242.58
Understandable, but when I do a selective query, the results come back pretty much within 5 seconds.
DB version is 11.2.0.3. Is there a BUG that I should know about?
Here is a snippet:
CREATE MATERIALIZED VIEW "SCHEMA"."MV_NAME_MV" USING INDEX REFRESH COMPLETE ON DEMAND AS (SELECT distinct mapguide_persons(pl.location_code) "FULL_NAME_COSTCENTER",
mapguide_jobemp(pl.location_code) "TRUNCNAME_JOB",
mapguide_empnum(pl.location_code) "FULLNAME_EMPNUMBER_PHONE",
mapguide_english(pl.location_code) "ENGLISH_NAME_COSTCENTER",
pl.function_type_lookup_code "FUNCTION_TYPE_LOOKUP_CODE",
pl.location_code "LOCATION_CODE",
pl.org_id "ORG_ID"
FROM [email protected] pl
WHERE pl.function_type_lookup_code not in ('VALUE','CONSULT')
and sysdate between pl.active_start_date and active_end_date);
*Network netstat –in output **
netstat -in
Kernel Interface table
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0 1500 0 58751025 0 0 0 27335255 0 0 0 BMRU
eth0:1 1500 0 - no statistics available - BMRU
eth0:2 1500 0 - no statistics available - BMRU
eth1 1500 0 5569305513 0 0 0 4365204661 0 0 0 BMRU
eth2 1500 0 146061981 0 0 0 270589939 0 0 0 BMRU
eth2:1 1500 0 - no statistics available - BMRU
lo 16436 0 31731571 0 0 0 31731571 0 0 0 LRU
The above just hangs and spins its wheels…
Any ideas are appreciated…
thanksJCGO wrote:
The above just hangs and spins its wheels…
And what happens when you issue just the underlying select:
SELECT distinct mapguide_persons(pl.location_code) "FULL_NAME_COSTCENTER",
mapguide_jobemp(pl.location_code) "TRUNCNAME_JOB",
mapguide_empnum(pl.location_code) "FULLNAME_EMPNUMBER_PHONE",
mapguide_english(pl.location_code) "ENGLISH_NAME_COSTCENTER",
pl.function_type_lookup_code "FUNCTION_TYPE_LOOKUP_CODE",
pl.location_code "LOCATION_CODE",
pl.org_id "ORG_ID"
FROM [email protected] pl
WHERE pl.function_type_lookup_code not in ('VALUE','CONSULT')
and sysdate between pl.active_start_date and active_end_date
SY. -
Materialized View creation advice and SQL advice
I want to create a materialized view for the table below. The materialized view should query data from only this table and i want to join 2 rows to one.
The key for the joins are the column internal_correlation_id which is unique for request/response pair.
The table is updated every day with 2 million rows.
What type of materialized view should i use and how can i query to get one row?
CREATE TABLE EVENT (
caller_id VARCHAR2(255) NOT NULL
, service_id VARCHAR2(255) NOT NULL
, country_code VARCHAR2(2)
, internal_correlation_id VARCHAR2(255) NOT NULL -- Unique for request response pair
, received_date DATE NOT NULL
, status VARCHAR2(20)
, queue_name VARCHAR2(255) NOT NULL
, USER_ID VARCHAR2(50)
, engine_id VARCHAR2(50)
, tracking_correlation_id VARCHAR2(2000)
, mnc VARCHAR2(20)
, mcc VARCHAR2(20)
, request_type VARCHAR2(50) -- REQUEST or RESPONSE
, app_id VARCHAR2(50)
, failure_code VARCHAR2(50)
, failure_string VARCHAR2(255)
, created_date DATE DEFAULT SYSDATE
, updated_date DATE DEFAULT SYSDATE
DB release 11G release 1
Edited by: Alekons01 on Mar 24, 2012 2:43 PMAnyway, I don't believe you will be able to create MV with fast refresh. MV with complete refresh:
CREATE MATERIALIZED VIEW event_mv
BUILD IMMEDIATE
REFRESH COMPLETE ON DEMAND
AS
SELECT e1.caller_id req_caller_id,
e1.service_id req_service_id,
e1.country_code req_country_code,
e1.internal_correlation_id req_internal_correlation_id,
e1.received_date req_received_date,
e1.status req_status,
e1.queue_name req_queue_name,
e1.user_id req_user_id,
e1.engine_id req_engine_id,
e1.tracking_correlation_id req_tracking_correlation_id,
e1.mnc req_mnc,
e1.mcc req_mcc,
e1.request_type req_request_type,
e1.app_id req_app_id,
e1.failure_code req_failure_code,
e1.failure_string req_failure_string,
e1.created_date req_created_date,
e1.updated_date req_updated_date,
e2.caller_id rsp_caller_id,
e2.service_id rsp_service_id,
e2.country_code rsp_country_code,
e2.internal_correlation_id rsp_internal_correlation_id,
e2.received_date rsp_received_date,
e2.status rsp_status,
e2.queue_name rsp_queue_name,
e2.user_id rsp_user_id,
e2.engine_id rsp_engine_id,
e2.tracking_correlation_id rsp_tracking_correlation_id,
e2.mnc rsp_mnc,
e2.mcc rsp_mcc,
e2.request_type rsp_request_type,
e2.app_id rsp_app_id,
e2.failure_code rsp_failure_code,
e2.failure_string rsp_failure_string,
e2.created_date rsp_created_date,
e2.updated_date rsp_updated_date
FROM event e1,
event e2
WHERE e2.internal_correlation_id = e1.internal_correlation_id
AND e1.request_type = 'REQUEST'
AND e2.request_type = 'RESPONSE'
/SY. -
Materialized View - creation and schedule (To automate Refresh)
Hi All,
I have one table based on SQL Query (multiple tables) and loading data every day through procedure.
When I execute the procedure is taking lot of time to load data. That’s why I am planning to create Materialized view to refresh the data in a table every day at some point of time (ex:-9.00 am).
Exclude procedure and materialized view are there any ways to refresh the data?
Can you and all please help me to create materialized view and schedule (Automate refresh).
begin
insert into CLAIMS_PRODUCT_TAB
select
substr(at.ATN_VOUCHER_NUMBER,1,6) as BRANCH,
t.MONTH_NAME as MONTH,t.FISCAL_YEAR as YEAR,
bb.ACC_ACCOUNT_TYPE as TYPE,
aa.ACC_DEPARTMENT_CODE as DEPT,
pr.PRODUCT_NAME as PRODUCT,
case bb.ACC_ACCOUNT_TYPE when '1301' then 'Claims Paid' when '5383' then 'Claims OS' end as HEAD,
case aa.ACC_DEPARTMENT_CODE when '31' then 'OD' when '32' then 'TP' when '39' then 'TP Pool' end as DEPT_NAME,
count(distinct at.CLAIM_ID) as CLAIMS,
--count( distinct at.POLICY_ID) as POLICIES,
sum(atd.ATD_CREDIT_AMOUNT - atd.ATD_DEBIT_AMOUNT) as totals
from
ACCOUNTING_TRN_DETAIL atd,time t,
ACCOUNT bb,
ACCOUNT aa,claim c, policy p,product pr,
accounting_transaction at
where bb.ACC_ACCOUNT_ID = aa.ACC_ACC_ACCOUNT_ID
and at.CLAIM_ID = c.CLAIM_ID
and c.POLICY_ID = p.POLICY_ID
and p.PRODUCT_ID = pr.PRODUCT_ID
and aa.ACC_ACCOUNT_ID = atd.ACC_ACCOUNT_ID
and atd.ATN_ACCOUNTING_TRANSACTION_ID = at.ATN_ACCOUNTING_TRANSACTION_ID
and trunc(at.ATN_TRANSACTION_DATE) = t.CAL_DATE
and (bb.ACC_ACCOUNT_TYPE in ('1301','5383'))
group by substr(at.ATN_VOUCHER_NUMBER,1,6)
,t.MONTH_NAME
,t.FISCAL_YEAR,bb.ACC_ACCOUNT_TYPE
,aa.ACC_DEPARTMENT_CODE
,pr.PRODUCT_NAME
, case bb.ACC_ACCOUNT_TYPE when '1301' then 'Claims Paid' when '5383' then 'Claims OS' end
,case aa.ACC_DEPARTMENT_CODE when '31' then 'OD' when '32' then 'TP' when '39' then 'TP Pool' end );
end;
Thanks and Regards
VenkatIs the MV and the source tables on the same database? If this is a remote MV, then check the source site if there are any issues (TEMP, UNDO space issues).
-
Unexpected synonym creation via a materialized view DDL statement
While I was doing some testing for a future materialized view creation I did this...
create materialized view yes as select empno, ename from emp;Oracle created a table called "YES" and a materialized view called "YES".
Then I did this...
create materialized view wow as select empno, ename from emp;Oracle created a table called "WOW" and materialized view called "WOW", and a synonym called "WOW1"...
Eh? Whats up with he synonym called "WOW1"?
SQL*Plus: Release 9.0.1.4.0 -
Oracle9i Enterprise Edition Release 9.2.0.5.0 - 64bitI'm not able to reproduce this. My version is 9.2.0.7.0
my_schema@mydb> create materialized view yes as select employee_id, salary from employees;
Materialized view created.
Elapsed: 00:00:01.00
my_schema@mydb> select object_type, owner, object_name from dba_objects where object_name = 'YES';
OBJECT_TYPE OWNER OBJECT_NAME
MATERIALIZED VIEW my_schema YES
TABLE my_schema YES
Elapsed: 00:00:00.03
my_schema@mydb> create materialized view wow as select employee_id, salary from employees;
Materialized view created.
Elapsed: 00:00:00.04
my_schema@mydb> select object_type, owner, object_name from dba_objects where object_name like 'WOW%';
OBJECT_TYPE OWNER OBJECT_NAME
MATERIALIZED VIEW my_schema WOW
TABLE my_schema WOW -
Refresh of a materialized view
Hi All!
I have a materialized view defined like:
CREATE MATERIALIZED VIEW v_ship_info_new
PCTFREE 5 PCTUSED 60
TABLESPACE DATA_BIG
STORAGE
INITIAL 32768K
MINEXTENTS 1
MAXEXTENTS UNLIMITED
USING INDEX STORAGE (INITIAL 2M NEXT 500K)
REFRESH START WITH ROUND(SYSDATE + 1) + 08/24
NEXT ROUND(SYSDATE + 2) + 08/24
AS
SELECT .....
The view was created on Sep.-13-2005. I expected that the view will be refreshed today at 08:00 AM, but the last_ddl_time in user_objects is Sep.-18-2005 and the data in the view is also from Sep.-18-2005. There is no time filter in SELECT statement. The view should shows a result of left outer join of two tables.
Any idea?
Thanks,
AndrejAndrej,
You should consider the NEXT interval relative to the last materialized view refresh. Reading your materialized view definition it results that:
- the materialized view was refreshed for the first time on 14-sep at 8:00 am (START WITH ROUND(SYSDATE + 1) + 08/24)
- the materialized view is then refreshed on 16-sep at 8:00 am, 18-sep at 8:00 am (ROUND(SYSDATE + 2) + 08/24)
Considering you have specified the START WITH clause in your command, the NEXT date should be considered starting from the timestamp of the last refresh and not from the moment of the materialized view creation.
Regards,
Adi -
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 -
I have this subquery in a materialized view.
(SELECT COUNT(*)
FROM product_statistics_units psu
INNER JOIN scenes_identity_fact sif
ON (trunc(sif.date_acquired) = trunc(psu.scene_date))
AND ((SELECT satellite_sensor_key
FROM lu_satellite sat
WHERE psu.satellite = sat.satellite
AND psu.sensor_id = sat.sensor_id) = sif.satellite_sensor_key)
AND ((SELECT wrs_key
FROM worldwide_reference_system wwrs
WHERE psu.wrs_path = wwrs.wrs_path
AND wwrs.wrs_row
BETWEEN psu.wrs_starting_row
AND psu.wrs_ending_row) = sif.wrs_key)
WHERE psu.date_unit_shipped IS NOT NULL)
AS times_sold,When I try to create the view, I get this error
ORA-22818: subquery expressions not allowed here
The subquery works fine as a stand-alone query, but when put in the SELECT statement for the materialized view is when I get the error. Also if I comment out the two AND clauses in the join, it works ok.
I am fairly new to oracle and sql, but I have been tasked with creating this materialized view. Any help you guys can give me would be greatly appreciated.Oracle is VERY fussy about what it will/won't allow in materialized view creation. You hit one of the limitations. Try recoding the sub-query as a table join since its doing correlation and see if that works.
Also do not put comments ("--" or " "/* */") in the MV SQL; I've had trouble trying to self-document the SQL in that way. -
Materialized view (creating and complete refresh)
Good day.
I have a huge query that is used to create a materialized view. The query consist of 9 joins, a lot of aggregations, some subqueries, so we can say it is rather huge. The query itself executes for about 30 seconds and returns about 200 rows. The materialized view creates and refreshes for more than 30 minutes. Can someone please explain me the mechanism of materialized view creation which causes such bad performance.
We use Oracle Database 9.2.0.4.
Thank you in advance.I've fount the solution. May be it will be useful for someone not regarding that 9.2 database is less used today than 10.2.
I studied carefully the plan of the query and the plan of insert statement that is used when creating materialized view and found the cause of trouble. Insert statements generates VIEW PUSHED PREDICATE and BITMAP CONVERSION FROM ROWIDS when parsing. Bitmap conversion can be removed by setting environment parameter btree_bitmap_plans to false (a well-known issue), but I decided not ot change the production environment. The pushed predicate can be removed by using hint NO_PUSH_PRED to each subquery used in a materialized view. This step reduced the time of materialized view creation and execution to about a minute.
Thank everyone who tried to help. -
Hi All,
I had some problem with my Materialized views, that's why Dropped all of the Logs + Materialized Views from my Production Database. Kindly tell me that, Is there any Query, which I can run and make Materialized View Logs from my Existing Tables . Thanks
Regards,
ImranIncremental Materialized View creation steps
Hi,
Find the below steps to create MV's with logs.
1. Materialized view log creation at master.
2. DB link creation at MV site to master site.
3. Materialized view creation at MV site.
4. Refresh the MV.
Materialized view log creation at master.
SQLPLUS <USER_MASTER_SITE>/<PASSWORD>@<MASTER_SITE>
CREATE MATERIALIZED VIEW LOG ON <TABLE_NAME>;
DB link creation at MV site.
SQLPLUS <USER_MV_SITE>/<PASSWORD>@<MV_SITE>
CREATE Database Link <MASTER_SITE> Connect To <USER_MASTER_SITE> Identified By <PASSWORD> Using ‘<tnsnames>’
Materialized view creation at MV site.
SQLPLUS <USER_MV_SITE>/<PASSWORD>@<MV_SITE>
CREATE MATERIALIZED VIEW <TABLE_NAME> BUILD
IMMEDIATE REFRESH FAST ON DEMAND
ENABLE QUERY REWRITE
AS SELECT * FROM <TABLE_NAME>@<MASTER_SITE> REFRESH ;
Refresh the MV.
SQLPLUS <USER_MV_SITE>/<PASSWORD>@<MV_SITE>
Execute DBMS_SNAPSHOT.REFRESH( '<TABLE_NAME>','f');
Regards,
Prasanna -
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..
-
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. -
Cannot create Materialized View using PL/SQL procedure
Hello,
I have a question related to Materialized View creation.
I have a stored procedure that creates materialized view. When trying to run this procedure I get insufficient privileges error: ORA-01031.
When I run content of this procedure as anonymous PL/SQL block them materialized view is created without any complications.
Can you please advice me on that topic?
Is it even possible to create materialized view in stored procedure as I haven't found an info on it.
Thanks
PetrHi chudapet,
Whenever you do operation in procedure you need to have direct grants and not via a role.
Most probably the grant to create materialized view is available via a role to your user.
Assign direct grant to the user:
grant create materialized view to scott;
{code}
Maybe you are looking for
-
Creating a model for jTable in JDeveloper..
Hi everybody, I have a little problem about making a model for my jTable. Previously i've been using Netbeans and i had no problem about table models. Object[][] data={{" "," "," "," "}}; String[] columnNames = {"Pers_no","Name","Surname","Position"}
-
Updating to OSX Mavericks with a Bootcamp partition
Hi, I've got an early 2013 Macbook Pro and I just managed to install Windows 7 with Boot Camp. I'd like now to update my OSX partition to Mavericks. Is there any possibility that updating my OSX partition my Windows 7 partition gets damage? Thanks.
-
Strange HDD problem in Windows 7
Have a A660 laptop for 10 months. HDD died, no boot, no recovery, nothing, and no restore discs. Sent in to Toshiba for warrantee repair. They sent it back with new HDD. We started it up, and ran as a new install, like a new laptop. Everything l
-
Link between 2 SelectOnceChoice component doesn't work.
Hello all, I am using ADF BC, with Jdev version 10.1.3.3. Right now I have the requirement to put 2 SelectOneChoice and 1 table component on a new page. User select the value in the 1st list box and the value in 2nd list box should change according t
-
Submit problem using Adobe Designer 7.0 form & GroupWise email
We are designing an interactive form using Adobe Designer 7.0, and would like for other people in the organization to be able to fill in the form electronically then hit the "Submit by Email" to return the data. For email, we are using Novell GroupWi