Altering Materialized view.

I have a materialized view with 2 columns,
Now I want to add two more columns to that MVIEW.
Is there any way to add those two columns without droping the
existed materialized view.
CREATE MATERIALIZED VIEW MDT.MASTER_MV
BUILD IMMEDIATE
REFRESH COMPLETE ON DEMAND
WITH PRIMARY KEY
AS
SELECT empno,ename
FROM emp;
Now I want to add sal and comm columns to the
mview MASTER_MV.Without droping it.
Please help me.

>
Now I want to add sal and comm columns to the
mview MASTER_MV.Without droping it.
>
The technically correct answer? Just use an ALTER statement to add the columns
This works on 11g r2.
CREATE MATERIALIZED VIEW MASTER_MV
BUILD IMMEDIATE
REFRESH COMPLETE ON DEMAND
WITH PRIMARY KEY
AS
SELECT empno,ename
FROM emp
alter materialized view master_mv add (sal number(7,2), comm number(7,2))This adds the columns and you can refresh the MV and select the new columns.
The columns won't have any data and you won't be able to put data in them.
But hey - you didn't say anything about that.
Practically speaking you will have to drop and recreate the MV with the additional columns.
Here is an interesting link about using a prebuilt table for the MV which makes a drop and recreate go quickly
http://www.rampant-books.com/art_nanda_fast_regfresh_materialized_views.htm

