Ensuring Oracle caches an in() clause

How do I post a select statement against Oracle that includes an IN(...) clause with varying lengths and make sure it gets cached in the SQL-Area.
Joinig to a temporary tables seems too expensive to me since I must handle lots of HTTP-Sessions concurrently.
Any ideas?
Thankx,
Jan

One way I've found to get around this is to have .net pass in a comma seperated list of values into the procedure, then have the procedure split it up into a table and use that in the IN. There's probably a better way to do it, but this works:
create or replace
TYPE "STRINGTABLETYPE" AS TABLE OF VARCHAR2(30);
create or replace
FUNCTION "FUNC_STR2STRTBL"
( p_str in varchar2 ) return
stringTableType
as
l_str long default p_str || ',';
l_n number;
l_data stringTableType := stringTabletype();
begin
loop
l_n := instr( l_str, ',' );
exit when (nvl(l_n,0) = 0);
l_data.extend;
l_data( l_data.count ) := ltrim(rtrim(substr(l_str,1,l_n-1)));
l_str := substr( l_str, l_n+1 );
end loop;
return l_data;
end;
Then in your actual query procedure, you can do something like this:
SELECT * FROM table WHERE column IN (select * from THE (select cast(FUNC_STR2TBL(parameter) as STRINGTABLETYPE) from dual))

