Timer in Oracle

Hi,
I want to introduce timer in my application i.e in my form. It continously checks whether at present if server time is not in betwwen 8:00am and 9:00 a.m it closes the application.
Any friend has any idea how to to do this.
Thanks

Hi,
I don't understand completly your requirements, could you explain better?
If you want to perform certain actions depending in the time, you can do something like (simple example):
Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as hr
SQL>
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
  2     v_start_date DATE;
  3     v_end_date   DATE;
  4     v_date       DATE;
  5  BEGIN
  6     v_start_date := trunc(SYSDATE) + 8 / 24;
  7     v_end_date := trunc(SYSDATE) + 9 / 24;
  8     v_date := SYSDATE;
  9 
10     IF v_date < v_start_date OR v_date > v_end_date THEN
11        dbms_output.put_line('Time outside range');
12     ELSE
13        dbms_output.put_line('Time IN range');
14     END IF;
15  END;
16  /
Time outside range
PL/SQL procedure successfully completed
SQL>
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
  2     v_start_date DATE;
  3     v_end_date   DATE;
  4     v_date       DATE;
  5  BEGIN
  6     v_start_date := trunc(SYSDATE) + 8 / 24;
  7     v_end_date := trunc(SYSDATE) + 9 / 24;
  8     v_date := to_date('26/04/2009 8:23','DD/MM/YYYY HH24:MI');
  9 
10     IF v_date < v_start_date OR v_date > v_end_date THEN
11        dbms_output.put_line('Time outside range');
12     ELSE
13        dbms_output.put_line('Time IN range');
14     END IF;
15  END;
16  /
Time IN range
PL/SQL procedure successfully completed
SQL> Regards,

