CONTAINS problem in materialized view

SELECT SCORE(1) AS RELEVANCE, AST_OID, TOTAL
FROM asset_materialized_vw
WHERE CONTAINS(total, '%PRODUCT%', 1) > 0
ORDER BY RELEVANCE DESC;
The table in the FROM clause, asset_materialized_vw is a materialized view of a view called asset_vw with a complex query in it, it produces 2 columns, 1 ast_oid, which contains a unique id, and total which is a varchar2 column on which I put a CTXSYS.CONTEXT index, after putting the index on this column, I can execute the above query and it results many rows, but after about 5 - 10 minutes it doesn't return any rows at all anymore. Here is the script I used to create the index and materialized view:
The view:
SELECT * FROM asset_materialized_vw WHERE upper(total) LIKE '%N4S%'
DROP MATERIALIZED VIEW mv_emp_pk
CREATE MATERIALIZED VIEW asset_materialized_vw
     REFRESH COMPLETE
     NEXT SYSDATE + 1/96
     WITH PRIMARY KEY
     AS
     SELECT AST_OID,
          CONCAT(ASSET_REMARK, CONCAT(OBJECT_REFERENCE, CONCAT(PRJ_PROJECT_NAME, CONCAT(DV_REFERENCE_VALUE, CONCAT(LD_NAME_B, CONCAT(LD_NAME_A, CONCAT(DVL_DESCRIPTION, CONCAT(MDV_TEXT_VALUE, CONCAT(BUT_DVL_DESCRIPTION, CONCAT(MAG_DVL_DESCRIPTION, CONCAT(AGP_DVL_DESCRIPTION, CONCAT(BRC_DVL_DESCRIPTION, CONCAT(CAM_DVL_DESCRIPTION, CONCAT(PRS_NAME, PRD_PROPERTIES)))))))))))))) AS TOTAL
     FROM ASSET_VW
The index:
CREATE INDEX idx_asset_materialized_vw ON asset_materialized_vw(total)
INDEXTYPE IS CTXSYS.CONTEXT

Simple testcase to reproduce your issue:
/* snapshot refreshes every 15 seconds */
SQL> CREATE MATERIALIZED VIEW emp_mv
REFRESH COMPLETE
NEXT SYSDATE + 15/(24*60*60)
AS
SELECT * FROM emp
Snapshot created.
/* Context index */
SQL> CREATE INDEX emp_txt_idx ON emp_mv
(ename)
INDEXTYPE IS ctxsys.CONTEXT
Index created.
SQL> SELECT ename,
       deptno
  FROM emp_mv
WHERE contains (ename, 'scott') > 1
ENAME          DEPTNO
SCOTT              20
/* wait 20 seconds*/
SQL> EXEC dbms_lock.sleep(20)
PL/SQL procedure successfully completed.
SQL> SELECT *
  FROM emp_mv
WHERE contains (ename, 'scott') > 1
"no rows selected."
/* sync the index */
SQL> BEGIN
   ctx_ddl.sync_index ('emp_txt_idx');
END;
SQL> SELECT ename,
       deptno
  FROM emp_mv
WHERE contains (ename, 'scott') > 1
ENAME          DEPTNO
SCOTT              20I would alter the generated job (from creation of materialized view) to append the sync of the index:
BEGIN
  SYS.DBMS_JOB.CHANGE
      job        => 325634 /*  your job number */
     ,what       => 'dbms_refresh.refresh(''"EMP_MV"'');
                     ctx_ddl.sync_index (''emp_txt_idx'');'
     ,next_date  => sysdate
     ,interval   => 'SYSDATE + 15/(24*60*60) '
END;

