Run simultaneously multiple dml statements.

Hi all
I have an obligation to perform multiple dml instructions at the same time. I tried to do this using dbms_job, in vain.
I planned 3 dbms_job at the same time. Each task has a bulk insert statement, inserting into a single target table. Kick off 3 jobs, but there was almost a minute apart.
Is there another way to do this?

You can launch 3 separate SQL more sessions, but how run you dml statements at the same exact time?

My desktop computer, here's how I would do:

Create a batch back file (for example runall.cmd) that looks like this:

Start some_command.cmd
Start some_command.cmd
Start some_command.cmd

Then double-click it. This will lauch some_command.cmd in 3 separate sessions. Each will be launched but will not wait to complete before starting the next.

In the batch file, some_command.cmd, you can have everything you want. But it will probably take sqlplus.exe with command line options (one of them a .sql script).

That's how I used "Parallelization DIY" of Tom Kite. But I would normally have a parameter (such as a range or something) to keep the LMD are mutually exclusive.

Tags: Database

Similar Questions

  • running multiple dml in parallel

    It is possible to run the following at the same time (run all 3 inserts at the same time)?

    Insert into table1
    Select * from tablea;

    Insert into table2
    Select * from tableb.

    insert into table 3
    Select * from tablec.

    Thank you

    1. How can I spawn multiple threads in oracle?

    You can schedule jobs to run in another session (this is different from normal multithreaded development because you do not inherently have the ability to monitor or kill the other sessions you have created, those other sessions conducted with completely separate transactions, etc.) using the DBMS_JOB and DBMS_SCHEDULER, package i.e.

    DECLARE
      l_jobno NUMBER;
    BEGIN
      dbms_job.submit(
        l_jobno,
        'BEGIN INSERT INTO table1 SELECT * FROM someOtherTable; END;',
        sysdate + interval '10' second
      );
      commit;
    END;
    

    hourly, a new session to be created in 10 seconds to run your insert statement. You could plan as many jobs as you like.

    2. which is the best way to use when these inserts occur several times in a day at unexpected times?

    How many rows you insert?

    And why you copy all the data from one table to the other several times a day at odd intervals? This requirement seems weird - there may be another approach which does not copy all the data from one table to the other.

    Assuming that the data from volume is sufficient to make parallel DML valid, and assuming that the impact on the performance to make the parallel DML is acceptable (i.e. parallel execution means more machine resources will be dedicated to your session, leaving fewer resources for other sessions) I would usually be much prefer to have three DML statements in a single transaction in one sitting than everyone who happened to be executed at the same time to have several sessions of each race a Declaration of single-threaded.

    Justin

  • How to run multiple sql statements

    Hi all

    I wonder if I can run multiple sql statements in one shot with > >, immediate run

    for example:

    I set the variable as X: = sql statement
    Y: = sql statement
    z: = sql statement

    can I execute immediate (X, Y, Z);

    If yes how? and if not what other possible

    Thank you

    Beginning with the codes of Ganesh

    DECLARE
       l_statement                 VARCHAR2 (2000);
       v_passwd                    VARCHAR2 (200);
       v_username                  VARCHAR2 (200) := 'test';
       v_pwd_key                   VARCHAR2 (200) := 'lwty23';
       v_dblink_name               VARCHAR2 (2000);
       v_dblink_drop               VARCHAR2 (2000);
       v_dblink_create             VARCHAR2 (2000);
       v_dblink_check_connection   VARCHAR2 (2000);
       l_number                    NUMBER;
    BEGIN
       --<>
       FOR c_instance IN (SELECT *
                            FROM v_oracle_instances
                           WHERE environment = 'Developement')
       LOOP
          SELECT encpwd_owner.display_db_encpwd (v_username,
                                                 c_instance.host_name,
                                                 c_instance.instance_name,
                                                 v_pwd_key)
            INTO v_passwd
            FROM DUAL;
    
          v_dblink_name := c_instance.host_name || '_' || c_instance.instance_name;
          v_dblink_create :=
                ' CREATE DATABASE LINK '
             || v_dblink_name
             || ' CONNECT TO '
             || v_username
             || ' '
             || 'IDENTIFIED BY '
             || v_passwd
             || ' USING'
             || ' ''(DESCRIPTION=
    (ADDRESS=(PROTOCOL=TCP)(HOST= '
             || c_instance.host_name
             || ')(PORT='
             || c_instance.LISTENER_PORT
             || '))(CONNECT_DATA=(SID='
             || c_instance.instance_name
             || ')))''';
          v_dblink_check_connection := 'select 1 from global_name@' || v_dblink_name || '.QCM';    --- Notice this change. I am simply selecting 1. That should be enough to test the database link.
          v_dblink_drop := 'drop database link ' || v_dblink_name || '.QCMTLAF';
    
          -- l_statement := 'BEGIN ' || v_dblink_create ';' || v_dblink_check_connection ';' || v_dblink_drop '; END ;'
    
          BEGIN
              EXECUTE IMMEDIATE (v_dblink_create);
              DBMS_OUTPUT.PUT_LINE ('DB Link ' || v_dblink_name || ' Created');
         EXCEPTION
            WHEN others THEN
               dbms_output.put_line( 'Failed to create the database link ' || v_dblink_name  );
               dbms_output.put_line( dbms_utility.format_error_backtrace() );
               INSERT INTO error_table( column_list )
                 VALUES( <> );
         END;
    
          EXECUTE IMMEDIATE (v_dblink_check_connection) INTO l_number;    --- Notice this.
    
          DBMS_OUTPUT.PUT_LINE ('DB Link ' || v_dblink_name || ' Tested');
    
          BEGIN
             EXECUTE IMMEDIATE (v_dblink_drop);
             DBMS_OUTPUT.PUT_LINE ('DB Link ' || v_dblink_name || ' Dropped');
          EXCEPTION
             WHEN others THEN
               dbms_output.put_line( 'Failed to drop the database link ' || v_dblink_name  );
               dbms_output.put_line( dbms_utility.format_error_backtrace() );
               INSERT INTO error_table( column_list )
                 VALUES( <> );
         END;
       END LOOP;
    END;
    

    But I agree with the comment that others have grown up is not really wise to create and drop a database like that link.

    Justin

  • DBMS_FGA &amp; DML statements

    Hello


    I was able to set up and configure FGA in my database and get my SQLs get connected in DBA_FGA_AUDIT_TRAIL. However my requirement is to put the DML statements from the front of the table triggers.
    When I run an insert/update/delete statement against a table say i.e. EMP.  I would llike to see education performed in the front insert/update / deletion of the respective table triggers.  But even after configuration FGA i.e of Audit policy for the EMP table I am unable to get all records if inserted in DBA_FGA_AUDIT_TRAIL when I ask this view BEFORE the trigger Update of the table

    How to get my DML statement or clause of the DML where atleast in my before triggers. Please help in this regard.

    I went through the links and documents below, but none of that speaks my requirment.

    The notes that I have visited.

    http://download.Oracle.com/docs/CD/B19306_01/network.102/b14266/cfgaudit.htm#i1011302

    Metalink notes

    10g: Fine grain auditing (Doc ID 266896.1()
    How to use DBMS_FGA with a complex audit_condition (include/exclude multiple users) (Doc ID 832856.1()

    Thanks in advance

    I make my own comments of Nicolas - it doesn't make much sense to check if an UPDATE statement updates of each row in the table.

    If you don't want to verify such a thing (it being understood that it is almost certainly a bad idea), the classical approach would be to have
    -A BEFORE level trigger UPDATE statement which has initialized a collection
    -A BEFORE the UPDATE to the row-level trigger who populated the collection (i.e. Add the primary key for each update of the collection line)
    -AFTER level trigger UPDATE statement which compared the number of rows affected number of rows in the table

    If you want to get the SQL statement that caused an audit event to end grain, you are probably looking for

    SYS_CONTEXT( 'USERENV', 'CURRENT_SQL')
    

    But trying to use it to determine if each row is updated in the way you mentioned sounds even worse than three trigger approach.

    Justin

  • 12 c call Webservice JDeveloper get "SQL string is not a DML statement" as a SQLException exception

    Hi guys,.

    I developed a java class to access the database using the OracleDataSource class and run a SQL query with a select statement. It works very well. I have built a wrapper class and as a Web service. I get "SQL string is not a DML statement" as a SQLException exception when I run as a Web service, but it works very well as an application.

    No idea why I get this error? Not sure why WebSercie is having a problem while this works as an application.

    Thank you and best regards,

    Srini Mel

    Solved the problem by myself.

    The first release "SQL string is not a DML statement" is due to an additional line (pstmt2.executeUpdate ()) in the code.

    Second question, receives not the query response is due to bad user input. I walked into 13.21651 instead of 31.21651.

    Thank you!

    Srini

  • Insertion of a DML statement as string in a table column


    Hello

    Is there a way I can insert a dml statement (such as "update a SET COL1 = 10") in a table column using a procedure or a function.

    I can do it by simply running an INSERT statement. But how can I do with a proc or function without getting an error "Cannot perform a DML operation inside a query"

    Please advice

    Hello

    937454 wrote:

    In fact, it can be done through a procedure. I was trying to see if I can do this with a function.

    Of course, you can do so via a function; you just can not call this function of a SQL statement.

    If the function returns a VARCHAR2, then you could call it like this:

    DECLARE

    foo VARCHAR2 (100);

    BEGIN

    foo: = fun_a;

    END;

    or like this:

    BEGIN

    dbms_output.put_line (fun_a);

    END;

  • Procedure Oracle can run simultaneously?

    Hi Experts

    Procedure Oracle can run simultaneously?

    Here's my concern, my procedure is already started manually and according to the times calls the same procedure by another application at the same time, so now procedure can work simultaneously or it will display an error message?

    Please explain

    Thanks in advance

    Multiple instances of a procedure can be executed at the same time...

    It will cause problem - that will depend on what you do in the procedure...

    For example, if the procedure seeks to change the same data even time in various forums, it will cause problems...

  • PLS-00435: without LINKING DML statement to BULK cannot be used

    My requirement

    I dynamically create a staging table my_stg and then fill it out. Seems simple, but do not know why I get this error

    create table gtest4 (myid varchar2 (10), mykey varchar2 (10));


    create table gtest5 (myid varchar2 (10), mykey varchar2 (10));

    insert into gtest4 values (1.3);


    insert into gtest4 values (2.7);

    insert into gtest5 values (5,3);

    insert into gtest5 values (1, 7);

    commit;


    / * Formatted on 2012/01/27 17:52 (trainer more v4.8.8) * /.
    CREATE OR REPLACE PROCEDURE px
    IS
    RecType (RECORD IS of TYPE)
    MyID VARCHAR2 (100),
    MyKey VARCHAR2 (100)
    );

    TYPE tabtype IS rectype TABLE
    INDEX OF DIRECTORY;

    REC tabtype;
    News sys_refcursor;
    BEGIN
    EXECUTE IMMEDIATE ' create table my_stg (myid varchar2 (100), mykey varchar2 (100)) ';

    Heart OPEN FOR "select a.myid, b.mykey
    gtest4 a, gtest5 b
    where a.mykey = b.mykey';

    LOOP
    News FETCH
    COLLECTING LOOSE rec LIMIT 500;

    FORALL I IN 1... recomm. COUNTY
    EXECUTE IMMEDIATE "insert into my_stg (myid, mykey) values (rec (i) .myid,
    Rec (i). MyKey)';
    OUTPUT WHEN heart % NOTFOUND;
    END LOOP;
    END;
    /


    I compile the above proc and get

    PLS-00435: without LINKING DML statement to BULK cannot be used

    the reason why I put in run is immediate because the my_stg table does not exist, it is created on the fly

    Maybe

    INSERT INTO my_stg (myid, mykey, id_seq)
    VALUES (rec1(i), rec2(i). sequence.nextval);
    

    Concerning

    Etbin

  • How can I include multiple SELECT statements in a PL/SQL?

    I want to be able to include multiple SELECT statements in a PL/SQL script. Here are 2 of my SELECT statements. They compile them and run successfully, but when I try to run them together, I get the error: ORA-06550: line 26, column1: PLS-00103: encountered the symbol "BEGIN." Line 26, it is where the 2nd script begins. Thank you in advance for your help!

    Set serveroutput on
    DECLARE
    v_item_type VARCHAR2 (20);
    number of v_total_count;
    v_approved VARCHAR2 (20);
    number of v_apprv_count;

    BEGIN
    SELECT ITEM_TYPE, count (*)
    IN v_item_type, v_total_count
    Of
    APPLSYS. WF_ITEMS
    WHERE
    ITEM_TYPE = "GLBATCH" AND
    End_date is not null
    ITEM_TYPE GROUP;
    dbms_output.put_line ('Item_type: ' | v_item_type);
    dbms_output.put_line ('Count: ' | v_total_count);
    END;

    BEGIN
    SELECT B.ACTIVITY_RESULT_CODE, COUNT (*)
    IN v_approved, v_apprv_count
    Of
    APPLSYS. WF_ITEMS, A.
    APPLSYS. B WF_ITEM_ACTIVITY_STATUSES,
    APPLSYS. FND_USER C.
    APPLSYS. FND_USER D
    WHERE
    A.ITEM_TYPE = B.ITEM_TYPE AND
    A.ITEM_KEY = B.ITEM_KEY AND
    A.ITEM_TYPE = "GLBATCH" AND
    A.END_DATE is not null AND
    A.OWNER_ROLE = C.USER_NAME and
    B.ACTIVITY_RESULT_CODE = "APPROVED" AND
    B.ASSIGNED_USER is not null and
    B.ASSIGNED_USER (+) = D.USER_NAME
    GROUP BY b.activity_result_code;
    dbms_output.put_line (' approved: ' | v_approved);
    dbms_output.put_line ('Count: ' | v_apprv_count);
    END;

    Try this,

    Declare
       v_item_type   Varchar2(20);
       v_total_count Number;
       v_approved    Varchar2(20);
       v_apprv_count Number;
    Begin
       -- First SQL
    
       SELECT ITEM_TYPE
             ,Count(*)
         INTO v_item_type
             ,v_total_count
         FROM APPLSYS.WF_ITEMS
        WHERE ITEM_TYPE = 'GLBATCH'
          AND END_DATE Is Not Null
        Group BY ITEM_TYPE;
    
       dbms_output.put_line('Item_type: ' || v_item_type);
       dbms_output.put_line('Count: ' || v_total_count);
    
       -- Second SQL
    
       SELECT B.ACTIVITY_RESULT_CODE
             ,Count(*)
         INTO v_approved
             ,v_apprv_count
         FROM APPLSYS.WF_ITEMS                  A
             ,APPLSYS.WF_ITEM_ACTIVITY_STATUSES B
             ,APPLSYS.FND_USER                  C
             ,APPLSYS.FND_USER                  D
        WHERE A.ITEM_TYPE = B.ITEM_TYPE
          AND A.ITEM_KEY = B.ITEM_KEY
          AND A.ITEM_TYPE = 'GLBATCH'
          AND A.END_DATE Is Not Null
          AND A.OWNER_ROLE = C.USER_NAME
          AND B.ACTIVITY_RESULT_CODE = 'APPROVED'
          AND B.ASSIGNED_USER Is Not Null
          AND B.ASSIGNED_USER(+) = D.USER_NAME
        Group BY b.activity_result_code;
    
       dbms_output.put_line('Approved: ' || v_approved);
       dbms_output.put_line('Count: ' || v_apprv_count);
    End;
    

    Hope this helps,
    Christian Balz

  • Excuting multiple sql statements

    Hi to everyone.



    I am quite new to Oracle, even though I have a great experience with SQL and MySQL commands. I am facing a problem that I guess it's really Basic.



    I got a dump of an Oracle database in a format .sql. I mean that the schema and data are built thanks to a large number of sql statements. In particular the schema is done by many 'create a table... '. «While the data are built through «insert into...» ». My need is to import these databases into a new Oracle Oracle 10 g XE database.



    I installed it on a Debian system, and I can properly run a single SQL command both through the web interface http://localhost: 8080/apex and logging as user oracle through the name of sqlplus user/passwd command.



    My problem is that the data is spread over approximately 12000 SQL «INSERT INTO...» "so all one by one run might be a bit boring :-)



    < u > so I ask if there is a way to tell Oracle to execute multiple SQL statements he read a file (like MySQL for example). < /u >



    I'm planning to write a script to do if there is no better way. I know there's no way to dump databases Oracle, but I can change the .sql format since it's the only one I had.

    in SQL * Plus you can run a SQL file with the start command or the abridged version: @

    SQL> start filename.sql
    
    or 
    
    SQL> @filename.sql
    
  • Prevent the business rule to run simultaneously

    Hi all

    We are on Hyperion Planning 11.1.1.3.500. One of our business rules makes the system completely meaningless with its results when some users are running at the same time. A person must have been necessary a HBR not to run when it is already running. I need your suggestions to avoid the business rule to run simultaneously.

    Thank you

    Hello

    • tell users check the console to work first, before you run the rule.

    or

    • have a member of the system in your dimension that you can use as a flag. You set it to 1 as the beginning of the rule to indicate he runs, 0 / #Missing at the end of the rule to indicate is finished. You then add a @RETURN to leave the calculation if this flag is set to 1 in your rule. Just be careful about this because if for any reason the calculation fails, or is killed by an admin then your flag is set to 1, but you can still have a form of admin to reset these flags easily if necessary.

    See you soon

    JM

  • I have the table of 3 columns A, B, C. I want to store the sum of columns A B in the C column without using the DML statements. Can anyone help please how to do. ?

    I have the table of 3 columns A, B, C. I want to store the sum of columns A B in the C column without using the DML statements. Can anyone help please how to do. ?

    11.1 and especially you have virtual column

    SQL> create table t
      2  (
      3     a number
      4   , b number
      5   , c generated always as (a+b) virtual
      6  );
    
    Table created.
    
    SQL> insert into t (a, b) values (1, 2);
    
    1 row created.
    
    SQL> select * from t;
    
             A          B          C
    ---------- ---------- ----------
             1          2          3
    

    Before that, a front insert - trigger

    SQL> create table t
      2  (
      3     a number
      4   , b number
      5   , c number
      6  );
    
    Table created.
    
    SQL> create or replace trigger t_default before insert on t for each row
      2  begin
      3    :new.c := :new.a+:new.b;
      4  end;
      5  /
    
    Trigger created.
    
    SQL> insert into t (a, b) values (1, 2);
    
    1 row created.
    
    SQL> select * from t;
    
             A          B          C
    ---------- ---------- ----------
             1          2          3
    
  • transactions and failure of DML statement

    Hello

    Say I have 10 DML statements as part of my operation and the 9th one fails (and I have no to autocommit).

    Is it possible to have an exception that deals with this and 10th instruction and allow the validation of the transaction, or the whole operation should be cancelled?

    Thank you.

    Your session will automatically rollback the statement failed. All prior statements remain uncommitted. What you do then, it's up to you.

  • Procedure with the DML statements that insert values from 1 to 100 in only one table and it is matching word equivalent in the other

    Can someone help me create a procedure with the DML statements that insert values from 1 to 100 in a table "abc" and the procedure must connect the numbers into words in another table "xyz" without doing a commit explicitly. "."

    Currently on trial...

    SQL > create table abc (num number);

    Table created.

    SQL > create table xyz (num varchar2 (100));

    Table created.

    SQL > ed
    A written file afiedt.buf

    1. insert all
    2 values of 1 = 1 then in abc (num) (l)
    3 when the values of 1 = 1 then in xyz (num) (to_char (to_date(l,'j'), 'jsp'))
    4 * Select the level from dual connect by level<=>
    SQL > /.

    200 rows created.

    And the result...

    SQL > select * from abc;

    NUM
    ----------
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    ..
    ..
    ..
    98
    99
    100

    100 selected lines.

    SQL > select * from xyz;

    NUM
    ----------------------------------------------------------------------------------------------------
    one
    two
    three
    four
    five
    six
    seven
    eight
    nine
    ten
    Eleven
    twelve
    ..
    ..
    ..
    98
    Nineteen eighty
    Cent

    100 selected lines.

  • The feature "Made simultaneous multiple images" or a similar added after effects CC?

    Adobe removed the feature "Made simultaneous multiple images" after effects 2015. Is this feature or a similar feature in after effects CC? I'm curious because I'm considering buying a new processor, and I need to know how the multi-core performance is the latest version of After Effects. I'd appreciate any guidance on this topic, if anyone has a Pearl of wisdom here.

    Hi kearley2018,

    The links below are for comfortable reading about multicore performance.

    Adobe After Effects CC 2015 Multi Core Performance

    Adobe After Effects CC 2014 Multi Core Performance

    As far as I know, their methodology is quite valid.

    Best regards

    Jachymeveque devote Metlicka

Maybe you are looking for

  • replacement of motherboard on the 2005 media center a1330n computer

    Someone gave me this computer recently because the motherboard was bad.  I was able to find an another mb just like it and installed yesterday and left everything else as it was in the computer.  Now, when I turn it on it has a blue screen that says

  • It is recommended only to perform file integrity checker to solve my problem. How can I do?

    File indexing process failed Operating system cannot detect diag systems. app. Said that my C drive is damaged

  • find Mo for the installed video card

    I followed the instructions given when I searched on the net. Go to the control panel and find an icon that has "customization" that there is zero with this specific formulation?... I know how to find the 'specifications' of what has been installed f

  • Laptop mouse problems

    My laptop seems to have mouse problems lately.  It is to select things too fast for me.  It highlights all, or choose something just because I'm pointing at it, even if I click on the object.  Is there a way to fix this?  I looked threw the help, and

  • Internal mic not working not not after using micro usb

    Hello I have a laptop HP Pavilion G6, and I recently bought a USB micropnone for registration. I installed the micro and tested it, but when I tried to re - turn on the internal microphone, I couldn't register! The speakers and webcam are still worki