Best way to insert in a table througth a database link

Hi all,
i have two databases (oracle 10g, windows 2003 server)
Database A and Database B
i need to insert data in a table (Table_A) that lives in database A
The data i have to insert is in a table that lives a database B
I have a database link from database B to database A
so, connected to database B, i'm trying the following :
insert into table_a@database_link_to_A
select col1
from table_b
where col1 is not null
This query is taking forever, and i have to cancel it.
I'd like to hear from your experience. Wich is the best way to accomplish this task ?
Best Regards
Rui Madaleno
NOTE: I forgot to mencion that Table_A does not have any trigger or indexes.
Edited by: ruival on Jan 20, 2010 3:51 PM

Try this:
insert /*+ append */ into table_a@database_link_to_A select col1 from table_b where col1 is not nullOr
Sqlplus COPY another option.
[http://www.praetoriate.com/oracle_tips_dm_sqlplus_copy.htm]
HTH
-Anantha

Similar Messages

  • Best way to insert millions of records into the table

    Hi,
    Performance point of view, I am looking for the suggestion to choose best way to insert millions of records into the table.
    Also guide me How to implement in easier way to make better performance.
    Thanks,
    Orahar.

    Orahar wrote:
    Its Distributed data. No. of clients and N no. of Transaction data fetching from the database based on the different conditions and insert into another transaction table which is like batch process.Sounds contradictory.
    If the source data is already in the database, it is centralised.
    In that case you ideally do not want the overhead of shipping that data to a client, the client processing it, and the client shipping the results back to the database to be stored (inserted).
    It is must faster and more scalable for the client to instruct the database (via a stored proc or package) what to do, and that code (running on the database) to process the data.
    For a stored proc, the same principle applies. It is faster for it to instruct the SQL engine what to do (via an INSERT..SELECT statement), then pulling the data from the SQL engine using a cursor fetch loop, and then pushing that data again to the SQL engine using an insert statement.
    An INSERT..SELECT can also be done as a direct path insert. This introduces some limitations, but is faster than a normal insert.
    If the data processing is too complex for an INSERT..SELECT, then pulling the data into PL/SQL, processing it there, and pushing it back into the database is the next best option. This should be done using bulk processing though in order to optimise the data transfer process between the PL/SQL and SQL engines.
    Other performance considerations are the constraints on the insert table, the triggers, the indexes and so on. Make sure that data integrity is guaranteed (e.g. via PKs and FKs), and optimal (e.g. FKs should be indexes on the referenced table). Using triggers - well, that may not be the best approach (like for exampling using a trigger to assign a sequence value when it can be faster done in the insert SQL itself). Personally, I avoid using triggers - I rather have that code residing in a PL/SQL API for manipulating data in that table.
    The type of table also plays a role. Make sure that the decision about the table structure, hashed, indexed, partitioned, etc, is the optimal one for the data structure that is to reside in that table.

  • Best way to outer join a table that is doing a sub query

    RDBMS : 11.1.0.7.0
    Hello,
    What is the best way to outer join a table that is doing a sub query? This is a common scenario in EBS for the date tracked tables.
    SELECT papf.full_name, fu.description
      FROM fnd_user fu
          ,per_all_people_f papf
    WHERE fu.user_id = 1772
       AND fu.employee_id = papf.person_id(+)
       AND papf.effective_start_date = (SELECT MAX( per1.effective_start_date )
                                          FROM per_all_people_f per1
                                         WHERE per1.person_id = papf.person_id)Output:
    No output produced because the outer join cannot be done on the sub queryIn this case I did a query in the FROM clause. Is this my best option?
    SELECT papf.full_name, fu.description
      FROM fnd_user fu
          ,(SELECT full_name, person_id
              FROM per_all_people_f papf
             WHERE papf.effective_start_date = (SELECT MAX( per1.effective_start_date )
                                                  FROM per_all_people_f per1
                                                 WHERE per1.person_id = papf.person_id)) papf
    WHERE fu.user_id = 1772
       AND fu.employee_id = papf.person_id(+)Output:
    FULL_NAME     DESCRIPTION
    {null}            John DoeThanks,
    --Johnnie                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Hi,
    BrendanP wrote:
    ... See the adjacent thread for the other with Row_Number().Do you mean {message:id=10564772} ? Which threads are adjacent is always changing. Post a link.
    I think RANK suits the requirements better than ROW_NUMBER:
    WITH    all_matches     AS
         SELECT  papf.full_name
         ,      fu.description
         ,     RANK () OVER ( PARTITION BY  papf.person_id
                               ORDER BY          papf.effective_start_date     DESC
                        )           AS r_num
         FROM             fnd_user             fu
         LEFT OUTER JOIN      per_all_people_f  papf  ON  fu.employee_id  = papf.person_id
         WHERE   fu.user_id  = 1772
    SELECT     full_name
    ,     description
    FROM     all_matches
    WHERE     r_num     = 1
    Johnnie: I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    See the forum FAQ {message:id=9360002}

  • In Acrobat Professional 8, what is the best way to insert/combine multiple pdf's together in a large

    In Acrobat Professional 8, what is the best way to insert/combine multiple pdf's together in a large volume?
    We have 300 pdf reports and need to insert a 2 page cover page infront of each report. Not sure if Batch processing is best???
    Thanks for any tips.

    Probably each cover page is different too. I would probably just bite the bullet and do each individually. I would create the 2 cover pages in WORD or other word processor and print to cover.pdf. Then open a PDF and Pages>Insert Pages or the cover.pdf to the front of the open PDF and save as to the current PDF. Then repeat 299 times. Each time you would make the appropriate change to the DOC file and print a new cover.pdf file (you might want to turn off open in Acrobat for this processing in the printer properties to save time). Probably a good idea to keep a list of the files to check off what has been done (you can generate a list in DOS by Start>cmd, change the directory to your location [cd path], and do "dir >>list.txt". That will give you a list to use.). There may be an easier way, but by the time you get it figured out you might be done this way.

  • Best way to deal with Mutating table exception with Row Level Triggers

    Hello,
    It seems to be that the best way to deal with Mutating Table exception(s) is to have to put all the trigger code in a package & use it in conjunction with a Statement level trigger .
    This sounds quite cumbersome to me . I wonder is there any alternative to dealing with Mutating table exceptions ?
    With Regards

    AskTom has a good article about this,
    http://asktom.oracle.com/tkyte/Mutate/index.html

  • What is the best way of insertion using structured or binary type in oracle

    what is the best way of insertion using structured or binary type in oracle xml db 11g database

    SQL*Loader.

  • Best way to insert 300dpi photo's into Ilustrator file for print

    I am creating a 5.5 X 8 postcard style card for print.  I need to place 15 photographs that are aprox. 1.5 X 2.5 each.  What is the best way to insert these files so that my file doesn't become too large?  I will be making a PDF of the final artwork to send to the printer.  Your guidance is much appreciated!!

    Link don't embed the images. Use a layered format such as .psd, .tif, or .pdf. Psd is not lossy, .tif can be lossy if you modify the default settings, .pdf you choose how much compression you want, and a small amount of compression can make a much smaller file size.
    I would recomend using .psd, in cmyk color space. When you make your pdf for printing is when you will decide how much compression and which pdf preset you will use(press ready or PDF X should be a good choice). That will be your important choice.

  • Best way to insert a handmade signature

    Best way to insert a handmade signature
    I would like to know the best way to insert a handmade signature in a pdf acrobat document.
    Best Regards
    p.d. A tutorial perhaps ?

    Yep you link in now fixed. what most likely happed is when you click on Link tool in the forum, when window open the http:// is already in the window. Most likely you clicked at the beginning of the http and pasted your link.
    I always when this window open triple click on the http:// so everything is selected, then hit Delete (I use Mac - PC it would be backspace) so window is completely empty then I paste the link.
    But I occasionally I let it happen myself.

  • What is the best way to insert massive data into an existing excel file?

    dear gurus,
    i am wondering that what is the best way to insert massive data into an existing excel file, more performance perspective.
    the file is read from BDS , and we want to insert data into it .
    the way i can think of is
    1. OLE AUTOMATION
       i think performance will be a big problem
    2. Office integration
        i am not sure it's facing the same performance issue ?
    3 . XXL_SIMPLE_API/FULL_API
        I am not sure whether they can insert data into an existing excel file?
    could you please give me some advices?
    br.
    jun

    Hi,
    If you want to APPEND data( add data to an existing excel file) from SAP, then use GUI_DOWNLOAD fm with APPEND = 'X' paramter.
    Best regards,
    Prashant

  • How many ways to insert data in the R/3 database

    hi
                 abappers,
    could u pls tell me for this question.

    Hi Basha,
    There are many ways to insert data in the R/3 database.
    Based on lot of factors, it will be decided which option to use.
    For example:
    1. Through a BDC ABAP program
    2. Through LSMW tool
    3. Through IDOCS using ALE or EDI
    4. Through ABAP program using insert/modify statement
    5. Manually creating entres in the table
    6. Using transaction code SM30 (Maintain table Views)
    Hope this helps.
    Please reward if useful.
    Thanks,
    Srinivasa

  • Can you suggest a best way to store and read arabic from oracle database?

    Hi ,
    can you suggest a best way to store and read arabic from oracle database?
    My oracle database is Oracle Database 10g Release 10.1.0.5.0 - 64bit Production on unix HP-UX ia64.
    NLS_NCHAR_CHARACTERSET AL16UTF16
    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    NLS_CHARACTERSET WE8ISO8859P1
    I have presently stored the data in nvarchar2 field. But i am not able to display it correctly.

    Using the national characterset should work but there are other factors that you have to consider when working with NCHAR/NVARCHAR2/NCLOB.
    If possible, changing the characterset is usually the best solution if it's a possiblity for you.
    For more info:
    Dear Gurus: Can u pls explain the difference between VARCHAR2 & NVARCHAR2??

  • The best way to insert values in a Nested Table

    Hi!
    I want to insert values from a SQL-query in a Nested Table.What's the best way to do it?
    In addition,the only way that I've found is doing a query and when I've got the query result I insert it into the Nested Table.For instance:
    FOR cur_row IN (SELECT id,nstreet from example Where id=3) LOOP
    --here I'm inserting the values of the query in the nested table.
    -- VarNestedTable is a Nested Table of Row_Type.
    --Row_Type is an object with two fields:Id,Nstreet
    VarNestedTable.extend;
    VarNestedTable(Coincidents.Last):= Row_type(cur_row.id,cur_row.nstreet);
    END LOOP;

    How to Use Tables: Creating a Table Model.
    very bad example:
    class DataObject {
    String name, age, numberOfMonkeys;
    class DOTableModel extends AbstractTableModel {
      final String[] COLUMN_HEADER = { "Name", "Age", Monkeys" };
      List dataObjects;
      public String getColumnName(int column)  {
         return COLUMN_HEADER[ column ];
      public int getRowCount() {
        return dataObjects.size();
      public int getColumnCount() {
         return COLUMN_HEADER.size();
      public Object getValueAt(int row, int column) {
         DataObject do = dataObject.get( row );
         switch( column ) {
           case 0: return do.name;
           case 1: return do.age;
           case 2: return do.numberOfMonkeys;
    }

  • Best way to Insert Records into a DB

    hi
    i have around 400000(4 lakh ) records to insert into a db , whats the optimal way to do it ,
    i tried it doin g using threads i could gain only 2 seconds for 4 lakh records ,suggest me a better way

    Very hard thread, poor informations u give us can not help me too much to understand really the problem.
    Where do u have to 40.000K (input) records?
    Those records must be only added to output table?
    How many rows, and how many indexes output table has?
    The cost oh each insert depends also on how many indexes dbms has
    to manage on oupy table.
    In general to take about 2 seconds to add to a table a large amount of rows depends on many variables (hardware performances, dbms performances and so on)
    If u ahve only to insert and your input secord statys on another table,
    I think that a performance way to do it is insert select, so
    insert into output select * from input
    If your input records statys on a text file, the best way is to use
    native dbms importer
    Let me know something more....
    Regards

  • Best way to update an OLTP table ?

    Hi,
    We have an OLTP table with huge data.
    We need to update a status column from 'N' to 'Y' for almost 70% of rows based on some condition.
    This table may be accessed by hundreds of sessions at a time.
    So, what is the best way to do the same.
    Rgds,
    Rup

    if someone is using the table, ddl cannot be done (or at least you would have to wait maybe a long time)
    quick test...
    SQL> create table bank
      2  (id number primary key
      3  ,acc number
      4  ,ind varchar2(1)
      5  )
      6  /
    Table created.
    SQL> insert into bank
      2  select rownum
      3       , rownum * 10
      4       , 'N'
      5    from all_objects
      6   where rownum <= 10
      7  /
    10 rows created.
    SQL> commit;
    Commit complete.
    SQL> update bank
      2     set acc = -10
      3   where id = 10
      4  /
    1 row updated.new session
    SQL> alter table bank
      2  add new_ind varchar2(1)
      3  /
    alter table bank
    ERROR at line 1:
    ORA-00054: resource busy and acquire with NOWAIT specifiedwell, not a long time... but anyway you can't do ddl while someone is working on the table.

  • How is the best way to manage the stats table?

    Hello!
    I have the Integration 2.1 working with an Oracle 8.1.7 db. I noticed that the table
    STATS is growing pretty fast.
    How is the best way to manage this table?... I haven't found something related with
    this issue in the documentation, but at least I want to know how to safely delete
    records from this table.
    For example, if I know the minimal time I have to keep in the table, is quite simple
    to create a shell script and/or Oracle pl/sql job to trim the table.
    I hope somebody can help me!!!!
    Thank you!
    Ulises Sandoval

    Write an app people want to buy and rate highly.

Maybe you are looking for