Similar Messages

  • Problem in materialized view

    Hello everybody!!!
    I used the following script in order to see the automatic refresh of data contained in a materialized view.
    I used the following script in SCOTT schema:
    create materialized view log on emp
    with rowid (job,sal)
    including new values
    create materialized view emp_mv
    build immediate
    refresh fast on commit
    as
    select job , sum(sal) sum_sal
    from emp
    group by job
    The problem is that after i update the sal column (and commit it) of an employee and selecting from the emp_nv , I DO NOT see any difference , although the materialized view log has been updated successfully!!!
    Under which circumstances the materialized view would be updated as well?
    Simon.

    What is job_queue_processes set to on your system? Materialized view refreshes are generally done as background jobs, so that initializiation parameter needs to be set to a non-zero value.
    Justin

  • Problem with Materialized Views after an export

    Hi @ everybody,
    At an Oracle 11g R2 (11.2.0.3.0) instance, all actual CPU's/SPU's are installed, on a Red Hat 6 Machine i have a problem with Materialized Views from a schema, which i have exportet from an old database machine on Oracle 10g (10.2.0.1.0) to the new machine.
    I've exportet with the old exp and imported with imp, because i know, that i get some strange errors because of the materialized views when i'm using the new expdp and impdp tools.
    At the old machine the materialized views are so programmed, that they get an update of data at a defined time like this:
    START WITH TRUNC(SYSDATE) + 21/24
          NEXT SYSDATE+1
    ...But after the export this "update function" of the materialized view is not available. So i have deleted that views and recreated them with the START WITH parameters. So now they are running.
    But why do i have this problem?
    Is this "START WITH" somewhere written as a job or so in, for example, DBMS_SCHEDULER or something else? So i had forgotten to export these jobs or where is that defined?
    Is this a bug?
    Thanks for answers and help!
    Best regards,
    David

    I can't remember the error of expdp/impdp. That is some days ago, i have to rebuild this.
    I think in my scenario for the import i don't need the TABLE_EXISTS_ACTION, because by importing at the new server i've just createt the naked tablespace for the data and the users, not more. So he didn't has something to overwrite.
    And i have to tell you: i'm just the dbA. The desining of the tables and materialized views is many years ago by installing the old server. I'm just to young in my company to know about the design of the instance and why it was designed so.
    Anyway: my problem is, that after the import of the schemas to a new server the "START WITH" option in the materialized views is not there anymore and i just want to why so i can think about a solution for that and create it with the database designers of my company.
    EDIT: And here are the SQL Statements for creating the Materialized Views:
    First, at the OLD Server (Oracle 10g 10.2.0.1.0)
      CREATE MATERIALIZED VIEW "DUPONT_CCG2_P"."PR_PRODUCT_ITEMS"
      ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "DUPONT_14523"
      BUILD IMMEDIATE
      USING INDEX
      REFRESH COMPLETE ON DEMAND START WITH sysdate+0 NEXT SYSDATE+1
      USING DEFAULT LOCAL ROLLBACK SEGMENT
      DISABLE QUERY REWRITE
      AS (SELECT DISTINCT
          PR_CUSTOMER_MASTER_DATA.CLIENT_ID,
          PR_CUSTOMER_MASTER_DATA.ILN_USER,
          PR_ARTICLE.EAN,
          PR_ARTICLE.CODE,
          PR_USED_ARTICLE_TEXT.ARTICLE_TEXT,
          PR_USED_ARTICLE_TEXT.LANG_CODE,
          PR_ARTICLE.SUP_ITEM_NO,
          PR_ARTICLE.OLD_ITEM_NO,
          PR_COMPANY_ITEM_MATCH.ITEM_BY_NO,
          PR_COMPANY_ITEM_MATCH.UOM_UNIT,
          PR_COMPANY_ITEM_MATCH.PRICE_UOM,
          PR_COMPANY_ITEM_MATCH.PRICE,
          PR_COMPANY_ITEM_MATCH.CURRENCY,
          PR_COMPANY_ITEM_MATCH.PRICE_QTY,
          PR_COMPANY_ITEM_MATCH.SALES_UNIT,
          PR_COMPANY_ITEM_MATCH.START_DATE,
          PR_COMPANY_ITEM_MATCH.END_DATE,
          PR_ARTICLE.UPDATED_AT
            FROM PR_ARTICLE, PR_COMPANY_ITEM_MATCH, PR_USED_ARTICLE_TEXT, PR_CUSTOMER_MASTER_DATA, PR_ADDRESS
            WHERE PR_ADDRESS.ORDER_TYPE='REP'
          AND PR_CUSTOMER_MASTER_DATA.ILN_USER=PR_ADDRESS.ILN_USER
          AND PR_COMPANY_ITEM_MATCH.ILN_USER=PR_ADDRESS.ILN_LINK
          AND PR_CUSTOMER_MASTER_DATA.SALES_ORG=PR_COMPANY_ITEM_MATCH.SALES_ORG
          AND PR_CUSTOMER_MASTER_DATA.CLIENT_ID=PR_COMPANY_ITEM_MATCH.CLIENT_ID
          AND PR_CUSTOMER_MASTER_DATA.CLIENT_ID=PR_ADDRESS.CLIENT_ID
          AND PR_ARTICLE.SUP_ITEM_NO=PR_COMPANY_ITEM_MATCH.SUP_ITEM_NO
          AND PR_COMPANY_ITEM_MATCH.SALES_ORG=PR_USED_ARTICLE_TEXT.SALES_ORG
          AND PR_ARTICLE.SUP_ITEM_NO=PR_USED_ARTICLE_TEXT.SUP_ITEM_NO
          AND PR_CUSTOMER_MASTER_DATA.LANG_CODE=PR_USED_ARTICLE_TEXT.LANG_CODE
          AND ( PR_COMPANY_ITEM_MATCH.END_DATE IS NULL OR to_date(PR_COMPANY_ITEM_MATCH.END_DATE,'YYYYMMDD') - sysdate > 0)
          AND ( PR_COMPANY_ITEM_MATCH.START_DATE IS NULL OR sysdate - to_date(PR_COMPANY_ITEM_MATCH.START_DATE,'YYYYMMDD') > 0)
    )And here the at the NEW Server (Oracle 11g R2 11.2.0.3.0)
      CREATE MATERIALIZED VIEW "DUPONT_CCG2_P"."PR_PRODUCT_ITEMS" ("CLIENT_ID", "ILN_USER", "EAN", "CODE", "ARTICLE_TEXT", "LANG_CODE", "LANR", "OLD_LANR", "ITEM_BY_NO", "UOM_UNIT", "PRICE_UOM", "PRICE", "CURRENCY", "PRICE_QTY", "SALES_UNIT", "START_DATE", "END_DATE", "UPDATED_AT")
      ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
    NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "DUPONT_14523"
      BUILD IMMEDIATE
      USING INDEX
      REFRESH COMPLETE ON DEMAND START WITH sysdate+0 NEXT SYSDATE+1
      USING DEFAULT LOCAL ROLLBACK SEGMENT
      USING ENFORCED CONSTRAINTS DISABLE QUERY REWRITE
      AS (SELECT DISTINCT
          PR_CUSTOMER_MASTER_DATA.CLIENT_ID,
          PR_CUSTOMER_MASTER_DATA.ILN_USER,
          PR_ARTICLE.EAN,
          PR_ARTICLE.CODE,
          PR_USED_ARTICLE_TEXT.ARTICLE_TEXT,
          PR_USED_ARTICLE_TEXT.LANG_CODE,
          PR_ARTICLE.SUP_ITEM_NO,
          PR_ARTICLE.OLD_ITEM_NO,
          PR_COMPANY_ITEM_MATCH.ITEM_BY_NO,
          PR_COMPANY_ITEM_MATCH.UOM_UNIT,
          PR_COMPANY_ITEM_MATCH.PRICE_UOM,
          PR_COMPANY_ITEM_MATCH.PRICE,
          PR_COMPANY_ITEM_MATCH.CURRENCY,
          PR_COMPANY_ITEM_MATCH.PRICE_QTY,
          PR_COMPANY_ITEM_MATCH.SALES_UNIT,
          PR_COMPANY_ITEM_MATCH.START_DATE,
          PR_COMPANY_ITEM_MATCH.END_DATE,
          PR_ARTICLE.UPDATED_AT
            FROM PR_ARTICLE, PR_COMPANY_ITEM_MATCH, PR_USED_ARTICLE_TEXT, PR_CUSTOMER_MASTER_DATA, PR_ADDRESS
            WHERE PR_ADDRESS.ORDER_TYPE='REP'
          AND PR_CUSTOMER_MASTER_DATA.ILN_USER=PR_ADDRESS.ILN_USER
          AND PR_COMPANY_ITEM_MATCH.ILN_USER=PR_ADDRESS.ILN_LINK
          AND PR_CUSTOMER_MASTER_DATA.SALES_ORG=PR_COMPANY_ITEM_MATCH.SALES_ORG
          AND PR_CUSTOMER_MASTER_DATA.CLIENT_ID=PR_COMPANY_ITEM_MATCH.CLIENT_ID
          AND PR_CUSTOMER_MASTER_DATA.CLIENT_ID=PR_ADDRESS.CLIENT_ID
          AND PR_ARTICLE.SUP_ITEM_NO=PR_COMPANY_ITEM_MATCH.SUP_ITEM_NO
          AND PR_COMPANY_ITEM_MATCH.SALES_ORG=PR_USED_ARTICLE_TEXT.SALES_ORG
          AND PR_ARTICLE.SUP_ITEM_NO=PR_USED_ARTICLE_TEXT.SUP_ITEM_NO
          AND PR_CUSTOMER_MASTER_DATA.LANG_CODE=PR_USED_ARTICLE_TEXT.LANG_CODE
          AND ( PR_COMPANY_ITEM_MATCH.END_DATE IS NULL OR to_date(PR_COMPANY_ITEM_MATCH.END_DATE,'YYYYMMDD') - sysdate > 0)
          AND ( PR_COMPANY_ITEM_MATCH.START_DATE IS NULL OR sysdate - to_date(PR_COMPANY_ITEM_MATCH.START_DATE,'YYYYMMDD') > 0)
    )The own differences i can see is at the "header". In the new one is the NOCOMPRESS LOGGING Option and in the first line the code has the columns diretcly defined.
    But, i think, for my problem this line is determining:
      REFRESH COMPLETE ON DEMAND START WITH sysdate+0 NEXT SYSDATE+1And this line is the same at both server.
    Edited by: David_Pasternak on 12.04.2013 00:06

  • Problem with Materialized Views in 10g

    Hi All,
    I am creating a Materialized View like
    CREATE MATERIALIZED VIEW mvname TABLESPACE SYSTEM BUILD IMMEDIATE REFRESH WITH ROWID FOR UPDATE AS ( SELECT a,b,c FROM table_a,table_b,table_c WHERE cond );
    I am getting an error
    SQL Error: ORA-12013: updatable materialized views must be simple enough to do fast refresh.
    Can anyone tell what is the problem?
    I have included rowid of all three tables in select clause.

    Hi,
    From Oracle Docs:
    ORA-12013: updatable materialized views must be simple enough to do fast refresh
    Cause: The updatable materialized view query contained a join, subquery, union, connect by, order by, or group by caluse.
    Action: Make the materialized view simpler. If a join is really needed, make multiple simple materialized views then put a view on top of them.
    Regards
    K.Rajkumar

  • Problems creating Materialized View

    Hello,
    i have Problems with the creation of a materialized view with the following sql-statement:
         SELECT Tag_ID, ROWNUM AS RowNr
         FROM L_tag
         ORDER BY tag_id ASC
    in the table L_tag is only one column (tag_id) that contains all dates (1895.01.01 - 2020.01.01) as numbers (format like: 20020508)
    if i create the materialized view, no errors occures. if i check later the sql-statement of this materialized view, there is no ORDER BY!!:
         SELECT Tag_ID, ROWNUM AS RowNr
         FROM L_tag
    has anyone an idea, why oracle don't accept the order by clause?
    thanks,
    Dome

    has anyone an idea, why oracle don't accept the order by clause?Yes, because Oracle stores data in an unorderred fashion (except for IOT, but that's different matter). So your ORDER BY clause makes no sense for stored data.
    You must use ORDER BY when doing the final select from the MV (...).
    Regards,
    Yoann.

  • Problems with materialized view and fk between two db

    Hi,
    i have two databases db1 and db2 and from db1 is a table(DM_MESSDATEN) which contains a foreign key to a table(DM_FAUNA) in db2.
    Now I want to write my done steps to get more clearification and hopefully someone can point out my wrong steps.
    1st
    i create the tables inside db1 without a foreign key to the table in db2.
    2nd
    i create a database link inside db1 to db2
    create public database link DATENBANK2 connect to phantomas identified by bachelor06 using 'DMDB2';
    3rd
    now and here i stuck want to create a materialized view inside db1
    create materialized view DATAMART_MVW AS
    select * from DM_MESSDATEN, DM_FAUNA@DATENBANK2
    where DM_MESSDATEN.FAUNA_ID=DM_FAUNA.FAUNA_ID;
    or should the view be created inside of db2?
    4th
    and then i want to reactivate the foreign key inside the table of db1- but can't because of
    problems in step 3 :(
    So it would be nice if someone could help me
    thanks a lot
    thomas

    I think you haven't been clear in your statement of your problem:
    now and here i stuck want to create a materialized view inside db1Why are you stuck? If you want to enforce a froeign key locally using data from a remote database then you need to build a materialized view on your local table tablespace that sucks data across from the remote database. You can then create a foreign key on your local table using the local MV.
    If the remote table is updated frequently and you want the local MV kept in sync then you will need to put soem further replication in place. For instance you may need to create a materilaized view log on the remote database.
    Cheers, APC

  • Problem with materialized views

    I have a problem with the use of materialized views.
    I make this procedure:
    1: I create a table with the results of a query
    2: Create a materialized view in that prebuilt table
    Problem: When i execute the query after creating the materialized view i receive this error from oracle : ora-00903 table do not exists.
    I get that error in 10% of the materielized views that i create that way, anyone can tell me what is the problem?

    I'm using Oracle 9.2.0.5.0
    query rewrite disabled

  • Problem regarding Materialized View

    Hi,
    I have a master table "nms_num_schm" on SID-SLBANCS and its corresponding materialized view "mlog$_nms_num_schm". The MV is supposed to move data from this master table to a table "nms_num_schm_mv" on SID-ORCL.
    The MV is set to select data after every 5 mins and the db link is also set. also the grants have also been provided.
    I inserted the data in master table and data populated in the mlog table.But the problem is that its staying in mlog table and not moved to the "_mv" table even after 1 hr.Even though snaptime is populated with a time of refresh,the refresh didnt happen.
    So 3 things here -
    1) Why did the refresh didnt happen
    2) If the refresh didnt happen because of any issue/error, where can I check what was the issue.
    3) To make things worse, there are 17 more tables such similar setup. Some data refresh works sometimes, sometimes not.
    Please provide your valuable comments to resolve the same.
    Here's a snapshot of the mlog table -
    insert into MLOG$_NMS_NUM_SCHM (NMS_SEC_ID, NMS_NMBRNG_SCHM, SNAPTIME$$, DMLTYPE$$, OLD_NEW$$, CHANGE_VECTOR$$)
    values ('ZA00ISCDWD', 1, to_date('05-11-2008 11:17:07', 'dd-mm-yyyy hh24:mi:ss'), 'I', 'N', 'FEFF');

    Hi,
    I have a master table "nms_num_schm" on SID-SLBANCS and its corresponding materialized view "mlog$_nms_num_schm". The MV is supposed to move data from this master table to a table "nms_num_schm_mv" on SID-ORCL.
    The MV is set to select data after every 5 mins and the db link is also set. also the grants have also been provided.
    I inserted the data in master table and data populated in the mlog table.But the problem is that its staying in mlog table and not moved to the "_mv" table even after 1 hr.Even though snaptime is populated with a time of refresh,the refresh didnt happen.
    So 3 things here -
    1) Why did the refresh didnt happen
    2) If the refresh didnt happen because of any issue/error, where can I check what was the issue.
    3) To make things worse, there are 17 more tables such similar setup. Some data refresh works sometimes, sometimes not.
    Please provide your valuable comments to resolve the same.
    Here's a snapshot of the mlog table -
    insert into MLOG$_NMS_NUM_SCHM (NMS_SEC_ID, NMS_NMBRNG_SCHM, SNAPTIME$$, DMLTYPE$$, OLD_NEW$$, CHANGE_VECTOR$$)
    values ('ZA00ISCDWD', 1, to_date('05-11-2008 11:17:07', 'dd-mm-yyyy hh24:mi:ss'), 'I', 'N', 'FEFF');

  • Problem with materialized view

    Hello!!!
    In order to see how materialized views work , I executed the following script in SCOTT schema:
    create materialized view log on emp
    with rowid (job,sal)
    including new values;
    create materialized view emp_mv
    build immediate
    refresh fast on commit
    as
    select job , sum(sal) sum_sal
    from emp
    group by job;
    The problem is that when i update the column sal , or insert a new record in EMP table , the materialized view emp_nv IS NOT UPDATED , although the materialized view log registers the change.
    In which circumstances the desired change will take place?
    Note:
    The parameter 'JOB_QUEUE_PROCESSES' of the database has the value 10.

    Hi,
    I tried your code and it works perfectly for me. You must ensure you commit your change in order for the materialized view to refresh.

  • Problem with MATERIALIZED VIEW (snapshot)

    Hi,
    I've any problem with creating MATERIALIZED VIEW (snapshot)
    My table is ROOMS:
    SQL> DESC ROOMS
    Name Null? Type
    LS_ID VARCHAR2(32)
    BL_ID NOT NULL VARCHAR2(32) PRIMARY KEY1
    FL_ID NOT NULL VARCHAR2(4) PRIMARY KEY2
    RM_ID NOT NULL VARCHAR2(8) PRIMARY KEY3
    SITE_ID VARCHAR2(32)
    SQL> SELECT COUNT(*)
    2 FROM ROOMS;
    COUNT(*)
    203973
    SQL> SELECT COUNT (TOT)
    2 FROM (SELECT COUNT(*) TOT, LS_ID, SITE_ID
    3 FROM ROOMS
    4 GROUP BY LS_ID, SITE_ID);
    COUNT(TOT)
    11673
    I'd like to create one MATERIALIZED VIEW that refresh every 30 seconds when I insert, update or delete on ROOMS table.
    I tried this:
    CREATE MATERIALIZED VIEW ROOMS_SNAP
    BUILD IMMEDIATE
    REFRESH complete
    START WITH to_date(sysdate,'dd/mm/yyyy hh24:mi:ss')
    NEXT sysdate + 30/86400
    disable QUERY REWRITE
    AS
    SELECT LS_ID, SITE_ID
    FROM ROOMS
    GROUP BY LS_ID, SITE_ID
    but when I insert, update or delete one record on ROOMS table, ROOMS_SNAP not refresh.
    What I wrong?
    How Can I write MATERIALIZED VIEW to maintain synchronization
    between ROOMS_SNAP AND LS_ID, SITE_ID by ROOMS?
    Thanks

    Try this way:
    SQL> SHOW PARAMETER JOB
    NAME                                 TYPE        VALUE
    job_queue_processes                  integer     0
    SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=20 SCOPE=MEMORY;
    SQL> create materialized view log on emp tablespace jam_ts
      2  with rowid, primary key;
    Materialized view log created.
    SQL> create materialized view emp_mat
      2  tablespace jam_ts
      3  refresh fast start with sysdate
      4  next sysdate + interval '15' second as
      5  select * from emp where deptno=30;
    Materialized view created.
    SQL> update  emp
      2  set     ename=lower(ename)
      3  where   deptno=30;
    6 rows updated.
    SQL> commit;
    Commit complete.
    ---"After 15 seconds it will be refreshed automatically...."
    SQL> select * from emp_mat;
      EMPNO ENAME      JOB           MGR HIREDATE      SAL    COMM  DEPTNO
       7499 allen      SALESMAN     7698 20-FEB-81    1600     300      30
       7521 ward       SALESMAN     7698 22-FEB-81    1250     500      30
       7654 martin     SALESMAN     7698 28-SEP-81    1250    1400      30
       7698 blake      MANAGER      7839 01-MAY-81    2850              30
       7844 turner     SALESMAN     7698 08-SEP-81    1500       0      30
       7900 james      CLERK        7698 03-DEC-81     950              30
    6 rows selected.Message was edited by:
    Jameel

  • Numeric Value rounding problems in Materialized Views

    All numeric values are getting rounded in the materialized views. Is there any solution for this?
    Any help is greatly appreciated...
    Thanks,
    Satya

    Hi Bill,
    Actually the problem is with the Toad version I'm using, it is not interpreting the decimal values of MVs properly. They look good when I checked in SQLPLUS.
    Any way, thanks for your response.
    -Satya

  • Problem refreshing Materialized View in SQL Developer

    I have a database schema with a Materialized View (MV) that updates a products table shown on a website. This schema was recently imported to an 11g database from 8i, but since this import I have been unable to refresh my schema’s Materialized View.
    The MV_PRODUCT_MASTER Materialized View attaches price data to product data that is stored in a normal WEB_PRODUCT table, and create an MV table as a result. The output MV table is what the website pulls data from to display to the site users. Since it is an MV table, this table cannot be edited directly. In order to change, say, a product description, I need to alter the description field in WEB_PRODUCT and manually refresh the MV_PRODUCT_MASTER table. Only through the refresh will the upstream edits appear in the MV_PRODUCT_MASTER table and be visible on the website.
    In my old 7.6.0.11 copy of TOAD, I could manually refresh these MVs easily, by opening the “Snapshots” tab, right clicking on the MV I wanted to refresh and selecting the “Refresh” option. Since the schema was imported to 11g, I have been using the Oracle SQLDeveloper tool to manage the schema. SQLDeveloper doesn’t have a clear method for manually refreshing an MV, or else the method I am using isn’t working.
    If I right click on the MV_PRODUCT_MASTER Materialized View object, and choose “Other Actions”, I see the following choices:
    Shrink Materialized View
    Compile Materialized View
    Force Materialized View Refresh
    Rebuild Materialized View
    …I assumed that “Force Materialized View Refresh” was the right choice, and chose that. This option displays the SQL:
    alter materialized view "WEBADMIN"."MV_PRODUCT_MASTER" consider fresh
    When I apply this, I get the message: “Materialized view “MV_PRODUCT_MASTER” has been set torefreshed”. However, no changes appear in the MV output table. i.e. if I make a specific change to a row in the WEB_PRODUCT table, the change is not being carried into the MV_PRODUCT_MASTER table, so that indicated that the refresh is not actually happening. The MV table appears to believe it is being refreshed:
    REWRITE_CAPABILITY     GENERAL
    REFRESH_MODE     DEMAND
    REFRESH_METHOD     COMPLETE
    BUILD_MODE     IMMEDIATE
    FAST_REFRESHABLE     NO
    LAST_REFRESH_TYPE     COMPLETE
    LAST_REFRESH_DATE     06-APR-10
    STALENESS     UNKNOWN
    …but it isn’t showing any changes.
    What am I doing wrong? Is there a plain SQL statement I can run in order to run these refreshes, instead of using the SQLDeveloper GUI? Thanks for any advice on this.

    Hi Blama,
    DDL for Index-organized Materialized Views is generated in the Early Adopter release 4.1.0.866, which is now available for download.
    The Organization on the Table that is implemented as the Materialized View should be set to INDEX, and the Table's IOT properties will be used during DDL generation.
    David

  • Problem creating materialized view

    OK, I'm totally new in using materialized views.
    I'm trying to create one and to make it refreshed on commit
    CREATE MATERIALIZED VIEW VK_CLIENT  build immediate refresh fast on commit AS
      select c1.code,
    c1.fiche fiche_1,
    decode( c1.sfam, '04', 
    decode( c7.sfam, '04', 'M. et Mme', c1.lnte ), c1.lnte ) lnte_1,
    decode( c1.sfam, '04', 
    decode( c7.sfam, '04', 
    decode( c1.lnte, 'M.', c1.libe, c7.libe ), c1.libe ), c1.libe ) libe_1,
    decode( c1.sfam, '04', 
    decode( c7.sfam, '04', 
    decode( c1.lnte, 'M.', substr( c1.libe, 1, c1.lgnom ), substr( c7.libe, 1, c7.lgnom ) ), substr( c1.libe, 1, c1.lgnom ) ), substr( c1.libe, 1, c1.lgnom ) ) nom_1,
    decode( c1.sfam, '04', 
    decode( c7.sfam, '04', 
    decode( c1.lnte, 'M.', initcap( substr( c1.libe, c1.lgnom + 2 ) ), initcap( substr( c7.libe, c7.lgnom + 2 ) ) ), initcap( substr( c1.libe, c1.lgnom + 2 ) ) ), initcap( substr( c1.libe, c1.lgnom + 2 ) ) ) prenom_1,
    decode( c1.sfam, '04', decode( c7.sfam, '04', decode( c1.lnte, 'Mlle', 'Mme', c1.lnte ), c1.lnte ), c1.lnte ) lnte_1_bis,
    c1.libe libe_1_bis,
    substr( c1.libe, 1, c1.lgnom ) nom_1_bis,
    initcap( substr( c1.libe, c1.lgnom + 2 ) ) prenom_1_bis,
    c1.sfam sfam_1,
    c1.dnai dnai_1,
    decode( to_char( c1.dnai, 'dd' ), '01', '1er', 
    decode( substr( to_char( c1.dnai, 'dd' ), 1, 1 ), 0, substr( to_char( c1.dnai, 'dd' ), 2 ), to_char( c1.dnai, 'dd' ) ) ) || ' ' || 
    rtrim( to_char( c1.dnai, 'month', 'nls_date_language = french' ) ) || to_char( c1.dnai, ' yyyy' ) dnai_fr_1,
    c1.horsfoyer horsfoyer_1,
    decode( c1.lnte, 'Mlle', 'f', 'Mme', 'f', 'M.', 'm' ) accord_1,
    c7.fiche fiche_7,
    decode( c1.sfam, '04', 
    decode( c7.sfam, '04', null, c7.lnte ), c7.lnte ) lnte_7,
    decode( c1.sfam, '04', 
    decode( c7.sfam, '04', null, c7.libe ), c7.libe ) libe_7,
    decode( c1.sfam, '04', 
    decode( c7.sfam, '04', null, substr( c7.libe, 1, c7.lgnom ) ), substr( c7.libe, 1, c7.lgnom ) ) nom_7,
    decode( c1.sfam, '04', 
    decode( c7.sfam, '04', null, initcap( substr( c7.libe, c7.lgnom + 2 ) ) ), initcap( substr( c7.libe, c7.lgnom + 2 ) ) ) prenom_7,
    decode( c7.sfam, '04', decode( c1.sfam, '04', decode( c7.lnte, 'Mlle', 'Mme', c7.lnte ), c7.lnte ), c7.lnte ) lnte_7_bis,
    c7.libe libe_7_bis,
    substr( c7.libe, 1, c7.lgnom ) nom_7_bis,
    initcap( substr( c7.libe, c7.lgnom + 2 ) ) prenom_7_bis,
    c7.sfam sfam_7,
    c7.dnai dnai_7,
    decode( to_char( c7.dnai, 'dd' ), '01', '1er', 
    decode( substr( to_char( c7.dnai, 'dd' ), 1, 1 ), 0, substr( to_char( c7.dnai, 'dd' ), 2 ), to_char( c7.dnai, 'dd' ) ) ) || ' ' || 
    rtrim( to_char( c7.dnai, 'month', 'nls_date_language = french' ) ) || to_char( c7.dnai, ' yyyy' ) dnai_fr_7,
    decode( c7.lnte, 'Mlle', 'f', 'Mme', 'f', 'M.', 'm' ) accord_7,
    initcap( decode( instr( lower( c1.adr1 ), 'log' ), '1', c1.adr2, decode( instr( lower( c1.adr1 ), 'bât' ), '1', c1.adr2, c1.adr1 ) ) ) adr1,
    initcap( decode( decode( instr( lower( c1.adr1 ), 'log' ), '1', c1.adr2, decode( instr( lower( c1.adr1 ), 'bât' ), '1', c1.adr2, c1.adr1 ) ), c1.adr2, null, 
    decode( instr( lower( c1.adr2 ), 'log' ), '1', c1.adr3, decode( instr( lower( c1.adr2 ), 'bât' ), '1', c1.adr3, c1.adr2 ) ) ) ) adr2,
    initcap( decode( instr( lower( c1.adr3 ), 'log' ), '1', null, decode( instr( lower( c1.adr3 ), 'bât' ), '1', null, c1.adr3 ) ) ) adr3,
    c1.ptt,
    c1.lcom,
    decode( c7.fiche, null, decode( c1.lnte, 'Mme', 'Madame', 'Mlle', 'Mademoiselle', 'M.', 'Monsieur', 'Monsieur' ),
    decode( nvl( c1.sfam, '07' ), '04', 
    decode( nvl( c7.sfam, '07' ), '04', 'Madame, Monsieur', 
    decode( c1.lnte, 
    'Mme', decode( c7.lnte, 'Mme', 'Mesdames', 'Mlle', 'Madame, Mademoiselle', 'M.', 'Madame, Monsieur', 'Madame, Monsieur' ), 
    'Mlle', decode( c7.lnte, 'Mme', 'Madame, Mademoiselle', 'Mlle', 'Mesdemoiselles', 'M.', 'Mademoiselle, Monsieur', 'Mademoiselle, Monsieur' ),
    'M.', decode( c7.lnte, 'Mme', 'Madame, Monsieur', 'Mlle', 'Mademoiselle, Monsieur', 'M.', 'Mesieurs', 'Mesieurs' ),
    '. ', decode( c7.lnte, 'Mme', 'Madame, Monsieur', 'Mlle', 'Mademoiselle, Monsieur', 'M.', 'Mesieurs', 'Mesieurs' ),
    decode( c1.lnte,
    'Mme', decode( c7.lnte, 'Mme', 'Mesdames', 'Mlle', 'Madame, Mademoiselle', 'M.', 'Madame, Monsieur', 'Madame, Monsieur' ),
    'Mlle', decode( c7.lnte, 'Mme', 'Madame, Mademoiselle', 'Mlle', 'Mesdemoiselles', 'M.', 'Mademoiselle, Monsieur', 'Mademoiselle, Monsieur' ),
    'M.', decode( c7.lnte, 'Mme', 'Madame, Monsieur', 'Mlle', 'Mademoiselle, Monsieur', 'M.', 'Mesieurs', 'Mesieurs' ),
    '. ', decode( c7.lnte, 'Mme', 'Madame, Monsieur', 'Mlle', 'Mademoiselle, Monsieur', 'M.', 'Mesieurs', 'Mesieurs' ),
    '-' ) ) ) lnte_long,
    decode( c1.cfam, null, c7.cfam, c1.cfam ) cfam,
    decode( c1.cfam, null, c7.allo, c1.allo ) allo,
    decode( c1.sexe, 'm', decode( c7.sexe, null, 'ms', 'm', 'mp', 'f', 'mp' ), 'f', decode( c7.sexe, null, 'fs', 'm', 'mp', 'f', 'fp' ), '-' ) accord,
    c9.fiche fiche_9,
    c9.lnte lnte_9,
    c9.libe libe_9,
    substr( c9.libe, 1, c9.lgnom ) nom_9,
    initcap( substr( c9.libe, c9.lgnom + 2 ) ) prenom_9,
    initcap( decode( instr( lower( c9.adr1 ), 'log' ), '1', c9.adr2, decode( instr( lower( c9.adr1 ), 'bât' ), '1', c9.adr2, c9.adr1 ) ) ) adr1_9,
    initcap( decode( decode( instr( lower( c9.adr1 ), 'log' ), '1', c9.adr2, decode( instr( lower( c9.adr1 ), 'bât' ), '1', c9.adr2, c9.adr1 ) ), c9.adr2, null, 
    decode( instr( lower( c9.adr2 ), 'log' ), '1', c9.adr3, decode( instr( lower( c9.adr2 ), 'bât' ), '1', c9.adr3, c9.adr2 ) ) ) ) adr2_9,
    initcap( decode( instr( lower( c9.adr3 ), 'log' ), '1', null, decode( instr( lower( c9.adr3 ), 'bât' ), '1', null, c9.adr3 ) ) ) adr3_9,
    c9.ptt ptt_9,
    c9.lcom lcom_9,
    decode( c9.lnte, 'Mlle' , 'Mademoiselle', 'Mme', 'Madame', 'M.', 'Monsieur', 'M. et Mme', 'Madame, Monsieur', null ) lnte_long_9,
    decode( c9.sexe, 'm', 'ms', 'f', 'fs', null, null, '-' ) accord_9,
    no.nbocc
    from client c1,
    client c7, 
    client c9,
    select z.code code,
    count(*) nbocc
    from client z
    where to_char( sysdate, 'yyyymmdd' ) between to_char( z.cdeb, 'yyyymmdd' ) and to_char( nvl( z.cfin, sysdate ), 'yyyymmdd' )
    group by z.code
    ) no
    where c1.code = c7.code (+)
    and c1.role = '1'
    and c7.role (+) ='7'
    and nvl( c7.horsfoyer (+), 0 ) = '0'
    and to_char( nvl( c7.cfin (+), sysdate ), 'yyyymmdd' ) >= to_char( sysdate, 'yyyymmdd' )
    and c1.code = c9.code (+)
    and c9.role (+) = '9'
    and to_char( nvl( c9.cfin (+), sysdate ), 'yyyymmdd' ) >= to_char( sysdate, 'yyyymmdd' )
    and c9.lnte (+) not in ( '. ', 'Assoc.', 'Ste' )
    and c9.lcom (+) is not null
    and c1.code = no.code (+);when doing so, I'm getting a ORA-12054:
    ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view
    12054. 00000 - "cannot set the ON COMMIT refresh attribute for the materialized view"
    *Cause:    The materialized view did not satisfy conditions for refresh at
    commit time.
    *Action:   Specify only valid options.
    When I create the materialized view with just CREATE MATERIALIZED VIEW "H6801_GL_00"."VK_CLIENT" AS
    it works but the refresh is only "ON DEMAND"...
    Can't find how and why it won't work...
    Edited by: MacFizz on Dec 17, 2009 3:22 PM

    You could try the DBMS_MVIEW.TUNE_MVIEW and check if you can modify you materialized view or "refactor" it in a smaller, fast refreshable part that you could combine later to the sysdate/rownum part of it.
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10821/advisor.htm
    Explanation on restrictions of fast refresh:
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10706/repmview.htm
    Below there's an example of a fast refreshable mview, on creating the materialized view log and so on:
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/statements_6002.htm#i2080820

  • Problem in Materialized Views

    Hi,
    I have two servers one is remote database (it resides in public ip) and another one is local database.
    I have created Materialized view in Local System to replicate the data from remote system to Local System, Local system Internally creates Jobs , because of this replication Local System continuously ping the remote system, if any point of time network goes down, Local System unable to ping the remote system , at that time it gives Request timed out, due to this Reason jobs were going to fail. Is there any possibility to start these jobs automatically without manual intervention.
    Can you please suggest to go forward this.
    Regards,
    Paparao

    you may have another dbms_job or unix cron job to control and enable some of or all of broken jobs easily? A sample code may be like this one;
    DECLARE
      CURSOR C1 IS SELECT * from USER_JOBS
                              WHERE THIS_SEC IS NULL AND BROKEN='Y';
      ND DATE;
      stmt VARCHAR2(200);
    BEGIN
      FOR C1R IN C1 LOOP
        stmt :=  'SELECT '||C1R.INTERVAL||' FROM DUAL';
        EXECUTE IMMEDIATE stmt INTO ND;
        DBMS_OUTPUT.PUT_LINE(C1R.JOB||'-'||TO_CHAR(ND, 'DD/MM/YYYY HH24:MI:SS'));
        DBMS_JOB.BROKEN(C1R.JOB, FALSE, ND);
      END LOOP;
    END;
    /

  • Problem with materialized views DDL generation

    Hi, there is no check box in the *'Drop' Selection* tab for materialized views so no option to drop this objet type. It does drop the corresponding table but not the MV. Is there another way to automatically drop this type of object when generating DDL ??? More on, I have created a primary key for the same MV, based on two fields , checked the Generate check box but the command is not included in the DDL. Is this a known issue ???
    Thanks.
    Edited by: Gordrien on 2011-06-21 10:04

    Hi Gordrien,
    More on, I have created a primary key for the same MV, based on two fields , checked the Generate check box but the command is not included in the DDLCan you elaborate on that. It's not clear what you are doing and what you are expecting as result in DDL generation.
    Philip

Maybe you are looking for

  • How do I make a PDF file from my notes app?

    II'm trying to change my notes doc to a PDF file so far no luck any help?

  • No plusings Install (OMWB)

    Hi , I am migrating sybase database 12.5 database to Oracle 10g Rel2 database using Oracle Migration workbench 10.1.0.4 I have downloaded the zip file of OMWB and unzip it to C:\ drive and copied the required plugins (Sybase12.jar) to C:\omwb\plugins

  • Basic PL/SQL

    Is there any way by which i could see the underlying script of a stored procedure?

  • List/ItemRenderer troubles

    Hey, I just submitted a bug here: http://bugs.adobe.com/jira/browse/SDK-24069 and thought I would see if the community had a workaround. Like always, I could just be missing something really basic. Thanks, - e Oh, the code (and playable swf) is poste

  • 20-in Intel iMac (early 2006) Tiger -- configuring Airport Extreme Card

    Hi -- I come from a mostly "not mac" background and am having difficulty diagnosing a slow internet connection -- and can't tell if I'm trying to use the right tool for the job. (I am using MAC OS X 10.4.11) My home network uses a Linksys WRT54G wire