Blocking Session -  blocked SQL - SELECT SYSDATE   FROM SYS.DUAL

Oracle 10.0.0.4g
When database execute some big and long queries/operations my system is slow and some users wait, can’t work (they work with some Oracle forms applications ) because I often have blocking session.
I found up that this blocking sessions block only this query of another user:
SELECT SYSDATE   FROM SYS.DUAL
Or:
+10-АВГ-2009 08:51:10 User X1 ( SID= 222 ) with the statement: SELECT ... is blocking the SQL statement on Y1 ( SID=333 ) blocked SQL -> SELECT SYSDATE FROM SYS.DUAL+
When I kill one of the blocking session another session take his place and do the same:
+10-АВГ-2009 08:53:10 User X2 ( SID= 444 ) with the statement: SELECT ... is blocking the SQL statement on Y2 ( SID=555 ) blocked SQL -> SELECT SYSDATE FROM SYS.DUAL+
When long queries finished everything is OK.
Please Help Me!!!

I create ASH report:_
Top User Events
Avg Active
Event Event Class % Activity Sessions
enq: TM - contention Application 55.87 0.96
db file sequential read User I/O 18.87 0.32
CPU + Wait for CPU CPU 16.33 0.28
db file scattered read User I/O 3.02 0.05
Top Event P1/P2/P3 Values
Event % Event P1 Value, P2 Value, P3 Value % Activity
Parameter 1 Parameter 2 Parameter 3
enq: TM - contention 55.87 "xxxxxxxxxxxxxxxxxxxx" 38.35
name|mode object # table/partition
"1111111111","xxxxxxx","0" 17.44
db file sequential read 19.21 "xxxxxxxxxxxxxxx’’ 0.00
file# block# blocks
db file scattered read 3.03 "xxxxxxxxxxxxxxxxxxxxxx’’ 0.01
file# block# blocks
Top SQL Statements …………..
SQL ID Planhash % Activity Event % Event
fnxxxxxxxxx N/A 25.09 enq: TM - contention 23.47
** SQL Text Not Available **
N/A 25.09 db file sequential read 1.19
** SQL Text Not Available **
byxxxxxxxxxxxxx 1111111 10.11 enq: TM - contention 7.43
SELECT SYSDATE FROM SYS.DUAL
db file sequential read 2.10
fnxxxxxxxxx 11111111111 2.57 enq: TM - contention 2.16
** SQL Text Not Available **
Top DB Objects
Object ID % Activity Event % Event
Object Name (Type) Tablespace
11111 10.33 enq: TM - contention 10.30
XXXXXXXXXXXXXXXXXXXXXXXX (INDEX) CC
99999 10.18 enq: TM - contention 10.16
XXXXXXXXXXXXXXXXXXXXXXXXX (INDEX) IND
933333 6.67 enq: TM - contention 6.55
FFFFFFFFFFFFFFFF (TABLE) T3
114545 3.88 enq: TM - contention 3.85
RRRRRRRRRRRRRRRRRRRRRR (INDEX) JJJ
1136664 2.96 enq: TM - contention 2.93
FFFFFFFFFFFFFFFFFFFFFFFFF (INDEX) G
How to found sql text that is not available ** SQL Text Not Available **?
What to do whit this Top DB Objects that have enq: TM - contention event?
And how to solve this problem?

