成功刷新后,物化视图过时是compilation_error

时间:2015-05-27 09:46:01

标签: sql oracle plsql oracle11g materialized-views

我有1个物化视图并编译它没有任何错误,甚至手动刷新也没有编译错误。物化视图也是可搜索的并包含值。但是一旦你检查了视图的陈旧性,它就是compilation_error。此对象在SQL Dev中也有红色X.以下是我的方案。

  • 在APR-30上执行SQL * Plus中的物化视图,该视图每9点自动刷新一次(参见下面的实际MV代码)。
  • 在SQL * Plus中执行MVIEW LOGS。 在SQL Dev中,选中物化视图详细信息选项卡。 STALENESS是FRESH,这很好。
  • 2天后(MAY-02),选中物化视图详细信息选项卡。 STALENESS是NEEDS_COMPILE,有效,应在下次刷新时更改。
  • 检查是否有新记录要添加到源表中(即从MLOG $ _FACILITIES中选择*)。
  • 由于APR-30后自动刷新不处理。 04年5月,手动
  • 执行刷新'F'但建议编译错误运行完全刷新。
  • 执行完全刷新,成功。
  • 检查all_mview表。上次刷新日期已更新至May-04。
  • 检查物化视图的详细信息,其STALENESS值为COMPILATION_ERROR
  • 我尝试再次执行刷新'FAST',但不会更改.saleness值。
  

注意:到目前为止,刷新日期仍为May-04,Staleness = COMPILATION_ERROR。