Similar Messages

  • Oracle cache and File System cache

    on the checkpoint, oracle cache will be written to disk. But, If an oracle database is over file system datafile, it likely that the data are still leave in FileSystem cache. I don't know how could oracle keep data consistency.

    Thanks for your feedback. I am almost clear about this issue now, except one point need to be confirmed: do you mean that on linux or unix, if required, we can set "direct to disk" from OS level, but for windows, it's default "direct to disk", we do not need to set it manually.
    And I have a further question: If a database is stored on a SAN disk, say, a volume from disk array, the disk array could take snapshot for a disk on block level, we need to implement online backup of database. The steps are: alter tablespace begin backup, alter system suspend, take a snapshot of the volume which store all database files, including datafiles, redo logs, archived redo logs, controll file, service parameter file, network parameter files, password file. Do you think this backup is integrity or not. please note, we do not flush the fs cache before all these steps. Let's assume the SAN cache could be flushed automatically. Can I think it's integrity because the redo writes are synchronous.

  • Disabling oracle cache

    Hi,
    I am a graduate student in Computer Science and need to do some experiments for my thesis. I am not very familiar with oracle. I am using oracle and have implemented a cache to store some of the frequently used data items in my application.
    I am connecting to oracle using the ODBC driver 9.0.2, the one that comes with oracle 9i client installation.
    To measure the performance of the cache, I need to disable any other cache implemented by the oracle client or the server. Is there any way by which I can do that? I know oracle does do some of its own caching.
    Is there any way in which I can disable the oracle cache? Please refer me to the appropriate documentation.
    Something that I can give in my query. I am not the DBA. It is ok even if there is a directive in the query to tell oracle to bypass the cache. That will also work for me.
    Thanks,
    Nishant
    Thanks,
    Nishant

    You can flush the shared pool
    ALTER SYSTEM FLUSH SHARED_POOLwhich will flush the buffer cache. This will clear the cache on the server. I don't believe it is possible to tell Oracle not to cache buffers it reads from disk, though.
    What sort of client-side caches are you thinking of? The client will automatically fetch rows you may not have requested yet (i.e. fetch the first 10 rows from SELECT * FROM <<someLargeTable>> when the application requests the first row). That is covered by the prefetch count in the ODBC DSN. Not sure what a value of 0 means, though-- that may specify that the default value be used.
    What about things like the operating system cache (assuming you're not using raw devices) or the hardware disk cache. I don't think you can disable those.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Caching at client end using Oracle Cache Implementation

    I would like to know if we could use Oracle' Cache Implementation at the client end [Application server]- if so how do I go abt it & from performance point of view is this better .... Pls get back at the earliest

    Dear All,
    I got this link while googling -
    http://www.ibm.com/developerworks/webservices/library/ws-cach1/
    ................ caching concept is clear now............ but still
    implementation part is not cleared.....
    How, What and Where i need to do changes for this............
    I am using JDK 1.5 and Axis 1.4........
    Regards,
    Santosh Sharma

  • Oracle cache is still there after I restart the Oracle server - can it be?

    Hello,
    My name is Tal and I work for a software company called Mercury.
    We have a strange case in Oracle 9.2.0.6 (running on Solaris 2.9) and I wonder if one of you can help.
    I am running query, this query is doing something like “select * from x where y between z and w”.
    x, y, z and w are parameters which cause the query to be one that scans a lot of data.
    I run the query twice and the first time takes 60 seconds, but the second time takes only 3 seconds.
    I assumed that this is caused by the database cache (block buffers).
    BUT,
    Then I bounced the database (shutdown immediate + startup) and rerun the query.
    It comes back after 3 seconds again!!!
    Can some share some info on this; it looks like Oracle cache is still there after I restart the Oracle server.
         Tal Olier ([email protected]).

    Regarding the buffer cache, it is definitly flushed after database restart.
    There can be many factors causing your case:
    1. The first time you ran the query, some other process was consuming the server resources.
    2. Some other users were running heavy queries.
    3. Sudden Heavy network activities.
    Q: Did the query, in any time, run in 60 seconds again?
    If yes, then further factors should be considered.

  • Oracle cache - 10g updating...

    Hi all,
    I have setup a cache using TimesTen in front of an Oracle 10g instance.
    I am caching a number of tables where I would like to allow updates/inserts within TimesTen to be propogated back to 10g.
    The reason being I would only like to hold a subset of the cached table in TimesTen (and keep on pruning it on a daily basis by date for instance - due to memory constraints) I of course dont want these deletes to be pushed to the cache but I do want the updates and inserts to be pushed.
    Is there a way of doing this?
    Thanks,
    Dan

    Yes, there are several ways to do this.
    1. If you are using TimesTen 7.0 or later then you could configure automatic aging (timestamp or LRU based). See the SQL Guide for details. When aging removes a row in TimesTen the 'delete' is not propagated to Oracle.
    2. If you are using AWT or SWT cache groups, you or the application (or a cron script etc.) can execute UNLOAD CACHE GROUP cgname WHERE ...; Any rows matching the WHERE clause will be removed from TimesTen but again the 'deletes' will not be propagated to Oracle. Contracts this with doing DELETE FROm cgtable WHERE ...; in which case the deletes are propagated to Oracle.
    3. If you have a USERMANAGED cache group and are doing manual propagation to Oracle using FLUSH CACHE GROUP then this anyway does not propagate deletes.
    Chris

  • Cannot connect to Oracle cache administrator.Please help.

    Hi ,
    I was not able to connect to the Oracle TimesTen database the usual way. I get the following errors:
    Backend failed with exit status 1:
    C:\TimesTen\tt70_32\srv\info\ws\cgi-bin\cache/ttBackEnd.exe -connStr "DSN=TTSS" -user "APPS" -oraclepwd [Omitted] -oralogin
    ERROR in ttBackEnd.c, line 1121: prepare failed
    ODBC Error/Warning = S1000, Additional Error/Warning = 5104
    TT5104: Could not initialize the function pointers backend database api. Function OCIEnvCreate was not in the library. -- file "bdbOciFuncs.c", lineno 332, procedure "initOraFuncPtrs()"
    I have re-installed the TimesTen s/w quite a few times but in vain. It would be great if someone can throw light on this issue. Thanks in advance.
    Thanks,
    Susruth.

    Hi Chris,
    Please find the details blow
    1. The output of the ttVersion command (to verify if access control is enabled).
    C:\>ttversion
    TimesTen Release 7.0.2.0.0 (32 bit NT) (tt70_32:17000) 2007-05-04T21:01:22Z
    Instance admin: Rajib.Sarkar
    Instance home directory: C:\TimesTen\tt70_32
    Daemon home directory: C:\TimesTen\tt70_32\srv\info
    Access control enabled.
    2. The DSN settings for the datastore
    DSN Name = timestest
    charecter set =WE8MSWIN1252 same as in the databse.
    Authenticate times ten client connection checked.
    type mode = 0 oracle
    3. The connect string you are using to connect to the store from ttIsql
    Command> connect timestest;
    Enter password for 'testuser':
    7001: User authentication failed
    The command failed.
    Command> connect "dsn=timestest;oraclepwd=mypsswrd";
    Enter password for 'testuser':
    7001: User authentication failed
    The command failed.
    Command>
    Regards

  • Oracle 10g group by clause

    I have one SQL query using a GROUP BY clause and no ORDER BY clause is used. When executed in Oracle 8i, the query results are returned ordered by first column mentioned in the GROUP BY clause. When the same query is executed in Oracle 10g, the query results are returned withour ordering the data by the first column in the GROUP BY clause. It works only when I explicitly mention the ORDER BY clause. Can you please explain this? In Orcale 8i, is it that, by default, the data is ordered by the first column mentioned in the GROUP BY clause when ORDER BY clause is not mentioned?
    In which order does oracle 10g sorts when I use group by clause in oracle 10g

    [email protected] wrote:
    the use of group by is to group based on some column value, in this case why does the the output differs in rows. why does the output, when you use group by is not the following formatSorry, but this is a totally fruitless topic. Why are you bothering with something that is totally internal to the DBMS? If you want the data ordered, use ORDER BY, it's that simple.
    Check out this link, if you want some discussion on it:
    [http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:74320098178823]

  • Oracle Cached Prepared Statement

    We recently upgraded from WL 8.1 SP3 to WL 9.2 and in the process updated the JDBC Driver for Oracle from 10.2.0.1 to 10.2.0.2. After we went live we started seeing issue in one table. The table contains some special character which is not suppose to be there.
    Here is the code & table details
    PreparedStatement pstmt = cn.prepareStatement("INSERT INTO INFO_TABLE(user_name,user_status) values (?,?)");
    pstmt.setString(1,requestObject.getUserName());
    if(requestObject.isValidUser)
    pstmt.setInt(2,requestObject.getStatus());
    }else
    pstmt.setNull(2,Types.VARCHAR);
    cn.commit();
    Table description:
    USER_NAME VARCHAR2(60);
    USER_STATUS VARCHAR2(5);
    - The USER_STATUS columns valid values are 0-4 or NULL.
    The problem is on certain occasions the valid user value in the table is some special character. I got the ascii value of this character as 128. We don't know yet whether setting int value and varchar (null) value on two different flow (but cached prepared statement) is the issue.
    We can fix the code to use uniform data type but we need to be sure this is what causing the problem. Further when I read the docs http://e-docs.bea.com/wls/docs90/jdbc_admin/jdbc_datasources.html
    I can associate the problem I face with this pointer however as I said, we need some sort of confirmation to make this change in the production code.
    Here is what I am specifically looking for
    1. Is there a way to confirm this problem?
    2. Can we log the prepared statement being executed and the binded value being sent to the Oracle DB?
    I suspect the VARCHAR null type is being casted to int value 128.
    Would really appreciate any pointers on this.
    Thanks

    Purushothaman Thambu wrote:
    We recently upgraded from WL 8.1 SP3 to WL 9.2 and in the process updated the JDBC Driver for Oracle from 10.2.0.1 to 10.2.0.2. After we went live we started seeing issue in one table. The table contains some special character which is not suppose to be there.
    Here is the code & table details
    PreparedStatement pstmt = cn.prepareStatement("INSERT INTO INFO_TABLE(user_name,user_status) values (?,?)");
    pstmt.setString(1,requestObject.getUserName());
    if(requestObject.isValidUser)
    pstmt.setInt(2,requestObject.getStatus());
    }else
    pstmt.setNull(2,Types.VARCHAR);
    cn.commit();
    Table description:
    USER_NAME VARCHAR2(60);
    USER_STATUS VARCHAR2(5);
    - The USER_STATUS columns valid values are 0-4 or NULL.
    The problem is on certain occasions the valid user value in the table is some special character. I got the ascii value of this character as 128. We don't know yet whether setting int value and varchar (null) value on two different flow (but cached prepared statement) is the issue.
    We can fix the code to use uniform data type but we need to be sure this is what causing the problem. Further when I read the docs http://e-docs.bea.com/wls/docs90/jdbc_admin/jdbc_datasources.html
    I can associate the problem I face with this pointer however as I said, we need some sort of confirmation to make this change in the production code.
    Here is what I am specifically looking for
    1. Is there a way to confirm this problem?
    2. Can we log the prepared statement being executed and the binded value being sent to the Oracle DB?
    I suspect the VARCHAR null type is being casted to int value 128.
    Would really appreciate any pointers on this.
    ThanksHi. I don't think there's any issue with WebLogic here, but the code you show
    might confuse some drivers. I highly recommend using setString for all
    varchar/char/varchar2 columns, not setInt(). If requestObject.getStatus()
    has to return an int, try this:
    if(requestObject.isValidUser)
    pstmt.setString(2, (""+ requestObject.getStatus()) );
    Joe

  • Sorting technique used by oracle for "order by" clause.

    Hi All,
    it could be very help to me if you provide some information about sorting technique used by oracle engine for order by clause.
    Issue i am facing :
    Table : xx
    Line Date
    1 05-06-2013 00:00:00
    2 05-06-2013 00:00:00
    when we query above table using order by date, it is returning line 2 prior to line 1. we would like to know why it is returning line 2 first?
    Regards,
    Ram

    >
    it could be very help to me if you provide some information about sorting technique used by oracle engine for order by clause.
    >
    Well ok - but be warned that many people wind up being sorry they ask that question. Hopefully Hemant's answer is what you really wanted.
    See 'Linguistic Sorting and String Searching' in the Oracle® Database Globalization Support Guide
    http://docs.oracle.com/cd/B28359_01/server.111/b28298/ch5lingsort.htm
    Sorting will be controlled by the settings of NLS_LANGUAGE, NLS_SORT and NLS_COMP.
    Here is the doc page for NLS_SORT
    http://docs.oracle.com/cd/B28359_01/server.111/b28298/ch3globenv.htm#i1008393
    >
    NLS_SORT specifies the type of sort for character data. It overrides the default value that is derived from NLS_LANGUAGE.
    NLS_SORT contains either of the following values:
    NLS_SORT = BINARY | sort_name
    BINARY specifies a binary sort. sort_name specifies a linguistic sort sequence.
    >
    And the one for NLS_COMP
    http://docs.oracle.com/cd/B28359_01/server.111/b28298/ch3globenv.htm#i1008458
    >
    The value of NLS_COMP affects the comparison behavior of SQL operations.
    You can use NLS_COMP to avoid the cumbersome process of using the NLSSORT function in SQL statements when you want to perform a linguistic comparison instead of a binary comparison. When NLS_COMP is set to LINGUISTIC, SQL operations perform a linguistic comparison based on the value of NLS_SORT. A setting of ANSI is for backward compatibility; in general, you should set NLS_COMP to LINGUISTIC when you want to perform a linguistic comparison.

  • Whre does oracle cache and temp files are located?

    Hi
    thank you for reading my post
    Please do not shoot me if i have misconception.
    I come from netbeans world and for netbeans there was some folder that we could delete to make netbeans cache fresh (so more speed).
    for Jdeveloper i can not find such folder and its some times that Jdev works really slow.
    once i delete the system directory and all my settings gone with that (specially server that i registered / database connection /libaries)
    what should i delete to
    -keep all registered server / librarye/database connections
    -make Oracle Jdeveloper to work like a new installation.
    thanks

    If you wish to exclude anything from the backup simply drag the item into the Exclude list. For example, you can save considerable space by excluding the /System/ folder. Cache files would be found in the /Library/ and /Home/Library/ folders. Each folder contains a folder named Caches. There is no specific folder in which temporary items as stored that is visible to the user because the operating system will usually delete temporary files on its own. This may not be the case for a specific program, however. Browsers may maintain their own reserved cache and temporary files, and manage them on their own.
    I do not think, however, that TM backs up caches or temporary files. I find no such items in my TM backup - only the folders. I do not back up my /System/ folder.

  • Error in Associating the Oracle Cache Administration user with the Cache Database

    hi good eve,
    i have done Configuration on the Oracle Database such as
    1.create tablespace ttusers
    2.running initCacheGlobalSchema.sql
    3.creating cache administration user with username cacheadm
    4.running grantCacheAdminPrivileges.sql
    5.granting object privileges on tables to cacheadm
    on Setting Up a Cache Database
    i already created cache database my_ttdb
    here i created and granted the cacheadm user as admin
    then
    {code}
    Command> connect "dsn=my_ttdb;uid=cacheadm;oraclepwd=cacheadm";
    Enter password for 'cacheadm':
    Connection successful: DSN=my_ttdb;UID=cacheadm;DataStore=C:\TimesTen\DataStoreP
    ath\my_ttdb;DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=US7ASCII;DRIVER
    =C:\TimesTen\TT1122~1\bin\ttdv1122.dll;LogDir=C:\TimesTen\logs;PermSize=40;TempS
    ize=32;TypeMode=0;OracleNetServiceName=XE;
    (Default setting AutoCommit=1)
    con1: Command> call TTCACHEUIDPWDSET('cacheadm','cacheadm');
    5220: Permanent Oracle connection failure error in OCIServerAttach(): ORA-12154
    : TNS:could not resolve the connect identifier specified rc = -1
    5935: Could not validate Oracle login: uid = CACHEADM, pwd = HIDDEN, OracleNetS
    erviceName = XE, TNS_ADMIN = "C:\TimesTen\TNS_AD~1", ORACLE_HOME= ""
    The command failed.
    {code}
    can you please help in solving this problem sir....
    thanking you,
    prakash

    THe main issue is this:
    TNS:could not resolve the connect identifier specified rc = -1
    TimesTen is not able to resolved the TNS name 'XE'. You need to be sure that (a) your TimesTen instance is correctly configured with the correct value for TNS_ADMIN. This should have been specified at install time but if not you can change it by running ttModInstall as the instance administrator. You will need to shutdown the main daemon and re-start it after making this change. Also, all users who will access Timesten need to have the environment variable TNS_ADMIN, set to the right value, present in their environment.
    Chris

  • Sequence caching with toplink and oracle caching

    Hi,
    In my application, I use toplink as a JPA provider. For performance reasons, I defined an allocationSize on sequence generator for some persistence objects. I read some documentation to understand how it works, the result of my research is that the allocationSize of sequence generator must match with the increment value of the sequence in database.
    So if I want to cache 1000 of values, I must define on my sequence generator allocationSize of 1000 and create a sequence like this : create sequence myseq increment by 1000. Am I right ?
    Second question, what if my sequence define a cache in the database. For example, create sequence myseq increment by 1000 cache 20.
    Does it mean that 20 values will be cached or 1000*20 values will be cached ? Is the cache size defined per session or for all the sessions of the database ?
    Thanks.
    Will.

    Thank you for your response.
    I used the default parameter of toplink (increment by 50) and I left a cache size of 20 on database side.
    But I noticed that whenever the server restarts, I "lost" between 900 and 1000 ids (nearly 20*50). So even if sequence cache on oracle size is non transactional, I think there is a kind of prefetch somewhere on the server side. I must not lost more than 50 ids when a server restarts.
    If I remove the cache on database side, then the behavior is correct (the expected one to be more precise).
    Is there any kind of sequence caching in oracle jdbc drivers ?
    Thanks.
    Will.

  • Oracle Database down /failover clause ?

    hi
    I am collecting the information regarding oracle database down / failover clouses , so all of you requested kindly send me your experience regarding Oracle database down/failover reason/clause.
    thanks in advance
    regards

    Hi,
    Are you looking for notes or scenarious.
    If you are looking for some notes follow the below link:
    http://pavandba.wordpress.com/category/dataguard/
    Thanks,
    Rafi.

  • Clarification regarding understanding of ORACLE CONNECT BY PRIOR Clause

    Dear All,
    I am trying to understand ORACLE CONNECT BY CLAUSE and I wrote a query to verify my understanding.
    I wrote the below two queries.
    select level, lpad('*',2*(level -1),'*') ||ename t_ename, sys_connect_by_path(ename,'/') enames, empno, mgr from emp
    --where empno =empno
    start with empno=7654
    --start with mgr is null
    connect by prior empno = mgr;
    LEVEL T_ENAME ENAMES EMPNO MGR
    1 MARTIN /MARTIN 7654 7698
    Explanation: Here Start with EMPNO=7654 Means, the root node is 7654. Connect BY PRIOR EMPNO=MGR Means--> For the empno=7654 are there any persons under him. IE. Mgr with 7654.
    select level, lpad('*',2*(level -1),'*') ||ename t_ename, sys_connect_by_path(ename,'/') enames, empno, mgr from emp
    --where empno =empno
    start with empno=7698
    --start with mgr is null
    connect by prior empno = mgr
    LEVEL T_ENAME ENAMES EMPNO MGR
    1 BLAKE /BLAKE 7698 7839
    2 **ALLEN /BLAKE/ALLEN 7499 7698
    2 **WARD /BLAKE/WARD 7521 7698
    2 **MARTIN /BLAKE/MARTIN 7654 7698
    2 **TURNER /BLAKE/TURNER 7844 7698
    2 **JAMES /BLAKE/JAMES 7900 7698
    Explanation: Here Start with EMPNO=7698 Means, the root node is 7698. Connect BY PRIOR EMPNO=MGR Means--> For the empno=7698 are there any persons under him. IE. Mgr with 7698.
    IS MY UNDERSTANDING OF CONNECT BY PRIOR IS CORRECT?
    Please correct me if I am wrong.
    Thanks,
    MK.

    Yes, you're right
    Regards,
    Sayan M.

