Use of db sequence in a materialized view

Hi,
Will it be possible to use a database sequence in a materialized view?
The materialized view is to return the result set of query that joins multiple tables. One of the columns in the result set - the to-be-created materialized view - is null and requires a sequence.
Will it be possible to include a db sequence in the query?
Example:
create materialized view example_mview
as
select example_sequence.nextval, table1.'*', table2.'*'
from example_table1 table1, example_table2 table2
where table1.id=table2.id

What is the purpose of such numbering? To number each row?
If so - then use ROWNUM as 1st column.
SQL>with ddd
       as
       (select 333 COL from dual union all select 5444 COL from dual)
       select rownum,COL from ddd;ROWNUM COL
1 333
2 5444

Similar Messages

  • How do I use Primary Key and RowID in Materialized View Logs and MVs

    How do I use Primary Key and RowID in Materialized View Logs and Materialized Views????
    I don’t understand in the Materalized View Logs the diference between Primary Key and RowID. Besides, I could choose both Primary Key and RowID.
    When I have to use RowID?? Why?? And Primary Key??? And both, Primary Key and RowID????
    Thank you very much!

    Yes, I have already read it...
    But for example I don’t Understand:
    This is the example 8-1
    CREATE MATERIALIZED VIEW LOG ON products
    WITH SEQUENCE, ROWID
    (prod_id, prod_name, prod_desc, prod_subcategory, prod_subcat_desc, prod_
    category, prod_cat_desc, prod_weight_class, prod_unit_of_measure, prod_pack_
    size, supplier_id, prod_status, prod_list_price, prod_min_price)
    INCLUDING NEW VALUES;
    But if I create a Materialized View with TOAD if I choose a KEY field I receive the error:
    ORA-12026: invalid filter column detected
    Then I have to take out the Key (in the above example prod_id)
    And then the script is
    CREATE MATERIALIZED VIEW LOG ON products
    WITH ROWID, SEQUENCE, PRIMARY KEY!!!!!!!!!!!!!!!!!!!!
    (prod_id, prod_name, prod_desc, prod_subcategory, prod_subcat_desc, prod_
    category, prod_cat_desc, prod_weight_class, prod_unit_of_measure, prod_pack_
    size, supplier_id, prod_status, prod_list_price, prod_min_price)
    INCLUDING NEW VALUES;
    I have PRIMARY KEY in the definition (I don’t choose it) and I don’t have the prod_id field
    Why is it????
    Note: If I execute the script to create the MV Log manually the PRIMARY KEY option NO IS in the script and the prod_id field either is in the script.
    And on the other hand,
    What is this:
    CREATE MATERIALIZED VIEW LOG ON sales
    WITH ROWID;
    CREATE MATERIALIZED VIEW LOG ON times
    WITH ROWID;
    CREATE MATERIALIZED VIEW LOG ON customers
    WITH ROWID;
    These MATERIALIZED VIEW LOG contain any fields????
    Or it contain the primary key fields of this tables (sales, times and customers)??? Then, Why is it ROWID instead of PRIMARY KEY????
    Thanks!

  • Using oracle text on a non-materialized view

    I'm having trouble tracking down an error when using oracle text on a non-materialized view (indexes are on the referenced columns). My database has a users table and a user history table which saves the old values when a user profile changes. My view performs a "union all" so I can select from both at once.
    I would like to use oracle text to perform a "contains" on the view whenever someone signs up to see if any current users or historical entries contain the desired username.
    The following works fine:
    contains(user_history_view, 'bill')but when I reference anything in the contains clause, i get a "column is not indexed" error:
    contains(user_history_view, signup.user_name) --signup.username is 'bill'Here is a stripped-down demonstration (I am using version 10.2.0.4.0)
    create table signup (
      signup_id   number(19,0) not null,
      signup_name varchar2(255),
      primary key (signup_id)
    create table users (
      user_id   number(19,0) not null,
      user_name varchar2(255),
      primary key (user_id)
    create table user_history (
      history_id number(19,0) not null,
      user_id    number(19,0) not null,
      user_name  varchar2(255),
      primary key (history_id),
      foreign key (user_id) references users on delete set null
    create index user_name_index on users(user_name)
    indextype is ctxsys.context parameters ('sync (on commit)');
    create index user_hist_name_index on user_history(user_name)
    indextype is ctxsys.context parameters ('sync (on commit)');
    create index signup_name_index on signup(signup_name)
    indextype is ctxsys.context parameters ('sync (on commit)');
    create or replace force view user_history_view
    (user_id, user_name, flag_history) as
    select user_id, user_name, 'N' from users
    union all
    select user_id, user_name, 'Y' from user_history;
    --user bill changed his name to bob, and there is a pending signup for another bill
    insert into users(user_id, user_name) values (1, 'bob');
    insert into user_history(history_id, user_id, user_name) values (1, 1, 'bill');
    insert into signup(signup_id, signup_name) values(1, 'bill');
    commit;
    --works
    select * from user_history_view users, signup new_user
    where new_user.signup_id = 1
    and contains(users.user_name, 'bill')>0;
    --fails
    select * from user_history_view users, signup new_user
    where new_user.signup_id = 1
    and contains(users.user_name, new_user.signup_name)>0;I could move everything into a materialized view, but querying against real-time data like this would be ideal. Any help would be greatly appreciated.

    Hi,
    this is to my knowledge not possible. It is hard for Oracle to do, think about a table with many rows, every row with that column must be checked. So I think only a single varchar2 is possible. Maybe for you will a function work. It is possible to give a function as second parameter.
    function return_signup
    return varchar2
    is
      l_signup_name signup.signup_name%type;
    begin
      select signup_name
      into l_signup_name
      from signup
      where signup_id = 1
      and rownum = 1
      return l_signup_name;
    exception
      when no_data_found
      then
        l_signup_name := 'abracadabra'; -- hope does not exist
        return l_signup_name;
    end;Now you can use above function in the contains.
    select * from user_history_view users --, signup new_user
    --where new_user.signup_id = 1
    where contains(users.user_name, return_signup)>0;I didn't test the code! Maybe you have to adjust the function for your needs. But it is a idea how this can be done.
    Otherwise you must make the check by normaly check the columns by simple using a join:
    select * from user_history_view users, signup new_user
    where new_user.signup_id = 1
    and users.user_name = new_user.signup_name;Herald ten Dam
    htendam.wordpress.com

  • Update sequence wrong in Materialized view when using refresh group

    Hi,
    I made a trigger (for each row) on a materialized view(replication data from a master table in in a different database), which is refreshed by a refresh group (exec dbms_refresh.refresh('"...). However, the update order/sequence is important and must be handled (by the trigger) in the same order how the updates where done in the master table. Unfortunately the updates in the materialized view are NOT in the same order. The trigger is fired in a wrong order.
    I am using database version 10.2.0
    Does anybody reconize this problem, Is there a solution for this problem ( with keeping the refresh group mechanisme)?
    Thanks
    Regards
    Jurn

    rownum is determined as the row is output, so "order by rownum" does literally nothing.
    http://docs.oracle.com/cd/B19306_01/server.102/b14200/pseudocolumns009.htm

  • Materialized views used by answers

    Hi,
    I had create some materialized views for some graphs created on answers of Analytics. The problem i have is that the graphs still take much time to show the results, the materialized views has summarized measures from they original table which is of 33 millions rows to 2000 rows.
    Is there any option do i have to check on the Administration of ORACLE Business Intelligence for the materialized views being take by the queries?
    thanks a lot

    Tables were not created and imported into the physical Layer
    - What was imported into the physical layer if not tables?
    Do i have to add the materialized views in the physical Layer?
    - If query rewrite is turned on then the materialized views don't have to be. Oracle can rewrite sql in the backgrounf
    I haven't eneabled the QUERY REWRITE, so maybe with this can used it.
    - Worth a shot
    Where do i have to check the statistics? in OEM or Settings-Manage Sessions ?
    - You can use OEM to analyze tables and materialized views (and their indexes)
    - Speaking of indexes - Are the indexes being used or is table access done with full table scans
    - Beach

  • Materialized View Log

    Hi,
    I would like to create Fast refresh Materialized View in owb
    Create Materialized View F_CALL_DAY_MV PARALLEL LOGGING BUILD IMMEDIATE REFRESH FAST ENABLE QUERY REWRITE AS
    SELECT
    FCALL.ACCOUNT_DIM_ID,
    FCALL.INVOICE_DIM_ID,
    FCALL.SCHEDULER_DIM_ID,
    FCALL.CHAIRPERSON_DIM_ID,
    FCALL.DATE_DIM_ID,
    FCALL.RESERVATION_DIM_ID,
    FCALL.PRODUCT_DIM_ID,
    FCALL.CALL_STATUS_DIM_ID,
    FCALL.REVENUE_CENTER_DIM_ID,
    FCALL.CAMPAIGN_DIM_ID,
    FCALL.SALESPERSON_DIM_ID,
    count(*),
    count (FCALL.CAMPAIGN_ELAPSED_DAYS_TO_CALL) cnt_CAMP_ELAPSED_DAYS_TO_CALL,
    AVG(FCALL.CAMPAIGN_ELAPSED_DAYS_TO_CALL) AVG_CAMP_ELAPSED_DAYS_TO_CALL,
    SUM(FCALL.SCHEDULED_CONNECTIONS) SCHEDULED_CONNECTIONS,
    SUM(FCALL.ACTUAL_CONNECTIONS) ACTUAL_CONNECTIONS,
    DDATE.THE_DATE,
    DDATE.YEAR_NUM,
    DDATE.MONTH_NUM,
    DDATE.WEEK_OF_THE_YEAR,
    DACCOUNT.BILL_ACCOUNT_CD,
    DACCOUNT.ACCOUNT_NM,
    DCHAIRPERSON.CONTACT_FULL_NAME,
    DCHAIRPERSON.CONTACT_FULL_ADDRESS,
    DCHAIRPERSON.MAIN_PHONE_NUM,
    DCHAIRPERSON.MOBILE_PHONE_NUM,
    DCHAIRPERSON.EMAIL_ADDR
    FROM F_CALL FCALL,
    D_ACCOUNT DACCOUNT,
    D_CALL DCALL,
         D_INVOICE D_INVOICE,
         D_SCHEDULER DSCHEDULER,
         D_CHAIRPERSON DCHAIRPERSON,
         D_DATE DDATE,
         D_RESERVATION DRESERVATION,
    D_PRODUCT DPRODUCT,
         D_CALL_STATUS DCALLSTATUS,
         D_REVENUE_CENTER DREVENUECENTER,
         D_CAMPAIGN DCAMPAIGN,
         D_SALESPERSON DSALESPERSON
    WHERE FCALL.ACCOUNT_DIM_ID = DACCOUNT.ACCOUNT_DIM_ID
    AND FCALL.CALL_DIM_ID = DCALL.CALL_DIM_ID
    AND FCALL.INVOICE_DIM_ID = D_INVOICE.INVOICE_DIM_ID
    AND FCALL.SCHEDULER_DIM_ID = DSCHEDULER.SCHEDULER_DIM_ID
    AND FCALL.CHAIRPERSON_DIM_ID = DCHAIRPERSON.CHAIRPERSON_DIM_ID
    AND FCALL.DATE_DIM_ID = DDATE.DATE_DIM_ID
    AND FCALL.RESERVATION_DIM_ID = DRESERVATION.RESERVATION_DIM_ID
    AND FCALL.PRODUCT_DIM_ID = DPRODUCT.PRODUCT_DIM_ID
    AND FCALL.CALL_STATUS_DIM_ID = DCALLSTATUS.CALL_STATUS_DIM_ID
    AND FCALL.REVENUE_CENTER_DIM_ID = DREVENUECENTER.REVENUE_CENTER_DIM_ID
    AND FCALL.CAMPAIGN_DIM_ID = DCAMPAIGN.CAMPAIGN_DIM_ID
    AND FCALL.SALESPERSON_DIM_ID = DSALESPERSON.SALESPERSON_DIM_ID
    GROUP BY
    FCALL.ACCOUNT_DIM_ID,
    FCALL.INVOICE_DIM_ID,
    FCALL.SCHEDULER_DIM_ID,
    FCALL.CHAIRPERSON_DIM_ID,
    FCALL.DATE_DIM_ID,
    FCALL.RESERVATION_DIM_ID,
    FCALL.PRODUCT_DIM_ID,
    FCALL.CALL_STATUS_DIM_ID,
    FCALL.REVENUE_CENTER_DIM_ID,
    FCALL.CAMPAIGN_DIM_ID,
    FCALL.SALESPERSON_DIM_ID,
    DDATE.THE_DATE,
    DDATE.YEAR_NUM,
    DDATE.MONTH_NUM,
    DDATE.WEEK_OF_THE_YEAR,
    DACCOUNT.BILL_ACCOUNT_CD,
    DACCOUNT.ACCOUNT_NM,
    DCHAIRPERSON.CONTACT_FULL_NAME,
    DCHAIRPERSON.CONTACT_FULL_ADDRESS,
    DCHAIRPERSON.MAIN_PHONE_NUM,
    DCHAIRPERSON.MOBILE_PHONE_NUM,
    DCHAIRPERSON.EMAIL_ADDR
    For this i need to create Materialized View Log as specified below for all the tables
    used for creating above MV
    CREATE MATERIALIZED VIEW LOG ON D_SALESPERSON
    WITH ROWID, SEQUENCE(SALESPERSON_DIM_ID)
    INCLUDING NEW VALUES;
    But i'm not able to create MV log in oracle warehouse builder as specified above. When i specify base tables in owb it creates default mv log as
    CREATE MATERIALIZED VIEW LOG ON D_SALESPERSON but i need to create MV log with "WITH ROWID, SEQUENCE(SALESPERSON_DIM_ID)
    INCLUDING NEW VALUES"
    Please could you help me to resolve this issue
    Thanks
    Kavitha

    Hi,
    I would just create the MV Log manually from SQL*Plus.
    Best regards,
    Erik

  • How to make materialized view fast refresh parallel

    We have Oracle 11.2.0.1 on Redhat 5.2. We use a dozen of fast refresh materialized views in our application.
    From time to time MV refresh takes longer time than the refresh interval.
    One of way to improve performance of MV refresh is to make the refresh parallel, e.g. http://www.dba-oracle.com/t_materialized_views_refreshing_performance.htm
    - Use parallel DML - Oracle author Michael Armstrong Smith notes "I've done parallel materialized view refreshing
    on tables recently and improved the load times considerably. Rather than having one load which took 2 hours,
    I run 4 parallel loads, one for each partition. The length of time for the whole process is now determined by
    how long the biggest partition takes to load. In my case, this is 40 minutes, with two 30 minute loads and one
    20 minute load.  Overall I am saving 1 hour 20 minutes. I can now add further partitions and do the same thing.
    My only limitation is the parallel loads because I don't have unlimited processing power.
    {code} My master tables are not partitioned, but think parallel will still better than non-parallel.
    Now the question, how to make refresh parallel. According to the paragraph cited above, Use parallel DML appears doing the job. Can someone  confirm that.
    We use {code}
    alter materialied view MV_OFFENSE parallel REFRESH FAST start with sysdate next sysdate+ 1/24;
    {code}to schedule refresh. Does the parallel clause here parallels query the MV or refresh the MV?
    Any other way to make MV refresh parallel?
    Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Doc http://download.oracle.com/docs/cd/E11882_01/server.112/e16579/refresh.htm#i1006319 says:
    >
    In a data warehousing environment, assuming that the materialized view has a parallel clause, the following sequence of steps is recommended:
    1.
    Bulk load into the fact table
    2.
    Enable parallel DML
    3.
    An ALTER SESSION ENABLE PARALLEL DML statement
    4.
    Refresh the materialized view

  • Materialized view long transaction time

    I am using Oracle DB 11g R2 and created a materialized view log WITH SEQUENCE. I need to find out the exact date/time the transaction was made. I see that my MV log has the 'XID$$' column (NUMBER 22), but not sure how to determine the date/time from that. Is there another view/table I can join to get me that info? I see some have 'XID' column but they are RAW(8).
    Thanks
    Edited by: bobmagan on Feb 27, 2013 11:57 AM

    - CDC is at least as performant as materialized view logs. If you do asynchronous CDC, it performs better since you're not burdening the source transactions with the overhead of synchronously maintaining the materialized view logs.
    - CDC is at least as effective as materialized view logs. Since CDC is designed to publish changes to custom consumers where materialized view logs are designed to be used by Oracle to refresh a materialized view, it strikes me as a much safer solution. If someone comes along and creates a materialized view that starts using your materialized view log, for example, a solution that involves custom code to manipulate the materialized view is almost certainly going to fail.
    - CDC isn't an extra cost option so there shouldn't be a cost difference
    That leaves the question of simplicity. I'll certainly grant you that a materialized view log solution may appear simpler. But a lot of that simplicity advantage disappears over time. The fact that we're talking about doing things like querying relatively obscure data dictionary tables like all_summap, for example, is added complexity that a CDC-based solution doesn't need. But over time, I'd much rather maintain a CDC-based solution rather than hooking in to materialized view logs. If someone wants to build a materialized view and Oracle happens to be able to use the materialized view log you've created for your own CDC, the custom solution will stop working. Over time, Oracle introduces more and more functionality that allows the ROWID of a row to change (shrinking a table, flashback, etc.). If you're using CDC, Oracle will take care of making sure that all those things are presented to you correctly. If you're rolling your own solution, you have to test and ensure that your code handles all those cases correctly. When Oracle makes a change in some future release that you hadn't considered, you've got to notice the potential problem, code the fix, and test it. Most places are probably going to miss something and only discover that there is a problem when they do something like shrink a table and then find that their custom solution doesn't handle that gracefully.
    Justin

  • Issue with fast refresh on a materialized view

    Hi,
    Oracle DB version is 10.2.0.3
    We have a matierialized view created using this script. We have materialized view logs on these six tables.
    By default, it is set to ON COMMIT .
    When a batch job is run every morning (usually 100-200 records) we set it to ON DEMAND and then bring it back to ON COMMIT. It takes around 1-2 minutes.
    If the batch is unusually big, like say 100,000 it takes more than 5 hours to put it back on ON COMMIT. (We analyze the schema (GATHER STALE) before refreshing the MV.) Trace shows deletes taking a long time.
    When I see a big batch, I usually drop the view and recreate it with indexes (there is also a context index). Takes 30 mins to do the whole thing.
    I tried refreshing it COMPLETE when the num of rows is high but it still takes more than 2 hours..(I killed it)
    Is there any way to speed things up without dropping and recreating the MV ?
    thanks
    Mat view creation script:
    CREATE MATERIALIZED VIEW WCC_INTERNAL_SEARCH_M
    TABLESPACE ICV_TS_WCC_DATA
    NOCACHE
    LOGGING
    NOCOMPRESS
    NOPARALLEL
    BUILD IMMEDIATE
    REFRESH FAST ON COMMIT
    WITH ROWID
    AS
    SELECT orgname.ROWID orgname_rowid,
    cnt.ROWID cnt_rowid,
    locgrp.ROWID locgrp_rowid,
    cntry.ROWID cdcntry_rowid,
    addrgrp.ROWID addrgrp_rowid,
    addr.ROWID addr_rowid,
    cnt.cont_id cont_id,
    decode(cntry.name,'US',substr(addr.postal_code,1,5),addr.postal_code) postal_code,
    cntry.name country,
    UPPER(addr.addr_line_one) addr_line_one,
    UPPER(addr.addr_line_two) addr_line_two,
    UPPER(addr.addr_line_three) addr_line_three,
    UPPER(addr.CITY_NAME) city_name,
    UPPER(cnt.CONTACT_NAME) display_name,
    UPPER(orgname.ORG_NAME) org_name,
    addr.prov_state_tp_cd
    FROM orgname,
    contact cnt,
    locationgroup locgrp,
    cdcountrytp cntry,
    addressgroup addrgrp,
    address addr
    WHERE locgrp.cont_id = orgname.cont_id
    AND locgrp.cont_id = cnt.cont_id
    AND addrgrp.location_group_id = locgrp.location_group_id
    AND addr.country_tp_cd = cntry.country_tp_cd
    AND addr.address_id = addrgrp.address_id
    AND cnt.INACTIVATED_DT is null
    AND locgrp.END_DT is null
    AND orgname.END_DT is null
    AND cnt.person_org_code = 'O'
    AND cntry.lang_tp_cd = 100
    AND locgrp.member_ind = 'Y'
    AND locgrp.loc_group_tp_code = 'A'
    ORDER by org_name,city_name,postal_code,country;

    This is the script that creates the preferences and then the context index.
    exec ctx_ddl.create_preference('STEM_FUZZY_PREF', 'BASIC_WORDLIST');
    exec ctx_ddl.set_attribute('STEM_FUZZY_PREF','FUZZY_MATCH','AUTO');
    exec ctx_ddl.set_attribute('STEM_FUZZY_PREF','FUZZY_SCORE','60');
    exec ctx_ddl.set_attribute('STEM_FUZZY_PREF','FUZZY_NUMRESULTS','100');
    exec ctx_ddl.set_attribute('STEM_FUZZY_PREF','STEMMER','AUTO');
    exec ctx_ddl.set_attribute('STEM_FUZZY_PREF', 'wildcard_maxterms',15000) ;
    exec ctx_ddl.create_preference('LEXTER_PREF', 'BASIC_LEXER');
    exec ctx_ddl.set_attribute('LEXTER_PREF','index_stems', 'ENGLISH');
    exec ctx_ddl.set_attribute('LEXTER_PREF','skipjoins',',''."+/-&');
    exec ctx_ddl.create_preference('ICV_WCC_INT_SEARCH_CTX_PREF', 'BASIC_STORAGE');
    exec ctx_ddl.set_attribute('ICV_WCC_INT_SEARCH_CTX_PREF', 'I_TABLE_CLAUSE','tablespace ICV_TS_CTX_IDX');
    exec ctx_ddl.set_attribute('ICV_WCC_INT_SEARCH_CTX_PREF', 'K_TABLE_CLAUSE','tablespace ICV_TS_CTX_IDX');
    exec ctx_ddl.set_attribute('ICV_WCC_INT_SEARCH_CTX_PREF', 'N_TABLE_CLAUSE','tablespace ICV_TS_CTX_IDX');
    exec ctx_ddl.set_attribute('ICV_WCC_INT_SEARCH_CTX_PREF', 'I_INDEX_CLAUSE','tablespace ICV_TS_CTX_IDX compress 2');
    exec ctx_ddl.set_attribute('ICV_WCC_INT_SEARCH_CTX_PREF', 'P_TABLE_CLAUSE','tablespace ICV_TS_CTX_IDX');
    exec ctx_ddl.set_attribute('ICV_WCC_INT_SEARCH_CTX_PREF', 'R_TABLE_CLAUSE','tablespace ICV_TS_CTX_IDX');
    CREATE INDEX WCC_INT_SEARCH_CTX_I1 ON WCC_INTERNAL_SEARCH_M
    (ORG_NAME)
    INDEXTYPE IS CTXSYS.CTXCAT
    PARAMETERS('Wordlist STEM_FUZZY_PREF
    LEXER LEXTER_PREF
    STORAGE ICV_WCC_INT_SEARCH_CTX_PREF');
    DB is 10.2.0.3

  • Creating Materialized View in Toad

    As with every new endeavor - come new questions.
    I am trying to create a materialized view via toad (first time doing this). Now - toad is great, since it provides a kind-of wizard interface. Hence, one doesn't have to completely code in the create statement, with all of the options, etc.
    Instead, in toad, one can (via the schema browser), go into the Materialized Views tab and click on create new. This opens a window with 6 tabs: Basic Info, Refresh Info, Physical Attributes, Query, Partitions & Subpartition Template.
    In the Basic Info, one can put a check mark next to some of the following options:
    -Build Deffered
    -Parallel
    -Cache
    -Logging
    -Using index
    -Allow updates
    etc.
    I have read that build deferred refers to whether or not you would like the view to be created automatically or to be deferred.
    Anyways, I tried to find Toad documentation to explain each of the options in-detail. No success. Hence, am researching each part piece by piece.
    But - here is my question:
    In the Query tab, we are asked to specify a query. I am assuming that the query does not have to be a full query, beginning with CREATE MATERIALIZED VIEW mv_table1 REFRESH FAST etc...
    Since in this 'wizard', we are providing the MV name at the top of the dialog box, we are checking the 'options' in the other tabs, etc.
    And so, I assumed that the query should merely be a select query in the window mentioned above.
    So I entered the following:
    select * from table1@remote_db;
    When I go to verify the syntax, I get the error message: ORA_00911: invalid character. It seems to be pointing to my db_link (remote_db). I have been using this link throughout many places, w/o any problems.
    Has anyone created a MV in toad before? Any links to good toad documentation would be helpful as well.
    Thanks.

    (This is fun... ;))
    For anyone endeavoring this in the future, below I have attached the prerequisites required in order to create a materialized view (can also be found @ http://download-uk.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_6002.htm):
    Prerequisites
    The privileges required to create a materialized view should be granted directly rather than through a role.
    To create a materialized view in your own schema:
    You must have been granted the CREATE MATERIALIZED VIEW system privilege and either the CREATE TABLE or CREATE ANY TABLE system privilege.
    You must also have access to any master tables of the materialized view that you do not own, either through a SELECT object privilege on each of the tables or through the SELECT ANY TABLE system privilege.
    To create a materialized view in another user's schema:
    You must have the CREATE ANY MATERIALIZED VIEW system privilege.
    The owner of the materialized view must have the CREATE TABLE system privilege. The owner must also have access to any master tables of the materialized view that the schema owner does not own (for example, if the master tables are on a remote database) and to any materialized view logs defined on those master tables, either through a SELECT object privilege on each of the tables or through the SELECT ANY TABLE system privilege.
    To create a refresh-on-commit materialized view (ON COMMIT REFRESH clause), in addition to the preceding privileges, you must have the ON COMMIT REFRESH object privilege on any master tables that you do not own or you must have the ON COMMIT REFRESH system privilege.
    To create the materialized view with query rewrite enabled, in addition to the preceding privileges:
    If the schema owner does not own the master tables, then the schema owner must have the GLOBAL QUERY REWRITE privilege or the QUERY REWRITE object privilege on each table outside the schema.
    If you are defining the materialized view on a prebuilt container (ON PREBUILT TABLE clause), then you must have the SELECT privilege WITH GRANT OPTION on the container table.
    The user whose schema contains the materialized view must have sufficient quota in the target tablespace to store the master table and index of the materialized view or must have the UNLIMITED TABLESPACE system privilege.
    When you create a materialized view, Oracle Database creates one internal table and at least one index, and may create one view, all in the schema of the materialized view. Oracle Database uses these objects to maintain the materialized view data. You must have the privileges necessary to create these objects.

  • SQL command of Materialized View Relication in Oracle XE

    Hi, all,
    While waiting for the machine to be OK, I decide to post my understand of materialized view replication here and please point me anything incorrect.
    I have two machines A and B, I want to make A as a master and B as replica, to replicate table test.
    On A:
    create materialized view log on test;
    On B:
    create database link dbl_a
    connect to SYSTEM identified by password
    using '(DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = a)(PORT = 1521))
    (CONNECT_DATA =
    (SID = XE)
    create materialized view test_mview as select * from test@dbl_a;
    At last, when I want to make a synchronization, I run
    On B:
    EXECUTE DBMS_MVIEW.REFRESH('test_mview');
    Any point is appreciated.
    Best wishes,
    Kemian

    You can use DBMS_METADATA :
    SCOTT@orcl SQL> create materialized view mv_emp
      2  refresh fast on demand with rowid
      3* as select empno,ename,job,sal from emp
    SCOTT@orcl SQL> /
    Materialized view created.
    SCOTT@orcl SQL> set long 100000
    SCOTT@orcl SQL> select DBMS_METADATA.GET_DDL('MATERIALIZED_VIEW','MV_EMP','SCOTT') from dual
    SCOTT@orcl SQL> /
    DBMS_METADATA.GET_DDL('MATERIALIZED_VIEW','MV_EMP','SCOTT')
      CREATE MATERIALIZED VIEW "SCOTT"."MV_EMP"
      ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOG
    GING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"
      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 "USERS"
      REFRESH FAST ON DEMAND
      WITH ROWID USING DEFAULT LOCAL ROLLBACK SEGMENT
      DISABLE QUERY REWRITE
      AS select empno,ename,job,sal from emp
    SCOTT@orcl SQL>                                                                               

  • Create Materialized View with Compress clause

    Hi,
    Oracle 9i R2 has an option to use compress clause while creating table, materialized view or etc. Just wanted some help on tips to be followed during creating a materilized view with compress clause and refresh the same.do i need to follow any special procedures ??? Any help greatly appreciated.
    Thanks,
    Chak.

    I read in the book that while inserting user /+append+/ otherwise table with compress will fail. I am doing materialized view refresh with fast mode and data will be inserted as per logs residing at master site.. while inserting into materialized view, do i have to setup specially since fast refresh is going to insert data into existing materialized view.
    Thanks,

  • About Refresh Error In Materialized view

    hi
    i have
    Oracle 9.2.0.1 at the windows server 2003
    i have created some materialized view to use in my one web application running on tomcat
    i have scheduling for refresh it using refresh utility available in oracle materialized view snapshot refresh
    but when its try to run state of refresh become unusable and table according to it
    remains empty
    when i try to do it manually it gives error log
    Ora-12008 error in materialized view refresh path
    ora-01114 io error writing block to file 201(block #2621321)
    ora-27069 skgfdisp:attmempt to do i/o beyond the range of file
    osd-04026 invalid parameter passed(OS 2621327)
    ora-01114 io error writing block to file 201(block#2621321)
    ora-27069 skgfdisp:attempt do i/o beyond the range of the file
    osd-04026 invalid parameter passed (OS 2621327)
    ora 06512 at "SYS.DBMS_SNAPSHOt",line 794
    ora 06512 at "SYS.DBMS_SNAPSHOt", line 851
    ora 06512 at "SYS.DBMS_SNAPSHOt", line 832
    ora 06512 at line 2
    even i could not understand this error
    one strange thing in this when i restart my server and try to refresh
    it is going to be refresh
    please help me

    I suspect one of your datafiles has exceeded the 4Gb windows limit. Your tablespace has probably been set to autoextend and this has created the problem. I am not sure what you can do at this point apart from recover from backup. I would open a TAR with Oracle Support as soon as possible to try and resolve this issue.
    Please note: This forum is for OLAP issues only. If you need more information I would try posting on the database forum.
    Keith Laker
    Oracle EMEA Consulting
    OLAP Blog: http://oracleOLAP.blogspot.com/
    OLAP Wiki: http://wiki.oracle.com/page/Oracle+OLAP+Option
    DM Blog: http://oracledmt.blogspot.com/
    OWB Blog : http://blogs.oracle.com/warehousebuilder/
    OWB Wiki : http://wiki.oracle.com/page/Oracle+Warehouse+Builder
    DW on OTN : http://www.oracle.com/technology/products/bi/db/11g/index.html

  • 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;

  • Advantage of Materialized view on prebuilt table

    Could someone tell me the advantage of Materialized view on prebuilt table?. I'm unable to understand the concept from the Oracle documentation. I need to know the answers for following questions.
    1) Is the data stored in table and MV same?. Does the query retrive data from table or MV?. The query internally uses either table or a view as the names of both are same.
    2) Our DSS application is generating complicated queries and executing for long time. Is there any way I can optimize those queries using MV without rewriting the code in the application.

    It's a roughly analgous problem to figuring out what set of indexes to create to improve the performance of an application-- you need to understand the various queries, how the application is accessing data, and you need to balance a variety of competing needs in order to come up with a reasonable set of indexes.
    Fundamentally, Oracle can only use a materialized view to satisfy a query if a human could use just the data in the materialized view to answer the question. That generally means that the materialized view is going to have to be aggregated at a lower level or at the same level as the query. A materialized view that aggregates sales by day can be used for queries by year but a materialized view that aggregates sales by year cannot be used for queries that get sales by day. A materiailized view that aggregates sales by vendor and product can be used for queries that aggregate by vendor or by product, but a materialized view that aggregates by product cannot be used in a query that aggregates by product for a particular vendor.
    You'll have to balance what materialized views are ideal for a particular query, what materialized views are sufficient for a particular set of queries, and how to balance the space, managability, and refresh performance requirements between creating lots of somewhat redundant materialized views that provide optimal query performance at the cost of a lot of disk and a large refresh window vs creating fewer, more general materialized views that consume less disk and can be refreshed faster but that provide less query performance boosts.
    Justin

Maybe you are looking for

  • Can You Home Sharing Between Two iTunes Accounts

    Hi, My Dad has a vast amount of music on his itunes account and my old iPod used to be linked up to his account. But recently I got a iPhone 4 and I created my own iTunes account. I would like to be able to listen to the music on my Dad's account as

  • Will I able to install Logic on Apple Mac Mini A1347 with this requirements:

    Hi, Will Logic Pro 9 able to run smoothly on this system configuration: Apple Mac Mini A1347 <MC815RS / A> i5 2410M / 2 / 500 / WiFi / BT / MacOS X    ? Is 2048МB of RAM enough? Thank you in advance!

  • Portal intergration

    Hi Experts, I am working on webdynpro abap,i need material on WEBDYNPRO ABAP  PORTAL INTEGRATION  if u provide me with screen shots it will be good reference to me. THANKS & REGARDS. krishna.

  • No PXA Storage Space is available

    Experts, During Client Copy in SCCL, the buffer space has been completely used up and PXA Storage Space is not available. Therefore, all other programs are giving dumps. I have modified the profile parameter abap/buffersize  and increased the size fr

  • NAC Problem_In-Band Virtual Gateway deployment

    we deployed In-Band virtual gateway deployment.. the users connected to untrusted Vlan and took IP address from DHCP where it configured on ASA that is connected to trusted interface but no one can reach to the gateway " IP address of the firewall" a