Similar Messages

  • Materialized view to ensure data integrity over multiple tables

    Hello,
    I have a problem and I am not able to solve it. Partially, It is because of my poor SQL skills. I have three tables and I am using one sequence to enter data into them.
    What I am tying to do is to create a materialized view ( complete or fast, whichever) with refresh on commit option to check that each table contains unique data in comparison to other.
    I am posting code so you can get along:
    CREATE TABLE table_1 (
    ID NUMBER PRIMARY KEY
    CREATE TABLE table_2 (
    ID NUMBER PRIMARY KEY
    CREATE TABLE table_3 (
    ID NUMBER PRIMARY KEY
    INSERT INTO table_1 VALUES (1);
    INSERT INTO table_1 VALUES (2);
    INSERT INTO table_2 VALUES (3);
    INSERT INTO table_2 VALUES (4);
    INSERT INTO table_3 VALUES (5);
    INSERT INTO table_3 VALUES (6); I want to write create a materialized view that will give me output only in case that there are same values in two different tables. I got this far.
    CREATE MATERIALIZED view mv_test
    REFRESH COMPLETE ON COMMIT
    AS
    SELECT count(1) ROW_COUNT
    FROM dual
    WHERE EXISTS (
         SELECT a.id
         FROM table_1 a
         WHERE a.id IN(
             SELECT b.id
             FROM table_2 b))
    OR EXISTS (
        SELECT a.id
         FROM table_1 a
         WHERE a.id IN
                 (SELECT c.id
                 FROM table_3 c))
    OR EXISTS (
        SELECT b.id
             FROM table_2 b
        WHERE b.id IN
                 (SELECT c.id
                 FROM table_3 c));
        ALTER MATERIALIZED VIEW mv_test
        ADD CONSTRAINT cs_mv_test
        CHECK (row_count = 0) DEFERRABLE; This sql statement itself returns no rows if my logic is correct. And in case there were some duplicate rows in two different table, it would return 1 and constraint would throw an error.
    However, I cannot create this with ON COMMIT option. When I try to compile I get:
    ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view I went through documentation, tried creating mat_view logs etc.
    I know that one of the mistakes is that I am referencing dual table and I am not sure if I can use EXISTS.
    Unfortunately, my SQL wisdom ends here. I need help rewriting the sql, so it would work in materialized view with refresh on commit option. Please, help!!!
    I know that since I am using a sequence there is little chance that same value will get into two different tables, but I would like to perform somekind of check.
    Thank you in advance.

    >
    I know that since I am using a sequence there is little chance that same value will get into two different tables, but I would like to perform somekind of check.If you are certain that you control all the inputs to the table and you are definitely using one sequence to insert into all three tables then there is physically no possible way you will get duplicate values across tables.
    Writing something to check if this is the case would almost be like writing something to verify that 1+1 really does equal 2 in 100% of cases.
    if you must, however. consider something similar to the following which may be more performant:
    select *
      from table_1 t1
      full outer join table_2 t2 on (t1.id = t2.id)
      full outer join table_3 t3 on (t1.id = t2.id
                                     or
                                     t2.id = t3.id)
    where t1.id+t2.id+t3.id not in (t1.id,t2.id,t3.id);

  • How to get a materialized view get to refresh itself after the job is "broken"

    we created a materialized view sometime ago with the following statement:
    create materialized view SXV_PUB_EMPLOYEE_CERT_ALL_M
    refresh complete on demand
    start with to_date('30-08-2009 04:00:00', 'dd-mm-yyyy hh24:mi:ss') next trunc(sysdate) + (28/24)
    as
    select  sxv_emp_cert_all.*
    from    sxv_employee_certification_all sxv_emp_cert_all;
    this week we found out it had not been refresh for about a month
    In dba_jobs the column broken was 'Y', next_date time something like 01-01-4000 and failures 16
    when I ran it manually by executing
    BEGIN DBMS_MVIEW.REFRESH('SXV_PUB_EMPLOYEE_CERT_ALL_M', 'C'); END;
    I found that one of the columns was too small (probably a columns of one of the underlying tables had been extended since the creation of the materialized view)
    After fixing this I ussied yesterday (on 29-8-2013) the statement :
    alter materialized view SXV_PUB_EMPLOYEE_CERT_ALL_M
    refresh complete on demand
    start with to_date('30-08-2009 04:00:00', 'dd-mm-yyyy hh24:mi:ss') next trunc(sysdate) + (28/24)
    after this the table dba_jobs showed me 30-08-2013 04:00:00 as next date
    I was expecting it to run this night at 04:00, but it didn't
    the last_date column value was still from about a month ago, the column broken still shows 'Y'
    and the next date 30-08-2013 04:00:00 (while it should been set to 31-08-2013 01:00:00
    Rrunning
    BEGIN DBMS_MVIEW.REFRESH('SXV_PUB_EMPLOYEE_CERT_ALL_M', 'C'); END;
    gave no errors this time
    and in User_Mview_Analysis the last_refresh_date column showed the date/time I had executed it
    Any idea how to get the job "unbroken" again so that the view refreshes itself every night?
    the database is Oracle Database 10g Release 10.2.0.4.0
    regards,
    Remco

    thanx for all your helpful and correct answers . but eventually I found it myself
    exec dbms_job.broken(<jobnumber>, false);

  • UPDATING the query in materialized view

    Hi,
    i have a little doubt in Materialized view. i created a materialized view and log with the following query,
    create table test_mv (a number ,b number )
    alter table test_mv add constraint t_pk primary key ( a );
    insert into test_mv values (1,2);
    insert into test_mv values(2,2);
    insert into test_mv values(3,2);
    insert into test_mv values(4,2);
    insert into test_mv values(5,2);
    commit;
    CREATE MATERIALIZED VIEW LOG ON test_mv
    WITH SEQUENCE, ROWID
    *(a,b)*
    INCLUDING NEW VALUES;
    CREATE MATERIALIZED VIEW product_sales_mv
    ENABLE QUERY REWRITE
    AS SELECT  b  from test_mv;
    Now i want to update the query in the MV as 'Select a from test_mv' . for that i tried with
    *'ALTER MATERIALIZED VIEW product_sales_mv AS SELECT a from test_mv;'*
    But it throwing error,
    Error starting at line 5 in command:
    alter  MATERIALIZED VIEW product_sales_mv   AS SELECT  b  from test_mv
    Error report:
    SQL Error: ORA-00933: SQL command not properly ended
    +00933. 00000 - "SQL command not properly ended"+
    *Cause:+   
    *Action:+
    i guess i am doing wrong. kindly help me here. i want to update it without drop and recreate.
    thanks,
    Jeevanand.Ke

    Hi Jeeva,
    No. you cannot add or drop columns to the materialized view using the ALTER Statement.
    To Change the Structure of the view , drop and re-create the materialized view.
    To Alter a materialized view log, You can use the ALTER MATERIALIZED VIEW LOG. By this,
    You can add new columns to a materialized view log.
    ALTER MATERIALIZED VIEW LOG ON sggi_mrps.emp ADD(deptno);Thanks,
    Shankar
    Edited by: Shankar Viji on Aug 24, 2012 2:11 AM

  • 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

  • MATERIALIZED VIEW becamed to ZOMBIE :(  What Can I do ?

    Hi! Can anybody give me an advice about this ?
    look:
    10:27:23 ARCGIS2@sgp >drop MATERIALIZED VIEW "ARCGIS"."GP_CP_P_VIEW";
    Materialized view dropped.
    10:27:28 ARCGIS2@sgp >drop MATERIALIZED VIEW "ARCGIS"."GP_CP_P_VIEW";
    Materialized view dropped.
    10:27:31 ARCGIS2@sgp >alter MATERIALIZED VIEW "ARCGIS"."GP_CP_P_VIEW" compile;
    alter MATERIALIZED VIEW "ARCGIS"."GP_CP_P_VIEW" compile
    ERROR at line 1:
    ORA-12003: materialized view "ARCGIS"."GP_CP_P_VIEW" does not exist
    10:27:32 ARCGIS2@sgp >select count(*) from "ARCGIS"."GP_CP_P_VIEW";
    COUNT(*)
    0
    10:31:55 ARCGIS2@sgp >select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bi
    PL/SQL Release 10.2.0.2.0 - Production
    CORE 10.2.0.2.0 Production
    TNS for Linux: Version 10.2.0.2.0 - Production
    NLSRTL Version 10.2.0.2.0 - Production

    Nope, drop table do not work. It told me that i must use drop materil.. view.
    I deleted two records from obj$ and restart database.
    An ugly solution for stupid dude ;(

  • How to add new columns in materialized view

    We are using Oracle 10g Release2.
    We need to add new columns to a prebuilt fast refresh materialized view. We want to add 4 new columns in this table and make them part of select statement in the materialized view. We can drop the view but we cannot do complete refresh after that because the paymentsInfo table has a creation_timestamp column which is populated by before row insert trigger with systimestamp. If we did the complete refresh, all values in this column shall be changed.
    CREATE MATERIALIZED VIEW  paymentsInfo
    ON PREBUILT TABLE
    REFRESH FAST
      ON DEMAND
      START WITH SYSDATE
      NEXT SYSDATE+5/1440
      WITH PRIMARY KEY
    DISABLE QUERY REWRITE AS
    SELECT PAYMENT_ID,BATCH_REFERENCE, TRANSACTION_REFERENCE, NO_OF_TRANSACTIONS, DEBIT_ACC_NUM,... from payment@dblink
    I want to know is there any other way to add new columns without losing any changes from the master table.
    Thanks.

    There is no way to add new Columns to Materialized view. To add new columns, it has to be dropped and re-built again.
    Extract from Oracle Documentaion:
    Use the ALTER MATERIALIZED VIEW statement to modify an existing materialized view in one or more of the following ways:
      To change its storage characteristics
      To change its refresh method, mode, or time
      To alter its structure so that it is a different type of materialized view
      To enable or disable query rewrite
    If you have a problem of Complete refresh, then It may be beneficial to get the backup of the MView; Drop and re-create it with modified definition; Restore the backup data leaving the new columns untouched (assuming they are to be kept as fetched from the Master site).

  • Modify query used in Materialized View

    Are there any ways to modify the query used in materialized view without dropping the materialized view. I dont think alter materialized view has such an option.
    Please provider me your suggestions.

    you have to give "ENABLE QUERY REWRITE" option then u can change your query

  • Materialized views - schedule, indexes, query rewrite, etc.

    I'm trying to get the hang of materialized views and need some help . . .
    running Oracle 10gR2
    I created a materialized view as follows:
    CREATE MATERIALIZED VIEW "MY_SCHEMA"."USERS"
    AS
    SELECT * FROM "USERS"@PRODUCTION -- to copy the USERS table from my production database to this database
    Worked fine. So far so good. Then, I altered it to schedule the refresh:
    ALTER MATERIALIZED VIEW "MY_SCHEMA"."USERS" REFRESH FORCE START WITH SYSDATE NEXT TRUNC(SYSDATE + 1) + 4/24
    -- to schedule a refresh immediately (SYSDATE) and every morning thereafter at 4:00 am (I think)
    then, I wanted to enable query rewrite, so I issued the following command:
    ALTER MATERIALIZED VIEW "MY_SCHEMA"."USERS" ENABLE QUERY REWRITE;
    and I got the
    ALTER MATERIALIZED VIEW succeeded.
    message for both of those commands (I'm doing this in SQL Developer).
    Then, I edit the materialized view in SQL Developer, click on the 'SQL' tab, and get the following:
    CREATE MATERIALIZED VIEW "MY_SCHEMA"."USERS"
    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 "TBLSPC_PHIGH"
    BUILD IMMEDIATE
    USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "TBLSPC_PHIGH"
    REFRESH FORCE ON DEMAND START WITH sysdate+0 NEXT TRUNC(SYSDATE + 1) + 4/24
    WITH PRIMARY KEY USING DEFAULT LOCAL ROLLBACK SEGMENT
    DISABLE QUERY REWRITE
    AS SELECT "USERS"."User" "User","USERS"."Logon" "Logon","USERS"."Name" "Name","USERS"."Password"
    "Password","USERS"."Level" "Level","USERS"."Producer" "Producer","USERS"."Deleted" "Deleted","USERS"."ClaimDoctor"
    "ClaimDoctor","USERS"."UserType" "UserType","USERS"."Locked" "Locked","USERS"."Scheduler"
    "Scheduler","USERS"."RestrictDays" "RestrictDays","USERS"."First" "First","USERS"."DisableAutoChart"
    "DisableAutoChart","USERS"."MaxChartOut" "MaxChartOut","USERS"."MaxHoursOut" "MaxHoursOut","USERS"."EffDate"
    "EffDate","USERS"."ExpDate" "ExpDate","USERS"."SwipeLogon" "SwipeLogon","USERS"."SwipePassword"
    "SwipePassword","USERS"."PwdLastChanged" "PwdLastChanged","USERS"."Audit" "Audit","USERS"."IsInstructor"
    "IsInstructor" FROM "USERS"@PRODUCTION.REGRESS.RDBMS.DEV.US.ORACLE.COM "USERS";
    The problems I've encountered so far:
    1) I created this two days ago and changed the value of one column in one row in the 'source' USERS table
    (USERS@PRODUCTION) as a test case. So far, that change has not propagated over to my materialized view even though
    it has had two chances to do so (yesterday morning at 4:00 am and this morning at 4:00 am).
    2) I enabled QUERY REWRITE. Why does it still show DISABLE?
    3) The primary key of the table came over (as far as I can tell) because it shows in SQL Developer. However, the
    indexed columns are no longer indexed. Do I need to recreate those indexes manually and will they persist?
    4) As you have guessed, I have just taken the plunge into materialized views, and have not been able to find
    anything on the Web along the lines of 'Materialized Views for Dummies'. So, any and all advice/suggestions/help
    will be welcome.
    Thanks,
    Carl

    The Refresh would be executed by a job submitted in the background.
    Query USER_JOBS (or DBA_JOBS) to see if a job has been submitted and if it has been running (you'd be able to see LAST_DATE, LAST_SEC and NEXT_DATE and NEXT_SEC). \
    If the Refresh job has been failing the FAILURES count would be incremented. If there are 16 consecutive failures, the job is marked BROKEN. (if a job fails, Oracle retries it automatically and keeps retrying till it is BROKEN). If the job has been failing you would get messages in the database instance alert log file and trace files.
    If the Refresh job has not been running check the parameter value for JOB_QUEUE_PROCESSES -- a value of 0 would not run in jobs in the USER_JOBS/DBA_JOBS view. Ask the DBA to increase set this parameter to at least 1.
    Hemant K Chitale
    http://hemantoracledba.blogspot.com

  • Materialized view showing red cross in front of it in SQL developer

    we created a materialized view in oracle database,it works fine, and other views that select on  it return results and work fine too. But it has a red cross in front of it in oracle developer.
    I then refresh the view, or recreate the view, it shows green, but after a while when I come back, the red cross show up again.
    What does it mean, any error message we can find?
    Thanks

    878566 wrote:
    we created a materialized view in oracle database,it works fine, and other views that select on  it return results and work fine too. But it has a red cross in front of it in oracle developer.
    I then refresh the view, or recreate the view, it shows green, but after a while when I come back, the red cross show up again.
    What does it mean, any error message we can find?
    It means your system is working NORMALLY! There is no 'error message' to find because there is no error. What you describe is EXACTLY how MVs are designed to work.
    It is NORMAL for MVs to be, and to become, invalid, especially if there refresh setting is ON DEMAND. Don't confuse 'validity' with 'staleness'; they are very different things.
    See the section 'Invalidating Materialized Views' in the Data Warehousing Guide'
    http://docs.oracle.com/cd/B28359_01/server.111/b28313/advmv.htm#i1007082
    Invalidating Materialized Views
    Dependencies related to materialized views are automatically maintained to ensure correct operation. When a materialized view is created, the materialized view depends on the detail tables referenced in its definition. Any DML operation, such as an INSERT, or DELETE, UPDATE, or DDL operation on any dependency in the materialized view will cause it to become invalid. To revalidate a materialized view, use the ALTER MATERIALIZED VIEW COMPILE statement.
    A materialized view is automatically revalidated when it is referenced. In many cases, the materialized view will be successfully and transparently revalidated. However, if a column has been dropped in a table referenced by a materialized view or the owner of the materialized view did not have one of the query rewrite privileges and that privilege has now been granted to the owner, you should use the following statement to revalidate the materialized view:
    ALTER MATERIALIZED VIEW mview_name COMPILE; 
    The state of a materialized view can be checked by querying the data dictionary views USER_MVIEWS or ALL_MVIEWS. The column STALENESS will show one of the values FRESH, STALE, UNUSABLE, UNKNOWN, UNDEFINED, or NEEDS_COMPILE to indicate whether the materialized view can be used. The state is maintained automatically. However, if the staleness of a materialized view is marked as NEEDS_COMPILE, you could issue an ALTER MATERIALIZED VIEW ... COMPILE statement to validate the materialized view and get the correct staleness state. If the state of a materialized view is UNUSABLE, you must perform a complete refresh to bring the materialized view back to the FRESH state. If the materialized view is based on a prebuilt table that you never refresh, you will need to drop and re-create the materialized view.
    As the doc states Oracle will normally 'revalidate' an MV when it is referenced. You can do this manually by using 'ALTER . . . COMPILE'. For an ON DEMAND MV compiling it will NOT alter the contents of the MV - it may stil be STALE.
    You don't need to REFRESH or recreate the MV to make it valid; just recompile it. If it doesn't become VALID after you compile it then there is usually an issue with one of the dependent objects that you need to resolve.

  • Query on materialized view

    Hi,
    Materialized view can't be renamed, so how can I reduce the downtime for any new column addition in the materialized view.
    Regards,
    Koushik

    Agree with your reply.
    I like to do the following steps assuming there is already a materialized view created on a base table :
    1. Add any new column to the base table.
    2. Drop and recreate the mlog table.
    3. execute the statement "alter materialized view <mv_name> consider fresh" to simulate the error "ORA-12034: snapshot log on "<schema>"."<mv_name>" younger than last refresh"
    4. Create a new MV with the additional columns and with a different name.
    5. Drop the existing(old) MV.
    6. Rename the new MV with the name of the old one.
    Now this renaming is not possible. Is there any alternative way do the thing whatever I am trying to do by the above steps.
    Can you please also tell me what is use of "ENABLE QUERY REWRITE" option during creation of a materialized view.
    Thanks & Regards,
    Koushik

  • Error on compile the Materialized view refresh

    Hello all,
    I am getting issue while compile the Materialized view refresh.
    ALTER MATERIALIZED VIEW FII_GL_AGRT_SUM_MV COMPILE;--( did successfully)
    exec DBMS_MVIEW.REFRESH('APPS.FII_GL_AGRT_SUM_MV','C');
    Error:
    ORA-12008: error in materialized view refresh path
    ORA-01013: user requested cancel of current operation
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2545
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2751
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2720
    ORA-06512: at line 1
    Please tell me what could be the issue
    Thanks and Regards,
    Muthu

    Hello all,
    I am using R12.1.3.
    While execute the below command, its not completing..
    exec DBMS_MVIEW.REFRESH('APPS.FII_GL_AGRT_SUM_MV','C');
    I found the reason why its not completing. Because its Refresh In Progress.
    SQL> select u.name owner,o.name mview_name, s.obj#,lastrefreshdate
    *2 from sys.obj$ o, sys.sum$ s, sys.user$ u*
    *3 where u.user# = o.owner# and o.obj# = s.obj# and o.type# = 42 AND bitand(s.mflags, 8) = 8;*
    OWNER                          MVIEW_NAME                           OBJ# LASTREFRE
    APPS                           FII_GL_AGRT_SUM_MV                 438268 06-MAR-13
    SQL> select decode(bitand(s.mflags,8), 8,'Refresh In Progress','Not being refreshed')
    *2 from sys.obj$ o, sys.user$ u, sys.sum$ s*
    *3 where o.obj# = s.obj# and o.owner# = u.user# and o.type# = 42*
    *4 and o.name='FII_GL_AGRT_SUM_MV';*
    DECODE(BITAND(S.MFL
    Refresh In Progress
    How to stop Refreshing or is there any other solution for this issue?
    Please clarify me...
    Thanks and Regards,
    Muthu

  • [Materialized View] - NEEDS_COMPILE Problem ... no refresh

    Hello,
    I've a strange problem with an Oracle 8.1.7.4 DB.
    I've a table 'BRANCARD'
    I create a MV with auto-refresh.
    <code>
    CREATE MATERIALIZED VIEW MV_00087_BRANCARD
    STORAGE (INITIAL 100K NEXT 100K PCTINCREASE 0)
    TABLESPACE BRANCA
    REFRESH FAST
    WITH PRIMARY KEY
    START WITH SYSDATE NEXT SYSDATE+1/1440
    DISABLE QUERY REWRITE AS
    select * from brancard where no_hop='00087' order by no_branc,ty_branc;
    Materialized view created.</code>
    my problem :
    At the first refresh...
    <code>
    select MVIEW_NAME, UPDATABLE, REWRITE_ENABLED, REWRITE_CAPABILITY, REFRESH_MODE, REFRESH_METHOD, STALENESS, AFTER_FAST_REFRESH, COMPILE_STATE from all_mviews
    MVIEW_NAME U R REWRITE_C REFRES REFRESH_ STALENESS AFTER_FAS COMPILE_STATE
    MV_00087_BRANCARD Y N TEXTMATCH DEMAND FAST FRESH FRESH NEEDS_COMPILE
    VUE_00087_ETA N N GENERAL DEMAND COMPLETE UNDEFINED UNDEFINED VALID
    VUE_00087_PASSINT N N NONE DEMAND COMPLETE UNDEFINED UNDEFINED VALID
    VUE_00087_PDT N N NONE DEMAND COMPLETE UNDEFINED UNDEFINED VALID
    VUE_00087_PLTTECH N N NONE DEMAND COMPLETE UNDEFINED UNDEFINED VALID
    VUE_00087_SER N N NONE DEMAND COMPLETE UNDEFINED UNDEFINED VALID
    VUE_00087_UAD N N NONE DEMAND COMPLETE UNDEFINED UNDEFINED VALID
    VUE_00087_UFP N N GENERAL DEMAND COMPLETE UNDEFINED UNDEFINED VALID
    VUE_00087_UHPDT N N NONE DEMAND COMPLETE UNDEFINED UNDEFINED VALID
    </code>
    the refresh failed without error. only 'NEEDS_COMPILE' value in COMPILE_STATE !!
    If i try an 'alter compile' it's OK
    If i try an execute DBMS_snapshot.refresh('MV_00087_BRANCARD', '?') it's ok
    ...but the refresh is not automatic ;((
    any idea about this strange behavior ?
    thanks for your help.

    Any DDL or DML operation on base table can invalidate a materialized view
    State of materialized views can be checked in dictionary view USER_MVIEWS or ALL_MVIEWS. and column- STALENESS
    You can use
    ALTER MATERIALIZED VIEW MV_Name COMPILE statement to validate the materialized view and get the correct state.
    Thanks
    Message was edited by:
    user542366

  • Adding a field to materialized view

    I have a materialized view called DEVICE which gets it's data from a table called device in another database (asset3). A new field was added to the device table in the asset3 database. In order to add that field to the materialized view, will I need to drop the materialized view and recreate it or can I run an alter command to add the field?
    SQL> select MVIEW_NAME,QUERY from DBA_MVIEWS where OWNER='DWH' and MVIEW_NAME='DEVICE';
    MVIEW_NAME
    QUERY
    DEVICE
    select * from device@asset3Thanks
    Ravi

    You have to recreate materialized Views
    Example(REFRESH FAST ON COMMIT):
    SQL> CREATE MATERIALIZED VIEW LOG ON B with rowid;
    SQL> CREATE MATERIALIZED VIEW MV_B REFRESH FAST ON COMMIT with rowid AS select * from B;
    SQL> alter table B add k number;
    SQL> ALTER MATERIALIZED VIEW LOG ON B add (k);
    SQL> drop MATERIALIZED VIEW MV_B;
    SQ> CREATE MATERIALIZED VIEW MV_B REFRESH FAST ON COMMIT with rowid AS select * from B;Edited by: Surachart (HunterX) on Jun 17, 2009 11:11 PM

  • How to change Materialized View query?

    Hi all,
    sorry for this newbie question, but I'm not able to work out this matter...
    How can I change the query used by a materialized view without dropping an recreate all, and using another user(SYS in my case)?
    It looks like the command 'alter materialized view ...' does not allow this, am I wrong?
    thanks a lot
    aldo

    You quick answer saved me a lot of other unsuccessfully searches.
    thanks
    aldo

Maybe you are looking for

  • How do I get an edited pdf out of Adobe reader and into my dropbox so I can access it later?

    I have an ipad mini that I use to read journal articles.  I open them in Adobe Reader and use the tool to edit them (highlight, underline, comment, etc).  Once Ihave finished editing them how do I export them back to drop dropbox so that I can use th

  • IOS 8.0.2 disaster

    Yesterday I loaded iOS 8.0.2 onto my iPad which totaly screwed it up, fortunately Apple help got me going by reseating my iPad throught iTunes which was excellent service, v pleased with the service.  However since the install my iPad has filed to co

  • Car Signal Booster

    I work on a construction sites all around Indiana. Well most of these sites do not have very good signal... Or you walk to one spot and it goes up to 2 or 1 bar then the next is no signal... Everyday for lunch we sit in truck and txt/surf internet/ma

  • Re: Chinese locale

    IP Phone localization files The IP Phone localization files provide support for languages, languages, network tones and cadences. The supported locales include Bulgarian, Chinese-Chinese, Chinese-Taiwanese, Croatian, Czech Republic, Danish, Dutch, Fi

  • Where to see list of absence reason codes to confirm configuration?

    Hi all, Can someone tell where to see the absence reason codes in HR Thanks Jerry