Maybe you are looking for

  • OEM Apple nVidia GeForce 7300 GT is on Adobe's list of unsupported GPUs for Open GL rendering-

    My Mac Pro's Radeon X1900 XT is retired to my computer grave yard, in my basement, but going back to the OEM Apple nVidia GeForce 7300 GT, which shipped with my Mac Pro, brought some encouraging results. When I first got the 2007 Mac Pro, in 2009, I

  • Can I use 20" iMac as a monitor for an airbook

    i have an iMac and an air book. Now that I am using the two devices I am fed up of copying the data from the airbook to the iMac. Simple solution appears to be that I use the iMac as a display for the airbook. My IMac is over a year old. 

  • Usage Tracking OBIEE 11.1.1.5.0

    Good afternoon Hope you are all well. Myself and our OBIEE team is having a problem with OBIEE Usage Tracking. Everyday we could view our daily usage for our users (Query counts, row counts logged in users etc) Since this morning (2013/04/03) our usa

  • Where can I find a snug fitting sleeve for late 2013, 13" MBP with retina?

    I was able to find many sleeves sold for MBP retina, but they also fit regular MBP. I want a snug fitting sleeve, specifically tailored for the retina display 13" MBP from late 2013. Does anyone know of any? Your help is appreciated.

  • SAP Program Status Attribute

    Hi All, I have a question? When we create an ABAP program (using SE38), why we have 4 different types of option in the Attribute called Status ? SAP Standard Production program Customer Production program System Program Test Program