Create Materialized View  based on another database table using db link?

SQL> SELECT sysdate
2 FROM dual@CBRLINK ;
SYSDATE
21-NOV-12
SQL> CREATE MATERIALIZED VIEW USERCBR.V_T24_COUNTRY1
2 REFRESH COMPLETE
3 START WITH SYSDATE NEXT SYSDATE + (5/24)
4 AS
5 SELECT sysdate
6 FROM dual@CBRLINK ;
CREATE MATERIALIZED VIEW USERCBR.V_T24_COUNTRY1
ERROR at line 1:
ORA-04052: error occurred when looking up remote object SYS.DUAL@CBRLINK
ORA-00600: internal error code, arguments: [ORA-00600: internal error code,
arguments: [qksfroFXTStatsLoc() - unknown KQFOPT type!], [0], [], [], [], [],
ORA-02063: preceding line from CBRLINK

It works for me:orcl>
orcl> CREATE MATERIALIZED VIEW scott.V_T24_COUNTRY1
  2  REFRESH COMPLETE
  3  START WITH SYSDATE NEXT SYSDATE + (5/24)
  4  AS
  5  SELECT sysdate
  6  FROM dual@l1 ;
Materialized view created.
orcl> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
PL/SQL Release 11.2.0.3.0 - Production
CORE    11.2.0.3.0      Production
TNS for 32-bit Windows: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
orcl>so there is no problem with the code. HTH.

Similar Messages

  • How to create materialized view based on a synonym

    Hi all,
    I am trying to create simple materialized view based on a synonym and that synonym is pointing a view in other database (using dblink). I am getting table or view not found error . I am able to select synonym if i use select but not in materialized view. Please help me.
    Thanks,

    The best way to do this is to create a materialzed view based on the underlying code of the original view. If you don't have this handy, issue the following in sqlplus:
    select text
    from user_views
    where view_name = 'NAME_OF_VIEW'
    You can then cut and paste the sql statement into your create materialized view statement.
    Please note, you will probable have to set the long parameter to a higher value to reveal the complete statement for example:
    SQL> set long 2048

  • How to create materialized view based on a view?

    Hi,
    I hope this is not very far fetched idea.
    I have a very complex view and I would like to replicate it 'in place' that is I would like to make a materialized view that is based on this view complex view. I would like to use this materialized view (i.e table) to query data instead of using the original view, since it takes Oracle some 10-15 seconds to execute my query on the original view and I am not allowed to create indexes on most of the tables that are included in the original view.
    Can this be done?
    Best regards,
    Tamas Szecsy

    The best way to do this is to create a materialzed view based on the underlying code of the original view. If you don't have this handy, issue the following in sqlplus:
    select text
    from user_views
    where view_name = 'NAME_OF_VIEW'
    You can then cut and paste the sql statement into your create materialized view statement.
    Please note, you will probable have to set the long parameter to a higher value to reveal the complete statement for example:
    SQL> set long 2048

  • How to create materialized view log on remote database

    How do you create materialized view logs on a remote database.
    I tried
    create materialized view log on global_express_views.vccs438_project_work_request@h92edwp with sequence, rowid ( columns...)
    ERROR at line 1:
    ora-00949 illegal reference to remote database

    Hi,
    I am not getting the error exactly. But have some suggestion:
    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.
    Hope, this may help you?
    Thanx.. Ratan

  • Create Materialized View based on Results from LDAP Query

    Hi -- I'm trying to create a materialized view based on results from an LDAP query. Unfortunately, it looks like a materialized view can't be created based on a stored procedure, which is where the LDAP results are obtained (using nested loops).
    Does anyone have any idea how to do this without first kicking off a stored procedure that populates a temp table which would be used to create the materialized view? I'm trying to minimize the steps that the DBA's will need to go through when refreshing this new view.
    Thanks,
    ~Christine

    Can you give us more details about the stored procedure you're calling. It will help to know what parameters are involved and what data types they are.
    Off the top of my head though it looks like, at the very least, you would need a stored function that calls the stored procedure. I don't think there is any way to call stored procedures from CREATE ... commands. If you're going to create a stored function anyway ... well, you might as well just create a procedure that inserts values into a regular table instead of fussing with functions and materialized views. You'll probably want to schedule your new procedure to run periodically since it sounds like you'll need the values refreshed from time to time.

  • APEX  How do I create a Form based on a Database Table from other schema

    My APEX schema is WISEXP. I have a database table that resides in WISDW schema on the same database. I want to create Tabular form based on this table.
    I am not able to create a FORM based on the table from WISDW schema. I am able to create a FORM based on SQL though from this table in WISDW schema - but it does not do any action on Update/Insert rows.
    Appropriate Synonyms and grants are created. Is there a limitation or am I missing something? Please advise.
    thanks
    Rupen

    If Rupen is using 2.2 or 2.2.1, it is likely he is running into the bug described here: Re: Workspace to Schema Assignments
    In that case, it may be a necessary and sufficient workaround to assign the foreign schema to the workspace.
    Scott
    Message was edited by:
    sspadafo

  • Create Materialized View with GROUP BY

    I have a table
    treecluster NUMBER(3)
    treenumber NUMBER(3)
    treedate DATE
    nestnumber NUMBER(3)
    eggs NUMBER(3)
    nestlings NUMBER(3)
    fledglings NUMBER(3)
    nestfate VARCHAR2(10)
    nestfailurecode NUMBER(2)
    I want to group the data by treecluster, treenumber, year, and nest number and get a max eggs, nestlings, fledglings. I am doing this with the following:
    SELECT treecluster, treenumber, to_char(nestchecksdate, 'YYYY'), nestnumber,
    max(eggs), max(nestlings), max(fledglings)
    FROM nestchecks
    GROUP BY treecluster, treenumber, to_char(nestchecksdate, 'YYYY'), nestnumber;
    This works fine.
    The last record for a year has a nestfate and nestfailurecode value.
    I need to group all information and then also get the nestfate and nestfailurecode for the year. How do I go about getting this information?
    I am really trying to create a summary materialized view based on a data table so the select I am trying to craft would be a part of a create materialized view as SELECT...
    so I want to be able to group the info and add in the nestfate and failurecode in one step.
    Thanks!

    try this:
    SQL> select * from table_tree;
    TREECLUSTER TREENUMBER NESTCHECK NESTNUMBER       EGGS  NESTLINGS FLEDGLINGS NESTFATE   NESTFAILURECODE
              4        167 17-MAY-00          2          0          0
              4        167 24-MAY-00          2          3          0
              4        167 30-MAY-00          2          3          0
              4        167 12-JUN-00          2          0          1            FAILURE                  2
    select a.treecluster, a.treenumber, to_char(a.nestyear,'YYYY') nestyear,
           a.nestnumber, a.eggs, a.nestlings, a.fledglings, a.nestfate, a.nestfailurecode
    from   (select max(treecluster) treecluster, max(treenumber) treenumber,
                   max(nestchecksdate) nestyear,
                   max(nestnumber) nestnumber, max(eggs) eggs, max(nestlings) nestlings,
                   nvl(max(FLEDGLINGS),0) FLEDGLINGS, max(NESTFATE) NESTFATE,
                   max(nestfailurecode) nestfailurecode
            from table_tree) a
    TREECLUSTER TREENUMBER NEST NESTNUMBER       EGGS  NESTLINGS FLEDGLINGS NESTFATE   NESTFAILURECODE
              4        167 2000          2          3          1          0 FAILURE                  2hope this helps

  • Create Materialized View ORA-01723: zero-length columns are not allowed

    I am trying to create a materialized view which derives a column from a function and I get: ORA-01723: zero-length columns are not allowed.
    I am using 10gR2 with the following definition (simple version):
    CREATE MATERIALIZED VIEW AS
    SELECT
    function_name(column_name) COLUMN_ALIAS
    FROM table_name;
    I have even tried to cast it like below:
    CREATE MATERIALIZED VIEW AS
    SELECT
    CAST(function_name(column_name) AS VARCHAR2(200)) COLUMN_ALIAS
    FROM table_name;
    My function does have an exception to return a value even if no values are found.
    I have looked all over for the solution. Does anyone have a way around this issue? I really need my function to derive the column as it has business rules which I cannot join into my materialized view definition. My only hope around this is to insert the values into a table and then create a materialized view from that table, I don't want to do that if someone has a solution around this.
    Any help would be greatly appreciated.
    Thank you,
    Kyle
    Edited by: Kyle Miller on Apr 19, 2011 8:28 AM

    Have you tried creating a table with the correct structure and then creating the materialized view based on the prebuilt table as described here...
    http://www.oaktable.net/content/ultra-fast-mv-alteration-using-prebuilt-table-option
    Cheers
    Ben

  • How to create an ODS based on a particular table

    Can Anybody tell me how to create an ODS based on a particular table and what are the basic requirements for that

    Hi Priya,
    If my understanding is right, you want to create an ODS based on a database table.
    Here, I will assume that you already know how to create an ODS. Otherwise, do let me know so that I can guide you on how to do it.
    Basically, an ODS consists of two important sections i.e.
    1. Key Fields
    2. Data Fields
    First, we must identify what are the field(s) in the table that make its records unique. You can think of this as database's primary key(s) e.g. Document Number. These field(s) must be inserted in ODS' Key Fields section. You can only insert Characteristics in Key Fields and the InfoObjects in this section will uniquely identify an ODS record or line item.
    Next, you can include the rest of the fields (either Characteristics and Key Figures) in ODS' Data Fields and activate the ODS.
    Having done that, you have already successfully create an ODS based on a database table.
    Hope that helps.
    Best wishes,
    Syuhair.

  • Grand Total Not working on Materialized view based table ??

    Hi all,
    I have a complex report report by using sum and decode function. I precalculated my requirment in database and then create a materialized view based on my sql statement. I import this view in physical and BM model and its results very fine and efficient. But the problem create when I implement Grand Total on my report in table view it did'nt work means (Grand Total is not working on this MV based table) Any idea why ??
    any reply would by higly appriciated.
    Regards

    Hi Zishan,
    Check the Aggregation Rule and set it to sum in the table view.
    That is go to the "edit formula" tab of the column for which you want grand total and set that to sum.
    Hope this will help.
    Thanks
    Ashok

  • Error while creating materialized view which using database link

    Helo!
    I'm getting error "ORA-00942: table or view does not exist" when I want to create materialized view.
    Details:
    1. On destination database I create a database link:
    CREATE DATABASE LINK SDATABASE
    CONNECT TO MYUSER
    IDENTIFIED BY MYUSERPASS
    USING 'ORCL';
    => Command "SELECT * FROM TABLE1@SDATABASE" returns data normally!
    2. On source database I create MATERIALIZED VIEW LOG:
    CREATE MATERIALIZED VIEW LOG
    ON TABLE1
    WITH PRIMARY KEY
    INCLUDING NEW VALUES;
    3. Now, when I want to create MATERIALIZED VIEW on destination database:
    CREATE MATERIALIZED VIEW TABLE1
    REFRESH FAST
    START WITH SYSDATE
    NEXT SYSDATE + 1/1440
    WITH PRIMARY KEY
    AS SELECT * FROM TABLE1@SDATABASE;
    ...I get error "ORA-00942: table or view does not exist"!
    How is that possible if command "SELECT * FROM TABLE1@SDATABASE" returns data normally?
    Thanks,
    Voranc

    And, I'm using Oracle 10g.
    Voranc

  • Create materialized View fails with "table or view does not exist"

    DB: 10.2.0.4
    OS: Win 2003
    Hi,
    Here in my tests, i have 2 databases (A(source) and B(backup)), and i am trying to create an mview in database B to replicate data from one test table from database A, only for test purpose. I'm getting the error "table or view does not exist" when i try to create a mview with REFRESH FAST. Here is my code:
    CREATE MATERIALIZED VIEW TESTES.TAB_TESTES_REPLIC_MVIEW_02
    REFRESH FAST
    START WITH TO_DATE('21/02/2012 18:50:00', 'DD/MM/YYYY HH24:MI:SS')
    NEXT SYSDATE + 1/24/60
    WITH PRIMARY KEY
    AS SELECT REGISTRO1,
    REGISTRO2
    FROM TESTES.TAB_TESTES_REPLIC_MVIEW_02@DB_LINK_ORA10;
    The dblink is workig fine(dblink user has select privilege on TESTES.TAB_TESTES_REPLIC_MVIEW_02), and i have created the mview log on database A.
    Where is my mistake.
    Thanks a lot.
    Edited by: Fabricio_Jorge on 21/02/2012 19:06

    I found the solution.
    I had to grant SELECT on the mview log. The name is avaiable in DBA_MVIEW_LOGS

  • Create materialized view in SE referring table in EE

    Hi DBAs,
    I am trying to create a Materialized view on Oracle 10g Standard Edition which is installed on Linux Debian Lenny.
    The master table is on Oracle 10g Enterprise Edition installed on Red Hat Linux 4.1.2.
    When I run,
    create materialized view t1 build immediate refresh fast as (select * from aksharaemsmigrated.t1@db102)
    i get,
    ORA-12028: materialized view type is not supported by master site
    When I run,
    create materialized view t1 build immediate refresh fast on commit as (select * from aksharaemsmigrated.t1@db102);
    I get,
    ORA-01031: insufficient privileges
    When I run,
    select * from aksharaemsmigrated.t1@db102
    I get,
    the rows from aksharaemsmigrated.t1@db102
    NOTE: 'db102' is remote DB on 10g EE for which I created db link.
    I am able to create Mview for local table.
    Is this not supported? I mean creating Mview on Oracle SE referring base table from Oracle EE.
    I have to give solution soon. Can you please throw some light.
    Regards,
    Vijay

    Don't put select statement inside parantheses.
    Test these
    create table x1 as select * from aksharaemsmigrated.t1@db102;
    create materialized view t1 build immediate refresh fast as select * from aksharaemsmigrated.t1@db102 ;Note that you cannot create an MV that is REFRESH ON COMMIT when across Databases.
    See my explanation at http://hemantoracledba.blogspot.com/2008/06/mvs-with-refresh-on-commit-cannot-be.html
    Hemant K Chitale

  • Can we create materialized view on the top of another materialized view.

    Hi ,
    can we create materialized view on the top of another materialized view.
    Thanks
    Naveen

    Welcome , Just remember is not good apporch to do that since performance when MV refresh
    Please mark this thread as answered .

  • CREATE MATERIALIZED VIEW - TABLE OR VIEW DOES NOT EXIST

    Anybody can help me? Why could this happen?
    SQL> CREATE MATERIALIZED VIEW LESTARI.YIELD_BI_ACTUAL_PLAN_BLOK_MVU
    2 TABLESPACE MVU
    3 NOCACHE
    4 NOPARALLEL
    5 REFRESH FORCE
    6 START WITH TO_DATE('19-APR-2005 18:00:00','DD-MON-YYYY HH24:MI:SS')
    7 WITH PRIMARY KEY
    8 USING DEFAULT LOCAL ROLLBACK SEGMENT
    9 DISABLE QUERY REWRITE AS
    10 SELECT PT,
    11 TO_CHAR(TANGGAL,'MMYYYY')PERIODE,
    12 AFDELING,
    13 BLOK,
    14 TH_TANAM,
    15 SUM(TON_TERIMA) TON_TERIMA,
    16 SUM(JJG_TERIMA) JJG_TERIMA,
    17 SUM(JJG_PANEN) JJG_PANEN,
    18 SUM(HK) HK, (LS_TANAM),
    19 DECODE(LS_TANAM,0,0,ROUND((SUM(TON_TERIMA)/(LS_TANAM)),2)) YIELD,
    20 HITUNG_STANDARD_YIELD (PT, TH_TANAM,TO_CHAR(TANGGAL,'MMYYYY')) YIELD_STD,
    21 DECODE(SUM(JJG_TERIMA),0,0,ROUND(SUM(TON_TERIMA)*1000/SUM(JJG_TERIMA),2)) BJR,
    22 HITUNG_STANDARD_BJR_TH_TANAM(PT,TH_TANAM) BJR_STD,
    23 DECODE(SUM(HK),0,0,ROUND((SUM(TON_TERIMA)*1000/SUM(HK)),2)) OP,
    24 DECODE(SUM(JJG_TERIMA),0,0,HITUNG_STANDARD_OUTPUT_PEMANEN(ROUND(SUM(TON_TERIMA)*1000/SUM(JJG_
    TERIMA),2))) OP_STD,
    25 MAX(POTENSI) POTENSI,
    26 MAX(DIS_POT) DIS_POT,
    27 DECODE(LS_TANAM,0,0,ROUND(MAX(POTENSI)*MAX(DIS_POT)/100/LS_TANAM,2)) YIELD_POTENSI,
    28 MAX(RAPIM) RAPIM,
    29 MAX(DIS_RAPIM) DIS_RAPIM,
    30 DECODE(LS_TANAM,0,0,ROUND(MAX(RAPIM)*MAX(DIS_RAPIM)/100/LS_TANAM,2)) YIELD_RAPIM
    31 FROM (SELECT B.*, A.LS_TANAM, A.TH_TANAM, POTENSI, DIS_POT, RAPIM, DIS_RAPIM
    32 FROM ASSET_BLOK_VU A, T_TANAMAN B, T_PLAN_TANAMAN C, T_DISTRIBUSI_PLAN_TANAMAN D
    33 WHERE A.PT = B.PT
    34 AND B.PT = C.PT
    35 AND C.PT = D.PT
    36 AND A.KD_AFD = B.AFDELING
    37 AND B.AFDELING = C.AFDELING
    38 AND A.KD_BLOK = B.BLOK
    39 AND B.BLOK = C.BLOK
    40 AND A.TAHUN = TO_CHAR(TANGGAL,'RRRR')
    41 AND TO_CHAR(TANGGAL,'MM')=D.BULAN
    42 AND A.TAHUN = D.TAHUN
    43 AND A.TAHUN = C.TAHUN
    44 AND A.LS_TANAM > 0) A
    45 GROUP BY PT, TO_CHAR(TANGGAL,'MMYYYY'), AFDELING, BLOK, LS_TANAM, TH_TANAM
    46 /
    CREATE MATERIALIZED VIEW LESTARI.YIELD_BI_ACTUAL_PLAN_BLOK_MVU
    ERROR AT LINE 1:
    ORA-00942: TABLE OR VIEW DOES NOT EXIST

    32 FROM ASSET_BLOK_VU A, T_TANAMAN B, T_PLAN_TANAMAN C, T_DISTRIBUSI_PLAN_TANAMAN D
    Either of these tables/views do not exist. Check the spelling of the table/view names

Maybe you are looking for

  • Error while invoking Create Applicant api thru apps adapter

    Hi All, We are trying to invoke Create Applicant API(hr_applicant_api.create_applicant) thru apps adapter but we are getting below error message - (we are using ebs 12.1.1 and soa 11.1.1.3) Exception occured when binding was invoked. Exception occure

  • Saving PDF files in AIR

    Hi there, I'm trying to save a template PDF form file that has been loaded using htmlLoader & filled using AS 3 along with a document-level JavaScript in the PDF file. I can't seem to find a way to save the file to disk. I looked at AlivePDF but it s

  • CR XI SDK Printing Services

    Hi Expert, My customer have one invoice program which generate invoice document in AS400 machine. This invoice program was written with RPG/CL programming language. However, they having difficulty for print out thier invoices details in Bar Code and

  • Failed to close connection for data source "EntityDataSource"

    Hi All, I have deployed some PowerView reports on SharePoint 2013. I have open it on sharepoint, wait for 5 mins & then I try to change any filter then I am getting following error as Failed to close connection for data source "EntityDataSource" Erro

  • ISE basic configuration.

    Hi Guys, Need help regarding ISE configuration. I have ISE in the network and want to do some basic  like simple authentication , authorization and some policies with the wired clients. Please provide any docuemnt or links to do this (too urgent) Tha