OracleBulkCopy WritetoServer does Select * from TableName , fix it please

In Odp.Net latest version , whenever OracleBulkCopy.WritetoServer is called. It internally calls "Select * from TableName " to validate the table schema.
I did some debugging and found that this is called in function GetMetaData() in OracleBulkCopy class .
Please fix this issue by appending where 1=0 in the select clause so that it does not do a full table scan for every bulk copy insert.
The whole advantage of OracleBulkcopy performance improvement is lost because of this line.
When the Destination Table has < 1 lakh records this is not a big issue, but it degrades very badly when the destination table name has million records .
Please release a patch as soon as possible.

yes 100% sure, we even captured the trace logs from the Oracle Db end and we saw that "Select * from Tablename" was executed. See the trace below.
To elaborate on it, I am a .Net Consultant, i even went into the Odp.Net dll code and verified that GetMetaData function is called when WritetoServer is called on a new OracleBulkCopyInstance.
trace below
SQL ID: 46dym63c8qhxd
Plan Hash: 0
select *
from
TABLEX
call count cpu elapsed disk query current rows
Parse 1 0.01 0.01 0 60 0 0
Execute 0 0.00 0.00 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
total 1 0.01 0.01 0 60 0 0
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 94
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 1 0.00 0.00
SQL*Net message from client 1 0.00 0.00
SQL ID: 5s2vzq2q78n3w
Plan Hash: 0
LOCK TABLE "SCHEMAX"."TABLEX" IN ROW EXCLUSIVE MODE NOWAIT
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
total 2 0.00 0.00 0 0 0 0
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 94 (recursive depth: 1)
SQL ID: dbxwyh9wxp32b
Plan Hash: 0
LOCK TABLE "SCHEMAX"."TABLEX" PARTITION ("P3") IN EXCLUSIVE MODE
NOWAIT
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
total 2 0.00 0.00 0 0 0 0
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 94 (recursive depth: 1)
SQL ID: 9y27jut66ajz5
Plan Hash: 0
INSERT /*+ SYS_DL_CURSOR */ INTO "SCHEMAX"."TABLEX" PARTITION ("P3")
("PARTITION_ID","GID","SEGMENT_ID","RID","STATUS",
"VERIFIC","FILE_ID","RECORD_ID","SUB_REC_ID",
"S_ID2","FILLER1","FILLER2","FILLER3","FILLER4","FILLER5",
"FILLER6","FILLER7","FILLER8","FILLER9","FILLER10","FILLER11","FILLER12",
"FILLER13","FILLER14","FILLER15","FILLER16","FILLER17","FILLER18",
"FILLER19","FILLER20","FILLER21","FILLER22","FILLER23","FILLER24",
"FILLER25","FILLER26","FILLER27","FILLER28","FILLER29","FILLER30",
"ID_BODY","CODE","EXP_DATE","SUB_RECORD_3","OCCUR",
"PARENT","SEGMENT","ID_VALUE","IS_ID")
VALUES
(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL)
Edited by: Y2KPRABU on Jul 16, 2012 11:38 PM

