DBMS_PROFILER

Hi all

I want to see total time taken by my package, so I run it as below but get no results.

Please tell us how to see the total time per line.

DECLARE
   errbuf   VARCHAR2 (100);
   retcode   NUMBER;
BEGIN
   fnd_global.apps_initialize (1438, 50777, 660);
   mo_global.set_policy_context ('S', 82);
   DBMS_PROFILER.start_profiler;
   xxom01.xxommain01 (errbuf, retcode, 2114663);
   DBMS_PROFILER.stop_profiler;
END;

Getting Run id :

SELECT plsql_profiler_runnumber.CURRVAL runid FROM DUAL;

Output Sequel :

  SELECT s.line,
         p.total_occur,
         p.total_time,
         s.text
    FROM all_sources s,
         (SELECT u.unit_owner,
                 u.unit_name,
                 u.uit_type,
                 d.line#,
                 d.total_occur,
                 d.total_time / 1000000 total_time
            FROM plsql_profiler_date d, plsql_profiler_units u
           WHERE  u.runid = :run_id -- Run id from above sql
           AND u.runid = d.runid AND u.unit_number = d.unit_number) p
   WHERE     s.owner = p.unit_owner(+)
         AND s.name = p.unit_name(+)
         AND s.TYPE = p.unit_type(+)
         AND s.line = p.line#(+)
         AND s.name = UPPER ('')
         AND s.owner = UPPER ('')
ORDER BY line;

See the test below

Connected to:

Database Oracle 12 c Enterprise Edition Release 12.1.0.1.0 - 64 bit Production

With the options of partitioning, OLAP, advanced analytics and Real Application Testing

SQL > CREATE or REPLACE PACKAGE test_pkg

2 AS

FUNCTION test_func (p_param1 VARCHAR2) 3

4 RETURN THE NUMBER;

5 END test_pkg;

6.

Package created.

SQL > show err

No errors.

SQL >

SQL > CREATE or REPLACE PACKAGE test_pkg BODY

2 AS

FUNCTION test_func (p_param1 VARCHAR2) 3

4 RETURN NUMBER

5 AS

6 BEGIN

7

8 IF p_param1 = 1 THEN

9 RETURN 1;

10 END IF;

11

12 RETURN 0;

13

14 END test_func;

15

16 END test_pkg;

17.

Package body created.

SQL > show err

No errors.

SQL > SELECT runid, run_comment FROM plsql_profiler_runs

2;

RUNID RUN_COMMENT

---------- ------------------------------

1 xxom01.xxommain01: 5 February 16

SQL > SET SERVEROUTPUT ON

SQL > DECLARE

2 l_profilerresult directory;

3 l_val NUMBER;

4 BEGIN

l_profilerresult 5: = DBMS_PROFILER. START_PROFILER ('xxom01: ' |) To_char (sysdate, 'DDMonYYYY'));

6 l_val: = test_pkg.test_func (1);

7 DBMS_OUTPUT. Put_line (l_val);

8 l_profilerresult: = DBMS_PROFILER. STOP_PROFILER;

9 END;

10.

1

PL/SQL procedure successfully completed.

SQL > SELECT runid, run_comment

2 FROM plsql_profiler_runs

3 WHERE run_comment = ' xxom01: ' | To_char (sysdate, 'DDMonYYYY');

RUNID RUN_COMMENT

---------- ------------------------------

5 xxom01: February 5, 2016

SQL > SELECT ppu.runid,.

2 ppu.unit_type,

ppu.unit_name 3,.

PPD.line # 4,

5 ppd.total_time

6 plsql_profiler_units spp.,

7 plsql_profiler_data ppd

8 WHERE ppu.runid = ppd.runid

9 AND ppu.unit_number = ppd.unit_number

10 AND ppu.runid = 5

11 ORDER BY ppu.unit_number, ppd.line #;

RUNID UNIT_TYPE UNIT_NAME LINE # TOTAL_TIME