Similar Messages

  • Parse times in Oracle 11G

    Has anyone else experienced extremely long parse times for Oracle 11G versus 10G? We are experiencing at least a 10 times increase in the parsing of our SQL statements. This is causing our customers to complain when running reports which contain several SQL statements that aren't in the SGA due to the infrequent use. I have opened a Service Request and development stated that this is to be expected with Oracle 11G due to the new optimizer features. I have tried to disable the features by settting the optimizer version to anything but 11G and no setting has helped. To make thing even worse, this increased parse time is on a new server that should be 2.5 times faster than the server that is running the 10G database. I do get at least a 2.5 times increase, larger if I/O intensive, in almost every other aspect of the database except for the parse times.

    user5999814 wrote:
    I wondered what the resolution was to this issue. We currently experiencing this will our Oracle 11.1.0.7 database with a small but important set of queries and it seems to be getting worse. We first noticed it with a query that went from taking 3.5 seconds to 7 seconds. A SQLTrace / TKProf revealed that 99% of the time was being spent during the parsing. A second similar query that brings in more data is taking around 1.5 minutes to parse then only a few seconds to actually execute. These are queries that are part of on online web transaction so this is not acceptable. We are able to replicate the behavior in multiple database instances.As a starting point it would be interesting to see the tkprof output from :
    alter session set events '10046 trace name context forever, level 8';
    +your select statement+
    exitWhen posting the output, use the "code" tags (see below) to make the output readable.
    Regards
    Jonathan Lewis
    To post code, statspack/AWR report, execution plans or trace files, start and end the section with the tag {noformat}{noformat} (lowercase, curly brackets, no spaces) so that the text appears in fixed format.
    There is a +"Preview"+ tab at the top of the text entry panel. Use this to check what your message will look like before you post the message. If it looks a complete mess you're unlikely to get a response. (Click on the +"Plain text"+ tab if you want to edit the text to tidy it up.)
    +"I believe in evidence. I believe in observation, measurement, and reasoning, confirmed by independent observers. I'll believe anything, no matter how wild and ridiculous, if there is evidence for it. The wilder and more ridiculous something is, however, the firmer and more solid the evidence will have to be."+
    Isaac Asimov                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Problem with getting current date and time using oracle.jbo.domain.Date

    I`d like to get current date and time using oracle.jbo.domain.Date method getCurrentDate(), but it always return current date and 12:00:00. I also need to get the current time.

    I think you should use java.sql.Timestamp domain.
    (And set database type to TIME or DATETIME.)
    Jan

  • Selecting only time in oracle forms

    Hi all,
    like date picker in oracle forms can i select the time in oracle forms into a text item.
    i want to display the time in this format 10:10:30 a.m. and also i want to insert into the table
    i have taken the data type of this column as varchar2(15) if i take date can i insert the time or varchar2 is ok.
    my oracle forms version is 10g.
    please reply...

    Hi, extreme
    extreme wrote:
    Hi all,
    like date picker in oracle forms can i select the time in oracle forms into a text item.
    i want to display the time in this format 10:10:30 a.m. and also i want to insert into the table
    i have taken the data type of this column as varchar2(15) if i take date can i insert the time or varchar2 is ok.Better take column having data type date. You can insert date and time in the date field.
    Just you need to change in forms.
    Change the Data type Date to Datetime
    to show only time, use format mask.
    Hope this helps

  • Is 000001010000z a valid date time in Oracle?

    Hi,
    When working with Open LDAP connection from Oracle, I need to set and remove the value '000001010000z' for locking and unlocking the user account respectively. This is working fine. However, for some calculation, I need to convert this value as a date value which I couldn't do. Is this a valid date time in Oracle? If so how to convert it as a date value.
    Oracle version: 10g R2
    Thanks,
    Natarajan

    Thanks, Mithun for your answer. We have the same issue, as an user, we can lock an account using the special value, but unable to unlock using the same user. I have reported this to our LDAP administrator.
    Regarding my question using this special value as a date value in oracle, though it is a valid date in the LDAP system, we cannot convert this as a date value in Oracle.
    Natarajan

  • Problem while inserting Date/Time in Oracle Database

    Hai,
    i want to insert the date and time in a date column. here, i am using java.sql.Date and java.sql.Time to assign the date in Prepared Statement.
    PreparedStatement psmt=con.prepareStatement("insert into test(ex_date) values(?)");
    java.util.Calendar c=Calendar.getInstance();
    c.set(2002,2,21,10,10,00);
    java.sql.Date d=new Date(c.getTime().getTime());
    java.sql.Time t=new Time(c.getTime().getTime());
    psmt.clearParameters();
    psmt.setDate(1,d);
    psmt.setDate(1,t);
    psmt.executeUpdate();
    Above program is inserted the Date and time in the database as the following "1900/2/21 10:10 AM"
    but i am giving the year as 2002. it inserted the year as 1900. what is the problem with the code?
    please let me know
    Thanks in advance.
    Regards
    sankarjune14

    Hai Franco,
    i put the wrong code. Here, is the Original Code.
    PreparedStatement psmt=con.prepareStatement("insert into test(ex_date) values(?)");
    java.util.Calendar c=Calendar.getInstance();
    c.set(2002,2,21,10,10,00);
    java.sql.Date d=new Date(c.getTime().getTime());
    java.sql.Time t=new Time(c.getTime().getTime());
    psmt.clearParameters();
    psmt.setDate(1,d);
    psmt.setTime(1,t); // Last time i put psmt.setDate(1,t);
    psmt.executeUpdate();
    and, the getTimeInMillis() method is a protected method in java.util.Calendar class. how can we use it
    please give me some other idea to insert the date and time in oracle database.
    Thanks in advance
    sankarjune14

  • Why can't read access log file in real-time? (Oracle Weblogic Server 10.3)

    We can't read access log file in real-time. If access log is rotation to new file so can read access log file but can't read real-time.
    *** Oracle Weblogic Server versions 10 R3

    what's your meaning? try this command "tail -f access.log".
    Threre is a buffer about 8K for WebLogic to write the access info into the log files, so you can't see the access info untill the buffer is full.

  • UNIX time to Oracle time

    Hallo,
    I am acquiring the data for my reports in a UNIX evironment using embedded SQL.
    Therefore I am searching for a function that converts the UNIX time to ORACLE time. Currently I am doing the conversion via a string representation but I would prefer a function that does it on a binary level.
    Thanks a lot - Ulrich

    maybe (using the link provided) ;)
    select case when :unixts between -2114380800 and 2145916799
                then TO_DATE('19700101000000','YYYYMMDDHH24MISS') + NUMTODSINTERVAL(:unixts,'SECOND')
           end the_date
      from dualRegards
    Etbin

  • What time the Oracle Data Mining 10g  ?

    What time the Oracle Data Mining 10g ?

    If you are referring to the 10.1 release of the ODM user interface, that should be available in beta form very shortly(a couple weeks) with the final release very soon after that.

  • Convert a Number to time in Oracle

    Hi,
    In a oracle database table i have a colum that gives the value from 0 to 2359. I want to convert Number to time in Oracle. Any i dea on the query for this.
    I have tried
    SELECT TO_CHAR('2342','HH:MI') "Time"
    FROM dual;
    but it is not functioning.
    Thanks

    The Number that i want to convert to Time is of the
    columns of the same table and depending on its value,
    i want to display it as Time.
    Thanks,Well it sounds like you certainly have no clue what you are doing whatsoever. I predict a bright future for you.
    Here's some advice. If the column should have a date or time in it then use a date or time type column. If you are creating a variable data type column then ASAP get a book on SQL before you fuck things up worse then you have.
    There is no great mystery here. There is the right way (as suggested by WorkForFood) and there is the wrong way (whatever you are doing). So do what WorkForFood told you or just go away because nobody cares to help make a disaster.

  • Displaying Dynamic Time in Oracle forms6i

    Hi all,
    i want to display dynamic time in Oracle forms (forms 6i). this should be displayed in text item only..
    i want it to run time continuously. What can i do for this.
    Please help me guys
    Regards
    Balraj

    try this as im doing to my forms 6i
    /* *Trigger : _WHen-neW-Form-instaNcE*  */
    declare
    mtimer_id timer;
    begin
    /*THis if you want to appear on your Window.     */
    SET_WINDOW_PROPERTY('WINDOW1', TITLE, 'Hospital Management Information System',TO_CHAR(SYSDATE, 'DD/MM/YYYY HH24:MI:SS')) ;
    /* Create a TiMeR               */
         HD_TIMER := CREATE_TIMER('mtimer_id', 1000, _REPEAT) ;*
    /* for the item you need to add item in a block */
    *:control_blk.item_hrs := to_char(sysdate,'HH12:MI:SS am');*
    /* Trigger: When-Timer-exPiRed */
    declare
    mexpired_timer varchar(20) := getapplication_property(timer_name); <<< this if you have more than 1 timer to check what timer is expired
    begin
    if mexpired_timer = 'mtimer_id' then
    SET_WINDOW_PROPERTY('WINDOW1', TITLE, 'Hospital Management Information System',TO_CHAR(SYSDATE, 'DD/MM/YYYY HH24:MI:SS')) ;
    *:control_blk.item_hrs := to_char(sysdate,'HH12:MI:SS am')* <<<--- This for the item...
    end if;
    /* DONT FORGET THIS */
    Synchronize;
    end;
    Edited by: charles on Jan 24, 2011 10:06 AM
    Edited by: charles on Jan 24, 2011 10:11 AM
    Edited by: charles on Jan 24, 2011 10:12 AM
    Edited by: charles on Jan 24, 2011 10:13 AM
    Edited by: charles on Jan 24, 2011 10:14 AM

  • How to insert large amount of records at a time into oracle

    Hi, im Dilip. I'm newbie to Oracle. For practicing purpose i got some SQL code which has huge amounts of records in text format which i need to copy+paste in my SQL Plus in Oracle 9i. But when i try to paste in SQL Plus I'm unable to paste more them 50 lines of code at a time. In one of the text file there is 80 thousand lines of record's code i need to paste. Please help me. Here is the link for the text file I'm using : http://www.mediafire.com/view/?4o9eo1qjd15kyib . Any kind of help will be much appreciated.

    982089 wrote:
    Hi, im Dilip. I'm newbie to Oracle. For practicing purpose i got some SQL code which has huge amounts of records in text format which i need to copy+paste in my SQL Plus in Oracle 9i. But when i try to paste in SQL Plus I'm unable to paste more them 50 lines of code at a time. In one of the text file there is 80 thousand lines of record's code i need to paste. Please help me. Here is the link for the text file I'm using : http://www.mediafire.com/view/?4o9eo1qjd15kyib . Any kind of help will be much appreciated.
    sqlplus user1/pass1
    @sql_text_file.sql
    doing above will execute all the SQL statements in the text file

  • Problem with Inserting Date and Time in Oracle 8i

    I am using JDBC thin driver version 8.1.6. with oracle 8i and am unable to insert and update date & time in American format
    (mm/dd/yyyy hh24:mi:ss).
    example:
    UPDATE TABLE_NAME SET DATE_COLUMN='08/16/2000 12:45:00';
    Can someone please help?
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Kanwal:
    I am using JDBC thin driver version 8.1.6. with oracle 8i and am unable to insert and update date & time in American format
    (mm/dd/yyyy hh24:mi:ss).
    example:
    UPDATE TABLE_NAME SET DATE_COLUMN='08/16/2000 12:45:00';
    Can someone please help?
    <HR></BLOCKQUOTE>
    Hey Kanwal,
    You can try the following statement
    UPDATE TABLE_NAME SET DATE_COLUMN = to_date('08/16/2000 12:45:00','mm/dd/yyyy HH:MI:SS'
    WHERE .... ;
    null

  • Connect via SQL*Plus taking more time in Oracle 11 than in 10

    Oracle Version
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Productioncurrently migrating from
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE    10.2.0.4.0      Production
    TNS for IBM/AIX RISC System/6000: Version 10.2.0.4.0 - Productio
    NLSRTL Version 10.2.0.4.0 - ProductionOS is AIX 5.3 for Oracle 10 and AIX 6.1 for Oracle 11.
    We are currently in the process of migrating some applications from Oracle 10 to 11. Our admins have setup a new development system for us with an Oracle 11 instance. Regarding performance the new system behaves more or less the same than our old, e.g. when executing SQLs we notice hardly any performance differences and those we find are slightly in favour of the new system.
    But now we discovered that the time it takes to establish a database connection via SQL*Plus is longer on the Oracle 11 system. Running the following code
    sqlplus -s user/pw@database <<END
    quit
    ENDa thousand times takes ~60s under Oracle 10 but ~140s under Oracle 11. This may not seem much but we are running a test framework consisting of a bunch of shell scripts where several thousand connections are openend via SQL*Plus to execute some SQLs, so that even this small time difference results in rather huge difference in total runtime. The SQLs themself require roughly the same time in both databases, as already mentioned above they are in fact slightly faster in Oracle 11.
    To analyze the time difference I ran a trace for the connect with the following parameters in sqlnet.ora
    TRACE_LEVEL_CLIENT=4
    TRACE_UNIQUE_CLIENT=ONand found out that there is a time difference of about 70ms during the connect handshake:
    Oracle 10
    [22-MAR-2013 12:13:09:595] nscon: doing connect handshake...
    [22-MAR-2013 12:13:09:595] nscon: sending NSPTCN packet
    [22-MAR-2013 12:13:09:621] nscon: got NSPTRS packet
    [22-MAR-2013 12:13:09:621] nscon: sending NSPTCN packetOracle 11
    (1) [22-MAR-2013 12:15:26:812] nscon: doing connect handshake...
    (1) [22-MAR-2013 12:15:26:812] nscon: sending NSPTCN packet
    (1) [22-MAR-2013 12:15:26:906] nscon: got NSPTRS packet
    (1) [22-MAR-2013 12:15:26:906] nscon: sending NSPTCN packetUnder Oracle 10 there are 26ms between sending the NSPTCN packet and getting the NSPTRS packet, whereas under Oracle 11 this takes 94ms. I ran the trace again, this time with
    TRACE_LEVEL_CLIENT=16and got the following results for the critical interval:
    Oracle 10:
    [22-MAR-2013 13:17:37:638] nscon: sending NSPTCN packet
    [22-MAR-2013 13:17:37:638] nspsend: entry
    [22-MAR-2013 13:17:37:638] nspsend: plen=218, type=1
    [22-MAR-2013 13:17:37:638] nttwr: entry
    [22-MAR-2013 13:17:37:638] nttwr: socket 9 had bytes written=218
    [22-MAR-2013 13:17:37:638] nttwr: exit
    [22-MAR-2013 13:17:37:638] nspsend: packet dump
    <<packet dump removed>>
    [22-MAR-2013 13:17:37:638] nspsend: 218 bytes to transport
    [22-MAR-2013 13:17:37:638] nspsend: normal exit
    [22-MAR-2013 13:17:37:638] nscon: exit (0)
    [22-MAR-2013 13:17:37:638] nsdo: nsctxrnk=0
    [22-MAR-2013 13:17:37:638] nsdo: normal exit
    [22-MAR-2013 13:17:37:638] nsdo: entry
    [22-MAR-2013 13:17:37:638] nsdo: cid=0, opcode=68, *bl=512, *what=9, uflgs=0x0, cflgs=0x3
    [22-MAR-2013 13:17:37:638] nsdo: rank=64, nsctxrnk=0
    [22-MAR-2013 13:17:37:638] nsdo: nsctx: state=2, flg=0x4005, mvd=0
    [22-MAR-2013 13:17:37:638] nsdo: gtn=10, gtc=10, ptn=10, ptc=2011
    [22-MAR-2013 13:17:37:638] nscon: entry
    [22-MAR-2013 13:17:37:638] nscon: recving a packet
    [22-MAR-2013 13:17:37:638] nsprecv: entry
    [22-MAR-2013 13:17:37:638] nsprecv: reading from transport...
    [22-MAR-2013 13:17:37:638] nttrd: entry
    [22-MAR-2013 13:17:37:665] nttrd: socket 9 had bytes read=8
    [22-MAR-2013 13:17:37:665] nttrd: exit
    [22-MAR-2013 13:17:37:665] nsprecv: 8 bytes from transport
    [22-MAR-2013 13:17:37:665] nsprecv: tlen=8, plen=8, type=11
    [22-MAR-2013 13:17:37:665] nsprecv: packet dump
    [22-MAR-2013 13:17:37:665] nsprecv: 00 08 00 00 0B 00 00 00  |........|
    [22-MAR-2013 13:17:37:665] nsprecv: normal exit
    [22-MAR-2013 13:17:37:665] nscon: got NSPTRS packetOracle 11
    (1) [22-MAR-2013 13:33:40:504] nscon: sending NSPTCN packet
    (1) [22-MAR-2013 13:33:40:504] nspsend: entry
    (1) [22-MAR-2013 13:33:40:504] nspsend: plen=205, type=1
    (1) [22-MAR-2013 13:33:40:504] nttwr: entry
    (1) [22-MAR-2013 13:33:40:504] nttwr: socket 8 had bytes written=205
    (1) [22-MAR-2013 13:33:40:504] nttwr: exit
    (1) [22-MAR-2013 13:33:40:504] nspsend: packet dump
    <<packet dump removed>>
    (1) [22-MAR-2013 13:33:40:505] nspsend: 205 bytes to transport
    (1) [22-MAR-2013 13:33:40:505] nspsend: normal exit
    (1) [22-MAR-2013 13:33:40:505] nscon: exit (0)
    (1) [22-MAR-2013 13:33:40:505] snsbitts_ts: entry
    (1) [22-MAR-2013 13:33:40:505] snsbitts_ts: acquired the bit
    (1) [22-MAR-2013 13:33:40:505] snsbitts_ts: normal exit
    (1) [22-MAR-2013 13:33:40:505] nsdo: nsctxrnk=0
    (1) [22-MAR-2013 13:33:40:505] snsbitcl_ts: entry
    (1) [22-MAR-2013 13:33:40:505] snsbitcl_ts: normal exit
    (1) [22-MAR-2013 13:33:40:505] nsdo: normal exit
    (1) [22-MAR-2013 13:33:40:505] nsdo: entry
    (1) [22-MAR-2013 13:33:40:505] nsdo: cid=0, opcode=68, *bl=2048, *what=9, uflgs=0x0, cflgs=0x3
    (1) [22-MAR-2013 13:33:40:505] snsbitts_ts: entry
    (1) [22-MAR-2013 13:33:40:505] snsbitts_ts: acquired the bit
    (1) [22-MAR-2013 13:33:40:505] snsbitts_ts: normal exit
    (1) [22-MAR-2013 13:33:40:505] nsdo: rank=64, nsctxrnk=0
    (1) [22-MAR-2013 13:33:40:505] snsbitcl_ts: entry
    (1) [22-MAR-2013 13:33:40:505] snsbitcl_ts: normal exit
    (1) [22-MAR-2013 13:33:40:505] nsdo: nsctx: state=2, flg=0x4005, mvd=0
    (1) [22-MAR-2013 13:33:40:505] nsdo: gtn=10, gtc=10, ptn=10, ptc=8155
    (1) [22-MAR-2013 13:33:40:505] nscon: entry
    (1) [22-MAR-2013 13:33:40:505] nscon: recving a packet
    (1) [22-MAR-2013 13:33:40:505] nsprecv: entry
    (1) [22-MAR-2013 13:33:40:505] nsprecv: reading from transport...
    (1) [22-MAR-2013 13:33:40:505] nttrd: entry
    (1) [22-MAR-2013 13:33:40:618] nttrd: socket 8 had bytes read=8
    (1) [22-MAR-2013 13:33:40:618] nttrd: exit
    (1) [22-MAR-2013 13:33:40:618] nsprecv: 8 bytes from transport
    (1) [22-MAR-2013 13:33:40:618] nsprecv: tlen=8, plen=8, type=11
    (1) [22-MAR-2013 13:33:40:618] nsprecv: packet dump
    (1) [22-MAR-2013 13:33:40:618] nsprecv: 00 08 00 00 0B 00 00 00  |........|
    (1) [22-MAR-2013 13:33:40:618] nsprecv: normal exit
    (1) [22-MAR-2013 13:33:40:618] nscon: got NSPTRS packetAny ideas what could be the reason for this time difference? Something in our network configuration or something else?

    With local connections - I do not think a TCP packet send from an IP to the same IP, leaves the interface as an actual wire protocol/signal. If I'm correct, then running local connection tests will be mostly useless in checking the actual network infrastructure.
    Tests 3 and 4 should be showing the same connection times as the same physical network infrastructure is used - only the direction is reversed in the tests.
    I would assume that port settings on the switches and interface settings on the routers treat packets equally in both directions between 2 servers. But this could in part explain the problem if this is not the case. In a case of a router for example, the 1st test's ingress interface is the egress interface of the 2nd test (and vice versa). Configurations can differ substantially between interfaces on the same router. Likewise if there is a firewall - as different rule sets are applied in each test and these rule sets could differ.
    So I would not be too quick to state that this is definitely not a network problem. But I agree that based on the small percentage difference (assuming comparable tests), it does not look like a network issue.
    The next step is to determine what the delay is between the listener accepting the client connection, and the connection being serviced by a dedicated server process.
    This will require listener tracing - tracing the time from when the listener accepted the connection (and parsed the TNS connection string), to handing off the connection to the dedicated server process.
    As a comparison test, you can also test shared server connections. Dispatcher processes (of the db instance) register themselves with the listener. The shared server client hand off is thus done to an existing server process - no need for the Listener to make a kernel call to load and initialise an executable image.
    Shared connections are typically faster than dedicated connections in this respect.
    If there is a major time difference, then it means some kind of issue with the listener dealing with dedicated servers as oppose to dispatcher hand off's. As both connections would have had very similar network transit time - which means the connection time difference is related directly to dealing with a dedicated server connection request and hand off.
    You can also substitute the oracle executable with a wrapper - and troubleshoot the actual dedicated server startup. I've only done this with Oracle XE 10.2 though and with local IPC connections. Unsure how robust this will be for testing purposes via TCP using 11g.

  • Row Insert in Timesten takes more time than Oracle

    Hi,
    I have a Timesten IMDB (11.2.1.8.0 (64 bit Linux/x86_64) with an underlying Oracle Database 11Gr2.
    Sys.odbc.ini entry is :
    [DSN_NAME]
    Driver=/application/TimesTen/matrix/lib/libtten.so
    DataStore=/application/TimesTen/DSN_NAME_datastore/DSN_NAME_DS_DIR
    LogDir=/logs_timeten/DSN_NAME_logdir
    PermSize=8000
    TempSize=250
    PLSQL=1
    DatabaseCharacterSet=WE8MSWIN1252
    OracleNetServiceName=DBNAME
    Connections=500
    PassThrough=0
    SQLQueryTimeout=250
    LogBufMB=512
    LogFileSize=512
    LogPurge=1
    When I try to insert a simple row in a table in an asyc cache group in Timesten it takes 3 ms (it has 6 indexes on it). On removing 4 indexes the performance improves to 1 ms. However inserting the same row on Oracle (with 6 indexes) takes 1.2 ms.
    How can we improve the insert row performance in Timesten ? Kindly assist.
    Regards,
    Karan
    PS: During the test run, we monitored deadlocks and log buffer waits with the following query and both values never changed from zero
    select PERM_ALLOCATED_SIZE,PERM_IN_USE_SIZE,TEMP_ALLOCATED_SIZE,TEMP_IN_USE_SIZE,DEADLOCKS,LOG_FS_READS,LOG_FS_WRITES,LOG_BUFFER_WAITS from sys.monitor;
    Edited by: 853100 on Nov 2, 2012 4:19 AM

    This is not very efficient as the statement will require likely need to be parsed for each INSERT. Even a soft parse is very expensive compared to the cost of the actual INSERT.
    Can you try changing your code to something like the following just to evaluate the difference in performance. The object is to prepare the INSERT just once, outside of the INSERT loop and then execute the prepared INSERT many times passing the required input parameters. I'm not a Pro*C expert but an outline of the code looks something like this:
    char * ins1 = "               INSERT INTO ORDERS(
                        ORD_ORDER_NO             ,
                        ORD_SERIAL_NO            ,
                        ORD_SEM_SMST_SECURITY_ID,
                        ORD_BTM_EMM_MKT_TYPE    ,
                        ORD_BTM_BOOK_TYPE        ,
                        ORD_EXCH_ID              ,
                        ORD_EPM_EM_ENTITY_ID     ,
                        ORD_EXCH_ORDER_NO        ,
                        ORD_CLIENT_ID            ,
                        ORD_BUY_SELL_IND         ,
                        ORD_TRANS_CODE           ,
                        ORD_STATUS               ,
                        ORD_ENTRY_DATE           ,
                        ORD_ORDER_TIME           ,     
                        ORD_QTY_ORIGINAL         ,
                        ORD_QTY_REMAINING        ,
                        ORD_QTY_DISC             ,
                        ORD_QTY_DISC_REMAINING   ,
                        ORD_QTY_FILLED_TODAY     ,
                        ORD_ORDER_PRICE          ,
                        ORD_TRIGGER_PRICE        ,  
                        ORD_DISC_QTY_FLG         ,
                        ORD_GTC_FLG              ,
                        ORD_DAY_FLG              ,
                        ORD_IOC_FLG             ,
                        ORD_MIN_FILL_FLG        ,
                        ORD_MKT_FLG             ,
                        ORD_STOP_LOSS_FLG       ,
                        ORD_AON_FLG             ,
                        ORD_GOOD_TILL_DAYS      ,
                        ORD_GOOD_TILL_DATE     ,     
                        ORD_AUCTION_NO          ,
                        ORD_ACC_CODE            ,
                        ORD_UM_USER_ID          ,
                        ORD_MIN_FILL_QTY        ,
                        ORD_SETTLEMENT_DAYS     ,
                        ORD_COMPETITOR_PERIOD   ,
                        ORD_SOLICITOR_PERIOD    ,
                        ORD_PRO_CLIENT          ,
                        ORD_PARTICIPANT_TYPE    ,
                        ORD_PARTICIPANT_CODE    ,
                        ORD_COUNTER_BROKER_CODE ,
                        ORD_CUSTODIAN_CODE      ,
                        ORD_SETTLER             ,
                        ORD_REMARKS             ,
                        ORD_BSE_DELV_FLAG       ,
                        ORD_BSE_NOTICE_NUM      ,
                        ORD_ERROR_CODE          ,
                        ORD_EXT_CLIENT_ID       ,
                        ORD_SOURCE_FLG          ,
                        ORD_BUY_BACK_FLG        ,
                        ORD_RESERVE_FLG         ,
                        ORD_BSE_REMARK          ,
                        ORD_CARRY_FORWARD_FLAG  ,
                        ORD_ORDER_OFFON         ,
                        ORD_D2C1_FLAG           ,
                        ORD_FI_RETAIL_FLG       ,
                        ORD_OIB_INT_REF_ID      ,
                        ORD_BOB_BASKET_ORD_NO   ,
                        ORD_PRODUCT_ID          ,
                        ORD_OIB_EXEC_REPORT_ID   ,
                        ORD_BANK_DP_TXN_ID       ,
                        ORD_USERINFO_PROG        ,
                        ORD_BANK_CODE            ,
                        ORD_BANK_ACC_NUM         ,
                        ORD_DP_CODE              ,
                        ORD_DP_ACC_NUM           ,
                        ORD_SESSION_ORDER_TYPE   ,
                        ORD_ORDER_CC_SEQ         ,
                        ORD_RMS_DAEMON_STATUS    ,
                        ORD_GROUP_ID             ,
                        ORD_REASON_CODE          ,
                        ORD_REASON_DESCRIPTION   ,
                        ORD_SERIES_IND           ,
                        ORD_BOB_BASKET_TYPE  ,
                        ORD_ORIGINAL_TIME    ,
                        ORD_TRD_EXCH_TRADE_NO,     
                        ORD_MKT_PROT   ,
                        ORD_SETTLEMENT_TYPE      ,
                        ORD_SUB_CLIENT,
                             ORD_ALGO_OI_NUM,
                             ORD_FROM_ALGO_CLORDID,
                             ORD_FROM_ALGO_ORG_CLORDID
                   VALUES(
                        :lvar_ord_order_no       ,
                        :lvar_ord_serial_no     ,
                        ltrim(rtrim(:lvar_ord_sem_smst_security_id)),
                        ltrim(rtrim(:lvar_ord_btm_emm_mkt_type)),
                        ltrim(rtrim(:lvar_ord_btm_book_type)),
                        ltrim(rtrim(:lvar_ord_exch_id))  ,
                        decode(:lD2C1Flag,'N',ltrim(rtrim(:lvar_ord_epm_em_entity_id)),ltrim(rtrim(:sD2C1ControllerId)))  ,
                                   :insertExchOrderNo,
                        ltrim(rtrim(:lvar_ord_client_id))  ,
                        ltrim(rtrim(:lvar_ord_buy_sell_ind)),
                        :lvar_ord_trans_code,
                        :cTransitStatus      ,
                        sysdate,
                        sysdate,
                        :lvar_ord_qty_original,
                        decode(:lvar_ord_qty_remaining  ,-1,to_number(null),:lvar_ord_qty_remaining)    ,
                        decode(:lvar_ord_qty_disc       ,-1,to_number(null),:lvar_ord_qty_disc),
                        decode(:lvar_ord_qty_disc_remaining,-1,to_number(null),:lvar_ord_qty_disc_remaining),
                        :lvar_ord_qty_filled_today    ,
                        :lvar_ord_order_price,
                        decode(:lvar_ord_trigger_price  ,-1,to_number(null),:lvar_ord_trigger_price)     ,
                                   decode(:lvar_ord_disc_qty_flg ,-1,null,:lvar_ord_disc_qty_flg)  ,
                                   decode(:lvar_ord_gtc_flg ,-1,null,:lvar_ord_gtc_flg)  ,
                                   decode(:lvar_ord_day_flg ,-1,null,:lvar_ord_day_flg)  ,
                                   decode(:lvar_ord_ioc_flg ,-1,null,:lvar_ord_ioc_flg)  ,
                                   decode(:lvar_ord_min_fill_flg ,-1,null,:lvar_ord_min_fill_flg)  ,
                                   decode(:lvar_ord_mkt_flg ,-1,null,:lvar_ord_mkt_flg)  ,
                                   decode(:lvar_ord_stop_loss_flg ,-1,null,:lvar_ord_stop_loss_flg)  ,
                                   decode(:lvar_ord_aon_flg ,-1,null,:lvar_ord_aon_flg)  ,
                        decode(:lvar_ord_good_till_days ,-1,to_number(null),:lvar_ord_good_till_days),
                        to_date(ltrim(rtrim(:lvar_ord_good_till_date))  ,'dd-mm-yyyy'),
                        :lvar_ord_auction_no,
                        ltrim(rtrim(:lvar_ord_acc_code)),
                        ltrim(rtrim(:lv_UserIdOrLogPktId)),
                        decode(:lvar_ord_min_fill_qty,-1,to_number(null),:lvar_ord_min_fill_qty),
                        :lvar_ord_settlement_days,
                        :lvar_ord_competitor_period,
                        :lvar_ord_solicitor_period,
                        :lvar_ord_pro_client         ,
                        ltrim(rtrim(:lvar_ord_participant_type)),
                        ltrim(rtrim(:lvar_ord_participant_code)),
                        ltrim(rtrim(:lvar_ord_counter_broker_code)),
                        trim(:lvar_ord_custodian_code)     ,
                        ltrim(rtrim(:lvar_ord_settler)),
                        ltrim(rtrim(:lvar_ord_remarks)),
                        ltrim(rtrim(:lvar_ord_bse_delv_flag))      ,
                        ltrim(rtrim(:lvar_ord_bse_notice_num))     ,
                        :lvar_ord_error_code         ,
                        trim(:lvar_ord_ext_client_id)      ,
                        ltrim(rtrim(:lvar_ord_source_flg)),
                        ltrim(rtrim(:lvar_ord_buyback_flg)),
                        :lvar_ord_reserve_flag        ,
                        trim(:lvar_ord_bse_remark)         ,
                        ltrim(rtrim(:lvar_ord_carryfwd_flg)),
                        :cOnStatus,
                        :lD2C1Flag,
                        :lSendToRemoteUser,
                        :lInternalRefId,
                        :lvar_bob_basket_ord_no,
                        ltrim(rtrim(:lvar_ord_product_id)),
                        trim(:lvar_ord_oib_exec_report_id)   ,
                        :lvar_BankDpTxnId  ,
                        ltrim(rtrim(:lEquBseUserCode )),
                        ltrim(rtrim(:lvar_BankCode))  ,
                        ltrim(rtrim(:lvar_BankAccNo)),
                        ltrim(rtrim(:lvar_DPCode)),
                        ltrim(rtrim(:lvar_DPAccNo))  ,
                        ltrim(rtrim(:lvar_OrderSessionType))   ,
                        :lvar_ord_order_cc_seq,
                        :lvar_ord_rms_daemon_status    ,
                        :lvarGrpId,
                        :lvar_ord_reason_code          ,
                        trim(:lvar_ord_reason_description)   ,
                        :lSecSeriesInd,
                        ltrim(rtrim(:lBasketType)),
                        sysdate,
                        (-1 * :lvar_ord_serial_no),
                        :MktProt ,          
                        :lvar_ord_sett_type,
                        ltrim(rtrim(:lvar_ca_cli_type)) ,
                                   :ComplianceID,
                                   ltrim(rtrim(:lvar_ClOrd)),
                                   ltrim(rtrim(:lvar_OrgClOrd))
    EXEC SQL AT :db_conn PREPARE i1 FROM :ins1;
         logTimestamp("BEFORE inserting in  orders table");
    for (i=0; i<NUM_INSERTS; i++)
              if ( strncmp(lvar_ord_exch_id.arr,"NSE",3) ==0 )
                   if(tmpExchOrderNo == -1)
                        insertExchOrderNo = NULL;
                   else
                        insertExchOrderNo = tmpExchOrderNo;
              else if ( strncmp(lvar_ord_exch_id.arr,"BSE",3) ==0 )
                   if(tmpExchOrderNo == -1)
                        insertExchOrderNo = NULL;
                   else
                        insertExchOrderNo = tmpExchOrderNo;
                lvar_ord_acc_code.len = strlen (lvar_ord_acc_code.arr);
              sprintf (lv_UserIdOrLogPktId.arr,"%d",UserIdOrLogPktId );
              lv_UserIdOrLogPktId.len = strlen (lv_UserIdOrLogPktId.arr) ;
              lEquBseUserCode.len = fTrim(lEquBseUserCode.arr,16);
              lvar_ord_buyback_flg.len = fTrim(lvar_ord_buyback_flg.arr,1);
              lvar_ord_exch_id.len = fTrim(lvar_ord_exch_id.arr,3);
                   EXEC SQL AT :db_conn EXECUTE i1 USING
                        :lvar_ord_order_no       ,
                        :lvar_ord_serial_no     ,
                        :lvar_ord_sem_smst_security_id,
                        :lvar_ord_btm_emm_mkt_type,
    etc. ;
              logTimestamp("AFTER inserting in  orders table");
    /* Divide reported time by NUM_INSERTS to get average time for one insert */
    Chris

  • Best practice for Near Real time with Oracle

    Hi,
    We plan to run a scenario to demonstrate DS ability for real time or near real time scenario.
    We identified different solutions and we are trying to choose the most appropriate :
    - Oracle 11g + Sybase Replication server + Data Services
    - Oracle 11g + Data services : real time jobs ( xml messages )
    - Oracle 11g + Data Services : CDC scenario
    I need to load data into a SAP Sybase IQ database : is there any known issue with one of the previous solution ?
    The challenge is to load a set of 10 tables, for more than 5 millions rows,
    Thanks for your advices,
    Guillaume

    Hi!
    Didn't anyone have this requirement for migrations? I have tested with the mysql select into file clause. Seems to work for simple data types - we're now testing with blobs...
    Markus

Maybe you are looking for