Similar Messages

  • Select * from {tablename}  : invalid table name error

    Hi,
    I want to get data from a table and the table should be passed at runtime from selecting a table from the drop down list.In case of insertion of values I am getting no errors.But when I pass the table name as an argument I am getting invalid table name error.I think there is any syntax errors.I appreciate any help.
    Regards,
    Sivaram

    you cannot use parameter for table name in PreparedStatement.
    you can either generate the sql dynamically, such as String sql="select * from "+tablename, or you can check whether the database vendor has special api for this.

  • Which is fast ? Select * from tableName or Select Column1,Column2 .... From tableName ? and Why ?

    Which is fast ? Select * from tableName or Select Column1,Column2 .... From tableName ? and Why ?
    select * from Sales.[SalesOrderHeader]
    select SalesOrderNumber,RevisionNumber,rowguid from Sales.[SalesOrderHeader]
    As you can see both the query execution plan and subtree cost is same. So how selecting the particular columns optimize the query ?

    Which is fast ? Select * from tableName or Select Column1,Column2 .... From tableName ? and Why ?
    select * from Sales.[SalesOrderHeader]
    select SalesOrderNumber,RevisionNumber,rowguid from Sales.[SalesOrderHeader]
    As you can see both the query execution plan and subtree cost is same. So how selecting the particular columns optimize the query ?
    Yes, selecting specific columns is always better than select *.
    If you always need few columns in result, then just use SELECT col1, col2 FROM YourTable. If you SELECT * FROM YourTable; that is extra useless overhead.
    If in future if someone adds Image/BLOB/Text type columns in your table, using SELECT * will worsen the performace for sure.
    Let's say if you have SP and you use INSERT INTO DestTable SELECT * FROM TABLE which runs fine BUT again if someone adds few more columns then your SP will fail saying provided columns don't match.
    -Vaibhav Chaudhari

  • Why does "SELECT * FROM [database].[schema].[table]" not work in Azure ?

    Hi all
    In Microsoft Azure I have 2 databases.
    I work since more than 10 years with T-SQL and I always use
    fully qualified object names, means "[database].[schema].[table]".
    When I now make a connection to my database "A" in Azure and
    write a Query against database "B" ("SELECT * FROM [B].[schema].[table]")
    I get an exception. Of course when I connect to database "B" it works
    but again not to database "A". When I use "SELECT * FROM [schema].[table]"
    with the right database connected, it also works in Azure.
    Hope you understand what I mean :-)
    In MS-SQL, this of course works fine.
    Well my question is: What sense does this make ??
    Do I now have to re-write everything just for azure or will this behavior changed sometimes ?
    I know MS-SQL is not the same like Azure-SQL, but hey; does Microsoft think all projects have only one database ?? :-)
    Thanks for any answer
    Frank

    Hi Frank,
    According to your description, you want to retrieval data cross database in SQL Azure, right?
    As June said, Currently cross database joins are not supported in SQL Azure. Also you cannot change database mid query so you cannot, for example, put a USE [MyDB] in your query either. Please refer to the link below to see the details.
    http://www.britishdeveloper.co.uk/2011/11/cross-database-joins-in-sql-azure.html
    If you have any concern about this behavior, you can submit a feedback at
    http://connect.microsoft.com/SQLServer/Feedback and hope it is resolved in the next release of service pack or product. Your feedback enables Microsoft to make software and services the best that they can be, Microsoft might consider to add this feature
    in the following release after official confirmation.
    Regards,
    Charlie Liao
    TechNet Community Support

  • Facebook wont load but everything else does? can you fix this please?

    For the past 2 days now when ever i try to log onto facebook it will not load the page. Everything else works just fine. Why is this and how can i fix this annoying problem so i can contact folks overseas?

    Using Safari to access Facebook?
    If so...
    From your Safari menu bar click Safari > Preferences then select the Privacy tab.
    Click:   Remove All Website Data
    Then delete the cache.
    Open a Finder window. From the Finder menu bar click Go > Go to Folder
    Type or copy paste the following
    ~/Library/Caches/com.apple.Safari/Cache.db
    Click Go then move the Cache.db file to the Trash.
    Quit and relaunch Safari to test.
    If nothing above helped, troubleshoot Safari extensions.
    From the Safari menu bar click Safari > Preferences then select the Extensions tab. Turn that OFF, quit and relaunch Safari to test.
    If that helped, turn one extension on then quit and relaunch Safari to test until you find the incompatible extension then click uninstall.

  • Long delay executing "select from m_service_replication" when partner is not reachable.

    I'm testing two SAP HANA SP08 with synchronous system replication. When connection between two replication partner is not available, any query that does select from m_service_replication takes relatively long time (almost 3 minutes for the first query after connection gets severed). All other queries I tried are not affected. Is it expected behavior? I do not quite understand why simple SQL query should depend on replication status, especially as hdbcons replication info returns immediately.
    Thank you!

    Hi,
    actually your database should not hang. Because when it hangs on one node this error will impact all the other instances as well, since this node has database blocks in memory it exclusively accesses, and when these cannot be transferred, your other nodes will "wait". Hence it is crucially important that when your disk controller hangs, the database instance gets aborted, if not even the node should get evicted.
    So if your described szenario really is the case, then the service definition will not help you fix the issue. You should instead have a look at the reason, why the node does not react (or does not get an error).
    If the clusternode behaves correctly then the service will failover. Just make sure you configure your clients correctly to react to this:
    http://www.oracle.com/technetwork/products/clustering/overview/awmrac11g-133673.pdf
    Regards
    Sebastian

  • "select * from table" and "select top 14260 from table" get nothing but select top 14259 get result successful

    select * from tablename                   ------always running,but get nothing
    select top 1 *  from tablename         -------get result quickly
    select top 2 *  from tablename         -------get result quickly
    select top 14259 * from tablename  --------get result quickly
    select top 14260 * from tablename  --------always running,but get nothing
    the thread is:
    java.net.SocketInputStream.socketRead0(Native Method)
    java.net.SocketInputStream.read(SocketInputStream.java:150)
    java.net.SocketInputStream.read(SocketInputStream.java:121)
    com.microsoft.sqlserver.jdbc.TDSChannel.read(IOBuffer.java:1782)
    com.microsoft.sqlserver.jdbc.TDSReader.readPacket(IOBuffer.java:4838)
       - 已锁定com.microsoft.sqlserver.jdbc.TDSReader@54269910
    com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(IOBuffer.java:6150)
    com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:402)
    com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:350)
    com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
    com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
       - 已锁定java.lang.Object@320b1499
    com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180)
    com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155)
    com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.execute(SQLServerPreparedStatement.java:332)

    when I run the below sql of Uri Dimant,I get many rows,I think you are right!
    Do you have some method to handle this problem?
    Or do you have some information for me to Learn?
    Thanks a lot.
    SELECT
    owt.session_id AS waiting_session_id,
        owt.blocking_session_id,
    DB_NAME(tls.resource_database_id) AS database_name,
        (SELECT SUBSTRING(est.[text], ers.statement_start_offset/2
    + 1,
    (CASE WHEN ers.statement_end_offset = -1
    THEN LEN(CONVERT(nvarchar(max), est.[text])) * 2
    ELSE ers.statement_end_offset
    END
    - ers.statement_start_offset
    ) / 2)
    FROM sys.dm_exec_sql_text(ers.[sql_handle]) AS est) AS waiting_query_text,
    CASE WHEN owt.blocking_session_id > 0 
    THEN (
    SELECT
    est.[text] FROM sys.sysprocesses AS sp
    CROSS APPLY sys.dm_exec_sql_text(sp.[sql_handle]) as est
    WHERE sp.spid = owt.blocking_session_id)
    ELSE
    NULL
    END AS blocking_query_text,
        (CASE tls.resource_type
    WHEN 'OBJECT' THEN OBJECT_NAME(tls.resource_associated_entity_id, tls.resource_database_id)
    WHEN 'DATABASE' THEN DB_NAME(tls.resource_database_id)
    ELSE (SELECT  OBJECT_NAME(pat.[object_id], tls.resource_database_id)
    FROM sys.partitions pat WHERE pat.hobt_id = tls.resource_associated_entity_id)
    END
    ) AS object_name,
    owt.wait_duration_ms,
    owt.waiting_task_address,
    owt.wait_type,
    tls.resource_associated_entity_id,
    tls.resource_description AS local_resource_description,
    tls.resource_type,
    tls.request_mode,
    tls.request_type,
    tls.request_session_id,
    owt.resource_description AS blocking_resource_description,
    qp.query_plan AS waiting_query_plan
    FROM sys.dm_tran_locks AS tls
    INNER JOIN sys.dm_os_waiting_tasks owt ON tls.lock_owner_address = owt.resource_address
    INNER JOIN sys.dm_exec_requests ers ON tls.request_request_id = ers.request_id
    AND owt.session_id = ers.session_id
    OUTER APPLY sys.dm_exec_query_plan(ers.[plan_handle]) AS qp
    GO

  • Select * from (select * from.....) ........problem

    Hi all!
    I am facing a prob while designing a query:
    I have a table named ind_mtr with column named "seq_no"....seq_no has a unique index.
    I want to arrange the data by seq_no in desc order and from arranged data i want to select first 500 records. For this purpose i supplied the following query:
    select seq_no from (select seq_no from ind_mtr where rownum<501)
    order by seq_no desc;
    But it is giving me wrong results...it selects first 500 records in database and then arranges them in desc order with respect to seq_no.
    Can anybody tell me how can i solve this...
    Riaz

    Since the 1st 500 rows in descending order on seq_id represents the 500 max values of seq_id, you really want something like the following: SELECT * FROM <tablename> where seq_id BETWEEN ( SELECT MAX( seq_id ) - 500 FROM <tablename> ) AND (SELECT MAX(seq_id) FROM <tablename> ); Or you could put into 2 queries in anonymous block. There is probably a better way. You should look into SQL For Smarties and SQL Puzzles and Answers by Joe Celko. Hope this helps.

  • Select from Multiple tables

    Hi,
    I am doing select from multiple tabels (2) in one SQL query.
    How to get the result as it says.. Column name is incorrect ?
    thanks,
    -raj

    treat the resultset as noraml. You get it in sequence as you have specified the column names. You use rs.getXXX(index) instead of columnname

  • Selecting from a comm delimited list

    Often we run queries like
    SELECT * FROM TABLENAME WHERE FIELDA NOT IN ('A','B','C');
    But what if your question goes in the opposite direction, what syntax would work?
    In other words. suppose I want to know which values in the list are not in the table. How could I find that out without having to create a temp table?
    I'm thinking that something like the following might work:
    SELECT FIELDA FROM ('A','B','C') A
    WHERE NOT EXISTS (SELECT 1 FROM TABLENAME B
    WHERE B.FIELDA = A.FIELDA)

    If you have a list of 30,000 items that you want to consider, then you'll likely want to have those items in a table. Here I'll create a fake table of orders, then create a shipment for most of those orders. Then I'll ask which orders of order type "PACKAGE BODY" have not been shipped.
    SQL> create table orders as
      2  select object_id AS order_id,
      3         object_type as order_type,
      4         owner as customer
      5    from all_objects;
    Table created.
    SQL>
    SQL> create table shipments as
      2  select *
      3    from orders
      4   where mod(order_id,47) > 0;
    Table created.
    SQL>
    SQL> select order_id
      2    from orders
      3   where order_type = 'PACKAGE BODY'
      4  minus
      5  select order_id
      6    from shipments
      7   where order_type = 'PACKAGE BODY';
      ORDER_ID
          3290
          3619
          3948
          4888
          5499
          5546
         25098
         25192
         29422
         32618
    10 rows selected.
    SQL>

  • Problem selecting from VIEW

    Hi All,
    I have to select from a maintenance view which is well defined (in ABAP DDIC).
    The problem is :
    <b>
    System is throwing a error saying the view is NOT defined in ABAP DDIC.
    </b>
    What can be the possible reason for this.
    Can we <b>NOT</b> select from maintainance views ?
    Please advice.
    Regards,
    Anirban

    HI,
      There is no harm in making use of view ...
    Can you please let us know the view which you are making use of ??
    Regards,
    Santosh

  • Selected from my iphone "Buy more ringtones"and it has dowloaded as a music file how do i get it to be a ring tone which is what should have happened.  Any ideas on how to fix this?

    selected from my iphone "Buy more ringtones"and it has dowloaded as a music file and is now in itunes on my laptop and in music on my iphone. How do i get it to be a ring tone which is what should have happened in the first place.  Any ideas on how to fix this? As in itunes I cannot see how to a) change it to a ring or b) drag across to the right area...
    I simply followed the prompts on my iphone 4s and would have expected it to end up as a ring tone.. any help, guidance, advice welcome...

    selected from my iphone "Buy more ringtones"and it has dowloaded as a music file and is now in itunes on my laptop and in music on my iphone. How do i get it to be a ring tone which is what should have happened in the first place.  Any ideas on how to fix this? As in itunes I cannot see how to a) change it to a ring or b) drag across to the right area...
    I simply followed the prompts on my iphone 4s and would have expected it to end up as a ring tone.. any help, guidance, advice welcome...

  • Objects in a cube: Does it matter whether selected from ODS or infocatalogu

    Hi,
    Objects in a cube: Does it matter whether selected from ODS or infocatalogue?
    When creating a cube, you have the option to select the char and key figures directly from ODSes feeding the cube or from the infocatalogue where the objects originally existed.
    Does it make a different, which of these 2 places you select the objects from for the cube?
    Thanks

    hi Amanda,
    it makes no difference, it doesn't matter.
    the ods/infoobject catalog just serve as template where we can choose infoobjects to be included in infocube.
    later in bi 7.0, we can directly type in infoobject technical name, like in ODS.
    hope this helps.

  • Select from 1 table only if a value does not exist

    Hello all,
    I'm having problems devising a single select statement to accomplish a single return value. I have tried variations of DECODE and COALESCE, but it's escaping me.
    I have two tables that are as follows:
    NAME
    ID, FULLNAME
    1, Senior
    2, Junior
    3, Mister
    4, Senor
    5, Miss
    ABBREVIATION
    ID, ABBREV
    1, Sr
    2, Jr
    3, Mr
    5, Ms
    What I would like to do is select from the NAME table only if the value does not exist in the ABBREVIATION table.
    Ideally if I were to do something such as:
    SELECT * FROM .... WHERE (ID=1 or ID=2 or ID=4) ....
    I would receive the following output:
    1, Sr
    2, Jr
    4, Senor
    Thanks for reading!

    You want an outer join.
    SELECT decode(a.abbrev, NULL, n.fullname, a.abbrev)
    FROM name n,
    abbreviation a
    WHERE n.ID = a.ID(+)
      AND ....Something like that.
    Full example:
    with n as (
    select 1 as ID, 'Senior' as FULLNAME from dual UNION ALL
    select 2 as ID, 'Junior' as FULLNAME from dual UNION ALL
    select 3 as ID, 'Mister' as FULLNAME from dual UNION ALL
    select 4 as ID, 'Senor' as FULLNAME from dual UNION ALL
    select 5 as ID, 'Miss' as FULLNAME from dual),
    a as (
    select 1 as ID, 'Sr' as ABBREV from dual UNION ALL
    select 2 as ID, 'Jr' as ABBREV from dual UNION ALL
    select 3 as ID, 'Mr' as ABBREV from dual UNION ALL
    select 5 as ID, 'Ms' as ABBREV from dual)
    select decode(a.abbrev, NULL, n.fullname, a.abbrev)
    from a, n
    where n.id = a.id(+)
    order by n.id;
    ID                     DECODE(A.ABBREV,NULL,N.FULLNAME,A.ABBREV)
    1                      Sr                                       
    2                      Jr                                       
    3                      Mr                                       
    4                      Senor                                    
    5                      Ms                                       
    5 rows selectedEdited by: tk-7381344 on Nov 17, 2008 1:31 PM

  • HT1338 I cannot access my Hotmail account with Safari on my MacBookAir but I can access it on my Mac/Safari and also from my PCs.  Has anyone experienced the same?  Does anyone know a fix for this?

    I cannot access my Hotmail account with Safari on my MacBookAir but I can access it on my Mac/Safari and also from my PCs.  Has anyone experienced the same?  Does anyone know a fix for this?

    To find out if it's system wide or user specific, try this...
    Open System Preferences>Users & Groups, unlock the lock, click on the little plus icon, make a new admin account, log out & into the new account.
    Does it work in the new account?

Maybe you are looking for