Materialized Views
Materialized Views
Materialized Views
com/2009/07/08/brief-introduction-
into-materialized-views/
exec dbms_mview.refresh(list=>'MV1',method=>'C')
select mview_name,staleness from user_mviews; [ to check status of the mview -
if the basetable definition changed ]
exec dbms_mview.refresh('MV1','F')
select MVIEW_NAME,LAST_REFRESH_TYPE,LAST_REFRESH_DATE from user_mviews;
SET LONG 20000 LONGCHUNKSIZE 20000 PAGESIZE 0 LINESIZE 1000 FEEDBACK OFF VERIFY OFF
TRIMSPOOL ON
BEGIN
DBMS_METADATA.set_transform_param (DBMS_METADATA.session_transform,
'SQLTERMINATOR', true);
DBMS_METADATA.set_transform_param (DBMS_METADATA.session_transform, 'PRETTY',
true);
END;
/
-----------------------------------------------------------------------------------
------------------------------------------------------------------------------->>
MATERIALIZED VIEW in Oracle: [RBST2]
SYS@dat-efs-r-c06-scan:1530/rbs_r_t2 SQL>select OWNER,MVIEW_NAME from all_mviews;
OWNER--- MVIEW_NAME--
SYSMAN MGMT_ECM_MD_ALL_TBL_COLUMNS
AVTALE MATVIEW_FRE
SYSMAN MGMT_ECM_MD_ALL_TBL_COLUMNS
MGMT_ECM_MD_ALL_TBL_COLUMNS SELECT c.METADATA_ID,
1179 N
N TEXTMATCH DEMAND FORCE DEFERRED NO COMPLETE 05-JUN-12 FRESH
NA N N N N N N VALID N 0
m.TARGET_TYPE,
m.SNAPSHOT_TYPE,
t.name as TABLE_NAME,
c.NAME,
c.UI_NAME,
c.TYPE, c.TYPE_FORMAT,
c.IS_CHILD_LINK, c.LINK_COLUMN_NAME,
c.table_name as SOURCE_TABLE_NAME
FROM
mgmt_ecm_snapshot_metadata m,
mgmt_ecm_snapshot_md_tables t,
mgmt_ecm_snapshot_md_tables anc,
mgmt_ecm_snapshot_md_columns c
WHERE
(anc.name, anc.metadata_id) in
(SELECT anc_t.name, anc_t.metadata_id
BRANDNAME,
CAMPAIGNTEXT,
CUSTREFPOS,
FU_ID,
FUSP_ID,
FUSP_ID_TYPE,
OPPRORADATO,
RULENUMBER,
AVTALE.REGEXP_TRANSFORM(ACCNUMRULE) as ACCNUMRULE ,
AVTALE.REGEXP_TRANSFORM(INVOICENUMRULE) as INVOICENUMRULE
FROM AVTALE.FRE
===================================================================================
===================================================================================
=================>>
https://www.toadworld.com/platforms/oracle/w/wiki/4935.script-to-create-ddl-for-
existing-materialized-view-for-fast-refresh
DECLARE
v_task_name VARCHAR2 (100);
v_mview_owner VARCHAR2 (30) := UPPER ('&&ENTER_MVIEW_OWNER');
v_mview_name VARCHAR2 (30) := UPPER ('&&ENTER_MVIEW_NAME');
v_sql VARCHAR2 (4000);
BEGIN
-- get mview text from data dictionary
SELECT DBMS_METADATA.get_ddl ('MATERIALIZED_VIEW', mview_name, owner)
INTO v_sql
FROM dba_mviews
WHERE owner = v_mview_owner AND mview_name = v_mview_name;
===================================================================================
=======================================================================>>>>>>>
MVIEW SQL Is:
MATVIEW_FRE :
===================================================================================
===========================================================================>
MVIEW SQL Is:
MGMT_ECM_MD_ALL_TBL_COLUMNS
===================================================================================
============================================================================>>