Similar Messages

  • Delay due to selecting sysdate from  dual

    Our application accessing dummy table dual frequently for getting current date and time. But some times this could reduce our database performance.
    How could we overcome this problem.
    ASH report_
    Top Events_
    latch: library cache      29.87      "5015593920","214","0"      26.57      address      number      tries
    Top SQL Statements_
    0vnruqfxmtu6q     Select to_number(to_char(Sysdate, 'YYYYMMDD')) from dual

    orianmoon wrote:
    Thanks for your replies,
    Please check this below link which shows my database performance at the time of running a particular sql , which is selecting sysdate using table dual. It created Lbrary cache latch contention.
    http://arun-itadmin.blogspot.com/2010/12/oracle-performance-screen.html
    My question is
    Is this the problem of frequent usage of table dual or usage of 'sysdate' ?
    It there any way to get date and time other than using sysdate function?
    Edited by: orianmoon on Dec 8, 2010 9:42 PMI don't see anything there that points the finger at SELECT SYSDATE FROM DUAL;

  • Select sysdate from dual, why?

    I have been looking at the SQL that is generated during fetches, updates
    etc. Why is the SELECT SYSDATE FROM DUAL being executed prior to every sql
    statement being executed?
    If I had to guess I would say it has to do with locking or logging but
    don't really have a clue!
    I suppose the final question is ... how can I switch it off!
    Thanks in advance
    Matt

    Have not seen oracle just dropping connection. In any case if you are using
    oracle JDBC 2 it has error event which lets you handle error conditions plus
    PooledConnection.getConnection() raises exception if its underlying physical
    connection is dead so you can catch it and discard old PooledConnection (and
    do not return it to the pool) and create new one without error ever going to
    the user. No need for "select sysdate from dual" once in a while or god
    forbid on every getConnection() /* hope oracle handles it more efficiently
    */ I stress tested my pool implementation - running many threads on JDO
    reads and killing connections on server left and right and Kodo never saw
    killed connections - it all was handled within pool itself without anything
    like "select sysdate from dual". What I am trying to say is at least as far
    as Oracle JDBC concerned their PooledConnection takes care of this
    "Patrick Linskey" <[email protected]> wrote in message
    news:[email protected]...
    Matt,
    We issue this to validate that connections retrieved from the pool are,
    in fact, open. Oracle has a nasty habit of dropping connections (you'd
    be surprised with some of the ways that Oracle sucks...), so it tends
    to be good to do this check relatively frequently.
    The frequency at which it occurs depends on a number of factors. First,
    it depends on whether or not you are using a connection pool. I believe
    that if you do not use the conn pool, then we probably check every time
    you get a connection. Second, it depends on the setting of the
    com.solarmetric.kodo.impl.jdbc.ConnectionTestTimeout setting, which
    specifies how often to check connections for validity. I believe that
    it's a number in seconds, but I'm not 100% sure; the configuration
    section of our docs will have the right answer. Third, it depends on
    the setting of com.solarmetric.kodo.impl.jdbc.ConnectionRetainMode,
    which controls when we get connections and when we release them.
    Finally, you can turn it off altogether by setting the
    com.solarmetric.kodo.impl.jdbc.DBDictionaryProperties property to
    contain the string 'ValidateConnections=false', which will turn off
    connection validation altogether.
    -Patrick
    Patrick Linskey
    SolarMetric Inc.

  • Select sysdate from dual (to custom format).

    Dear all,
    i like to SELECT SYSDATE FROM DUAL, and run this result in a query something like:
    SELECT X, Y, Z FROM TABLENAME WHERE ACCESSDATE = (SELECT SYSDATE FROM DUAL);
    The problem is that the value of ACCESSDATE is in an format like DD-MM-YYYY and that sysdate form dual is
    DD-MON-YYYY.
    How do i get sysdate into the format DD-MM-YYYY?
    Thanks already,
    Johan.

    Perhaps usefull for performance:
    first of all: no subselect is not needed. sysdate can be used as an argument directly (all functions are).
    secondly, if accessdate is of type 'date' and the table has a lot of rows, converting it to a char will bypass the index usage. Instead, if you are worrying about the time try this (the display format is of no concern here if the datatype is date):
    SELECT X, Y, Z FROM TABLENAME WHERE ACCESSDATE >trunc(sysdate) and ACCESSDATE < trunc(sysdate+1);
    if accessdate is of type 'varchar2' then this should be enough (and should remain using the indexes on accessdate):
    SELECT X, Y, Z FROM TABLENAME WHERE ACCESSDATE = to_date(sysdate,DD-MM-YYYY);
    Hope this helps,
    L.

  • BC4J smarter way to:   select sysdate from dual  ????

    Our architecture uses the DB server's date/time as the application's single
    place to get date / time. So our UI's / business logic needs sysdate in several
    places through screen flow and VO/Entities called by the business logic.
    I'll create a SQLView at design time to package calling select sysdate from dual.
    We're currently using Dynamic unnamed Views which are more expensive than just
    getting sysdate deserves and also are a memory leak if you don't
    call vo.remove() after you're done with the result set.
    But is there a simplier or smarter way to get sysdate from the DB than the more
    heavy weight than seems necessary step of instantiating a VO and creating a
    result set to get the String sysdate???
    Thanks,
    curt

    I cache viewObjects in the MT using some ViewObjectManager and had no
    problems till now (more then 6 months of production). Any AM that
    serve dynamic requests should have own ViewObjectManager-object.
    import oracle.jbo.*;
    import java.util.Hashtable;
    import java.util.Enumeration;
    public class ViewObjectManager {
    private ApplicationModule _appMod;
    private Hashtable _viewObjectNames;
    public ViewObjectManager(ApplicationModule am) {
    _appMod = am;
    _viewObjectNames = new Hashtable();
    public ViewObject getViewObject( String selectClause_,
    String fromClause_,
    String whereClause_ ) {
    ViewObject vo_ = null;
    String sqlStmt_ = _getSQLStmtFromClauses
    ( selectClause_, fromClause_, whereClause_ );
    String key_ = sqlStmt_;
    String voName_ = (String)_viewObjectNames.get(key_);
    boolean isNew_ = ( voName_ == null );
    if ( !isNew_ ) {
    vo_ = appMod.findViewObject(voName);
    if ( vo_ == null ) {
    viewObjectNames.remove(key);
    isNew_ = true;
    if ( isNew_ ) {
    vo_ = appMod.createViewObjectFromQueryStmt( null, sqlStmt );
    viewObjectNames.put( key, vo_.getName() );
    return vo_;
    private String getSQLStmtFromClauses( String selectClause,
    String fromClause_,
    String whereClause_ ) {
    return
    "SELECT "+selectClause_
    +" FROM "+fromClause_
    +( whereClause_ == null || whereClause_.equals("")
    ? "" : " WHERE "+whereClause_ ) ;
    Client method in this case looks like that:
    public static synchronized BigDecimal getNewId
    ( RequestOnNewId request__,
    QueryableApplicationModule am__ ) {
    String viewObjectName_ = request__.viewObjectName,
    sequenceName_ = request__.sequenceName,
    fromClause_ = request__.fromClause;
    BigDecimal new_id_ = null;
    ViewObject vo_;
    Row row_;
    Object obj_;
    vo_ = am__.getViewObjectManager()
    .getViewObject( sequenceName_+".NEXTVAL AS \"NEWID\"",
    "DUAL",
    null );
    vo_.executeQuery();
    row_ = vo_.first();
    obj_ = row_.getAttribute("NEWID");
    new_id_ = (obj_ == null) ? null : ((Number)obj_).bigDecimalValue();
    return new_id_;
    Hope this helps.
    Arkadi Ganov
    [email protected]

  • Select 'x' from sys.trigger$ t

    HI all,
    I am running adadmin and it's failed on worker01 and checking the log file I saw
    and not exists ( select 'x' from sys.trigger$ t
    ERROR at line 25:
    ORA-00942: table or view does not exist
    this error.can some one help me how to fix this.
    Regards
    A

    Just wonder If you have sorted out the issue?
    If not you can try to run the script assigned to the particular worker manualy in morder to reproduce the problem, then try to understand that is wrong by analizing the script.
    If yes can you please update as what was the problem?
    Yury
    Check this out:
    A.
    http://www.freelists.org/archives/ora-apps-dba/05-2006/msg00000.html
    B.
    - Users can subscribe to your list by sending email to
    ora-apps-dba-request_at_freelists.org with 'subscribe' in the Subject field
    C.
    http://www.freelists.org/archives/ora-apps-dba/05-2006/threads.html

  • Dynamic PL/SQL block vs dynamic SQL SELECT

    Hi there,
    I have a question regarding the optimal way to code a dynamic SELECT INTO statement. Below are the 2 posiibilities I know of:
    _1. Dynamically executing the SELECT statement and making use of the INTO clause of the EXECUTE IMMEDIATE statement_
    CREATE OR REPLACE FUNCTION get_num_of_employees (p_loc VARCHAR2, p_job VARCHAR2)
    RETURN NUMBER
    IS
    v_query_str VARCHAR2(1000);
    v_num_of_employees NUMBER;
    BEGIN
    v_query_str := 'SELECT COUNT(*) FROM emp_'
    || p_loc
    || ' WHERE job = :bind_job';
    EXECUTE IMMEDIATE v_query_str
    INTO v_num_of_employees
    USING p_job;
    RETURN v_num_of_employees;
    END;
    _2. Encapsulating the SELECT INTO statement in a block and dynamically exectuting the block_
    CREATE OR REPLACE FUNCTION get_num_of_employees (p_loc VARCHAR2, p_job VARCHAR2)
    RETURN NUMBER
    IS
    v_query_str VARCHAR2(1000);
    v_num_of_employees NUMBER;
    BEGIN
    v_query_str := 'begin
    SELECT COUNT(*) INTO :into_bind FROM emp_'
    || p_loc
    || ' WHERE job = :bind_job;
    end;';
    EXECUTE IMMEDIATE v_query_str
    USING out v_num_of_employees, p_job;
    RETURN v_num_of_employees;
    END;
    I was just wondering which way would be preferred? I know the second method uses a bind variable for the INTO clause, but does the first one also use bind varialbes (no semi-colon)? Any differences in terms of efficiency or speed?
    Thanks alot
    Edited by: BYS2 on Oct 19, 2011 1:23 AM

    sybrand_b wrote:
    No difference in terms of performance or speed
    Both variants will wreck the primary purpose of PL/SQL: to avoid parsing.
    When I would see a 'developer' do this, I would fire him on the spot.
    Why abuse PL/SQL in such a fashion? Both statements don't require parsing, as there is nothing dynamic in them and indicate a complete lack of understanding of Oracle, or a desire to deliver completely unscalable applications, resulting in end-users desiring to lynch you, and rightly so.
    Remove the dynamic SQL or find another job.
    Sybrand Bakker
    Senior Oracle DBANot dynamic? What if p_loc and p_job were generated dynamically based on user-input? or what if there were potentially thousands of tables that p_loc could refer to? Should I make a CASE statement with a thousand cases?
    In addition, the first example was actually taken directly from the official Oracle Database Application Developer's Guide (version 10.2). http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_dynamic_sql.htm#i1006429 - look under 'Sample Single-Row Query Using Native Dynamic SQL' heading. Therefore, if you have any issues with this alleged 'improper' usage of dynamic SQL, perhaps you should go talk to Oracle directly.
    While I appreciate your response, I don't think it has occurred that you that not everyone is a 'developer'. In fact, I have only very recently (several days ago) taught myself how to use Oracle SQL, PL/SQL and XMLDB by reading several of the official Oracle language and developer's guides. It is more a passing interest to me as I am working on some medical research which may require the use of a database. I am actually in medical school at the moment but have an undergraduate degree in Electrical and Computer engineering so I am generally well-versed in programming.
    Perhaps the next time, you post your rubbish, rude and unhelpful comments, you should stop and think that people come to this forum because they need help and not because they want to be told to 'find another job'. In fact, I am quite certain that I could make you look absolutely stupid in any topic of electrical engineering or medicine.
    Please do us all a favour and stop polluting this forum with your vapid posts. While I understand that your behavior is likely a compensatory mechanism to cope with your inferiority complex, know that help IS available if you need it.
    Edited by: BYS2 on Oct 19, 2011 2:13 AM

  • Access to view blocking sessions in sql server 2008

    Hi,
    One of my client wrote a stored procedure. we scheduled this SP in a job. while job is running, it is blocking other sessions. It is happening frequently. So, client is asking me to grant permission to view blocking session( want to execute sp_who2). Could
    you please advise me, which permission I need to give. I don't like to give access other than sp_who2. Please advise.
    Thanks.
    Raja.
    Thanks, Raja

    You need VIEW SERVER STATE permissions for sp_who or sp_who2 to work. You can also use sys.dm_exec_requests which will also give blocking information and requires the same permissions.
    Else you can take a look at the other alternative which is sp_whoisactive - check this link -
    http://sqlblog.com/blogs/adam_machanic/archive/2012/03/22/released-who-is-active-v11-11.aspx
    Regards, Ashwin Menon My Blog - http:\\sqllearnings.com

  • PL/SQL select list from query

    Hello,
    I am trying to modifying a PL/SQL process. Wherever there was a reference to the Application ID, I wanted to change it to refer to the Application Alias.
    Here is the original code:
    declare
       cursor app_cur is
          select aa.application_id||' - '||aa.application_name app_name,
                 aa.application_id
            from apex_applications aa
           where exists (select 1
                           from profiles p
                          where p.application_id = aa.application_id);
       cursor user_app_cur (p_user number, p_app number) is
          select to_char(profile_id)
            from user_app_profiles
           where user_id = p_user
             and application_id = p_app;
       v_profile   varchar2(10);
       v_count     number := 0;
       v_class     varchar2(15);
    begin
       htp.p('<table class="t3standardalternatingrowcolors" cellpadding="0" cellspacing="0">');
       htp.p('<tr><th class="t3header" >Application</th><th class="t3header" >Profile</th></tr>');
       for app in app_cur loop
          v_count := v_count + 1;
          if mod(v_count,2) = 1 then
             v_class := 't3dataalt';
          else
             v_class := 't3data';
          end if;
          open  user_app_cur(:P3_USER_ID, app.application_id);
          fetch user_app_cur
           into v_profile;
          if user_app_cur%notfound then
             v_profile := 'NONE';
          end if;
          close user_app_cur;
          htp.p('<tr><td class="'||v_class||'">'||app.app_name||
                '</td><td class="'||v_class||'">'||
                apex_item.select_list_from_query(40, v_profile,
                  'select description, profile_id from profiles where application_id = '||app.application_id,
               null, 'YES', 'NONE', 'No Profile Assigned', null, null, 'NO')||
                apex_item.hidden(41,app.application_id) ||
              '</td></tr>');
       end loop;
       htp.p('</table>');
    end;Here is my revised code:
    declare
       cursor app_cur is
          select aa.alias||' - '||aa.application_name app_name,
                 aa.alias
            from apex_applications aa
           where exists (select 1
                           from profiles p
                          where p.application_alias = aa.alias);
       cursor user_app_cur (p_user number, p_app varchar2) is
          select to_char(profile_id)
            from user_app_profiles
           where user_id = p_user
             and application_alias = p_app;
       v_profile   varchar2(10);
       v_count     number := 0;
       v_class     varchar2(15);
    begin
       htp.p('<table class="t3standardalternatingrowcolors" cellpadding="0" cellspacing="0">');
       htp.p('<tr><th class="t3header" >Application</th><th class="t3header" >Profile</th></tr>');
       for app in app_cur loop
          v_count := v_count + 1;
          if mod(v_count,2) = 1 then
             v_class := 't3dataalt';
          else
             v_class := 't3data';
          end if;
          open  user_app_cur(:P3_USER_ID, app.alias);
          fetch user_app_cur
           into v_profile;
          if user_app_cur%notfound then
             v_profile := 'NONE';
          end if;
          close user_app_cur;
          htp.p('<tr><td class="'||v_class||'">'||app.app_name||
                '</td><td class="'||v_class||'">'||
                apex_item.select_list_from_query(40, v_profile,
                  'select description, profile_id from profiles where application_alias = '||app.alias,
               null, 'YES', 'NONE', 'No Profile Assigned', null, null, 'NO')||
                apex_item.hidden(41,app.alias) ||
              '</td></tr>');
       end loop;
       htp.p('</table>');
    end;Here is the error:
    ORA-06550: line 1, column 153: PL/SQL: ORA-00904: "F109NEWNAME": invalid identifier ORA-06550: line 1, column 7: PL/SQL: SQL Statement ignored
    I think that the problem is in the table/LOV generation near the end, but I don't fully understand the apex_item.select_list_from_query function as it is written (I didn't write it).
    Any help is greatly appreciated.
    Thanks,
    Matt

    Hi Matt,
    This line:
    'select description, profile_id from profiles where application_alias = '||app.aliaswould become:
    select description, profile_id from profiles where application_alias = F109NEWNAMEif F109NEWNAME was the app_alias. SQL would see F109NEWNAME as a variable as it is not in quotes. Therefore, you should change the line to:
    'select description, profile_id from profiles where application_alias = ''' || app.alias || ''''to end up with:
    select description, profile_id from profiles where application_alias = 'F109NEWNAME'which would make more sense
    Andy

  • SQL Select and From Functions

    Can sql aggregate functions be added to an interface select clause and from clause.
    I want to have a datasource where one of the columns is an aggregate such as a count, which would need the ability to indicate a from clause function group by, or having by. In the Designer Diagram tab for the interface, it seems you can only apply sql functions to where clause joins or filters.
    I want to have a query such as follows as my datasource
    select columnA, count(*) as thecount
    from table x
    group by columnA
    order by thecount asc
    and ultimately
    select columnA, thecount
    from (select columnA, count(*) as thecount
    from table x
    group by columnA
    order by thecount asc)
    where rownum <1001
    Can this be done in the ODI Designer, without creating a physical custom view on the database?

    Hi lpantuso,
    Aggregate functions are added by ODI automatically. In this case you would want mappings like this:
    TARGET_COL_1: columnA
    TARGET_COL_2: count(*)
    ODI will generate something like this:
    select     
       columnA,
       count(*)
    from     MY_TABLE MY_TABLE
    where     
         (1=1)
    Group By MY_TABLE.columnA
    The subselect, however, isn't handled out of the box. In general ODI isn't quite as friendly with ordering clauses since order by is not relational. (Sets aren't ordered.) To get only the first 1000 columnA values, you'll probably need to create a view or break it into 2 separate interfaces.
    Regards,
    Matt

  • Select time from view

    i have a doubt as will a select based on a view will take more time than a select on 2 tables with a union.
    View will be:-
    create view1 as
    select column1 from table1
    union
    select column1 from table2
    so, will a
    select * from view1
    take more time than a
    select column1 from table1
    union
    select column1 from table2
    Please help in solving the doubt as it is urgent.
    regards.

    If it's that urgent why didn't you just rustle up a test case for yourself? You could have done that in the time it took you to post, let alone wait for my slow fingers to type one up and compose this reply. We are all volunteers here and there's no SLA.
    Here is a test case. Obviously the stats are different, that's because of the data in the buffer cache, but the EXPLAIN PLAN is identical (except for the VIEW bit), so the two queries should execute in a similar timeframe.
    Cheers, APC
    SQL> SET autotrace TRACEONLY
    SQL> SELECT col1 FROM t_10K
      2  UNION
      3  SELECT col1 FROM t_5k1
      4  /
    10000 rows selected.
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=43 Card=15000 Bytes=
              60000)
       1    0   SORT (UNIQUE) (Cost=43 Card=15000 Bytes=60000)
       2    1     UNION-ALL
       3    2       INDEX (FAST FULL SCAN) OF 'T10K_PK' (UNIQUE) (Cost=3 C
              ard=10000 Bytes=40000)
       4    2       TABLE ACCESS (FULL) OF 'T_5K1' (Cost=3 Card=5000 Bytes
              =20000)
    Statistics
            750  recursive calls
              0  db block gets
            213  consistent gets
             71  physical reads
              0  redo size
         132870  bytes sent via SQL*Net to client
           7825  bytes received via SQL*Net from client
            668  SQL*Net roundtrips to/from client
             16  sorts (memory)
              0  sorts (disk)
          10000  rows processed
    SQL> CREATE VIEW v1 AS
      2  SELECT col1 FROM t_10K
      3  UNION
      4  SELECT col1 FROM t_5k1
      5  /
    View created.
    SQL> SELECT * FROM v1
      2  /
    10000 rows selected.
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=43 Card=15000 Bytes=
              195000)
       1    0   VIEW OF 'V1' (Cost=43 Card=15000 Bytes=195000)
       2    1     SORT (UNIQUE) (Cost=43 Card=15000 Bytes=60000)
       3    2       UNION-ALL
       4    3         INDEX (FAST FULL SCAN) OF 'T10K_PK' (UNIQUE) (Cost=3
               Card=10000 Bytes=40000)
       5    3         TABLE ACCESS (FULL) OF 'T_5K1' (Cost=3 Card=5000 Byt
              es=20000)
    Statistics
             19  recursive calls
              0  db block gets
             54  consistent gets
              0  physical reads
              0  redo size
         132870  bytes sent via SQL*Net to client
           7825  bytes received via SQL*Net from client
            668  SQL*Net roundtrips to/from client
              3  sorts (memory)
              0  sorts (disk)
          10000  rows processed
    SQL>

  • Error while selecting date from external table

    Hello all,
    I am getting the follwing error while selecting data from external table. Any idea why?
    SQL> CREATE TABLE SE2_EXT (SE_REF_NO VARCHAR2(255),
      2        SE_CUST_ID NUMBER(38),
      3        SE_TRAN_AMT_LCY FLOAT(126),
      4        SE_REVERSAL_MARKER VARCHAR2(255))
      5  ORGANIZATION EXTERNAL (
      6    TYPE ORACLE_LOADER
      7    DEFAULT DIRECTORY ext_tables
      8    ACCESS PARAMETERS (
      9      RECORDS DELIMITED BY NEWLINE
    10      FIELDS TERMINATED BY ','
    11      MISSING FIELD VALUES ARE NULL
    12      (
    13        country_code      CHAR(5),
    14        country_name      CHAR(50),
    15        country_language  CHAR(50)
    16      )
    17    )
    18    LOCATION ('SE2.csv')
    19  )
    20  PARALLEL 5
    21  REJECT LIMIT UNLIMITED;
    Table created.
    SQL> select * from se2_ext;
    SQL> select count(*) from se2_ext;
    select count(*) from se2_ext
    ERROR at line 1:
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04043: table column not found in external source: SE_REF_NO
    ORA-06512: at "SYS.ORACLE_LOADER", line 19

    It would appear that you external table definition and the external data file data do not match up. Post a few input records so someone can duplicate the problem and determine the fix.
    HTH -- Mark D Powell --

  • Getting selected values from a data table

    My data table gets values directly from a result set.
    I went through http://balusc.blogspot.com/2006/06/using-datatables.html#top ,
    however, the data table shown in this example takes values from a simple list. I have trouble in getting selected values.
    Can anyone suggest how to select multiple values. here is a small code sample of what I have
    SessionBean
    ResultSet rs= db.retrieve_draft();
    datamodel = new ResultSetDataModel();
    datamodel.setWrappedData(rs);This is the JSF
    <h:dataTable binding="#{Engineer.dataTable1}" headerClass="list-header" id="dataTable1"
    rowClasses="list-row-even,list-row-odd" style="left: 144px; top: 192px; position: absolute"
    value="#{SessionBean1.datamodel}" var="currentRow">
    <h:column id="column1">
    <h:outputText id="outputText77" value="#{currentRow['report_number']}"/>
    <f:facet name="header">
    <h:outputText id="outputText78" value="Report Number"/>
    </f:facet>
    </h:column>Edited by: ktip on Jul 29, 2008 11:04 AM

    Here is what I was doing :
    This is my Session Bean (viz. SessionBean1)
    private CachedRowSetDataProvider draft_infoDataProvider;
        private CachedRowSetXImpl draft_RowSet;
        public CachedRowSetDataProvider getDraft_info() {
            return draft_infoDataProvider;
        public void setDraft_info(CachedRowSetDataProvider draft_info) {
            this.draft_info = draft_infoDataProvider;
        public CachedRowSetXImpl getDraft_RowSet() {
            return draft_RowSet;
        public void setDraft_row(CachedRowSetXImpl draft_row) {
            this.draft_row = draft_RowSet;
    public void get_drafts()
                Class.forName("com.mysql.jdbc.Driver");
                String url = "jdbc:mysql://localhost:3308/test";
                String dbUser = "root";
                String dbPassword = "adminadmin";
                con = DriverManager.getConnection(url, dbUser, dbPassword);
            String  sql="SELECT report_id from reports WHERE status='Draft' ";
            ResultSet rs=null;
            try
                Statement stmt1=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
                rs=stmt1.executeQuery(sql);
                draft_RowSet=new CachedRowSetXImpl();
                draft_RowSet.populate(rs);
                draft_infoDataProvider=new CachedRowSetDataProvider(draft_RowSet);
                result="ok";
            catch(SQLException e)
              System.out.println(e); 
              result="fail";
    Here is my jsp page (developed in Netbeans 6.1) showing the data table
    <webuijsf:table augmentTitle="false" binding="#{Engineer.table1}" clearSortButton="true" deselectMultipleButton="true"
                                            id="table1" selectMultipleButton="true" sortPanelToggleButton="true"
                                            style="left: 48px; top: 144px; position: absolute; width: 450px" title="Table" width="0">
             <webuijsf:tableRowGroup id="tableRowGroup1" rows="10" sourceData="#{SessionBean1.draft_infoDataProvider}" sourceVar="currentRow">
                      <webuijsf:tableColumn headerText="report_number" id="tableColumn1" sort="test_report.report_number">
                                            <webuijsf:staticText id="staticText1" text="#{currentRow.value['reports.report_id]}"/>
                        </webuijsf:tableColumn>
             </webuijsf:tableRowGroup>
       </webuijsf:table>Doing all this just resulted in a javax.Naming.Exception : Data Source is null
    I tested this piece of code to give me the number of rows in the underlying rowset and it worked well. But somehow I could not get to display the data. Am I missing something?
    Edited by: ktip on Jul 31, 2008 1:21 PM

  • Msg 8631 Internal error: Server stack limit has been reached on SQL Server 2012 from T-SQL script that runs on SQL Server 2008 R2

    I have an Script mostly that is generated by SSMS which works with-out issue on SQL Server 2008, but when I attempt to run it on a new fresh install of SQL Server 2012 I get an Msg 8631. Internal error: Server stack limit has been reached. Please look for
    potentially deep nesting in your query, and try to simplify it.
    The script itself doesn't seem to be all that deep or nested.  The script is large 2600 lines and when I remove the bulk of the 2600 lines, it does run on SQL Server 2012.  I'm just really baffled why something that SQL Server generated with very
    few additions/changes AND that WORKS without issue in SQL Server 2008 R2 would suddenly be invalid in SQL Server 2012
    I need to know why my script which is working great on our current SQL Server 2008 R2 servers suddenly fails and won't run on an new SQL Server 2012 server.  This script is used to create 'bulk' Replications on a large number of DBs saving a tremendous
    amount of our time doing it the manual way.
    Below is an 'condensed' version of the script which fails.  I have removed around 2550 lines of specific sp_addarticle statements which are mostly just copy and pasted from what SQL Management Studio 'scripted' for me went I when through the Replication
    Wizard and told it to save to script.
    declare @dbname varchar(MAX), @SQL nvarchar(MAX)
    declare c_dblist cursor for
    select name from sys.databases WHERE name like 'dbone[_]%' order by name;
    open c_dblist
    fetch next from c_dblist into @dbname
    while @@fetch_status = 0
    begin
    print @dbname
    SET @SQL = 'DECLARE @dbname NVARCHAR(MAX); SET @dbname = ''' + @dbname + ''';
    use ['+@dbname+']
    exec sp_replicationdboption @dbname = N'''+@dbname+''', @optname = N''publish'', @value = N''true''
    use ['+@dbname+']
    exec ['+@dbname+'].sys.sp_addlogreader_agent @job_login = N''DOMAIN\DBServiceAccount'', @job_password = N''secret'', @publisher_security_mode = 1, @job_name = null
    -- Adding the transactional publication
    use ['+@dbname+']
    exec sp_addpublication @publication = N'''+@dbname+' Replication'', @description = N''Transactional publication of database
    '''''+@dbname+''''' from Publisher ''''MSSQLSRV\INSTANCE''''.'', @sync_method = N''concurrent'', @retention = 0, @allow_push = N''true'', @allow_pull = N''true'', @allow_anonymous = N''false'', @enabled_for_internet
    = N''false'', @snapshot_in_defaultfolder = N''true'', @compress_snapshot = N''false'', @ftp_port = 21, @allow_subscription_copy = N''false'', @add_to_active_directory = N''false'', @repl_freq = N''continuous'', @status = N''active'', @independent_agent = N''true'',
    @immediate_sync = N''true'', @allow_sync_tran = N''false'', @allow_queued_tran = N''false'', @allow_dts = N''false'', @replicate_ddl = 1, @allow_initialize_from_backup = N''true'', @enabled_for_p2p = N''false'', @enabled_for_het_sub = N''false''
    exec sp_addpublication_snapshot @publication = N'''+@dbname+' Replication'', @frequency_type = 1, @frequency_interval = 1, @frequency_relative_interval = 1, @frequency_recurrence_factor = 0, @frequency_subday = 8,
    @frequency_subday_interval = 1, @active_start_time_of_day = 0, @active_end_time_of_day = 235959, @active_start_date = 0, @active_end_date = 0, @job_login = N''DOMAIN\DBServiceAccount'', @job_password = N''secret'', @publisher_security_mode = 1
    -- There are around 2400 lines roughly the same as this only difference is the tablename repeated below this one
    use ['+@dbname+']
    exec sp_addarticle @publication = N'''+@dbname+' Replication'', @article = N''TABLE_ONE'', @source_owner = N''dbo'', @source_object = N''TABLE_ONE'', @type = N''logbased'', @description = null, @creation_script =
    null, @pre_creation_cmd = N''drop'', @schema_option = 0x000000000803509F, @identityrangemanagementoption = N''manual'', @destination_table = N''TABLE_ONE'', @destination_owner = N''dbo'', @vertical_partition = N''false'', @ins_cmd = N''CALL sp_MSins_dboTABLE_ONE'',
    @del_cmd = N''CALL sp_MSdel_dboTABLE_ONE'', @upd_cmd = N''SCALL sp_MSupd_dboTABLE_ONE''
    EXEC sp_executesql @SQL
    SET @dbname = REPLACE(@dbname, 'dbone_', 'dbtwo_');
    print @dbname
    SET @SQL = 'DECLARE @dbname NVARCHAR(MAX); SET @dbname = ''' + @dbname + ''';
    use ['+@dbname+']
    exec sp_replicationdboption @dbname = N'''+@dbname+''', @optname = N''publish'', @value = N''true''
    use ['+@dbname+']
    exec ['+@dbname+'].sys.sp_addlogreader_agent @job_login = N''DOMAIN\DBServiceAccount'', @job_password = N''secret'', @publisher_security_mode = 1, @job_name = null
    -- Adding the transactional publication
    use ['+@dbname+']
    exec sp_addpublication @publication = N'''+@dbname+' Replication'', @description = N''Transactional publication of database
    '''''+@dbname+''''' from Publisher ''''MSSQLSRV\INSTANCE''''.'', @sync_method = N''concurrent'', @retention = 0, @allow_push = N''true'', @allow_pull = N''true'', @allow_anonymous = N''false'', @enabled_for_internet
    = N''false'', @snapshot_in_defaultfolder = N''true'', @compress_snapshot = N''false'', @ftp_port = 21, @allow_subscription_copy = N''false'', @add_to_active_directory = N''false'', @repl_freq = N''continuous'', @status = N''active'', @independent_agent = N''true'',
    @immediate_sync = N''true'', @allow_sync_tran = N''false'', @allow_queued_tran = N''false'', @allow_dts = N''false'', @replicate_ddl = 1, @allow_initialize_from_backup = N''true'', @enabled_for_p2p = N''false'', @enabled_for_het_sub = N''false''
    exec sp_addpublication_snapshot @publication = N'''+@dbname+' Replication'', @frequency_type = 1, @frequency_interval = 1, @frequency_relative_interval = 1, @frequency_recurrence_factor = 0, @frequency_subday = 8,
    @frequency_subday_interval = 1, @active_start_time_of_day = 0, @active_end_time_of_day = 235959, @active_start_date = 0, @active_end_date = 0, @job_login = N''DOMAIN\DBServiceAccount'', @job_password = N''secret'', @publisher_security_mode = 1
    -- There are around 140 lines roughly the same as this only difference is the tablename repeated below this one
    use ['+@dbname+']
    exec sp_addarticle @publication = N'''+@dbname+' Replication'', @article = N''DB_TWO_TABLE_ONE'', @source_owner = N''dbo'', @source_object = N''DB_TWO_TABLE_ONE'', @type = N''logbased'', @description = null, @creation_script
    = null, @pre_creation_cmd = N''drop'', @schema_option = 0x000000000803509D, @identityrangemanagementoption = N''manual'', @destination_table = N''DB_TWO_TABLE_ONE'', @destination_owner = N''dbo'', @vertical_partition = N''false''
    EXEC sp_executesql @SQL
    fetch next from c_dblist into @dbname
    end
    close c_dblist
    deallocate c_dblist
    George P Botuwell, Programmer

    Hi George,
    Thank you for your question. 
    I am trying to involve someone more familiar with this topic for a further look at this issue. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated. 
    Thank you for your understanding and support.
    If you have any feedback on our support, please click
    here.
    Allen Li
    TechNet Community Support

  • Thread : select switchover_status from v$database

    hi there,
    I am not able to change my primary database switchover to standby. As before i did some r.n.d while running below command on primary db: "alter database commit to switchover to physical with session shutdown" then i checked status
    "select switchover_status from v$database";
    sql>SWITCHOVER_STATUS
    TO PRIMARY
    after that i run this command to switch again to standby db:
    sql> alter database commit to switchover to standby with session shutdown;
    Database altered.
    but still showing same status:
    SQL> select switchover_status from v$database;
    SWITCHOVER_STATUS
    TO PRIMARY
    how do i make my primary db on switchover_status to standby .any solution would be graceful.
    thanks

    bingo!!
    i create backup of controlfile:
    sql>alter database backup controlfile to trace as '/Pgh/controlfile.sql';
    and take my primary db to nomount stage run the script:
    startup nomount;
    sql@Pgh/controlfile.sql';
    database mount;
    alter database open resetlogs;
    then i checked switchover_status
    select switchover_status from v$database;
    SWITCHOVER_STATUS
    to standby

Maybe you are looking for

  • How to print out page number

    I want to print page number with every page how it possible..... So that I would come to know how many printed documents are left.... Please reply soon

  • 13-inch, Late 2011 macbook pro i7 does not have option to turn mirroring on

    In the display preferences there is no option to turn mirroring if available, can anyone help. I can stream through itunes so I know my apple TV is accessible. Can anyone help?

  • Need to send the zip file to mail as an attachment

    i want to pick the zip file which consists some 2,3 files inside it. and send as it is to mail as an attachment.what i did is i have taken one zip file,,, "testing.zip" inside it i have "test1.txt" & "test2.csv" i created sender CC ,,in that i used m

  • Automatic Issuance after Goods Receipt

    Good day! Is there an available transaction code or movement type that could suffice this requirement: we want to GR a PO but will be automatically issued to a sales order. We have tried using movement type 231 in MIGO but the PO can not be displayed

  • Customize row specific row in ListBox

    Hello  I have several tables similar to this in my base.  row11   | row12  | row13   | row14  row21   | row22  | row23   | row24  row31   | row32  | row33   | row34  row41   | row42  | row43   | row44  row51   | row52  | row53   | row54 the first col