CREATE MATERIALIZED VIEW MV_XXX
SELECT FAC.ID FACILITY_ID,
         FAC.EXTERNAL_FACILITY_ID,
         FACTYPE.FACILITY_TYPE_CODE,
         FACTYPE.FACILITY_TYPE_NAME,
         FAC.ASSET_TAG,
         FAC.ORG_UNIT_TILE_ID TILE,
         FAC.CRITICALITY,
         FAC.FACILITY_STATUS,
         ATLAS.ATLAS,
         ATLAS.DESCRIPTION ATLAS_DESC,
         ORGUNIT.SHORT_TEXT ORG_UNIT,
         SUBSTR(ORGUNIT.SHORT_TEXT, 2, 1) DIVISION_CODE,
         TRIM(FAC.DIRECT_ADDRESS_INFORMATION) DIRECT_ADDRESS_INFORMATION,
         TRIM(FMA_A.ADDRESS_1) ADDR_STREET_NO,
         TRIM(FMA_A.ADDRESS_3) ADDR_STREET_PREDIRECTION,
         TRIM(FMA_A.ADDRESS_4) ADDR_STREET_NAME,
         TRIM(FMA_A.ADDRESS_5) ADDR_STREET_TYPE,
         TRIM(FMA_A.ADDRESS_6) ADDR_STREET_POSTDIRECTION,
         TRIM(FMA_A.ADDRESS_9) ADDR_STREET_CITY,
         FAC.RJRN_JURISDICTION JURISDICTION,
         TRIM(FMA_A.ADDRESS_11) ADDR_STREET_ZIPCODE,
         TAX_D.TAXING_DISTRICT_CODE,
         TRIM(FAC_CH_CRS1.VALUE) CROSSSTREET1_NAME,
         TRIM(FAC_CH_CRSTP1.VALUE) CROSSSTREET1_TYPE,
         TRIM(FAC_CH_CRS2.VALUE) CROSSSTREET2_NAME,
         TRIM(FAC_CH_CRSTP2.VALUE) CROSSSTREET2_TYPE,
         FAC.GPS_LATITUDE,
         FAC.GPS_LONGITUDE,
         FAC.X_COORDINATE,
         FAC.Y_COORDINATE,
         FAC_CH_ASSTID.VALUE ASST_ID,
         FAC_CH_UFID.VALUE UFID_NMBR,
         FAC.ROWID ROWID1,
         FACTYPE.ROWID ROWID2,
         FACORGUNIT.ROWID ROWID3,
         ORGUNIT.ROWID ROWID4,
         ATLAS.ROWID ROWDID5,
         FMA_A.ROWID ROWID6,
         FAC_CH_CRS1.ROWID ROWID7,
         FAC_CH_CRS2.ROWID ROWID8,
         FAC_CH_CRSTP1.ROWID ROWID9,
         FAC_CH_CRSTP2.ROWID ROWID10,
         FAC_TD_MUNI.ROWID ROWID11,
         TAX_D.ROWID ROWID12,
         FAC_CH_ASSTID.ROWID ROWID13,
         FAC_CH_UFID.ROWID ROWID14
  FROM   FACILITIES FAC,
         FACILITY_TYPE FACTYPE,
         FACILITY_ORG_UNITS FACORGUNIT,
         ORG_UNITS ORGUNIT,
         ORG_UNIT_ATLASES ATLAS,
         FM_ADDRESS FMA_A,
         FACILITY_CHARS FAC_CH_CRS1,
         FACILITY_CHARS FAC_CH_CRSTP1,
         FACILITY_CHARS FAC_CH_CRS2,
         FACILITY_CHARS FAC_CH_CRSTP2,
         FACILITY_TAX_DISTRICTS FAC_TD_MUNI,
         TAXING_DISTRICT TAX_D,
         FACILITY_CHARS FAC_CH_ASSTID,
         FACILITY_CHARS FAC_CH_UFID
  WHERE  (FAC.FLTY_FACILITY_TYPE = FACTYPE.FACILITY_TYPE_CODE (+))
         AND (FAC.ID = FACORGUNIT.FACL_ID (+))
         AND (FAC.ORG_UNIT_ATLAS_ID = ATLAS.SHORT_TEXT (+))
         AND (
              FAC.ID = FMA_A.ENTITY_KEY_VALUE_1 
              AND FMA_A.ENTITY_KEY_NAME_1 = 'ID'
              AND FMA_A.ENTITY_NAME = 'FACILITIES'
              AND FMA_A.ADDRESS_TYPE_CODE = 'A'
              )
         AND (FAC.ID = FAC_CH_CRS1.FACL_ID AND FAC_CH_CRS1.FCHT_RFCT_CHAR_TYPE = 'CROSSSTREET1')
         AND (FAC.ID = FAC_CH_CRSTP1.FACL_ID AND FAC_CH_CRSTP1.FCHT_RFCT_CHAR_TYPE = 'CROSSTYPE1')
         AND (FAC.ID = FAC_CH_CRS2.FACL_ID AND FAC_CH_CRS2.FCHT_RFCT_CHAR_TYPE = 'CROSSSTREET2')
         AND (FAC.ID = FAC_CH_CRSTP2.FACL_ID AND FAC_CH_CRSTP2.FCHT_RFCT_CHAR_TYPE(+) = 'CROSSTYPE2')
         AND (FAC.ID = FAC_TD_MUNI.FACL_ID (+))
         AND (FAC_TD_MUNI.TXDS_TAX_DISTRICT = TAX_D.TAXING_DISTRICT_CODE (+))
         AND (FAC.ID = FAC_CH_ASSTID.FACL_ID AND FAC_CH_ASSTID.FCHT_RFCT_CHAR_TYPE(+) = 'ASSETID')
         AND (FAC.ID = FAC_CH_UFID.FACL_ID AND FAC_CH_UFID.FCHT_RFCT_CHAR_TYPE(+) = 'UFID')
         AND FACORGUNIT.ORGU_ID = ORGUNIT.ID 
         AND FAC.FACILITY_STATUS = 'Installed'
         AND FAC.ASSET_MANAGER_FACILITY_YN = 'Y';


CREATE INDEX MV_XXX_FAC_ID ON schema.MV_XXX(FACILITY_ID);
CREATE INDEX MV_XXX_EXT_FAC_ID ON schema.MV_XXX(EXTERNAL_FACILITY_ID);
CREATE INDEX MV_XXX_FLTY_TYPE ON MV_XXX(FACILITY_TYPE_CODE, FACILITY_TYPE_NAME);
CREATE INDEX MV_XXX_ASSET_TAG ON MV_XXX(ASSET_TAG);
CREATE INDEX MV_XXX_TILE ON MV_XXX(TILE);
CREATE INDEX MV_XXX_ATLAS ON MV_XXX(ATLAS);
CREATE INDEX MV_XXX_ADDR_ST ON MV_XXX(ADDR_STREET_NAME);
CREATE INDEX MV_XXX_MUNI ON AEC_XXX(MUNICIPALITY);
CREATE INDEX MV_XXX_ASST_ID ON MV_XXX(ASST_ID);
CREATE INDEX MV_XXX_UFID ON MV_XXX(UFID_NMBR);

0 个答案:

没有答案