---------- -------------------------------- -------------------------------- ---------- ----------

5 ANONYMOUS BLOCK 1 0

5 ANONYMOUS BLOCK 5 0

5 ANONYMOUS BLOCK 6 20370

5 ANONYMOUS BLOCK 7-27777

5 ANONYMOUS BLOCK 8 925

5 ANONYMOUS BLOCK 9 0

PACK OF 5 BODY TEST_PKG 3 925

PACK OF 5 BODY TEST_PKG 8 925

PACK OF 5 BODY TEST_PKG 9 0

PACK OF 5 BODY TEST_PKG 12 0

PACK OF 5 BODY TEST_PKG 14 925

11 selected lines.

Tags: Database

Similar Questions

  • Steps using the DBMS_PROFILER package.

    Hi all

    I'd like to collect statistics for my stored procedure using DBMS_PROFILER package, but when I run the package by using the sample below, I get the following errors. I read the Oracle documentation, you need to have some loaded scripts (PROFTAB.sql.) etc. to execute it.

    Could someone, please give me the exact measurements that are necessary, if I can use this package in my diagram. Not as with which the user scripts should be executed, if scripts must be run in my schema, or etc., to grant all privileges and so on.

    Thank you.

    Below is executed the sample and the error I get. I use the version of Oracle 11 g.

    Samples:

    BEGIN

    DBMS_PROFILER.start_profiler ('test_profile');

    test;

    DBMS_PROFILER.stop_profiler;

    END;

    Error report-

    ORA-06528: PL/SQL Profiler generator runtime error

    ORA-06512: at "SYS." DBMS_PROFILER", line 123

    ORA-06512: at "SYS." DBMS_PROFILER", line 132

    ORA-06512: at line 2

    06528 00000 - "PL/SQL runtime error profile.

    * Cause: An error occurred during the execution of a PL/SQL Profiler

    operating mode.

    ORACLE-BASE - Oracle9i DBMS_PROFILER

    See you soon,.

    Manik.

  • DBMS_PROFILER need education

    Hello
    DECLARE
      l_result  BINARY_INTEGER;
    BEGIN
    --  l_result := DBMS_PROFILER.FLUSH_DATA;
      l_result := DBMS_PROFILER.start_profiler
      (run_comment => 'do_something: ' || SYSDATE);
      wedb.testproc;
      l_result := DBMS_PROFILER.stop_profiler;
    END;
    /
    I have used the code above to learn the features of DBMS_PROFILER, learned something.
    Then I tried to see the code PACKAGE SYS. DBMS_PROFILER, I see the spec but not the body. Please advice if ORACLE usually encapsulates this to the top of all users.
    I also question below
    -In the above code when I used "l_result: = DBMS_PROFILER.start_profiler (run_comment = >" foo: "|"). SYSDATE); ", which the Sub part of the spec DBMS_PROFILER gets used?

    FUNCTION start_profiler)
    run_comment IN VARCHAR2: = SYSDATE,.
    run_comment1 IN VARCHAR2: = ".
    run_number ON the directory
    )
    DIRECTORY BACK;

    PROCEDURE start_profiler)
    run_comment IN VARCHAR2: = SYSDATE,.
    run_comment1 IN VARCHAR2: = ".
    run_number ON the directory
    );

    FUNCTION start_profiler)
    run_comment IN VARCHAR2: = SYSDATE,.
    run_comment1 IN VARCHAR2: = "
    )
    DIRECTORY BACK;

    PROCEDURE start_profiler)
    run_comment IN VARCHAR2: = SYSDATE,.
    run_comment1 IN VARCHAR2: = "
    );

    Thank you

    You use "l_result: = DBMS_PROFILER.start_profiler (run_comment => ' foo: ' |)» SYSDATE); ». It is an assignment (http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/assignment_statement.htm#LNPLS01301)

    If you look at the link, you will see that after ": =" symbol, you can have as an expression. Instead of an expression, you can have a function. Instead of a statement, you can have a procedure. If your use exclude procedures, but the leaves open two functions.

    If a function has a parameter out (you better would not have an ever, but that's another debate), then you must specify one in the call.
    You do not have, so the only option left is the use of the third: the function without parameters.

    I hope this helps.

    Kind regards
    Rob.

  • How to configure the parameters of coverage of codes for SQL / PL - SQL with TeamCity or Jenkins? It will be very useful for me in my project.

    Hello

    I need to set up a process of continuous integration for my oracle database. We plan to use Team City and SVN as source control tool.  For the unit test framework, we'll add utPLSQL. But we must see a report of the code coverage for the test cases. When I Googled it I for additional information, the cone for utPLSQL does not provide for the code coverage with Jenkins, while ruby-plsql has provide. I need help in the implementation of the code coverage for my test in PL SQL framework.  Based on your contributions, we will develop a model of POC and if it works perfectly, we'll use this practice to the coverage across the tests. Righ now we have two options to go to the establishment of CI process

    (1) City team (Servers0 CI = > Source Control (SVN) == > build (Ant scripts) == > deploy == > Testing Framework (utPLSQL) = > Code Coverage (?) = > publish the results of the team by email)

    (2) Jenkins = > Source Control (SVN) = > Build = > deployment = > Testing Framework (utPLSQL) == > = Code coverage > publish the result of the cover and test code to the team.

    UTPLSQL | Oracle's thoughts

    Therefore, choosing a Code coverage tool that is utPLSQL and integrate also with Jenkins or Teamcity. Those who have already worked on this part, please do not share your contributions and suggestions.

    Thank you

    Jean Yves

    Hello

    Basically, we take the exit of dbms_profiler and generate code coverage statistics.

  • ORA-06528: PL/SQL Profiler generator runtime error

    Version 11.2.0.3.  I have installad DBMS_PROFILER:

    SYS AS SYSDBA > @?/rdbms/admin/profload.sql

    SYS AS SYSDBA > @?/rdbms/admin/proftab.sql


    I tried to use dbms_profiler.start_profiler in PLSQL code with user NUFN and discovered that lacked the NUFN user privileges on the objects of the Profiler. So I ran the following grants:

    grant the update, insert and delete on plsql_profiler_units to NUFN;

    grant the update, insert and delete on plsql_profiler_runs to NUFN;

    Grant execute on DBMS_PROFILER to NUFN;

    But still no luck:

    SQL > START

    dbms_profiler.start_profiler ('test1');

    EXECUTE IMMEDIATE 'select max (STATS_UPDATE_TIME), owner of the DBA_TAB_STATS_HISTORY group from owner to owner.

    dbms_profiler.stop_profiler ();

    END;

    /

    BEGIN

    *

    ERROR on line 1:

    ORA-06528: PL/SQL Profiler generator runtime error

    ORA-06512: at "SYS." DBMS_PROFILER", line 123

    ORA-06512: at "SYS." DBMS_PROFILER", line 132

    ORA-06512: at line 2

    I can't find what is missing from my user NUFN for her to be able to run DBMS_PROFILER.  Help, please!

    Thanks Bella, I had not run @?/rdbms/admin/proftab.sql as my user NUFN but as sys.  But you know what?  Even after execution of @?/rdbms/admin/proftab.sql as NUFN, the problem persisted!

    So I traced my session, read the trace file and found nothing wrong (but I have no experience in finding fault with the workings of dbms_profiler).  But I found the SQL code executed by the dbms_profiler.start_profiler command, which is:

    PARSING IN CURSOR #4574691968 len = 155 dep = 2 uid = 155 oct 2 lid = 155 = tim = hv 530047132716 = ad 3718124591 = "7000000946da848" sqlid = "akx2pxvftw51g."

    INSERT INTO PLSQL_PROFILER_RUNS (RUNID, RUN_DATE, RELATED_RUN, RUN_OWNER) VALUES (PLSQL_PROFILER_RUNNUMBER. NEXTVAL,: B1,: B2, USER) RETURN RUNID IN: O0

    END OF STMT

    ANALYSIS #4574691968:c = 315, e = 844, p = 0, cr = 0, cu = 0, put = 1, r = 0, dep = 2, og = 1, plh = 0, tim = 530047132715

    I tried manually the same HOME, and bingo, I discovered the cause of my problem:

    INSERT INTO PLSQL_PROFILER_RUNS (RUNID, RUN_DATE, RELATED_RUN, RUN_OWNER) VALUES (PLSQL_PROFILER_RUNNUMBER. NEXTVAL, sysdate, 'manually', 'ME');

    ORA-01950: no privileges on tablespace execution times

    After performing ALTER USER NUFN QUOTA UNLIMITED ON STATES; the problem has been resolved.

    Conclusion: after DBMS_PROFILER installation for a user, make sure that the user can write in objects DBMS_PROFILER (SUBSIDIES and QUOTAS).

  • package pl/sql execution plan

    Hi all

    How we can find the bottoleneks in the pl/sql package. I know we can use dbms_profiler. Gathersed data, but not having planned the details.

    Here's the query I use

    Select s.text,

    p.total_occur,

    p.TOTAL_TIME/1000000000 total_time,

    p.min_time / 1000000000 min_time,.

    p.max_time / 1000000000 max_time

    of plsql_profiler_data p, user_source s, plsql_profiler_runs r

    where p.line # = Check

    and p.runid = r.runid

    and r.run_comment = 'XXXX_YYY_INIT.XXX_TO_DDD(1,,360). '

    and s.name LIKE 'XXX % ';

    I see that dbms_profiler has gathered data. But it does give that which line is how long take.

    Please guide findout that.

    Thank you

    Col owner format a10

    Col name format a20

    row col 9999 format

    Col source format a40 word_wrap

    occurrences of col 9999999 format

    Col tot_time_s format 999,999,990.999

    Col run_comment format a40

    format of pct col 999

    Select runid, run_date, plsql_profiler_runs run_comment;

    Select OWNER u.unit_owner, u.unit_name NAME, d.line # LINE, (select the text from all_source where type in ('BODY of PACKAGE', 'FUNCTION', 'PROCEDURE', 'TRIGGER') and name = u.unit_name and = d.line line # and u.unit_owner and type = u.unit_type = owner) SOURCE, d.total_occur OCCURRENCES, (d.total_time/1000000000) TOT_TIME_S, d.total_time/r.run_total_time*100 "PCT".

    of plsql_profiler_runs r, plsql_profiler_units u, plsql_profiler_data d

    where are.runid = & runid

    and r.runid = u.runid

    and r.runid = d.runid

    and d.unit_number = u.unit_number

    and (d.total_time/1000000000) > 1 - more than 1 second

    order of tot_time_s

    /

    Kind regards

    Harman

  • How to make a Plan to explain on PL - SQL?

    Hey guys, it's Xev, I'm back with a whole new positive attitude . I am very happy now that I got my cluster (11.2) 2-node RAC 11 GR 2 installed and working properly

    I'm doing a plan to explain some pl - sql, I wrote, but I'm having a hard time trying to figure out how to make it work.

    The catplan.sql has been performed and I a plan_table ready and waiting for me.

    Here's the full code as well as the two tables table that I use, just as I'm supposed to display.

    This is the first table

    and Yes, I only want a single folder in there...

    CREATE TABLE FILLER

    ("DATA_PACKED" VARCHAR2 (75 BYTE)

    )

    Insert in FILLING (DATA_PACKED) values ('KICKKKKKKKKK');

    commit;

    Then at the top on the list is the table of the HAMMER, I will insert all the data once the pl/sql program runs...

    This table is supposed to be empty...

    CREATE TABLE HAMMER

    ('H1' VARCHAR2 (100 BYTE),

    "H2" VARCHAR2 (100 BYTE)

    )

    and now, the CODE... Now, it is a very small version of my load of GR 11, 2 test scripts that I wrote, but I need to see execution plan behind this logic.

    I can even make a plan to explain on this code, or do I have to use something else?

    ---------------------------------------------------------------------------------------------------------

    declare

    Table type is table of the varchar2 (30) index directory.

    Table Z_STUFF.

    Start

    Select * BULK COLLECT into Z_STUFF of filling;

    because me in 1... 100

    loop

    for zoo in 1... Z_STUFF. Count

    loop

    Insert into HAMMER (H1, H2)

    values (Z_STUFF (zoo), Z_STUFF (zoo));

    end loop;

    end loop;

    end;

    /

    ----------------------------------------------------------------------------------------------------

    All comments are welcome, I just need to see what makes this logic behind the scenes...

    Thank you

    Xev.

    A query plan refers to an SQL statement.  A PL/SQL block can have 0 or more SQL statements.  It is, therefore, unnecessary to speak to generate a query plan for a PL/SQL block.  Your PL/SQL block happens to contain two different SQL statements.  You might get two different query plans, one for each statement.  Given how trivial statements are, however, I'm not sure that query plans would give you a lot of information.

    What is the problem you're trying to solve?  If you try to set the PL/SQL, you probably want to look into various profilers of PL/SQL.  For example, the DBMS_PROFILER package or the package DBMS_HPROF.

    Justin

  • Question performance tuning...

    Hi all...

    Database: Oracle 9i

    Sorry for the vague question.
    I have a process that runs in "PROD" for (24 h) too high, which I am trying to tune.
    But the problem is that the same process in "DEV" only "15 min". There is a reason for that.
    "PROD" and "DEV" data are not synchronized.

    Table of one of the main process questions following records

    PROD-> record 340 million.
     partioned by monthly, have indexes on most of the "important" columns that queries are using.
    IN DEV-> record 26 million
    i cannot copy the "PROD" data to "DEV"
    I tried the following things.

    (1) verified "explain plan" for all queries that are in the process.
    explain the plan looks good for most applications. I mean most applications use "index scans" rather than "full table scan.
    I know it's not the only thing that I should. There are several other things that could give the issue. But the plan of the explain command is ""not really bad.

    (2) accrued dbms_profiler to verify the statement that re take longer. I'm able to find "some" who need some settings.
    By the way, my queries in the process will use hadly 1 or 2 partitions. i mean 1 or 2 months data
    How can i tune something which is running is ok in "DEV", but not in "PROD"?
    Sorry i didn't give much details about any other stuff.
    Please guide me some steps I can do to find out what is the cause of the problem.

    Please let me know if I need to post some explain plans or any other outputs.

    Thanks in advance

    (1) verified "explain plan" for all queries that are in the process.

    Are the execution of PROD or DEV plans?
    You could try to simulate PROD on DEV important statistics.
    http://www.Oracle-base.com/articles/Misc/cost-based-optimizer-and-database-statistics.php#transfering_stats
    But it would be something that your DBA should help you.

  • Explain the plan of a function?

    Hi people;

    I am running Oracle 11 g 11.2.0.3.
    Is it possible to get the plan of "explaining" execution of a function?

    Thx for your knowledge, looks.

    Hello

    dbms_profiler is really simple, it does not really require a tutorial.

    dbms_profiler.start_profiler;
    
    dbms_profiler.stop_profiler;
    

    That's all. The only thing that can take you a bit is the display of the results
    tables of % plsql_. Google will give you many links to examples, for example this one:

    http://www.toadworld.com/knowledge/KnowledgeXpertforOracle/tabid/648/TopicId/PROF7/default.aspx

    Best regards
    Nikolai

  • Under the execution of pl/sql

    Hi all

    How to find the lowest performance of pl/sql programs, such as the way which we find bad execution SQL of AWR/tkprof etc.?


    concerning
    Sunil

    You can use DBMS_PROFILER http://download.oracle.com/docs/cd/E11882_01/appdev.112/e16760/d_profil.htm#ARPLS039.

  • pl/sql profiler - data not listed is not in the Profiler tables?

    Hi all - just have a little problem with the pl/sql Profiler.
    Database Version: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    Database Version: PL/SQL Release 10.2.0.5.0 - Production
    I created a test procedure:
    SQL > create or replace procedure testme
    2 as
    3
    number of v_customer_count 4;
    t_number v_level_table 5;
    Number 6 v_std_code_id;
    7
    Start 8
    9
    10. select count (*)
    11 in v_customer_count
    12 customer_master;
    13
    14 select level
    collection in bulk 15
    16 in v_level_table
    17 of the double
    18 connection of level < = 5000;
    19
    20
    21 end;
    22.

    Created procedure.


    and I run the procedure as follows:
    SQL> declare
      2     run_id number;
      3  begin
      4  
      5    run_id := dbms_profiler.start_profiler(to_char(sysdate,'dd-mm-yyyy hh24:mi:ss'));
      6    
      7    testme;
      8    
      9    dbms_profiler.flush_data;
     10    dbms_profiler.stop_profiler;
     11  
     12    dbms_output.put_line(run_id);
     13  
     14  end;
     15  /
    2
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.08
    but:
    SQL> select * from sys.plsql_profiler_runs
      2  /
    
    no rows selected
    
    Elapsed: 00:00:00.00
    SQL> select * from sys.plsql_profiler_data;
    
    no rows selected
    What Miss me?

    Run proftab.sql in your schema, also compile in debug mode before the race.

  • Ampersand substitution in create or replace procedure statement

    Hi guys,.

    I wonder why my replacement ampersand works in a create or replace statement of the stored procedure.

    CREATE OR REPLACE PROCEDURE UPDATE_DIM_SALES AS


    Cancel the DEFINITION DimSales;
    Cancel the DEFINITION FactTable;
    SET DimSales = 'TESTTAB;
    SET FactTable = myfact;


    BEGIN
    *...*

    Error (5,20): PLS-00103: encountered the symbol "=" when expected as follows: =. (@ %; not null default range character)


    If I assign the value with: = I get the error "invalid table" thereafter for the statemnt of INSERTION:

    CREATE OR REPLACE PROCEDURE UPDATE_DIM_SALES AS


    Cancel the DEFINITION DimSales;
    Cancel the DEFINITION FactTable;
    SET DimSales: = ' x 2';
    SET FactTable: = ' x 1';


    BEGIN
    INSERT INTO & DimSales (column1, column2,...)

    Why not the ampersand substitution work in a stored procedure?

    No problem with the carpet. Display. But you don't need to create and drop them again. Simply create a time and refresh just before departure if necessary. I expect the creation and updating of points of view is fast comparibly. Also access to the seller_id should be indexed.

    Your original pl/sql block is slow due to several reasons. One might be that you agree to each line. Engage is an extremely slow process. He avoid as much as possible. Another part might be that you make all the changes of context of pl/sql. The obvious way to avoid this would be to BULK operations (bulk-select + Forall). It is not so difficult. The size of the collection must be limited to a lower amount.

    Best way would be to measure the performance of pl/sql parts using a tool such as DBMS_PROFILER. Then you can decide what part is slow and must be granted.

    A simple insert could be faster. Did you test that?

    example not tested

    INSERT /*+append */
    INTO &DimSales (K_Sales,REG,BVL,DS, VS,RS,GS,VK)
    (SELECT trim(leading '0' from RS||GS) ,REG, BVL,DS, VS,RS,GS,VK
    from &FactTable f
    join &testsales s on f.SellerNo =s.Seller_No;
    
    commit;
    

    You can run the other issues, but this is generally the fastest approach. Try to avoid the separate if possible. This requires a sort and will slow down the insert of a lot.

    Published by: Sven w. on November 30, 2010 17:10

  • test the performance of my proc

    I'm trying to find how long it takes to insert.
    Y at - it another way to find the exact time needed to insert in milliseconds.

    Here is my sample code. and the exit time. Are there

    create or replace procedure perftest
    IS
    I int: = 0;
    int j: = 0;
    int ID;
    T1 timestamp;
    T2 timestamp;
    T3 varchar2 (30);
    Start
    I'm in 1.20
    LOOP
    Select systimestamp in double t1;
    Select seq.nextval in double id;
    INSERT INTO dept (Id, name) values (id, 'keep')
    j in 1.100
    LOOP
    INSERT INTO values (Id, name, deptid) emp (j, 'sample', id);
    END LOOP;
    Select systimestamp in double t2;
    Select (t2 - t1) in t3 double;
    dbms_output.put_line (' the value is:-' | t3);
    END LOOP;
    end;
    /


    the value is:- + 00:00:00.047000000 000000000
    the value is:- + 00:00:00.000000000 000000000
    the value is:- + 00:00:00.016000000 000000000
    the value is:- + 00:00:00.000000000 000000000
    the value is:- + 00:00:00.015000000 000000000
    the value is:- + 00:00:00.016000000 000000000
    the value is:- + 00:00:00.000000000 000000000
    the value is:- + 00:00:00.015000000 000000000
    the value is:- + 00:00:00.000000000 000000000
    the value is:- + 00:00:00.016000000 000000000
    the value is:- + 00:00:00.000000000 000000000
    the value is:- + 00:00:00.000000000 000000000
    the value is:- + 00:00:00.016000000 000000000
    the value is:- + 00:00:00.000000000 000000000
    the value is:- + 00:00:00.015000000 000000000
    the value is:- + 00:00:00.000000000 000000000
    the value is:- + 00:00:00.016000000 000000000
    the value is:- + 00:00:00.016000000 000000000
    the value is:- + 00:00:00.000000000 000000000
    the value is:- + 00:00:00.000000000 000000000

    Install the package dbms_profiler.

    Add the Profiler command to your procedure.

    create or replace procedure perftest
    IS
    i int := 0;
    j int := 0;
    id int;
    t1 timestamp;
    t2 timestamp;
    t3 varchar2(30);
    RESULT NUMBER ;
    begin
    RESULT:=DBMS_PROFILER.START_PROFILER('prog');
    for i in 1..20
    LOOP
    select systimestamp into t1 from dual;
    select seq.nextval into id from dual;
    INSERT INTO dept (Id,Name) values (id,'store')
    for j in 1..100
    LOOP
    INSERT INTO emp (Id,name,deptid) values (j,'sample',id);
    END LOOP;
    select systimestamp into t2 from dual;
    select (t2-t1) into t3 from dual;
    dbms_output.put_line ('the value is :- '|| t3);
    END LOOP;
    RESULT:=DBMS_PROFILER.STOP_PROFILER ;
    end;
    /
    

    then run your procedure
    Review the statistics in the tables of Profiler.

    SELECT   u.unit_owner || '.' || u.unit_name unit, line#,
             ROUND (d.total_time / 1000000000) total_time_s, d.total_occur tc,
             SUBSTR (s.text, 1, 40) stext
        FROM plsql_profiler_runs r,
             plsql_profiler_units u,
             plsql_profiler_data d,
             all_source s
       WHERE r.runid = u.runid
         AND d.runid = u.runid
         AND u.unit_number = d.unit_number
         AND s.owner = u.unit_owner
         AND s.TYPE = u.unit_type
         AND s.NAME = u.unit_name
         AND s.line = d.line#
    ORDER BY line#
    /
    

    Sanjay

  • Optimized SQL in sql * more... .acts differently in pl/sql... Why?

    Hi all

    I was reading an ad, and there I found the below (beware I'm a dba level jr). My question is how can we optimize the sql inside pl/sql if his will act differently... as below mention... the SQL query can act differently (it may or may not) incorporated in a pl/sql block, let so say I have a select which I optimized in sql and now put this same sql in pl/sql and it is different... How can you optimize it... also I know dbms_profiler... any good links for her would be useful as well...

    The optimizer mode parameter is intended only for statements that are derived directly and not from PL/SQL statements. Therefore, if you have tested your SQL querymore or any other tool, then then joined the same in a PL/SQL (anonymous or stored routines) block, the query may or may not work the same! DML in PL/SQL statements are executed to CHOOSE mode (if statistical ALL_ROWS is present) defined at the session level default and OPTIMIZER_MODE does not influence besoin.*

    http://www.databasejournal.com/features/Oracle/article.php/3084581/Oracle-optimizer-moving-to-and-working-with-CBO-part-3.htm
    (see section - 8.4) SQL and PL/SQL

    user630084 wrote:

    The optimizer mode parameter is intended only for statements that are derived directly and not from PL/SQL statements. Therefore, if you have tested your SQL querymore or any other tool, then then joined the same in a PL/SQL (anonymous or stored routines) block, the query may or may not work the same! DML in PL/SQL statements are executed to CHOOSE mode (if statistical ALL_ROWS is present) defined at the session level default and OPTIMIZER_MODE does not influence besoin.*

    http://www.databasejournal.com/features/Oracle/article.php/3084581/Oracle-optimizer-moving-to-and-working-with-CBO-part-3.htm
    (see section - 8.4) SQL and PL/SQL

    I think that this does not apply to the latest versions of Oracle longer. The hidden parameter "_optimizer_mode_force" is true because 8.1.6 and, therefore, the recursive SQL in PL/SQL should follow the same OPTIMIZER_MODE as defined in the session.

    You can find a more detailed explanation on the website of Jonathan Lewis on this topic: http://www.jlcomp.demon.co.uk/faq/sqlplsql.html

    Kind regards
    Randolf

    Oracle related blog stuff:
    http://Oracle-Randolf.blogspot.com/

    SQLTools ++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676 /.
    http://sourceforge.NET/projects/SQLT-pp/

  • Procedure measure execution time...

    Hello

    Is it possible to measure how long each a database procedure take? Is it possible for V$ views Oracle or performance as AWR report? On the other hand, is it possible to measure the duration of execution of SQL statements, but without using "set timing on."

    Best,
    tutus

    To measure how long a process takes to run, use DBMS_PROFILER.

    To measure how long an individual SQL takes to run, use SQLTRACE and analyze results TKPROF.

Maybe you are looking for

  • Email with the password problem

    I get an error message when I send emails.  I get them, but I get a message that my "SMTP.me.com" refuse my password.  How can I fix?

  • Ultiboard some keys do not appear

    Hello I am facing a strange problem, after the design of the PCB that I attach to this issue, that everything is fine until I have print circuit. Then, some of the TOWEL would not appear. It sounds really weird. After a few tries, the problem seems t

  • How can I turn off the backlight on the keyboard of ultrabook S7?

    No one knows how to do?  There are some low light conditions where have the backlight makes it virtually impossible to read keys.

  • System anticipates the PDF files?

    For a few years on computers running Windows XP, I noticed that whenever I get near a file Adobe PDF system seems to anticipate the Open the order (click) showing the hourglass and slowdown in other GUI functions as if it is already running a kind of

  • Random disconnection on Atheros AR9002WB-1NG Wireless Network Adapter

    Hi all I have a problem doing my job in the internet due to random disconnection on the map of Atheros AR9002WB-1NG wireless network. Are there troubleshooting procedures to resolve these random disconnections? Windows 7 Home Premium SP1 ASUS N43SL A