View with billion data

DEAR EXPERTS,
TABLE_A WITH 25000 REC
TABLE_B WITH 300000 REC
THE SELECT STATEMENT USED IN VIEW AND DATASET WILL RETURN 25000 X 2300 ie. one RESULT SET IS
TABLE_A WILL GET 2300 MATCHING ROWS IN TABLE_B
I NEED TOP 100 REC FROM EACH RESULTSET FROM 25000 SETS
I AM TRYING WITH THIS 2 APPROCHES.. SUGGEST ME WHICH IS BEST OR ANY OTHER WAY TO GET MY RESULT
INSERT INTO TABLE_C
WITH DATASET
AS
SELECT A.CID,
     A.ZIPCD,
     ROW_NUMBER() OVER (PARTITION BY A.CID,A.ZIPCD ORDER BY GET_DIST_FN(A.LAT,B.LAT,A.LONG,B.LONG) RANK
     FROM TABLE_A A,TABLE_B B
     WHERE A.CID = B.CID
SELECT * FROM DATASET WHERE RANK < 100
CREATE VIEW RES_VW AS
     SELECT A.CID,
          A.ZIPCD,
          ROW_NUMBER() OVER (PARTITION BY A.CID,A.ZIPCD ORDER BY GET_DIST_FN(A.LAT,B.LAT,A.LONG,B.LONG) RANK
     FROM TABLE_A A,TABLE_B B
     WHERE A.CID = B.CID
INSERT INTO TABLE_C
SELECT * FROM RES_VW WHERE RANK < 100
MANY THANKS
KALINGA

WE'VE ONLY HAD 4 HRS 25 MINS TO READ YOUR SHOUTING WE HAVN'T HAD TIME TO DIGEST IT YET BOTH SOLUTIONS LOOK THE SAME TO ME

Similar Messages

  • BW Modeling Tools - open ods view with no data in BW

    Hi,
    We've created an Open ODS View in HANA Studio on HANA Model. HANA model has data in HANA Studio and BI reports on it, but when we look at the Open ODS View in BW, we don't see any data. We followed all prerequisites in installation guide and assigned authorizations to developers: https://websmp102.sap-ag.de/~sapidb/011000358700001144122013E
    We have dual schema HANA approach with BW sitting on own Schema.
    Could the BW system user be missing authorization?
    Sonni

    There is a nice Blog about mapping DBMS Users in SAP NetWeaver AS ABAP 7.40
    Best Regards Roland

  • Oracle Materialized view with xmltype data type

    this the table having in db1 i need to create materialized view db2 for this table i have followed below steps..
    create table WORKSHEETMASTER
    METHODID NUMBER(10),
    WORKSHEETCODE VARCHAR2(50 BYTE) not null,
    WORKSHEET SYS.XMLTYPE);
    create materialized view log on db1.WORKSHEETMASTER;
    db2
    CREATE MATERIALIZED VIEW WORKSHEETMASTER
    REFRESH FAST ON DEMAND
    AS
    SELECT METHODID,
    WORKSHEETCODE,
    worksheet FROM db1.WORKSHEETMASTER@DBLINK;
    when i was create materialized view above script in db2 iam getting error
    ORA-22992:cannot use LOB locators selected from remote tables
    like this when remove the worksheet column created succesfully may know how achieve this problem
    my database version 11g iam searched some sceniour not full filled
    need for help
    thanks

    this the table having with in DB1
    create table WORKSHEETMASTER
    METHODID NUMBER(10),
    WORKSHEETCODE VARCHAR2(50 BYTE) not null,
    WORKSHEET SYS.XMLTYPE,
    WORKSHEETID NUMBER primary key,
    CREATEDDATE DATE,
    CREATEDBY VARCHAR2(50 BYTE),
    WORKSHEETNAME VARCHAR2(50 BYTE),
    UPDATEDDATE DATE,
    UPDATEDBY VARCHAR2(50 BYTE),
    NOOFROWS NUMBER(3),
    NOOFCOLUMNS NUMBER(3),
    WORKSHEETTYPE CHAR(1 BYTE),
    SUBSTRATEUSED VARCHAR2(50 BYTE),
    STATUS NUMBER(1),
    APPROVEDBY VARCHAR2(50 BYTE),
    APPROVED CHAR(1 BYTE) default 'N',
    APPROVALREMARKS VARCHAR2(100 BYTE),
    LNG_WORKSHEETNAME VARCHAR2(50)
    iam trying to create materailzed view in db2
    create materialized view WORKSHEETMASTER
    refresh fast on demand
    as
    SELECT METHODID,
    WORKSHEETCODE,
    WORKSHEETID,
    worksheet,
    CREATEDDATE,
    CREATEDBY,
    WORKSHEETNAME,
    UPDATEDDATE,
    UPDATEDBY,
    NOOFROWS,
    NOOFCOLUMNS ,
    WORKSHEETTYPE,
    SUBSTRATEUSED,
    STATUS,
    APPROVEDBY,
    APPROVED,
    APPROVALREMARKS,
    LNG_WORKSHEETNAME FROM db1.WORKSHEETMASTER@DBLINK; --remote database
    iam creating above scriprt in db2 getting error this my total script

  • Very strange bug when using a view with a date

    Hi,
    Just thought I'd point out this bug I'd found and see if anybody has had similar problems.
    I'm connecting to Oracle 9i from servlets using the thin client-side JDBC driver. In the Oracle schema I've got a few views to another schema set up. One of them looks like this:
    select
    blah
    blah
    from
    projects
    where
    project_start_date between '1-Apr-2000' and '31-Mar-2010'
    Nothing wrong with this, you'd think. And indeed, the view works fine and any valid queries on the view also work fine if they're performed from anywhere apart from my servlets. The servlets can perform queries on all my other views but they think that this particular view is completely empty.
    As soon as I change the view to:
    project_start_date > '1-Apr-2000'
    the servlets can see the data in the view.
    Hope all this made sense. Anybody else had any similar problems?
    Chris.

    Any time you want to do a date comparison, you really want to do an explicit to_date conversion rather than relying on Oracle to do it implicitly. I'll wager that if you change the view to
    SELECT <columnList>
      FROM projects
    WHERE project_start_date BETWEEN to_date('1-Apr-2000', 'DD-MON-YYYY') and to_date('31-Mar-2010', 'DD-MON-YYYY')that everything will work.
    Justin

  • Materialized view with xmltype data type

    Hello to all,
    I have a challenge with my 10g r2 database. I need to make a materialized view from a table in this format:
    Name Null? Type
    RECID NOT NULL VARCHAR2(200)
    XMLRECORD XMLTYPE
    ,my problem is that (as i read from docs) i cant make the view refreshable on commit and also i cant refresh the mv in fast mode ( i dont need to refresh mv complete - takes too long).
    Do you have a hint for this?
    Thank you in advance.
    Daniel

    hi,
    I cant upgrade to 11g.Also i cant change the table structure.
    Here is a sample of xmltype field content:
    RECID      XMLRECORD
    D00009999      <row id='D100009999'><c2>10000</c2><c3>xxxxx</c3><c5>xxxx..
    And i need to extract in the mv the data from c2, c3 and so on.
    Still waiting for a hint.
    Thank you.

  • Refresh fails on materialized view with CLOB data type

    Hi,
    Hope somebody can help me with this issue.
    Some materialized views get status broken on refreshment, but only sometime. When I try to refresh them manually I get following message: "ORA-01400: cannot insert NULL into...". But I know for sure that there are no NULL values in the master table, MV and master tables are declared in the same way and all columns in master tables are NOT NULL columns. Another ting is that this error I get only on columns with data type CLOB.
    Please, help!
    /Julia

    hi,
    I cant upgrade to 11g.Also i cant change the table structure.
    Here is a sample of xmltype field content:
    RECID      XMLRECORD
    D00009999      <row id='D100009999'><c2>10000</c2><c3>xxxxx</c3><c5>xxxx..
    And i need to extract in the mv the data from c2, c3 and so on.
    Still waiting for a hint.
    Thank you.

  • Creating a View with "clipped" data

    Hi all,
    I'm wondering if someone might know if it's possible to have clipped data in a view without clipping the original data that the view is drawing from.
    The problem we have is that we have a full dataset that we need to keep in a complete state (as a table in Oracle). We want to be able to create a View that will display a subset of data from this table, however, some of the objects in the full dataset cross a boundary and for these objects, we want the View to only show the part of the object within that boundary.
    I know we can clip the original layer but we ideally need to keep that layer untouched and do the clipping on-the-fly in the View. Is this possible?
    Thanks for any help you can give,
    Cheers, Paul

    Do you want to:
    create view my_clip
    as
    select a.id,
    a.attribute,
    mdsys.sdo_intersection(a.geometry,b.geometry,0.005) as geometry
    from mycliparea b,
    mytable a
    where sdo_anyinteract(a.geometry,b.geometry) = 'TRUE'
    Now this will work but to get performance you will have to do one of two things:
    1. Create a function based index. See doco or other postings in this forum for examples
    of how to do this.
    2. Change the view from an ordinary view to a materialized view. And then create
    a normal spatial index on the computed shape. (I recommend the use of
    these as against ordinary views.)
    However, Bryan is right, the problem with SDO_INTERSECTION is that it can return:
    1. Polygons;
    2. Lines;
    3. Points;
    4. Compound objects containing one or more of the above.
    If you want polygons only, then you need to extract them.
    <selfpromtion>
    I have written a set of extraction functions that do this which are available for free.
    Contact me at "spatialdbadvisor at netspace dot net dot au" or "simon at spatialdbadvisor dot com"
    </selfpromotion>
    The correct view definition using one of my functions would be:
    create view my_clip
    as
    select a.id,
    a.attribute,
    geom.ExtractPolygon(
    mdsys.sdo_intersection(a.geometry,b.geometry,0.005))
    as geometry
    from mycliparea b,
    mytable a
    where sdo_anyinteract(a.geometry,b.geometry) = 'TRUE'
    regards
    S

  • Env: Weblogic 8.1.5 Getting empty return in test view with new data

    Hi, I am using Weblogic 8.1.5, Basically a run down of this issue is that my response in test view, is completely Empty when I add a new piece of data in the response current code example below:
      SuccessResponseType srtype = SuccessResponseType.Factory.newInstance();
                srtype.setFacDesig(inFacDesig);
                srtype.setFacType(inFacType);
                srtype.setFacTermA(inTermA);
                srtype.setFacTermZ(inTermZ);
                srtype.setNotes(NoteRtn);
                srtype.setE3Array(rtn);
                Response.setSuccessResponse(srtype);Basically when srtype.setNotes(NoteRtn); is added in test view NONE of the values get populated, but once I comment srtype.setNotes(NoteRtn); out all the other values get populated in the response. At this point I am just plugging dummy data for the value of NoteRtn just to figure out why its doing this. Here is some example output.
    This is a response when the new line is commented out : (Its a decent amount of stuff so I cut some out, but you get the idea)
    <ns:successResponse>
    <ns:FacDesig>20027</ns:FacDesig>
    <ns:FacType>T1F</ns:FacType>
    <ns:FacTermA>MMPHTNMAFD1</ns:FacTermA>
    <ns:FacTermZ>MMPHTNMA43T</ns:FacTermZ>
    <ns:E3info>
    <ns:E3FacDesig>7101</ns:E3FacDesig>
    <ns:E3FacType>E3</ns:E3FacType>
    </ns:E3info>
    </ns:successResponse>
    This is what I get when I add in srtype.setNotes(NoteRtn);
    <ns:successResponse>
    </ns:successResponse>
    its just completely empty. My experience with weblogic and webservices is limited as it is, I am basically looking for someone to point me in the right direction for getting this resolved. I did not code the app I am just enhancing to in essence just add 2 strings of data to the response. The .xsd file is properly set up with the new elements and the response in the .xsd is properly set up. I am just at a loss as to what can cause the whole response to go kaput, by adding one more response type.
    Anyway, Thanks in advance

    Hi, I am using Weblogic 8.1.5, Basically a run down of this issue is that my response in test view, is completely Empty when I add a new piece of data in the response current code example below:
      SuccessResponseType srtype = SuccessResponseType.Factory.newInstance();
                srtype.setFacDesig(inFacDesig);
                srtype.setFacType(inFacType);
                srtype.setFacTermA(inTermA);
                srtype.setFacTermZ(inTermZ);
                srtype.setNotes(NoteRtn);
                srtype.setE3Array(rtn);
                Response.setSuccessResponse(srtype);Basically when srtype.setNotes(NoteRtn); is added in test view NONE of the values get populated, but once I comment srtype.setNotes(NoteRtn); out all the other values get populated in the response. At this point I am just plugging dummy data for the value of NoteRtn just to figure out why its doing this. Here is some example output.
    This is a response when the new line is commented out : (Its a decent amount of stuff so I cut some out, but you get the idea)
    <ns:successResponse>
    <ns:FacDesig>20027</ns:FacDesig>
    <ns:FacType>T1F</ns:FacType>
    <ns:FacTermA>MMPHTNMAFD1</ns:FacTermA>
    <ns:FacTermZ>MMPHTNMA43T</ns:FacTermZ>
    <ns:E3info>
    <ns:E3FacDesig>7101</ns:E3FacDesig>
    <ns:E3FacType>E3</ns:E3FacType>
    </ns:E3info>
    </ns:successResponse>
    This is what I get when I add in srtype.setNotes(NoteRtn);
    <ns:successResponse>
    </ns:successResponse>
    its just completely empty. My experience with weblogic and webservices is limited as it is, I am basically looking for someone to point me in the right direction for getting this resolved. I did not code the app I am just enhancing to in essence just add 2 strings of data to the response. The .xsd file is properly set up with the new elements and the response in the .xsd is properly set up. I am just at a loss as to what can cause the whole response to go kaput, by adding one more response type.
    Anyway, Thanks in advance

  • How do you set up Paged View with Spry Data Sets

    Hope someone can help. I have constructed a Spry data set using a html table and want  to use the paged view javascript to limit the amount of rows displayed on one page at a time to 10 then forcing a new page. Have found the java script file in the spry 1.6 download and attached it to the spry assets folder and have followed the instructions found at the Adobe development center   http://labs.adobe.com/technologies/spry/articles/pager/index.html        with no luck. Have attached  files to show what I have done. If someone could look at this and point out my error or suggest a better way I would be grateful. I am not a code warrior so simple  instructions would be so helpful. Many thanks in advance.
    Here is the code
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.adobe.com/spry">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Untitled Document</title>
    <script src="SpryAssets/SpryData.js" type="text/javascript"></script>
    <script src="SpryAssets/SpryHTMLDataSet.js" type="text/javascript"></script>
    <script src="SpryAssets/SpryPagedView .js"></script>
    <link href="SpryAssets/SpryMasterDetail.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
    <!--
    var ds1 = new Spry.Data.HTMLDataSet("table.html", "ds1", {sortOnLoad: "Name", sortOrderOnLoad: "ascending"});
    ds1.setColumnType("Phone", "number");
    var pv1 = new Spry.Data.PagedView( ds1 ,{pageSize: 10});
    //-->
    </script>
    </head>
    <body>
    <input type="button" value="First" onclick="pv1.firstPage();" />
    <input type="button" value="Prev" onclick="pv1.previousPage();" />
    <input type="button" value="Next" onclick="pv1.nextPage();" />
    <input type="button" value="Last" onclick="pv1.lastPage();" /
    <div class="MasterDetail">
      <div spry:region="ds1" class="MasterContainer">
        <div class="MasterColumn" spry:repeat="ds1" spry:setrow="ds1" spry:hover="MasterColumnHover" spry:select="MasterColumnSelected">{Name}</div>
      </div>
      <div spry:detailregion="ds1" class="DetailContainer">
         <div class="DetailColumn">{Name}</div>
        <div class="DetailColumn">{Product}</div>
        <div class="DetailColumn">{Contact}</div>
        <div class="DetailColumn">{Phone}</div>
      </div>
      <br style="clear:both" />
    </div>
    <input type="button" value="First" onclick="pv1.firstPage();" />
    <input type="button" value="Prev" onclick="pv1.previousPage();" />
    <input type="button" value="Next" onclick="pv1.nextPage();" />
    <input type="button" value="Last" onclick="pv1.lastPage();" /
    </body>
    </html>

    Your region needs to refer to the pageview, not the dataset.  Your paged view var is already looking at/pulling in the ds.
    I would change the following code:
    <div spry:detailregion="ds1" class="DetailContainer">
         <div class="DetailColumn">{Name}</div>
        <div class="DetailColumn">{Product}</div>
        <div class="DetailColumn">{Contact}</div>
        <div class="DetailColumn">{Phone}</div>
      </div>
    to read the following:
    <div spry:region="pv1">
    <table>
    <tr spry:repeat="pv1">
    <td>{Name}</td>
    <td>{Product}</td>
    <td>{Contact}</td>
    <td>{Phone}</td>
    </tr>
    </table>
    Regards,
    Michael

  • Instead of trigger on view with CLOB data

    I have writed Instead of trigger for view "article(id,text)" with CLOB
    field "text".
    create or replace trigger v_article_insert
    instead of insert on v_article
    for each row
    declare
    begin
    insert into article(id,text) values(id,:new.text);
    end v_article_insert;
    When I try to do DML (insert, update), forexample:
    insert into v_article(text) values('bla-bla')
    I get:
    ORA-25008 no implicit conversion to LOB datatype in instead-of trigger.
    ( Cause: When inserting or updating a view using instead-of trigger, the
    new value for a LOB view column is of a different datatype.
    Action: Specified a LOB value as the new value for the LOB view
    column.)
    insert into v_article(text) values(empty_clob()) - It works...
    What does it mean and what is right syntax for DML for CLOB fields in
    instead of triggers?

    When inserting CLOBs you create the row with an Empty_Clob() to initialize the CLOB field. Then you can update the empty CLOB with your CLOB value.
    The error message is telling you that Oracle will not convert your CLOB to the initialization value needed.

  • Create Table/View with Validity Date Control?

    Hi,
    does anyone know the easiest way for me to create a custom view that uses validity dates to control records by time periods, similar to time constraint 1 infotypes in HR?
    For instance, if I define a table to store entries like so
    Client (Key): 100
    PSubArea (Key): C001
    Grouping (Key): 01
    End Date (Key): 99991231
    Begin Date: 18000101
    and I want to ensure that there can only be one record active on any given date, how can I prevent someone from creating a record from 20061107 - 20071107 that overlaps the existing record?
    Is there a setting I missed?
    Add conditions to generated view coding? Is there a good example?
    Thanks

    K, so I found these
    <a href="http://help.sap.com/saphelp_nw04s/helpdata/en/91/ca9fb3a9d111d1a5690000e82deaaa/content.htm">SAP Help - Time-Dependent Table/View</a>
    <a href="http://help.sap.com/saphelp_nw04s/helpdata/en/c1/df5c3c3b067331e10000000a114084/content.htm">Generate Time-Dependence</a>
    I'll give it a whirl now.

  • DB View with unknown data

    Hi Gurus,
    I have a interesting problem.There is a Z table ( transparent ).Lets say ZDUMMY_TABLE.When i try to see the data in ZDUMMY_TABLE from se16 i get an error like
    "No database table exists for table ZDUMMY_TABLE" .
    On the other hand there is a database view.ie. ZDUMMY_VIEW.In this view there is only one table.This table is the ZDUMMY_TABLE.When i try to see the data in ZDUMMY_VIEW from se16, it returns almost 100 lines of data.
    By the way, the table ZDUMMY_TABLE has only one key field and this field is MANDT.
    I couldnt figure this problem.
    Thanks for your help.
    Best regards,
    Burak

    >
    Burak Turnacigil wrote:
    ZDUMMY_TABLE.When i try to see the data in ZDUMMY_VIEW from se16, it returns almost 100 lines of data.
    By the way, the table ZDUMMY_TABLE has only one key field and this field is MANDT.
    Not possible.
    Rob

  • Speed of simple query to complicated view with few data increases after 3rd execution

    Hello everyone,
    I'm developing an OLTP application where a complicated view exists that is queried often by the application through Tomcat.
    The application itself uses a framework that generates the SQLs on the fly, so no parameter binding is possible.
    What I experience is the following:
    If I execute the query from the application, it always takes about 3 seconds to complete, also for subsequent runs (Tomcat uses ojdbc6.jar)
    If I execute the same query from SQL Developer it is the same behaviour. If I execute from Toad, it's the same behaviour for the first two runs, afterwards it executes in <50ms.
    I assume that it has something to do with plan creation/caching. How can I prove it and - best - fix it?
    Right now I'm using 11.2 XE running on my laptop together with Tomcat. In production it will be on a 11.2 SE1.
    The plan itself shows little to no cost. This is expected, as the tables are almost empty and all joins are indexed as needed (the last row of 103 steps is):
    |   0 | SELECT STATEMENT                                        
    |                           
    |
    1 |  4876 |
    26  (12)| 00:00:01 |
    The statement itself is
      SELECT
        .....all view columns...
        FROM myview
       WHERE (myview.user_id = 1010)
    The statement is always generated like this, but with changing user_id for different users. The plan ID is always the same, no matter what the user_id is.
    Is it possible to have the queries fast from the beginning / 2nd run of the query?
    Is is only happening on 11.2 XE and will be gone in 11.2 SE1?
    Thank you & Best regards,
    Blama

    Hello,
    thanks for pointing me in the right direction. I read http://docs.oracle.com/cd/E18283_01/server.112/e16638/optimops.htm and start to understand the feature.
    From the examples there and in http://www.oracle.com/technetwork/articles/sql/11g-sqlplanmanagement-101938.html I'd expect different behaviour than I get. Please see this example:
    I'll use 3 SQLs in the example. These are:
    1:
    SELECT sql_id, plan_hash_value, CHILD_NUMBER, EXECUTIONS, BUFFER_GETS, IS_BIND_SENSITIVE AS "BIND_SENSI",
           IS_BIND_AWARE AS "BIND_AWARE", IS_SHAREABLE AS "BIND_SHARE"
    FROM   V$SQL x
    WHERE  SQL_TEXT LIKE 'SELECT /*mytest*/%';
    2:
    SELECT /*mytest*/ * FROM V_LEAD_MATCHED_UNDISMISSED WHERE user_id = 1010;
    3:
    SELECT /*mytest*/ * FROM V_LEAD_MATCHED_UNDISMISSED WHERE user_id = 1011;
    The test:
    SQL1: no rows returned.
    SQL2: 2 sec, 2 rows (expected).
    SQL1:
    SQL_ID        PLAN_HASH_VALUE CHILD_NUMBER EXECUTIONS BUFFER_GETS BIND_SENSI BIND_AWARE BIND_SHARE
    gz8m7d1k2ha27      3045614858            0          1         293 N          N          Y       
    SQL2: 3 secs, 2 rows.
    SQL1:
    SQL_ID        PLAN_HASH_VALUE CHILD_NUMBER EXECUTIONS BUFFER_GETS BIND_SENSI BIND_AWARE BIND_SHARE
    gz8m7d1k2ha27      3045614858            0          1         293 N          N          N        
    gz8m7d1k2ha27      1139782015            1          1         293 N          N          Y       
    SQL2: 3 secs, 2 rows.
    SQL1:
    SQL_ID        PLAN_HASH_VALUE CHILD_NUMBER EXECUTIONS BUFFER_GETS BIND_SENSI BIND_AWARE BIND_SHARE
    gz8m7d1k2ha27      3045614858            0          1         293 N          N          N        
    gz8m7d1k2ha27      1139782015            1          1         293 N          N          N        
    gz8m7d1k2ha27      1139782015            2          1         293 N          N          Y
    SQL2: 54 millisecs(!), 2 rows.
    SQL1:
    SQL_ID        PLAN_HASH_VALUE CHILD_NUMBER EXECUTIONS BUFFER_GETS BIND_SENSI BIND_AWARE BIND_SHARE
    gz8m7d1k2ha27      3045614858            0          1         293 N          N          N        
    gz8m7d1k2ha27      1139782015            1          1         293 N          N          N        
    gz8m7d1k2ha27      1139782015            2          2         377 N          N          Y
    SQL2: 65 millisecs(!), 2 rows.
    SQL1:
    SQL_ID        PLAN_HASH_VALUE CHILD_NUMBER EXECUTIONS BUFFER_GETS BIND_SENSI BIND_AWARE BIND_SHARE
    gz8m7d1k2ha27      3045614858            0          1         293 N          N          N        
    gz8m7d1k2ha27      1139782015            1          1         293 N          N          N        
    gz8m7d1k2ha27      1139782015            2          3         461 N          N          Y
    Now everytime the statement is issued, it would use the fast child_number=2.
    I change the SQL to the one with the new user_id:
    SQL3: 2 secs, 2 rows (expected).
    SQL1:
    SQL_ID        PLAN_HASH_VALUE CHILD_NUMBER EXECUTIONS BUFFER_GETS BIND_SENSI BIND_AWARE BIND_SHARE
    gz8m7d1k2ha27      3045614858            0          1         293 N          N          N        
    gz8m7d1k2ha27      1139782015            1          1         293 N          N          N        
    gz8m7d1k2ha27      1139782015            2          3         461 N          N          Y        
    0psg36f5rf8q2      3045614858            0          1         293 N          N          Y    
    SQL3: 2 secs, 2 rows.
    SQL1:
    SQL_ID        PLAN_HASH_VALUE CHILD_NUMBER EXECUTIONS BUFFER_GETS BIND_SENSI BIND_AWARE BIND_SHARE
    gz8m7d1k2ha27      3045614858            0          1         293 N          N          N        
    gz8m7d1k2ha27      1139782015            1          1         293 N          N          N        
    gz8m7d1k2ha27      1139782015            2          3         461 N          N          Y        
    0psg36f5rf8q2      3045614858            0          1         293 N          N          N        
    0psg36f5rf8q2      1139782015            1          1         293 N          N          Y
    SQL3: 2 secs, 2 rows.
    SQL1:
    SQL_ID        PLAN_HASH_VALUE CHILD_NUMBER EXECUTIONS BUFFER_GETS BIND_SENSI BIND_AWARE BIND_SHARE
    gz8m7d1k2ha27      3045614858            0          1         293 N          N          N        
    gz8m7d1k2ha27      1139782015            1          1         293 N          N          N        
    gz8m7d1k2ha27      1139782015            2          3         461 N          N          Y        
    0psg36f5rf8q2      3045614858            0          1         293 N          N          N        
    0psg36f5rf8q2      1139782015            1          1         293 N          N          N        
    0psg36f5rf8q2      1139782015            2          1         293 N          N          Y 
    SQL3: 55 millisecs(!), 2 rows.
    SQL1:
    SQL_ID        PLAN_HASH_VALUE CHILD_NUMBER EXECUTIONS BUFFER_GETS BIND_SENSI BIND_AWARE BIND_SHARE
    gz8m7d1k2ha27      3045614858            0          1         293 N          N          N        
    gz8m7d1k2ha27      1139782015            1          1         293 N          N          N        
    gz8m7d1k2ha27      1139782015            2          3         461 N          N          Y        
    0psg36f5rf8q2      3045614858            0          1         293 N          N          N        
    0psg36f5rf8q2      1139782015            1          1         293 N          N          N        
    0psg36f5rf8q2      1139782015            2          2         377 N          N          Y
    SQL3: 56 millisecs(!), 2 rows.
    SQL1:
    SQL_ID        PLAN_HASH_VALUE CHILD_NUMBER EXECUTIONS BUFFER_GETS BIND_SENSI BIND_AWARE BIND_SHARE
    gz8m7d1k2ha27      3045614858            0          1         293 N          N          N        
    gz8m7d1k2ha27      1139782015            1          1         293 N          N          N        
    gz8m7d1k2ha27      1139782015            2          3         461 N          N          Y        
    0psg36f5rf8q2      3045614858            0          1         293 N          N          N        
    0psg36f5rf8q2      1139782015            1          1         293 N          N          N        
    0psg36f5rf8q2      1139782015            2          3         461 N          N          Y
    What I notice: The plan_hash_value is the same for each of the 1st executions of a SQL. This is expected, as only the bind parameter("user_id" in the SQL text) differs.
    I wonder if the rest is also OK the way it is. In production the SQL will be called with many different user_ids. Will it always take the steps of generating these three rows in v$sql?
    Is there anything I can do to make the calls 1-3 to every of the different user_id-statements faster? I'm pretty sure that the time it takes is related to query parsing and plan building, but please correct me if I'm wrong.
    Thanks & Best regards,
    Blama

  • Unable to drop materialized view with corrupted data blocks

    Hi,
    The alert log of our database is giving this message
    Wed Jan 31 05:23:13 2007
    ORACLE Instance mesh (pid = 9) - Error 1578 encountered while recovering transaction (6, 15) on object 13355.
    Wed Jan 31 05:23:13 2007
    Errors in file /u01/app/oracle/admin/mesh/bdump/mesh_smon_4369.trc:
    ORA-01578: ORACLE data block corrupted (file # 5, block # 388260)
    ORA-01110: data file 5: '/u03/oradata/mesh/mview.dbf'
    No one is using this mview still oracle is trying to recover this transaction (6, 15).
    when i tried to drop this mview it gives me this error
    ERROR at line 1:
    ORA-01578: ORACLE data block corrupted (file # 5, block # 388260)
    ORA-01110: data file 5: '/u03/oradata/mesh/mview.dbf'
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2255
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2461
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2430
    ORA-06512: at line 1
    I have tried to fix the corrupted data blocks by using dbms_repair package, but of no use.
    I have marked this block to be skipped by using dbms_repair.skip_block but still unable to drop it.
    Please suggest what should I do?
    Thanks in advance
    Anuj

    You are lucky if only your undesirable MV is affected by theese corrupted blocks. This is an advice to do a complete-super-full-hot-cold-middle backup of ypur database and search for any disk for a "possible replace".
    God save us!

  • Need help in creating a view with Encryption for hiding the code used by the multiple users

    Hi,
    Can anyone help me out in creating view with encryption data to hide the stored procedure logic with other users.
    I have create a stored procedure with encryted view but while running this manually temporary views are getting created, therefore the problem is if there are 500 entries then 500 temp views will get created.
    Any solution to aviod creating temporary views, please refer my code below
    USE [etl_validation]
    GO
    /****** Object:  StoredProcedure [dbo].[Pr_DBAccess_mod]    Script Date: 05/23/2014 12:53:22 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROCEDURE [dbo].[Pr_DBAccess_mod](@ETL_CONFIG_ID INT)
    AS
    BEGIN
    DECLARE @openquery NVARCHAR(MAX),
     @DATABASENAME NVARCHAR(100),
     @HIERNAME NVARCHAR(100),
     @TABLENAME NVARCHAR(100),
     @SERVERTYPE NVARCHAR(100),
     @SERVERNAME NVARCHAR(100),
     @USERNAME NVARCHAR(100),
     @PASSWORD NVARCHAR(100),
     @ETL_CONFIG_IDN NVARCHAR(100);
     SET @ETL_CONFIG_IDN=CAST(@ETL_CONFIG_ID AS NVARCHAR);
     SET @TABLENAME='Department';
     SET @SERVERTYPE='SQL';
     SET @SERVERNAME ='192.168.31.176';
     SET @DATABASENAME='AdventureWorks2008R2';
     SET @HIERNAME = 'HumanResources';
     IF @SERVERTYPE='SQL'
     BEGIN
    /*SET @openquery= 'SELECT * INTO ##TestTable
                     FROM OPENROWSET(''SQLNCLI'',''server=192.168.31.176;Trusted_Connection=yes;'','''+@query+''')'
    SET @openquery=  'CREATE VIEW '+@TABLENAME+@ETL_CONFIG_IDN+
                     ' WITH ENCRYPTION AS SELECT * FROM OPENROWSET(''SQLNCLI'',''SERVER='+@SERVERNAME+';TRUSTED_CONNECTION=YES;'',''SELECT * FROM '+@DATABASENAME+'.'+@HIERNAME+'.'+@TABLENAME+''')'
    SELECT @openquery
    END
    EXECUTE sp_executesql @openquery
    END

    Hi aa_rif,
    According to your description and code message, you execute the sp_executesql statement in your stored procedure, it indeed create many views with a tablename and ETL_CONFIG_ID named. If you need not to use these temporary views, you can delete them when
    it contains the tablename in one view name.  
    In addition, if you want to create view with encryption in SQL Server, you can use directly the ENCRYPTION option to encrypt the T-SQL of a view in create view commands, for more information, see:
    http://learnsqlserver.in/4/Create-View-With-Encryption.aspx. if not, you can descript more detail about requriements, so that more forum members can involve into the thread and help you
    out. 
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

Maybe you are looking for

  • Can you get DelegateSentItemsStyle to work in Outlook 2010?

    I am testing Outlook 2010 for our organization, and we use shared mailboxes extensively. As you might know, there has always been an issue that if you added a second mailbox to a particular exchange server account, and you sent messages using the ide

  • Need Help with Playing my music from my External Drive!!!! PLEASE HELP!!!

    So here's the deal, i just recently got a new macbook pro and i have crap loads of music stored onto my external drive, i want to be able to listen to my music in itunes without having to store all of my music onto my internal hard drive and take up

  • List single line of many and make count

    Hi How do I Display a name only once, count how many of them there are, and then display the start date that is first and the todate that is last eg. Tables look like this : Name Start Date End date Porche 26-10-2002 23-11-2002 Porche 23-09-2002 26-1

  • Jsf-naming:namingContainer leads to ClassCastException

    Hi, I am having a problem creating a JSF-Portlet (JSF 1.2) in a WebLogic Portal 10.3.2 I am trying to create a portal JSF-Portlet using the jsf-1.2_09 libraries (WebLogic default). The Portlet works great until I try to integrate the <jsf-naming:nami

  • After Effects cs4 in Production Prem. fails to install

    I have Production Premium CS4 running on Windows 7.  I went back the other day to install the After Effects application.  Each time I try to install it, It does through the install process.  After it goes through disk #3, it stops and I get a message